diff options
author | Ahmed S. Darwish <darwish.07@gmail.com> | 2008-03-01 14:51:09 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2008-04-18 19:52:32 -0400 |
commit | 8a076191f373abaeb4aa5f6755d22e49db98940f (patch) | |
tree | 1311a11332abb0828999a7347a07509a68dffb5f /security/dummy.c | |
parent | d1a4be630fb068f251d64b62919f143c49ca8057 (diff) |
LSM: Introduce inode_getsecid and ipc_getsecid hooks
Introduce inode_getsecid(inode, secid) and ipc_getsecid(ipcp, secid)
LSM hooks. These hooks will be used instead of similar exported
SELinux interfaces.
Let {inode,ipc,task}_getsecid hooks set the secid to 0 by default
if CONFIG_SECURITY is not defined or if the hook is set to
NULL (dummy). This is done to notify the caller that no valid
secid exists.
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
Acked-by: James Morris <jmorris@namei.org>
Reviewed-by: Paul Moore <paul.moore@hp.com>
Diffstat (limited to 'security/dummy.c')
-rw-r--r-- | security/dummy.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/security/dummy.c b/security/dummy.c index 78d8f92310a4..fb2e942efbb6 100644 --- a/security/dummy.c +++ b/security/dummy.c | |||
@@ -424,6 +424,11 @@ static int dummy_inode_listsecurity(struct inode *inode, char *buffer, size_t bu | |||
424 | return 0; | 424 | return 0; |
425 | } | 425 | } |
426 | 426 | ||
427 | static void dummy_inode_getsecid(const struct inode *inode, u32 *secid) | ||
428 | { | ||
429 | *secid = 0; | ||
430 | } | ||
431 | |||
427 | static int dummy_file_permission (struct file *file, int mask) | 432 | static int dummy_file_permission (struct file *file, int mask) |
428 | { | 433 | { |
429 | return 0; | 434 | return 0; |
@@ -542,7 +547,9 @@ static int dummy_task_getsid (struct task_struct *p) | |||
542 | } | 547 | } |
543 | 548 | ||
544 | static void dummy_task_getsecid (struct task_struct *p, u32 *secid) | 549 | static void dummy_task_getsecid (struct task_struct *p, u32 *secid) |
545 | { } | 550 | { |
551 | *secid = 0; | ||
552 | } | ||
546 | 553 | ||
547 | static int dummy_task_setgroups (struct group_info *group_info) | 554 | static int dummy_task_setgroups (struct group_info *group_info) |
548 | { | 555 | { |
@@ -616,6 +623,11 @@ static int dummy_ipc_permission (struct kern_ipc_perm *ipcp, short flag) | |||
616 | return 0; | 623 | return 0; |
617 | } | 624 | } |
618 | 625 | ||
626 | static void dummy_ipc_getsecid(struct kern_ipc_perm *ipcp, u32 *secid) | ||
627 | { | ||
628 | *secid = 0; | ||
629 | } | ||
630 | |||
619 | static int dummy_msg_msg_alloc_security (struct msg_msg *msg) | 631 | static int dummy_msg_msg_alloc_security (struct msg_msg *msg) |
620 | { | 632 | { |
621 | return 0; | 633 | return 0; |
@@ -1058,6 +1070,7 @@ void security_fixup_ops (struct security_operations *ops) | |||
1058 | set_to_dummy_if_null(ops, inode_getsecurity); | 1070 | set_to_dummy_if_null(ops, inode_getsecurity); |
1059 | set_to_dummy_if_null(ops, inode_setsecurity); | 1071 | set_to_dummy_if_null(ops, inode_setsecurity); |
1060 | set_to_dummy_if_null(ops, inode_listsecurity); | 1072 | set_to_dummy_if_null(ops, inode_listsecurity); |
1073 | set_to_dummy_if_null(ops, inode_getsecid); | ||
1061 | set_to_dummy_if_null(ops, file_permission); | 1074 | set_to_dummy_if_null(ops, file_permission); |
1062 | set_to_dummy_if_null(ops, file_alloc_security); | 1075 | set_to_dummy_if_null(ops, file_alloc_security); |
1063 | set_to_dummy_if_null(ops, file_free_security); | 1076 | set_to_dummy_if_null(ops, file_free_security); |
@@ -1094,6 +1107,7 @@ void security_fixup_ops (struct security_operations *ops) | |||
1094 | set_to_dummy_if_null(ops, task_reparent_to_init); | 1107 | set_to_dummy_if_null(ops, task_reparent_to_init); |
1095 | set_to_dummy_if_null(ops, task_to_inode); | 1108 | set_to_dummy_if_null(ops, task_to_inode); |
1096 | set_to_dummy_if_null(ops, ipc_permission); | 1109 | set_to_dummy_if_null(ops, ipc_permission); |
1110 | set_to_dummy_if_null(ops, ipc_getsecid); | ||
1097 | set_to_dummy_if_null(ops, msg_msg_alloc_security); | 1111 | set_to_dummy_if_null(ops, msg_msg_alloc_security); |
1098 | set_to_dummy_if_null(ops, msg_msg_free_security); | 1112 | set_to_dummy_if_null(ops, msg_msg_free_security); |
1099 | set_to_dummy_if_null(ops, msg_queue_alloc_security); | 1113 | set_to_dummy_if_null(ops, msg_queue_alloc_security); |