From 520d3df1fe1029e47497664fe705a104d5e0e3c9 Mon Sep 17 00:00:00 2001 From: anwleung Date: Tue, 27 Mar 2007 22:47:26 +0000 Subject: [PATCH] unix group preloading git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1309 29311d96-e01e-0410-9327-a35deaab8ce9 --- branches/aleung/security1/ceph/.groups | 2 +- branches/aleung/security1/ceph/config.cc | 3 +++ branches/aleung/security1/ceph/config.h | 1 + branches/aleung/security1/ceph/crypto/CapGroup.h | 10 ++++++++-- branches/aleung/security1/ceph/mds/MDS.cc | 16 ++++++++++++++++ 5 files changed, 29 insertions(+), 3 deletions(-) diff --git a/branches/aleung/security1/ceph/.groups b/branches/aleung/security1/ceph/.groups index 1234342ef6b92..8d2178310144d 100644 --- a/branches/aleung/security1/ceph/.groups +++ b/branches/aleung/security1/ceph/.groups @@ -1,4 +1,4 @@ 1000 1000 3500 -1 100 3407 -1 1500 384 555 -1 -1020 340 341 342 343 344 345 346 347 348 349 350 -1 \ No newline at end of file +1020 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 -1 \ No newline at end of file diff --git a/branches/aleung/security1/ceph/config.cc b/branches/aleung/security1/ceph/config.cc index 46c4b18bb4915..31e6079f8d5c1 100644 --- a/branches/aleung/security1/ceph/config.cc +++ b/branches/aleung/security1/ceph/config.cc @@ -315,6 +315,7 @@ md_config_t g_conf = { renewal_period: 240, /* renew every 4 minutes */ config_predict: 0, /* 0=off, non-zero = filename ptr */ collect_predictions: 0, /* 0=off, 1=on */ + preload_unix_groups: 0, /* 0=off, 1=on */ client_aux: 0, /* 0=off, 1=on */ sign_scheme: 0, /* 0=esign, 1=RSA */ hash_scheme: 0, /* 0=sha-1, 1=sha-256, @@ -809,6 +810,8 @@ void parse_config_options(std::vector& args) g_conf.config_predict = args[++i]; else if (strcmp(args[i], "--collect_predictions") == 0) g_conf.collect_predictions = atoi(args[++i]); + else if (strcmp(args[i], "--preload_unix_groups") == 0) + g_conf.preload_unix_groups = atoi(args[++i]); else if (strcmp(args[i], "--file_layout_ssize") == 0) g_OSD_FileLayout.stripe_size = atoi(args[++i]); diff --git a/branches/aleung/security1/ceph/config.h b/branches/aleung/security1/ceph/config.h index 5deafe005404b..68f13d0d81dd8 100644 --- a/branches/aleung/security1/ceph/config.h +++ b/branches/aleung/security1/ceph/config.h @@ -305,6 +305,7 @@ struct md_config_t { int renewal_period; char* config_predict; int collect_predictions; + int preload_unix_groups; int client_aux; int sign_scheme; int hash_scheme; diff --git a/branches/aleung/security1/ceph/crypto/CapGroup.h b/branches/aleung/security1/ceph/crypto/CapGroup.h index 412ba8a414ead..823f1ec196bc2 100644 --- a/branches/aleung/security1/ceph/crypto/CapGroup.h +++ b/branches/aleung/security1/ceph/crypto/CapGroup.h @@ -120,10 +120,16 @@ class CapGroup { return false; } - void set_list(list& nlist) { users = nlist; } + void set_list(list& nlist) { + users = nlist; + mtree = MerkleTree(users); + } list& get_list() { return users; } - void set_inode_list(list& ilist) { inodes = ilist; } + void set_inode_list(list& ilist) { + inodes = ilist; + file_tree = MerkleTree(inodes); + } list& get_inode_list() { return inodes; } }; diff --git a/branches/aleung/security1/ceph/mds/MDS.cc b/branches/aleung/security1/ceph/mds/MDS.cc index a81aa93c7d761..9dcf7d3a2b043 100644 --- a/branches/aleung/security1/ceph/mds/MDS.cc +++ b/branches/aleung/security1/ceph/mds/MDS.cc @@ -98,6 +98,22 @@ MDS::MDS(int whoami, Messenger *m, MonMap *mm) : timer(mds_lock) { myPrivKey = esignPrivKey("crypto/esig1023.dat"); myPubKey = esignPubKey(myPrivKey); + // hard code the unix groups? + if (g_conf.preload_unix_groups) { + gid_t group_gid = 1020; + list uid_list; + for (int start_uid = 340; start_uid <= 520; start_uid++) { + uid_list.push_back(start_uid); + cout << start_uid << ", "; + } + CapGroup cgroup; + cgroup.set_list(uid_list); + cgroup.sign_list(myPrivKey); + unix_groups_byhash[cgroup.get_root_hash()] = cgroup; + unix_groups_map[group_gid] = cgroup.get_root_hash(); + cout << endl << "hash " << cgroup.get_root_hash() << endl; + } + // create unix_groups from file? if (g_conf.unix_group_file) { -- 2.39.5