aboutsummaryrefslogtreecommitdiffstats
path: root/security/tomoyo/file.c
diff options
context:
space:
mode:
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>2010-07-29 01:29:55 -0400
committerJames Morris <jmorris@namei.org>2010-08-02 01:38:38 -0400
commit484ca79c653121d3c79fffb86e1deea724f2e20b (patch)
tree457aa73e37c9b5e5b4306430f40d1985b59ca226 /security/tomoyo/file.c
parent4d6ec10bb4461fdc9a9ab94ef32934e13564e873 (diff)
TOMOYO: Use pathname specified by policy rather than execve()
Commit c9e69318 "TOMOYO: Allow wildcard for execute permission." changed execute permission and domainname to accept wildcards. But tomoyo_find_next_domain() was using pathname passed to execve() rather than pathname specified by the execute permission. As a result, processes were not able to transit to domains which contain wildcards in their domainnames. This patch passes pathname specified by the execute permission back to tomoyo_find_next_domain() so that processes can transit to domains which contain wildcards in their domainnames. 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/file.c')
-rw-r--r--security/tomoyo/file.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/security/tomoyo/file.c b/security/tomoyo/file.c
index f7877fa80f14..9d32f182301e 100644
--- a/security/tomoyo/file.c
+++ b/security/tomoyo/file.c
@@ -95,12 +95,15 @@ void tomoyo_put_name_union(struct tomoyo_name_union *ptr)
95 tomoyo_put_name(ptr->filename); 95 tomoyo_put_name(ptr->filename);
96} 96}
97 97
98bool tomoyo_compare_name_union(const struct tomoyo_path_info *name, 98const struct tomoyo_path_info *
99 const struct tomoyo_name_union *ptr) 99tomoyo_compare_name_union(const struct tomoyo_path_info *name,
100 const struct tomoyo_name_union *ptr)
100{ 101{
101 if (ptr->is_group) 102 if (ptr->is_group)
102 return tomoyo_path_matches_group(name, ptr->group); 103 return tomoyo_path_matches_group(name, ptr->group);
103 return tomoyo_path_matches_pattern(name, ptr->filename); 104 if (tomoyo_path_matches_pattern(name, ptr->filename))
105 return ptr->filename;
106 return NULL;
104} 107}
105 108
106void tomoyo_put_number_union(struct tomoyo_number_union *ptr) 109void tomoyo_put_number_union(struct tomoyo_number_union *ptr)
@@ -504,16 +507,21 @@ int tomoyo_write_no_rewrite(char *data, const bool is_delete)
504 return tomoyo_update_no_rewrite_entry(data, is_delete); 507 return tomoyo_update_no_rewrite_entry(data, is_delete);
505} 508}
506 509
507static bool tomoyo_check_path_acl(const struct tomoyo_request_info *r, 510static bool tomoyo_check_path_acl(struct tomoyo_request_info *r,
508 const struct tomoyo_acl_info *ptr) 511 const struct tomoyo_acl_info *ptr)
509{ 512{
510 const struct tomoyo_path_acl *acl = container_of(ptr, typeof(*acl), 513 const struct tomoyo_path_acl *acl = container_of(ptr, typeof(*acl),
511 head); 514 head);
512 return (acl->perm & (1 << r->param.path.operation)) && 515 if (acl->perm & (1 << r->param.path.operation)) {
513 tomoyo_compare_name_union(r->param.path.filename, &acl->name); 516 r->param.path.matched_path =
517 tomoyo_compare_name_union(r->param.path.filename,
518 &acl->name);
519 return r->param.path.matched_path != NULL;
520 }
521 return false;
514} 522}
515 523
516static bool tomoyo_check_path_number_acl(const struct tomoyo_request_info *r, 524static bool tomoyo_check_path_number_acl(struct tomoyo_request_info *r,
517 const struct tomoyo_acl_info *ptr) 525 const struct tomoyo_acl_info *ptr)
518{ 526{
519 const struct tomoyo_path_number_acl *acl = 527 const struct tomoyo_path_number_acl *acl =
@@ -525,7 +533,7 @@ static bool tomoyo_check_path_number_acl(const struct tomoyo_request_info *r,
525 &acl->name); 533 &acl->name);
526} 534}
527 535
528static bool tomoyo_check_path2_acl(const struct tomoyo_request_info *r, 536static bool tomoyo_check_path2_acl(struct tomoyo_request_info *r,
529 const struct tomoyo_acl_info *ptr) 537 const struct tomoyo_acl_info *ptr)
530{ 538{
531 const struct tomoyo_path2_acl *acl = 539 const struct tomoyo_path2_acl *acl =
@@ -536,7 +544,7 @@ static bool tomoyo_check_path2_acl(const struct tomoyo_request_info *r,
536 &acl->name2); 544 &acl->name2);
537} 545}
538 546
539static bool tomoyo_check_mkdev_acl(const struct tomoyo_request_info *r, 547static bool tomoyo_check_mkdev_acl(struct tomoyo_request_info *r,
540 const struct tomoyo_acl_info *ptr) 548 const struct tomoyo_acl_info *ptr)
541{ 549{
542 const struct tomoyo_mkdev_acl *acl = 550 const struct tomoyo_mkdev_acl *acl =