diff options
author | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> | 2010-06-16 03:23:55 -0400 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2010-08-02 01:34:33 -0400 |
commit | 75093152a97ee0ec281895b4f6229ff3c481fd64 (patch) | |
tree | 960bdf1d441f43c2dfa3c4d54c48af5fc524a1a8 /security/tomoyo/util.c | |
parent | 99a852596beb26cc449ca1a79834c107ef4080e1 (diff) |
TOMOYO: Rename symbols.
Use shorter name in order to make it easier to fix 80 columns limit.
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 | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/security/tomoyo/util.c b/security/tomoyo/util.c index e5931686ca33..945eeefbbdfe 100644 --- a/security/tomoyo/util.c +++ b/security/tomoyo/util.c | |||
@@ -89,7 +89,7 @@ void tomoyo_print_ulong(char *buffer, const int buffer_len, | |||
89 | bool tomoyo_parse_name_union(const char *filename, | 89 | bool tomoyo_parse_name_union(const char *filename, |
90 | struct tomoyo_name_union *ptr) | 90 | struct tomoyo_name_union *ptr) |
91 | { | 91 | { |
92 | if (!tomoyo_is_correct_word(filename)) | 92 | if (!tomoyo_correct_word(filename)) |
93 | return false; | 93 | return false; |
94 | if (filename[0] == '@') { | 94 | if (filename[0] == '@') { |
95 | ptr->group = tomoyo_get_path_group(filename + 1); | 95 | ptr->group = tomoyo_get_path_group(filename + 1); |
@@ -115,7 +115,7 @@ bool tomoyo_parse_number_union(char *data, struct tomoyo_number_union *num) | |||
115 | unsigned long v; | 115 | unsigned long v; |
116 | memset(num, 0, sizeof(*num)); | 116 | memset(num, 0, sizeof(*num)); |
117 | if (data[0] == '@') { | 117 | if (data[0] == '@') { |
118 | if (!tomoyo_is_correct_word(data)) | 118 | if (!tomoyo_correct_word(data)) |
119 | return false; | 119 | return false; |
120 | num->group = tomoyo_get_number_group(data + 1); | 120 | num->group = tomoyo_get_number_group(data + 1); |
121 | num->is_group = true; | 121 | num->is_group = true; |
@@ -142,7 +142,7 @@ bool tomoyo_parse_number_union(char *data, struct tomoyo_number_union *num) | |||
142 | } | 142 | } |
143 | 143 | ||
144 | /** | 144 | /** |
145 | * tomoyo_is_byte_range - Check whether the string is a \ooo style octal value. | 145 | * tomoyo_byte_range - Check whether the string is a \ooo style octal value. |
146 | * | 146 | * |
147 | * @str: Pointer to the string. | 147 | * @str: Pointer to the string. |
148 | * | 148 | * |
@@ -151,7 +151,7 @@ bool tomoyo_parse_number_union(char *data, struct tomoyo_number_union *num) | |||
151 | * TOMOYO uses \ooo style representation for 0x01 - 0x20 and 0x7F - 0xFF. | 151 | * TOMOYO uses \ooo style representation for 0x01 - 0x20 and 0x7F - 0xFF. |
152 | * This function verifies that \ooo is in valid range. | 152 | * This function verifies that \ooo is in valid range. |
153 | */ | 153 | */ |
154 | static inline bool tomoyo_is_byte_range(const char *str) | 154 | static inline bool tomoyo_byte_range(const char *str) |
155 | { | 155 | { |
156 | return *str >= '0' && *str++ <= '3' && | 156 | return *str >= '0' && *str++ <= '3' && |
157 | *str >= '0' && *str++ <= '7' && | 157 | *str >= '0' && *str++ <= '7' && |
@@ -159,13 +159,13 @@ static inline bool tomoyo_is_byte_range(const char *str) | |||
159 | } | 159 | } |
160 | 160 | ||
161 | /** | 161 | /** |
162 | * tomoyo_is_alphabet_char - Check whether the character is an alphabet. | 162 | * tomoyo_alphabet_char - Check whether the character is an alphabet. |
163 | * | 163 | * |
164 | * @c: The character to check. | 164 | * @c: The character to check. |
165 | * | 165 | * |
166 | * Returns true if @c is an alphabet character, false otherwise. | 166 | * Returns true if @c is an alphabet character, false otherwise. |
167 | */ | 167 | */ |
168 | static inline bool tomoyo_is_alphabet_char(const char c) | 168 | static inline bool tomoyo_alphabet_char(const char c) |
169 | { | 169 | { |
170 | return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'); | 170 | return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'); |
171 | } | 171 | } |
@@ -223,15 +223,15 @@ void tomoyo_normalize_line(unsigned char *buffer) | |||
223 | unsigned char *dp = buffer; | 223 | unsigned char *dp = buffer; |
224 | bool first = true; | 224 | bool first = true; |
225 | 225 | ||
226 | while (tomoyo_is_invalid(*sp)) | 226 | while (tomoyo_invalid(*sp)) |
227 | sp++; | 227 | sp++; |
228 | while (*sp) { | 228 | while (*sp) { |
229 | if (!first) | 229 | if (!first) |
230 | *dp++ = ' '; | 230 | *dp++ = ' '; |
231 | first = false; | 231 | first = false; |
232 | while (tomoyo_is_valid(*sp)) | 232 | while (tomoyo_valid(*sp)) |
233 | *dp++ = *sp++; | 233 | *dp++ = *sp++; |
234 | while (tomoyo_is_invalid(*sp)) | 234 | while (tomoyo_invalid(*sp)) |
235 | sp++; | 235 | sp++; |
236 | } | 236 | } |
237 | *dp = '\0'; | 237 | *dp = '\0'; |
@@ -265,7 +265,7 @@ bool tomoyo_tokenize(char *buffer, char *w[], size_t size) | |||
265 | } | 265 | } |
266 | 266 | ||
267 | /** | 267 | /** |
268 | * tomoyo_is_correct_word2 - Validate a string. | 268 | * tomoyo_correct_word2 - Validate a string. |
269 | * | 269 | * |
270 | * @string: The string to check. May be non-'\0'-terminated. | 270 | * @string: The string to check. May be non-'\0'-terminated. |
271 | * @len: Length of @string. | 271 | * @len: Length of @string. |
@@ -273,7 +273,7 @@ bool tomoyo_tokenize(char *buffer, char *w[], size_t size) | |||
273 | * Check whether the given string follows the naming rules. | 273 | * Check whether the given string follows the naming rules. |
274 | * Returns true if @string follows the naming rules, false otherwise. | 274 | * Returns true if @string follows the naming rules, false otherwise. |
275 | */ | 275 | */ |
276 | static bool tomoyo_is_correct_word2(const char *string, size_t len) | 276 | static bool tomoyo_correct_word2(const char *string, size_t len) |
277 | { | 277 | { |
278 | const char *const start = string; | 278 | const char *const start = string; |
279 | bool in_repetition = false; | 279 | bool in_repetition = false; |
@@ -325,13 +325,13 @@ static bool tomoyo_is_correct_word2(const char *string, size_t len) | |||
325 | if (d < '0' || d > '7' || e < '0' || e > '7') | 325 | if (d < '0' || d > '7' || e < '0' || e > '7') |
326 | break; | 326 | break; |
327 | c = tomoyo_make_byte(c, d, e); | 327 | c = tomoyo_make_byte(c, d, e); |
328 | if (tomoyo_is_invalid(c)) | 328 | if (tomoyo_invalid(c)) |
329 | continue; /* pattern is not \000 */ | 329 | continue; /* pattern is not \000 */ |
330 | } | 330 | } |
331 | goto out; | 331 | goto out; |
332 | } else if (in_repetition && c == '/') { | 332 | } else if (in_repetition && c == '/') { |
333 | goto out; | 333 | goto out; |
334 | } else if (tomoyo_is_invalid(c)) { | 334 | } else if (tomoyo_invalid(c)) { |
335 | goto out; | 335 | goto out; |
336 | } | 336 | } |
337 | } | 337 | } |
@@ -343,39 +343,39 @@ static bool tomoyo_is_correct_word2(const char *string, size_t len) | |||
343 | } | 343 | } |
344 | 344 | ||
345 | /** | 345 | /** |
346 | * tomoyo_is_correct_word - Validate a string. | 346 | * tomoyo_correct_word - Validate a string. |
347 | * | 347 | * |
348 | * @string: The string to check. | 348 | * @string: The string to check. |
349 | * | 349 | * |
350 | * Check whether the given string follows the naming rules. | 350 | * Check whether the given string follows the naming rules. |
351 | * Returns true if @string follows the naming rules, false otherwise. | 351 | * Returns true if @string follows the naming rules, false otherwise. |
352 | */ | 352 | */ |
353 | bool tomoyo_is_correct_word(const char *string) | 353 | bool tomoyo_correct_word(const char *string) |
354 | { | 354 | { |
355 | return tomoyo_is_correct_word2(string, strlen(string)); | 355 | return tomoyo_correct_word2(string, strlen(string)); |
356 | } | 356 | } |
357 | 357 | ||
358 | /** | 358 | /** |
359 | * tomoyo_is_correct_path - Validate a pathname. | 359 | * tomoyo_correct_path - Validate a pathname. |
360 | * | 360 | * |
361 | * @filename: The pathname to check. | 361 | * @filename: The pathname to check. |
362 | * | 362 | * |
363 | * Check whether the given pathname follows the naming rules. | 363 | * Check whether the given pathname follows the naming rules. |
364 | * Returns true if @filename follows the naming rules, false otherwise. | 364 | * Returns true if @filename follows the naming rules, false otherwise. |
365 | */ | 365 | */ |
366 | bool tomoyo_is_correct_path(const char *filename) | 366 | bool tomoyo_correct_path(const char *filename) |
367 | { | 367 | { |
368 | return *filename == '/' && tomoyo_is_correct_word(filename); | 368 | return *filename == '/' && tomoyo_correct_word(filename); |
369 | } | 369 | } |
370 | 370 | ||
371 | /** | 371 | /** |
372 | * tomoyo_is_correct_domain - Check whether the given domainname follows the naming rules. | 372 | * tomoyo_correct_domain - Check whether the given domainname follows the naming rules. |
373 | * | 373 | * |
374 | * @domainname: The domainname to check. | 374 | * @domainname: The domainname to check. |
375 | * | 375 | * |
376 | * Returns true if @domainname follows the naming rules, false otherwise. | 376 | * Returns true if @domainname follows the naming rules, false otherwise. |
377 | */ | 377 | */ |
378 | bool tomoyo_is_correct_domain(const unsigned char *domainname) | 378 | bool tomoyo_correct_domain(const unsigned char *domainname) |
379 | { | 379 | { |
380 | if (!domainname || strncmp(domainname, TOMOYO_ROOT_NAME, | 380 | if (!domainname || strncmp(domainname, TOMOYO_ROOT_NAME, |
381 | TOMOYO_ROOT_NAME_LEN)) | 381 | TOMOYO_ROOT_NAME_LEN)) |
@@ -390,23 +390,23 @@ bool tomoyo_is_correct_domain(const unsigned char *domainname) | |||
390 | if (!cp) | 390 | if (!cp) |
391 | break; | 391 | break; |
392 | if (*domainname != '/' || | 392 | if (*domainname != '/' || |
393 | !tomoyo_is_correct_word2(domainname, cp - domainname - 1)) | 393 | !tomoyo_correct_word2(domainname, cp - domainname - 1)) |
394 | goto out; | 394 | goto out; |
395 | domainname = cp + 1; | 395 | domainname = cp + 1; |
396 | } | 396 | } |
397 | return tomoyo_is_correct_path(domainname); | 397 | return tomoyo_correct_path(domainname); |
398 | out: | 398 | out: |
399 | return false; | 399 | return false; |
400 | } | 400 | } |
401 | 401 | ||
402 | /** | 402 | /** |
403 | * tomoyo_is_domain_def - Check whether the given token can be a domainname. | 403 | * tomoyo_domain_def - Check whether the given token can be a domainname. |
404 | * | 404 | * |
405 | * @buffer: The token to check. | 405 | * @buffer: The token to check. |
406 | * | 406 | * |
407 | * Returns true if @buffer possibly be a domainname, false otherwise. | 407 | * Returns true if @buffer possibly be a domainname, false otherwise. |
408 | */ | 408 | */ |
409 | bool tomoyo_is_domain_def(const unsigned char *buffer) | 409 | bool tomoyo_domain_def(const unsigned char *buffer) |
410 | { | 410 | { |
411 | return !strncmp(buffer, TOMOYO_ROOT_NAME, TOMOYO_ROOT_NAME_LEN); | 411 | return !strncmp(buffer, TOMOYO_ROOT_NAME, TOMOYO_ROOT_NAME_LEN); |
412 | } | 412 | } |
@@ -528,7 +528,7 @@ static bool tomoyo_file_matches_pattern2(const char *filename, | |||
528 | } else if (c == '\\') { | 528 | } else if (c == '\\') { |
529 | if (filename[1] == '\\') | 529 | if (filename[1] == '\\') |
530 | filename++; | 530 | filename++; |
531 | else if (tomoyo_is_byte_range(filename + 1)) | 531 | else if (tomoyo_byte_range(filename + 1)) |
532 | filename += 3; | 532 | filename += 3; |
533 | else | 533 | else |
534 | return false; | 534 | return false; |
@@ -549,14 +549,14 @@ static bool tomoyo_file_matches_pattern2(const char *filename, | |||
549 | return false; | 549 | return false; |
550 | break; | 550 | break; |
551 | case 'a': | 551 | case 'a': |
552 | if (!tomoyo_is_alphabet_char(c)) | 552 | if (!tomoyo_alphabet_char(c)) |
553 | return false; | 553 | return false; |
554 | break; | 554 | break; |
555 | case '0': | 555 | case '0': |
556 | case '1': | 556 | case '1': |
557 | case '2': | 557 | case '2': |
558 | case '3': | 558 | case '3': |
559 | if (c == '\\' && tomoyo_is_byte_range(filename + 1) | 559 | if (c == '\\' && tomoyo_byte_range(filename + 1) |
560 | && strncmp(filename + 1, pattern, 3) == 0) { | 560 | && strncmp(filename + 1, pattern, 3) == 0) { |
561 | filename += 3; | 561 | filename += 3; |
562 | pattern += 2; | 562 | pattern += 2; |
@@ -577,7 +577,7 @@ static bool tomoyo_file_matches_pattern2(const char *filename, | |||
577 | continue; | 577 | continue; |
578 | if (filename[i + 1] == '\\') | 578 | if (filename[i + 1] == '\\') |
579 | i++; | 579 | i++; |
580 | else if (tomoyo_is_byte_range(filename + i + 1)) | 580 | else if (tomoyo_byte_range(filename + i + 1)) |
581 | i += 3; | 581 | i += 3; |
582 | else | 582 | else |
583 | break; /* Bad pattern. */ | 583 | break; /* Bad pattern. */ |
@@ -593,7 +593,7 @@ static bool tomoyo_file_matches_pattern2(const char *filename, | |||
593 | while (isxdigit(filename[j])) | 593 | while (isxdigit(filename[j])) |
594 | j++; | 594 | j++; |
595 | } else if (c == 'A') { | 595 | } else if (c == 'A') { |
596 | while (tomoyo_is_alphabet_char(filename[j])) | 596 | while (tomoyo_alphabet_char(filename[j])) |
597 | j++; | 597 | j++; |
598 | } | 598 | } |
599 | for (i = 1; i <= j; i++) { | 599 | for (i = 1; i <= j; i++) { |
@@ -939,10 +939,10 @@ bool tomoyo_domain_quota_is_ok(struct tomoyo_request_info *r) | |||
939 | if (perm & (1 << i)) | 939 | if (perm & (1 << i)) |
940 | count++; | 940 | count++; |
941 | break; | 941 | break; |
942 | case TOMOYO_TYPE_PATH_NUMBER3_ACL: | 942 | case TOMOYO_TYPE_MKDEV_ACL: |
943 | perm = container_of(ptr, struct tomoyo_path_number3_acl, | 943 | perm = container_of(ptr, struct tomoyo_mkdev_acl, |
944 | head)->perm; | 944 | head)->perm; |
945 | for (i = 0; i < TOMOYO_MAX_PATH_NUMBER3_OPERATION; i++) | 945 | for (i = 0; i < TOMOYO_MAX_MKDEV_OPERATION; i++) |
946 | if (perm & (1 << i)) | 946 | if (perm & (1 << i)) |
947 | count++; | 947 | count++; |
948 | break; | 948 | break; |