diff options
| author | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> | 2010-02-15 18:03:30 -0500 |
|---|---|---|
| committer | James Morris <jmorris@namei.org> | 2010-02-15 19:17:16 -0500 |
| commit | 7ef612331fb219620cc1abfc2446bb027d388aa0 (patch) | |
| tree | 3912acecc7437303e824d26a9ae124b765ce35d3 /security | |
| parent | 084da356f6e55ce42f1d2739178502023908c107 (diff) | |
TOMOYO: Use shorter names.
Use shorter name to reduce newlines needed for 80 columns limit.
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security')
| -rw-r--r-- | security/tomoyo/common.c | 74 | ||||
| -rw-r--r-- | security/tomoyo/common.h | 90 | ||||
| -rw-r--r-- | security/tomoyo/file.c | 295 | ||||
| -rw-r--r-- | security/tomoyo/gc.c | 18 | ||||
| -rw-r--r-- | security/tomoyo/tomoyo.c | 72 |
5 files changed, 250 insertions, 299 deletions
diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c index 3a36b56a2f5c..ffcf02450560 100644 --- a/security/tomoyo/common.c +++ b/security/tomoyo/common.c | |||
| @@ -841,25 +841,22 @@ bool tomoyo_domain_quota_is_ok(struct tomoyo_domain_info * const domain) | |||
| 841 | return true; | 841 | return true; |
| 842 | list_for_each_entry_rcu(ptr, &domain->acl_info_list, list) { | 842 | list_for_each_entry_rcu(ptr, &domain->acl_info_list, list) { |
| 843 | switch (ptr->type) { | 843 | switch (ptr->type) { |
| 844 | struct tomoyo_single_path_acl_record *acl; | 844 | struct tomoyo_path_acl *acl; |
| 845 | u32 perm; | 845 | u32 perm; |
| 846 | u8 i; | 846 | u8 i; |
| 847 | case TOMOYO_TYPE_SINGLE_PATH_ACL: | 847 | case TOMOYO_TYPE_PATH_ACL: |
| 848 | acl = container_of(ptr, | 848 | acl = container_of(ptr, struct tomoyo_path_acl, head); |
| 849 | struct tomoyo_single_path_acl_record, | ||
| 850 | head); | ||
| 851 | perm = acl->perm | (((u32) acl->perm_high) << 16); | 849 | perm = acl->perm | (((u32) acl->perm_high) << 16); |
| 852 | for (i = 0; i < TOMOYO_MAX_SINGLE_PATH_OPERATION; i++) | 850 | for (i = 0; i < TOMOYO_MAX_PATH_OPERATION; i++) |
| 853 | if (perm & (1 << i)) | 851 | if (perm & (1 << i)) |
| 854 | count++; | 852 | count++; |
| 855 | if (perm & (1 << TOMOYO_TYPE_READ_WRITE_ACL)) | 853 | if (perm & (1 << TOMOYO_TYPE_READ_WRITE)) |
| 856 | count -= 2; | 854 | count -= 2; |
| 857 | break; | 855 | break; |
| 858 | case TOMOYO_TYPE_DOUBLE_PATH_ACL: | 856 | case TOMOYO_TYPE_PATH2_ACL: |
| 859 | perm = container_of(ptr, | 857 | perm = container_of(ptr, struct tomoyo_path2_acl, head) |
| 860 | struct tomoyo_double_path_acl_record, | 858 | ->perm; |
| 861 | head)->perm; | 859 | for (i = 0; i < TOMOYO_MAX_PATH2_OPERATION; i++) |
| 862 | for (i = 0; i < TOMOYO_MAX_DOUBLE_PATH_OPERATION; i++) | ||
| 863 | if (perm & (1 << i)) | 860 | if (perm & (1 << i)) |
| 864 | count++; | 861 | count++; |
| 865 | break; | 862 | break; |
| @@ -1366,16 +1363,15 @@ static int tomoyo_write_domain_policy(struct tomoyo_io_buffer *head) | |||
| 1366 | } | 1363 | } |
| 1367 | 1364 | ||
| 1368 | /** | 1365 | /** |
| 1369 | * tomoyo_print_single_path_acl - Print a single path ACL entry. | 1366 | * tomoyo_print_path_acl - Print a single path ACL entry. |
| 1370 | * | 1367 | * |
| 1371 | * @head: Pointer to "struct tomoyo_io_buffer". | 1368 | * @head: Pointer to "struct tomoyo_io_buffer". |
| 1372 | * @ptr: Pointer to "struct tomoyo_single_path_acl_record". | 1369 | * @ptr: Pointer to "struct tomoyo_path_acl". |
| 1373 | * | 1370 | * |
| 1374 | * Returns true on success, false otherwise. | 1371 | * Returns true on success, false otherwise. |
| 1375 | */ | 1372 | */ |
| 1376 | static bool tomoyo_print_single_path_acl(struct tomoyo_io_buffer *head, | 1373 | static bool tomoyo_print_path_acl(struct tomoyo_io_buffer *head, |
| 1377 | struct tomoyo_single_path_acl_record * | 1374 | struct tomoyo_path_acl *ptr) |
| 1378 | ptr) | ||
| 1379 | { | 1375 | { |
| 1380 | int pos; | 1376 | int pos; |
| 1381 | u8 bit; | 1377 | u8 bit; |
| @@ -1384,17 +1380,15 @@ static bool tomoyo_print_single_path_acl(struct tomoyo_io_buffer *head, | |||
| 1384 | const u32 perm = ptr->perm | (((u32) ptr->perm_high) << 16); | 1380 | const u32 perm = ptr->perm | (((u32) ptr->perm_high) << 16); |
| 1385 | 1381 | ||
| 1386 | filename = ptr->filename->name; | 1382 | filename = ptr->filename->name; |
| 1387 | for (bit = head->read_bit; bit < TOMOYO_MAX_SINGLE_PATH_OPERATION; | 1383 | for (bit = head->read_bit; bit < TOMOYO_MAX_PATH_OPERATION; bit++) { |
| 1388 | bit++) { | ||
| 1389 | const char *msg; | 1384 | const char *msg; |
| 1390 | if (!(perm & (1 << bit))) | 1385 | if (!(perm & (1 << bit))) |
| 1391 | continue; | 1386 | continue; |
| 1392 | /* Print "read/write" instead of "read" and "write". */ | 1387 | /* Print "read/write" instead of "read" and "write". */ |
| 1393 | if ((bit == TOMOYO_TYPE_READ_ACL || | 1388 | if ((bit == TOMOYO_TYPE_READ || bit == TOMOYO_TYPE_WRITE) |
| 1394 | bit == TOMOYO_TYPE_WRITE_ACL) | 1389 | && (perm & (1 << TOMOYO_TYPE_READ_WRITE))) |
| 1395 | && (perm & (1 << TOMOYO_TYPE_READ_WRITE_ACL))) | ||
| 1396 | continue; | 1390 | continue; |
| 1397 | msg = tomoyo_sp2keyword(bit); | 1391 | msg = tomoyo_path2keyword(bit); |
| 1398 | pos = head->read_avail; | 1392 | pos = head->read_avail; |
| 1399 | if (!tomoyo_io_printf(head, "allow_%s %s%s\n", msg, | 1393 | if (!tomoyo_io_printf(head, "allow_%s %s%s\n", msg, |
| 1400 | atmark, filename)) | 1394 | atmark, filename)) |
| @@ -1409,16 +1403,15 @@ static bool tomoyo_print_single_path_acl(struct tomoyo_io_buffer *head, | |||
| 1409 | } | 1403 | } |
| 1410 | 1404 | ||
| 1411 | /** | 1405 | /** |
| 1412 | * tomoyo_print_double_path_acl - Print a double path ACL entry. | 1406 | * tomoyo_print_path2_acl - Print a double path ACL entry. |
| 1413 | * | 1407 | * |
| 1414 | * @head: Pointer to "struct tomoyo_io_buffer". | 1408 | * @head: Pointer to "struct tomoyo_io_buffer". |
| 1415 | * @ptr: Pointer to "struct tomoyo_double_path_acl_record". | 1409 | * @ptr: Pointer to "struct tomoyo_path2_acl". |
| 1416 | * | 1410 | * |
| 1417 | * Returns true on success, false otherwise. | 1411 | * Returns true on success, false otherwise. |
| 1418 | */ | 1412 | */ |
| 1419 | static bool tomoyo_print_double_path_acl(struct tomoyo_io_buffer *head, | 1413 | static bool tomoyo_print_path2_acl(struct tomoyo_io_buffer *head, |
| 1420 | struct tomoyo_double_path_acl_record * | 1414 | struct tomoyo_path2_acl *ptr) |
| 1421 | ptr) | ||
| 1422 | { | 1415 | { |
| 1423 | int pos; | 1416 | int pos; |
| 1424 | const char *atmark1 = ""; | 1417 | const char *atmark1 = ""; |
| @@ -1430,12 +1423,11 @@ static bool tomoyo_print_double_path_acl(struct tomoyo_io_buffer *head, | |||
| 1430 | 1423 | ||
| 1431 | filename1 = ptr->filename1->name; | 1424 | filename1 = ptr->filename1->name; |
| 1432 | filename2 = ptr->filename2->name; | 1425 | filename2 = ptr->filename2->name; |
| 1433 | for (bit = head->read_bit; bit < TOMOYO_MAX_DOUBLE_PATH_OPERATION; | 1426 | for (bit = head->read_bit; bit < TOMOYO_MAX_PATH2_OPERATION; bit++) { |
| 1434 | bit++) { | ||
| 1435 | const char *msg; | 1427 | const char *msg; |
| 1436 | if (!(perm & (1 << bit))) | 1428 | if (!(perm & (1 << bit))) |
| 1437 | continue; | 1429 | continue; |
| 1438 | msg = tomoyo_dp2keyword(bit); | 1430 | msg = tomoyo_path22keyword(bit); |
| 1439 | pos = head->read_avail; | 1431 | pos = head->read_avail; |
| 1440 | if (!tomoyo_io_printf(head, "allow_%s %s%s %s%s\n", msg, | 1432 | if (!tomoyo_io_printf(head, "allow_%s %s%s %s%s\n", msg, |
| 1441 | atmark1, filename1, atmark2, filename2)) | 1433 | atmark1, filename1, atmark2, filename2)) |
| @@ -1462,19 +1454,15 @@ static bool tomoyo_print_entry(struct tomoyo_io_buffer *head, | |||
| 1462 | { | 1454 | { |
| 1463 | const u8 acl_type = ptr->type; | 1455 | const u8 acl_type = ptr->type; |
| 1464 | 1456 | ||
| 1465 | if (acl_type == TOMOYO_TYPE_SINGLE_PATH_ACL) { | 1457 | if (acl_type == TOMOYO_TYPE_PATH_ACL) { |
| 1466 | struct tomoyo_single_path_acl_record *acl | 1458 | struct tomoyo_path_acl *acl |
| 1467 | = container_of(ptr, | 1459 | = container_of(ptr, struct tomoyo_path_acl, head); |
| 1468 | struct tomoyo_single_path_acl_record, | 1460 | return tomoyo_print_path_acl(head, acl); |
| 1469 | head); | ||
| 1470 | return tomoyo_print_single_path_acl(head, acl); | ||
| 1471 | } | 1461 | } |
| 1472 | if (acl_type == TOMOYO_TYPE_DOUBLE_PATH_ACL) { | 1462 | if (acl_type == TOMOYO_TYPE_PATH2_ACL) { |
| 1473 | struct tomoyo_double_path_acl_record *acl | 1463 | struct tomoyo_path2_acl *acl |
| 1474 | = container_of(ptr, | 1464 | = container_of(ptr, struct tomoyo_path2_acl, head); |
| 1475 | struct tomoyo_double_path_acl_record, | 1465 | return tomoyo_print_path2_acl(head, acl); |
| 1476 | head); | ||
| 1477 | return tomoyo_print_double_path_acl(head, acl); | ||
| 1478 | } | 1466 | } |
| 1479 | BUG(); /* This must not happen. */ | 1467 | BUG(); /* This must not happen. */ |
| 1480 | return false; | 1468 | return false; |
diff --git a/security/tomoyo/common.h b/security/tomoyo/common.h index 3727296f01f9..f4d3050b9c0e 100644 --- a/security/tomoyo/common.h +++ b/security/tomoyo/common.h | |||
| @@ -71,8 +71,8 @@ enum tomoyo_mac_index { | |||
| 71 | 71 | ||
| 72 | /* Index numbers for Access Controls. */ | 72 | /* Index numbers for Access Controls. */ |
| 73 | enum tomoyo_acl_entry_type_index { | 73 | enum tomoyo_acl_entry_type_index { |
| 74 | TOMOYO_TYPE_SINGLE_PATH_ACL, | 74 | TOMOYO_TYPE_PATH_ACL, |
| 75 | TOMOYO_TYPE_DOUBLE_PATH_ACL, | 75 | TOMOYO_TYPE_PATH2_ACL, |
| 76 | }; | 76 | }; |
| 77 | 77 | ||
| 78 | /* Index numbers for File Controls. */ | 78 | /* Index numbers for File Controls. */ |
| @@ -87,36 +87,36 @@ enum tomoyo_acl_entry_type_index { | |||
| 87 | */ | 87 | */ |
| 88 | 88 | ||
| 89 | enum tomo | ||
