diff options
author | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> | 2010-05-16 21:08:05 -0400 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2010-08-02 01:33:36 -0400 |
commit | cb0abe6a5b58499bd4bc1403f4987af9ead0642c (patch) | |
tree | 3a48c36dcfe0cfe1e4b6f3faf5ca3e7fae4327c7 /security/tomoyo/common.h | |
parent | 4c3e9e2ded48bcf696a45945ea7d25bb15b873fd (diff) |
TOMOYO: Use structure for passing common arguments.
Use "struct tomoyo_request_info" instead of passing individual arguments.
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 | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/security/tomoyo/common.h b/security/tomoyo/common.h index 33d3072f9bb4..91e2bcfd56e3 100644 --- a/security/tomoyo/common.h +++ b/security/tomoyo/common.h | |||
@@ -44,6 +44,13 @@ struct linux_binprm; | |||
44 | /* Profile number is an integer between 0 and 255. */ | 44 | /* Profile number is an integer between 0 and 255. */ |
45 | #define TOMOYO_MAX_PROFILES 256 | 45 | #define TOMOYO_MAX_PROFILES 256 |
46 | 46 | ||
47 | enum tomoyo_mode_index { | ||
48 | TOMOYO_CONFIG_DISABLED, | ||
49 | TOMOYO_CONFIG_LEARNING, | ||
50 | TOMOYO_CONFIG_PERMISSIVE, | ||
51 | TOMOYO_CONFIG_ENFORCING | ||
52 | }; | ||
53 | |||
47 | /* Keywords for ACLs. */ | 54 | /* Keywords for ACLs. */ |
48 | #define TOMOYO_KEYWORD_ALIAS "alias " | 55 | #define TOMOYO_KEYWORD_ALIAS "alias " |
49 | #define TOMOYO_KEYWORD_ALLOW_READ "allow_read " | 56 | #define TOMOYO_KEYWORD_ALLOW_READ "allow_read " |
@@ -153,6 +160,17 @@ struct tomoyo_page_buffer { | |||
153 | }; | 160 | }; |
154 | 161 | ||
155 | /* | 162 | /* |
163 | * tomoyo_request_info is a structure which is used for holding | ||
164 | * | ||
165 | * (1) Domain information of current process. | ||
166 | * (2) Access control mode of the profile. | ||
167 | */ | ||
168 | struct tomoyo_request_info { | ||
169 | struct tomoyo_domain_info *domain; | ||
170 | u8 mode; /* One of tomoyo_mode_index . */ | ||
171 | }; | ||
172 | |||
173 | /* | ||
156 | * tomoyo_path_info is a structure which is used for holding a string data | 174 | * tomoyo_path_info is a structure which is used for holding a string data |
157 | * used by TOMOYO. | 175 | * used by TOMOYO. |
158 | * This structure has several fields for supporting pattern matching. | 176 | * This structure has several fields for supporting pattern matching. |
@@ -332,8 +350,8 @@ struct tomoyo_domain_info { | |||
332 | * "allow_read", "allow_write", "allow_create", "allow_unlink", "allow_mkdir", | 350 | * "allow_read", "allow_write", "allow_create", "allow_unlink", "allow_mkdir", |
333 | * "allow_rmdir", "allow_mkfifo", "allow_mksock", "allow_mkblock", | 351 | * "allow_rmdir", "allow_mkfifo", "allow_mksock", "allow_mkblock", |
334 | * "allow_mkchar", "allow_truncate", "allow_symlink", "allow_rewrite", | 352 | * "allow_mkchar", "allow_truncate", "allow_symlink", "allow_rewrite", |
335 | * "allow_chmod", "allow_chown", "allow_chgrp", "allow_chroot", "allow_mount" | 353 | * "allow_ioctl", "allow_chmod", "allow_chown", "allow_chgrp", "allow_chroot", |
336 | * and "allow_unmount". | 354 | * "allow_mount" and "allow_unmount". |
337 | */ | 355 | */ |
338 | struct tomoyo_path_acl { | 356 | struct tomoyo_path_acl { |
339 | struct tomoyo_acl_info head; /* type = TOMOYO_TYPE_PATH_ACL */ | 357 | struct tomoyo_acl_info head; /* type = TOMOYO_TYPE_PATH_ACL */ |
@@ -567,7 +585,7 @@ struct tomoyo_policy_manager_entry { | |||
567 | bool tomoyo_compare_name_union(const struct tomoyo_path_info *name, | 585 | bool tomoyo_compare_name_union(const struct tomoyo_path_info *name, |
568 | const struct tomoyo_name_union *ptr); | 586 | const struct tomoyo_name_union *ptr); |
569 | /* Check whether the domain has too many ACL entries to hold. */ | 587 | /* Check whether the domain has too many ACL entries to hold. */ |
570 | bool tomoyo_domain_quota_is_ok(struct tomoyo_domain_info * const domain); | 588 | bool tomoyo_domain_quota_is_ok(struct tomoyo_request_info *r); |
571 | /* Transactional sprintf() for policy dump. */ | 589 | /* Transactional sprintf() for policy dump. */ |
572 | bool tomoyo_io_printf(struct tomoyo_io_buffer *head, const char *fmt, ...) | 590 | bool tomoyo_io_printf(struct tomoyo_io_buffer *head, const char *fmt, ...) |
573 | __attribute__ ((format(printf, 2, 3))); | 591 | __attribute__ ((format(printf, 2, 3))); |
@@ -623,8 +641,6 @@ bool tomoyo_verbose_mode(const struct tomoyo_domain_info *domain); | |||
623 | const char *tomoyo_path22keyword(const u8 operation); | 641 | const char *tomoyo_path22keyword(const u8 operation); |
624 | /* Get the last component of the given domainname. */ | 642 | /* Get the last component of the given domainname. */ |
625 | const char *tomoyo_get_last_name(const struct tomoyo_domain_info *domain); | 643 | const char *tomoyo_get_last_name(const struct tomoyo_domain_info *domain); |
626 | /* Get warning message. */ | ||
627 | const char *tomoyo_get_msg(const bool is_enforce); | ||
628 | /* Convert single path operation to operation name. */ | 644 | /* Convert single path operation to operation name. */ |
629 | const char *tomoyo_path2keyword(const u8 operation); | 645 | const char *tomoyo_path2keyword(const u8 operation); |
630 | /* Create "alias" entry in exception policy. */ | 646 | /* Create "alias" entry in exception policy. */ |
@@ -723,7 +739,6 @@ int tomoyo_check_open_permission(struct tomoyo_domain_info *domain, | |||
723 | int tomoyo_path_perm(const u8 operation, struct path *path); | 739 | int tomoyo_path_perm(const u8 operation, struct path *path); |
724 | int tomoyo_path2_perm(const u8 operation, struct path *path1, | 740 | int tomoyo_path2_perm(const u8 operation, struct path *path1, |
725 | struct path *path2); | 741 | struct path *path2); |
726 | int tomoyo_check_rewrite_permission(struct file *filp); | ||
727 | int tomoyo_find_next_domain(struct linux_binprm *bprm); | 742 | int tomoyo_find_next_domain(struct linux_binprm *bprm); |
728 | 743 | ||
729 | /* Drop refcount on tomoyo_name_union. */ | 744 | /* Drop refcount on tomoyo_name_union. */ |