]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
unix group preloading
authoranwleung <anwleung@29311d96-e01e-0410-9327-a35deaab8ce9>
Tue, 27 Mar 2007 22:47:26 +0000 (22:47 +0000)
committeranwleung <anwleung@29311d96-e01e-0410-9327-a35deaab8ce9>
Tue, 27 Mar 2007 22:47:26 +0000 (22:47 +0000)
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1309 29311d96-e01e-0410-9327-a35deaab8ce9

branches/aleung/security1/ceph/.groups
branches/aleung/security1/ceph/config.cc
branches/aleung/security1/ceph/config.h
branches/aleung/security1/ceph/crypto/CapGroup.h
branches/aleung/security1/ceph/mds/MDS.cc

index 1234342ef6b92313c12c677ba169e3d612cf382b..8d2178310144d6b38889c8b862eb613269428a24 100644 (file)
@@ -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
index 46c4b18bb491564b5d5d47cb4dc6ae2481c4bdc4..31e6079f8d5c19cb9509893add9e2cd0d328e2c3 100644 (file)
@@ -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<char*>& 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]);
index 5deafe005404ba69e50783961ec4ae709c7ad171..68f13d0d81dd855fa6d475de5e8f7c7c302ad4a9 100644 (file)
@@ -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;
index 412ba8a414eadb191d45a1e43ae767b0574f9fc6..823f1ec196bc2a138d3438f770abca5cddf401f5 100644 (file)
@@ -120,10 +120,16 @@ class CapGroup {
     return false;
   }
 
-  void set_list(list<uid_t>& nlist) { users = nlist; }
+  void set_list(list<uid_t>& nlist) {
+    users = nlist;
+    mtree = MerkleTree(users);
+  }
   list<uid_t>& get_list() { return users; }
 
-  void set_inode_list(list<inodeno_t>& ilist) { inodes = ilist; }
+  void set_inode_list(list<inodeno_t>& ilist) {
+    inodes = ilist;
+    file_tree = MerkleTree(inodes);
+  }
   list<inodeno_t>& get_inode_list() { return inodes; }
 };
 
index a81aa93c7d76151e4cb24e0b0af0291818ab62fd..9dcf7d3a2b0431af354a21389f15641892f926b4 100644 (file)
@@ -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_t> 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) {