diff options
author | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> | 2010-05-16 21:12:46 -0400 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2010-08-02 01:33:39 -0400 |
commit | c3ef1500ec833890275172c7d063333404b64d60 (patch) | |
tree | 2453368e521a1f7a00098eef06afbedb8404503d /security/tomoyo/file.c | |
parent | 17fcfbd9d45b57f38d40e31f9d28db53f4af5c88 (diff) |
TOMOYO: Split files into some pieces.
security/tomoyo/common.c became too large to read.
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.c | 62 |
1 files changed, 2 insertions, 60 deletions
diff --git a/security/tomoyo/file.c b/security/tomoyo/file.c index c629cb4e2c66..c13806937dc6 100644 --- a/security/tomoyo/file.c +++ b/security/tomoyo/file.c | |||
@@ -1,12 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | * security/tomoyo/file.c | 2 | * security/tomoyo/file.c |
3 | * | 3 | * |
4 | * Implementation of the Domain-Based Mandatory Access Control. | 4 | * Pathname restriction functions. |
5 | * | ||
6 | * Copyright (C) 2005-2009 NTT DATA CORPORATION | ||
7 | * | ||
8 | * Version: 2.2.0 2009/04/01 | ||
9 | * | 5 | * |
6 | * Copyright (C) 2005-2010 NTT DATA CORPORATION | ||
10 | */ | 7 | */ |
11 | 8 | ||
12 | #include "common.h" | 9 | #include "common.h" |
@@ -100,61 +97,6 @@ bool tomoyo_compare_number_union(const unsigned long value, | |||
100 | } | 97 | } |
101 | 98 | ||
102 | /** | 99 | /** |
103 | * tomoyo_init_request_info - Initialize "struct tomoyo_request_info" members. | ||
104 | * | ||
105 | * @r: Pointer to "struct tomoyo_request_info" to initialize. | ||
106 | * @domain: Pointer to "struct tomoyo_domain_info". NULL for tomoyo_domain(). | ||
107 | * | ||
108 | * Returns mode. | ||
109 | */ | ||
110 | int tomoyo_init_request_info(struct tomoyo_request_info *r, | ||
111 | struct tomoyo_domain_info *domain) | ||
112 | { | ||
113 | memset(r, 0, sizeof(*r)); | ||
114 | if (!domain) | ||
115 | domain = tomoyo_domain(); | ||
116 | r->domain = domain; | ||
117 | r->mode = tomoyo_check_flags(domain, TOMOYO_MAC_FOR_FILE); | ||
118 | return r->mode; | ||
119 | } | ||
120 | |||
121 | static void tomoyo_warn_log(struct tomoyo_request_info *r, const char *fmt, ...) | ||
122 | __attribute__ ((format(printf, 2, 3))); | ||
123 | /** | ||
124 | * tomoyo_warn_log - Print warning or error message on console. | ||
125 | * | ||
126 | * @r: Pointer to "struct tomoyo_request_info". | ||
127 | * @fmt: The printf()'s format string, followed by parameters. | ||
128 | */ | ||
129 | static void tomoyo_warn_log(struct tomoyo_request_info *r, const char *fmt, ...) | ||
130 | { | ||
131 | int len = PAGE_SIZE; | ||
132 | va_list args; | ||
133 | char *buffer; | ||
134 | if (!tomoyo_verbose_mode(r->domain)) | ||
135 | return; | ||
136 | while (1) { | ||
137 | int len2; | ||
138 | buffer = kmalloc(len, GFP_NOFS); | ||
139 | if (!buffer) | ||
140 | return; | ||
141 | va_start(args, fmt); | ||
142 | len2 = vsnprintf(buffer, len - 1, fmt, args); | ||
143 | va_end(args); | ||
144 | if (len2 <= len - 1) { | ||
145 | buffer[len2] = '\0'; | ||
146 | break; | ||
147 | } | ||
148 | len = len2 + 1; | ||
149 | kfree(buffer); | ||
150 | } | ||
151 | printk(KERN_WARNING "TOMOYO-%s: Access %s denied for %s\n", | ||
152 | r->mode == TOMOYO_CONFIG_ENFORCING ? "ERROR" : "WARNING", | ||
153 | buffer, tomoyo_get_last_name(r->domain)); | ||
154 | kfree(buffer); | ||
155 | } | ||
156 | |||
157 | /** | ||
158 | * tomoyo_path2keyword - Get the name of single path operation. | 100 | * tomoyo_path2keyword - Get the name of single path operation. |
159 | * | 101 | * |
160 | * @operation: Type of operation. | 102 | * @operation: Type of operation. |