diff options
author | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> | 2011-09-10 02:25:58 -0400 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2011-09-13 18:27:06 -0400 |
commit | 731d37aa70c7b9de3be6bf2c8287366223bf5ce5 (patch) | |
tree | 8ac6028511485862572695eb91e2d461e0636182 /security/tomoyo/util.c | |
parent | 1f067a682a9bd252107ac6f6946b7332fde42344 (diff) |
TOMOYO: Allow domain transition without execve().
To be able to split permissions for Apache's CGI programs which are executed
without execve(), add special domain transition which is performed by writing
a TOMOYO's domainname to /sys/kernel/security/tomoyo/self_domain interface.
This is an API for TOMOYO-aware userland applications. However, since I expect
TOMOYO and other LSM modules to run in parallel, this patch does not use
/proc/self/attr/ interface in order to avoid conflicts with other LSM modules
when it became possible to run multiple LSM modules in parallel.
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/util.c')
-rw-r--r-- | security/tomoyo/util.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/security/tomoyo/util.c b/security/tomoyo/util.c index a1c3d9ccebfa..50e9b4c73ceb 100644 --- a/security/tomoyo/util.c +++ b/security/tomoyo/util.c | |||
@@ -159,6 +159,31 @@ char *tomoyo_read_token(struct tomoyo_acl_param *param) | |||
159 | } | 159 | } |
160 | 160 | ||
161 | /** | 161 | /** |
162 | * tomoyo_get_domainname - Read a domainname from a line. | ||
163 | * | ||
164 | * @param: Pointer to "struct tomoyo_acl_param". | ||
165 | * | ||
166 | * Returns a domainname on success, NULL otherwise. | ||
167 | */ | ||
168 | const struct tomoyo_path_info *tomoyo_get_domainname | ||
169 | (struct tomoyo_acl_param *param) | ||
170 | { | ||
171 | char *start = param->data; | ||
172 | char *pos = start; | ||
173 | while (*pos) { | ||
174 | if (*pos++ != ' ' || *pos++ == '/') | ||
175 | continue; | ||
176 | pos -= 2; | ||
177 | *pos++ = '\0'; | ||
178 | break; | ||
179 | } | ||
180 | param->data = pos; | ||
181 | if (tomoyo_correct_domain(start)) | ||
182 | return tomoyo_get_name(start); | ||
183 | return NULL; | ||
184 | } | ||
185 | |||
186 | /** | ||
162 | * tomoyo_parse_ulong - Parse an "unsigned long" value. | 187 | * tomoyo_parse_ulong - Parse an "unsigned long" value. |
163 | * | 188 | * |
164 | * @result: Pointer to "unsigned long". | 189 | * @result: Pointer to "unsigned long". |