diff options
author | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> | 2010-06-20 22:14:39 -0400 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2010-08-02 01:34:43 -0400 |
commit | 5448ec4f5062ef75ce74f8d7784d4cea9c46ad00 (patch) | |
tree | c4c742b928c799e03328e345e1d4af738f315afb /security/tomoyo/common.h | |
parent | 0617c7ff34dc9b1d641640c3953274bb2dbe21a6 (diff) |
TOMOYO: Use common code for domain transition control.
Use common code for "initialize_domain"/"no_initialize_domain"/"keep_domain"/
"no_keep_domain" keywords.
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security/tomoyo/common.h')
-rw-r--r-- | security/tomoyo/common.h | 64 |
1 files changed, 21 insertions, 43 deletions
diff --git a/security/tomoyo/common.h b/security/tomoyo/common.h index 12b0c5c46c8d..1277724edae4 100644 --- a/security/tomoyo/common.h +++ b/security/tomoyo/common.h | |||
@@ -50,8 +50,7 @@ enum tomoyo_policy_id { | |||
50 | TOMOYO_ID_GROUP, | 50 | TOMOYO_ID_GROUP, |
51 | TOMOYO_ID_PATH_GROUP, | 51 | TOMOYO_ID_PATH_GROUP, |
52 | TOMOYO_ID_NUMBER_GROUP, | 52 | TOMOYO_ID_NUMBER_GROUP, |
53 | TOMOYO_ID_DOMAIN_INITIALIZER, | 53 | TOMOYO_ID_TRANSITION_CONTROL, |
54 | TOMOYO_ID_DOMAIN_KEEPER, | ||
55 | TOMOYO_ID_AGGREGATOR, | 54 | TOMOYO_ID_AGGREGATOR, |
56 | TOMOYO_ID_GLOBALLY_READABLE, | 55 | TOMOYO_ID_GLOBALLY_READABLE, |
57 | TOMOYO_ID_PATTERN, | 56 | TOMOYO_ID_PATTERN, |
@@ -97,6 +96,15 @@ enum tomoyo_group_id { | |||
97 | #define TOMOYO_VALUE_TYPE_OCTAL 2 | 96 | #define TOMOYO_VALUE_TYPE_OCTAL 2 |
98 | #define TOMOYO_VALUE_TYPE_HEXADECIMAL 3 | 97 | #define TOMOYO_VALUE_TYPE_HEXADECIMAL 3 |
99 | 98 | ||
99 | enum tomoyo_transition_type { | ||
100 | /* Do not change this order, */ | ||
101 | TOMOYO_TRANSITION_CONTROL_NO_INITIALIZE, | ||
102 | TOMOYO_TRANSITION_CONTROL_INITIALIZE, | ||
103 | TOMOYO_TRANSITION_CONTROL_NO_KEEP, | ||
104 | TOMOYO_TRANSITION_CONTROL_KEEP, | ||
105 | TOMOYO_MAX_TRANSITION_TYPE | ||
106 | }; | ||
107 | |||
100 | /* Index numbers for Access Controls. */ | 108 | /* Index numbers for Access Controls. */ |
101 | enum tomoyo_acl_entry_type_index { | 109 | enum tomoyo_acl_entry_type_index { |
102 | TOMOYO_TYPE_PATH_ACL, | 110 | TOMOYO_TYPE_PATH_ACL, |
@@ -619,50 +627,26 @@ struct tomoyo_no_rewrite_entry { | |||
619 | }; | 627 | }; |
620 | 628 | ||
621 | /* | 629 | /* |
622 | * tomoyo_domain_initializer_entry is a structure which is used for holding | 630 | * tomoyo_transition_control is a structure which is used for holding |
623 | * "initialize_domain" and "no_initialize_domain" entries. | 631 | * "initialize_domain"/"no_initialize_domain"/"keep_domain"/"no_keep_domain" |
632 | * entries. | ||
624 | * It has following fields. | 633 | * It has following fields. |
625 | * | 634 | * |
626 | * (1) "head" is "struct tomoyo_acl_head". | 635 | * (1) "head" is "struct tomoyo_acl_head". |
627 | * (2) "is_not" is a bool which is true if "no_initialize_domain", false | 636 | * (2) "type" is type of this entry. |
628 | * otherwise. | ||
629 | * (3) "is_last_name" is a bool which is true if "domainname" is "the last | ||
630 | * component of a domainname", false otherwise. | ||
631 | * (4) "domainname" which is "a domainname" or "the last component of a | ||
632 | * domainname". This field is NULL if "from" clause is not specified. | ||
633 | * (5) "program" which is a program's pathname. | ||
634 | */ | ||
635 | struct tomoyo_domain_initializer_entry { | ||
636 | struct tomoyo_acl_head head; | ||
637 | bool is_not; /* True if this entry is "no_initialize_domain". */ | ||
638 | /* True if the domainname is tomoyo_get_last_name(). */ | ||
639 | bool is_last_name; | ||
640 | const struct tomoyo_path_info *domainname; /* This may be NULL */ | ||
641 | const struct tomoyo_path_info *program; | ||
642 | }; | ||
643 | |||
644 | /* | ||
645 | * tomoyo_domain_keeper_entry is a structure which is used for holding | ||
646 | * "keep_domain" and "no_keep_domain" entries. | ||
647 | * It has following fields. | ||
648 | * | ||
649 | * (1) "head" is "struct tomoyo_acl_head". | ||
650 | * (2) "is_not" is a bool which is true if "no_initialize_domain", false | ||
651 | * otherwise. | ||
652 | * (3) "is_last_name" is a bool which is true if "domainname" is "the last | 637 | * (3) "is_last_name" is a bool which is true if "domainname" is "the last |
653 | * component of a domainname", false otherwise. | 638 | * component of a domainname", false otherwise. |
654 | * (4) "domainname" which is "a domainname" or "the last component of a | 639 | * (4) "domainname" which is "a domainname" or "the last component of a |
655 | * domainname". | 640 | * domainname". |
656 | * (5) "program" which is a program's pathname. | 641 | * (5) "program" which is a program's pathname. |
657 | * This field is NULL if "from" clause is not specified. | ||
658 | */ | 642 | */ |
659 | struct tomoyo_domain_keeper_entry { | 643 | struct tomoyo_transition_control { |
660 | struct tomoyo_acl_head head; | 644 | struct tomoyo_acl_head head; |
661 | bool is_not; /* True if this entry is "no_keep_domain". */ | 645 | u8 type; /* One of values in "enum tomoyo_transition_type". */ |
662 | /* True if the domainname is tomoyo_get_last_name(). */ | 646 | /* True if the domainname is tomoyo_get_last_name(). */ |
663 | bool is_last_name; | 647 | bool is_last_name; |
664 | const struct tomoyo_path_info *domainname; | 648 | const struct tomoyo_path_info *domainname; /* Maybe NULL */ |
665 | const struct tomoyo_path_info *program; /* This may be NULL */ | 649 | const struct tomoyo_path_info *program; /* Maybe NULL */ |
666 | }; | 650 | }; |
667 | 651 | ||
668 | /* | 652 | /* |
@@ -793,15 +777,8 @@ int tomoyo_mount_permission(char *dev_name, struct path *path, char *type, | |||
793 | unsigned long flags, void *data_page); | 777 | unsigned long flags, void *data_page); |
794 | /* Create "aggregator" entry in exception policy. */ | 778 | /* Create "aggregator" entry in exception policy. */ |
795 | int tomoyo_write_aggregator_policy(char *data, const bool is_delete); | 779 | int tomoyo_write_aggregator_policy(char *data, const bool is_delete); |
796 | /* | 780 | int tomoyo_write_transition_control(char *data, const bool is_delete, |
797 | * Create "initialize_domain" and "no_initialize_domain" entry | 781 | const u8 type); |
798 | * in exception policy. | ||
799 | */ | ||
800 | int tomoyo_write_domain_initializer_policy(char *data, const bool is_not, | ||
801 | const bool is_delete); | ||
802 | /* Create "keep_domain" and "no_keep_domain" entry in exception policy. */ | ||
803 | int tomoyo_write_domain_keeper_policy(char *data, const bool is_not, | ||
804 | const bool is_delete); | ||
805 | /* | 782 | /* |
806 | * Create "allow_read/write", "allow_execute", "allow_read", "allow_write", | 783 | * Create "allow_read/write", "allow_execute", "allow_read", "allow_write", |
807 | * "allow_create", "allow_unlink", "allow_mkdir", "allow_rmdir", | 784 | * "allow_create", "allow_unlink", "allow_mkdir", "allow_rmdir", |
@@ -922,6 +899,7 @@ int tomoyo_update_policy(struct tomoyo_acl_head *new_entry, const int size, | |||
922 | void tomoyo_check_acl(struct tomoyo_request_info *r, | 899 | void tomoyo_check_acl(struct tomoyo_request_info *r, |
923 | bool (*check_entry) (const struct tomoyo_request_info *, | 900 | bool (*check_entry) (const struct tomoyo_request_info *, |
924 | const struct tomoyo_acl_info *)); | 901 | const struct tomoyo_acl_info *)); |
902 | const char *tomoyo_last_word(const char *name); | ||
925 | 903 | ||
926 | /********** External variable definitions. **********/ | 904 | /********** External variable definitions. **********/ |
927 | 905 | ||