aboutsummaryrefslogtreecommitdiffstats
path: root/security/tomoyo/file.c
diff options
context:
space:
mode:
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>2010-06-17 03:54:33 -0400
committerJames Morris <jmorris@namei.org>2010-08-02 01:34:41 -0400
commit31845e8c6d3f4f26702e567c667277f9fd1f73a3 (patch)
tree5c457513fcdae4e7e39b19d36e1698ae298ce8d4 /security/tomoyo/file.c
parenta230f9e7121cbcbfe23bd5a630abf6b53cece555 (diff)
TOMOYO: Aggregate reader functions.
Now lists are accessible via array index. Aggregate reader functions using index. 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.c87
1 files changed, 0 insertions, 87 deletions
diff --git a/security/tomoyo/file.c b/security/tomoyo/file.c
index df3b203d7d4..e7687ebdc5f 100644
--- a/security/tomoyo/file.c
+++ b/security/tomoyo/file.c
@@ -344,36 +344,6 @@ int tomoyo_write_globally_readable_policy(char *data, const bool is_delete)
344 return tomoyo_update_globally_readable_entry(data, is_delete); 344 return tomoyo_update_globally_readable_entry(data, is_delete);
345} 345}
346 346
347/**
348 * tomoyo_read_globally_readable_policy - Read "struct tomoyo_globally_readable_file_entry" list.
349 *
350 * @head: Pointer to "struct tomoyo_io_buffer".
351 *
352 * Returns true on success, false otherwise.
353 *
354 * Caller holds tomoyo_read_lock().
355 */
356bool tomoyo_read_globally_readable_policy(struct tomoyo_io_buffer *head)
357{
358 struct list_head *pos;
359 bool done = true;
360
361 list_for_each_cookie(pos, head->read_var2,
362 &tomoyo_policy_list[TOMOYO_ID_GLOBALLY_READABLE]) {
363 struct tomoyo_globally_readable_file_entry *ptr;
364 ptr = list_entry(pos,
365 struct tomoyo_globally_readable_file_entry,
366 head.list);
367 if (ptr->head.is_deleted)
368 continue;
369 done = tomoyo_io_printf(head, TOMOYO_KEYWORD_ALLOW_READ "%s\n",
370 ptr->filename->name);
371 if (!done)
372 break;
373 }
374 return done;
375}
376
377static bool tomoyo_same_pattern(const struct tomoyo_acl_head *a, 347static bool tomoyo_same_pattern(const struct tomoyo_acl_head *a,
378 const struct tomoyo_acl_head *b) 348 const struct tomoyo_acl_head *b)
379{ 349{
@@ -457,34 +427,6 @@ int tomoyo_write_pattern_policy(char *data, const bool is_delete)
457 return tomoyo_update_file_pattern_entry(data, is_delete); 427 return tomoyo_update_file_pattern_entry(data, is_delete);
458} 428}
459 429
460/**
461 * tomoyo_read_file_pattern - Read "struct tomoyo_pattern_entry" list.
462 *
463 * @head: Pointer to "struct tomoyo_io_buffer".
464 *
465 * Returns true on success, false otherwise.
466 *
467 * Caller holds tomoyo_read_lock().
468 */
469bool tomoyo_read_file_pattern(struct tomoyo_io_buffer *head)
470{
471 struct list_head *pos;
472 bool done = true;
473
474 list_for_each_cookie(pos, head->read_var2,
475 &tomoyo_policy_list[TOMOYO_ID_PATTERN]) {
476 struct tomoyo_pattern_entry *ptr;
477 ptr = list_entry(pos, struct tomoyo_pattern_entry, head.list);
478 if (ptr->head.is_deleted)
479 continue;
480 done = tomoyo_io_printf(head, TOMOYO_KEYWORD_FILE_PATTERN
481 "%s\n", ptr->pattern->name);
482 if (!done)
483 break;
484 }
485 return done;
486}
487
488static bool tomoyo_same_no_rewrite(const struct tomoyo_acl_head *a, 430static bool tomoyo_same_no_rewrite(const struct tomoyo_acl_head *a,
489 const struct tomoyo_acl_head *b) 431 const struct tomoyo_acl_head *b)
490{ 432{
@@ -563,35 +505,6 @@ int tomoyo_write_no_rewrite_policy(char *data, const bool is_delete)
563 return tomoyo_update_no_rewrite_entry(data, is_delete); 505 return tomoyo_update_no_rewrite_entry(data, is_delete);
564} 506}
565 507
566/**
567 * tomoyo_read_no_rewrite_policy - Read "struct tomoyo_no_rewrite_entry" list.
568 *
569 * @head: Pointer to "struct tomoyo_io_buffer".
570 *
571 * Returns true on success, false otherwise.
572 *
573 * Caller holds tomoyo_read_lock().
574 */
575bool tomoyo_read_no_rewrite_policy(struct tomoyo_io_buffer *head)
576{
577 struct list_head *pos;
578 bool done = true;
579
580 list_for_each_cookie(pos, head->read_var2,
581 &tomoyo_policy_list[TOMOYO_ID_NO_REWRITE]) {
582 struct tomoyo_no_rewrite_entry *ptr;
583 ptr = list_entry(pos, struct tomoyo_no_rewrite_entry,
584 head.list);
585 if (ptr->head.is_deleted)
586 continue;
587 done = tomoyo_io_printf(head, TOMOYO_KEYWORD_DENY_REWRITE
588 "%s\n", ptr->pattern->name);
589 if (!done)
590 break;
591 }
592 return done;
593}
594
595static bool tomoyo_check_path_acl(const struct tomoyo_request_info *r, 508static bool tomoyo_check_path_acl(const struct tomoyo_request_info *r,
596 const struct tomoyo_acl_info *ptr) 509 const struct tomoyo_acl_info *ptr)
597{ 510{