TOMOYO: Allow wildcard for execute permission.
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Thu, 3 Jun 2010 11:37:26 +0000 (20:37 +0900)
committerJames Morris <jmorris@namei.org>
Mon, 2 Aug 2010 05:33:42 +0000 (15:33 +1000)
Some applications create and execute programs dynamically. We need to accept
wildcard for execute permission because such programs contain random suffix
in their filenames. This patch loosens up regulation of string parameters.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: James Morris <jmorris@namei.org>
security/tomoyo/common.c
security/tomoyo/common.h
security/tomoyo/domain.c
security/tomoyo/file.c
security/tomoyo/number_group.c
security/tomoyo/path_group.c
security/tomoyo/util.c

index 98e3639..3f94011 100644 (file)
@@ -407,7 +407,7 @@ static int tomoyo_update_manager_entry(const char *manager,
                        return -EINVAL;
                e.is_domain = true;
        } else {
-               if (!tomoyo_is_correct_path(manager, 1, -1, -1))
+               if (!tomoyo_is_correct_path(manager))
                        return -EINVAL;
        }
        e.manager = tomoyo_get_name(manager);
index f4a8aa2..d1b8d79 100644 (file)
@@ -672,16 +672,15 @@ bool tomoyo_io_printf(struct tomoyo_io_buffer *head, const char *fmt, ...)
 /* Check whether the domainname is correct. */
 bool tomoyo_is_correct_domain(const unsigned char *domainname);
 /* Check whether the token is correct. */
-bool tomoyo_is_correct_path(const char *filename, const s8 start_type,
-                           const s8 pattern_type, const s8 end_type);
+bool tomoyo_is_correct_path(const char *filename);
+bool tomoyo_is_correct_word(const char *string);
 /* Check whether the token can be a domainname. */
 bool tomoyo_is_domain_def(const unsigned char *buffer);
 bool tomoyo_parse_name_union(const char *filename,
                             struct tomoyo_name_union *ptr);
 /* Check whether the given filename matches the given path_group. */
 bool tomoyo_path_matches_group(const struct tomoyo_path_info *pathname,
-                              const struct tomoyo_path_group *group,
-                              const bool may_use_pattern);
+                              const struct tomoyo_path_group *group);
 /* Check whether the given value matches the given number_group. */
 bool tomoyo_number_matches_group(const unsigned long min,
                                 const unsigned long max,
index 7b8693e..50f6e79 100644 (file)
@@ -131,11 +131,11 @@ static int tomoyo_update_domain_initializer_entry(const char *domainname,
        struct tomoyo_domain_initializer_entry e = { .is_not = is_not };
        int error = is_delete ? -ENOENT : -ENOMEM;
 
-       if (!tomoyo_is_correct_path(program, 1, -1, -1))
-               return -EINVAL; /* No patterns allowed. */
+       if (!tomoyo_is_correct_path(program))
+               return -EINVAL;
        if (domainname) {
                if (!tomoyo_is_domain_def(domainname) &&
-                   tomoyo_is_correct_path(domainname, 1, -1, -1))
+                   tomoyo_is_correct_path(domainname))
                        e.is_last_name = true;
                else if (!tomoyo_is_correct_domain(domainname))
                        return -EINVAL;
@@ -342,12 +342,12 @@ static int tomoyo_update_domain_keeper_entry(const char *domainname,
        int error = is_delete ? -ENOENT : -ENOMEM;
 
        if (!tomoyo_is_domain_def(domainname) &&
-           tomoyo_is_correct_path(domainname, 1, -1, -1))
+           tomoyo_is_correct_path(domainname))
                e.is_last_name = true;
        else if (!tomoyo_is_correct_domain(domainname))
                return -EINVAL;
        if (program) {
-               if (!tomoyo_is_correct_path(program, 1, -1, -1))
+               if (!tomoyo_is_correct_path(program))
                        return -EINVAL;
                e.program = tomoyo_get_name(program);
                if (!e.program)
@@ -533,13 +533,14 @@ static int tomoyo_update_alias_entry(const char *original_name,
        struct tomoyo_alias_entry e = { };
        int error = is_delete ? -ENOENT : -ENOMEM;
 
-       if (!tomoyo_is_correct_path(original_name, 1, -1, -1) ||
-           !tomoyo_is_correct_path(aliased_name, 1, -1, -1))
-               return -EINVAL; /* No patterns allowed. */
+       if (!tomoyo_is_correct_path(original_name) ||
+           !tomoyo_is_correct_path(aliased_name))
+               return -EINVAL;
        e.original_name = tomoyo_get_name(original_name);
        e.aliased_name = tomoyo_get_name(aliased_name);
-       if (!e.original_name || !e.aliased_name)
-               goto out;
+       if (!e.original_name || !e.aliased_name ||
+           e.original_name->is_patterned || e.aliased_name->is_patterned)
+               goto out; /* No patterns allowed. */
        if (mutex_lock_interruptible(&tomoyo_policy_lock))
                goto out;
        list_for_each_entry_rcu(ptr, &tomoyo_alias_list, list) {
Simple merge
Simple merge
Simple merge
Simple merge