diff options
author | James Morris <jmorris@namei.org> | 2010-02-28 17:36:31 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2010-02-28 17:36:31 -0500 |
commit | b4ccebdd37ff70d349321a198f416ba737a5e833 (patch) | |
tree | 275d717070346722c3aacd8355fb4f743216e03b /security/selinux/hooks.c | |
parent | 30ff056c42c665b9ea535d8515890857ae382540 (diff) | |
parent | ef57471a73b67a7b65fd8708fd55c77cb7c619af (diff) |
Merge branch 'next' into for-linus
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r-- | security/selinux/hooks.c | 41 |
1 files changed, 16 insertions, 25 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 9a2ee845e9d..5feecb41009 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -76,6 +76,7 @@ | |||
76 | #include <linux/selinux.h> | 76 | #include <linux/selinux.h> |
77 | #include <linux/mutex.h> | 77 | #include <linux/mutex.h> |
78 | #include <linux/posix-timers.h> | 78 | #include <linux/posix-timers.h> |
79 | #include <linux/syslog.h> | ||
79 | 80 | ||
80 | #include "avc.h" | 81 | #include "avc.h" |
81 | #include "objsec.h" | 82 | #include "objsec.h" |
@@ -125,13 +126,6 @@ __setup("selinux=", selinux_enabled_setup); | |||
125 | int selinux_enabled = 1; | 126 | int selinux_enabled = 1; |
126 | #endif | 127 | #endif |
127 | 128 | ||
128 | |||
129 | /* | ||
130 | * Minimal support for a secondary security module, | ||
131 | * just to allow the use of the capability module. | ||
132 | */ | ||
133 | static struct security_operations *secondary_ops; | ||
134 | |||
135 | /* Lists of inode and superblock security structures initialized | 129 | /* Lists of inode and superblock security structures initialized |
136 | before the policy was loaded. */ | 130 | before the policy was loaded. */ |
137 | static LIST_HEAD(superblock_security_head); | 131 | static LIST_HEAD(superblock_security_head); |
@@ -2049,29 +2043,30 @@ static int selinux_quota_on(struct dentry *dentry) | |||
2049 | return dentry_has_perm(cred, NULL, dentry, FILE__QUOTAON); | 2043 | return dentry_has_perm(cred, NULL, dentry, FILE__QUOTAON); |
2050 | } | 2044 | } |
2051 | 2045 | ||
2052 | static int selinux_syslog(int type) | 2046 | static int selinux_syslog(int type, bool from_file) |
2053 | { | 2047 | { |
2054 | int rc; | 2048 | int rc; |
2055 | 2049 | ||
2056 | rc = cap_syslog(type); | 2050 | rc = cap_syslog(type, from_file); |
2057 | if (rc) | 2051 | if (rc) |
2058 | return rc; | 2052 | return rc; |
2059 | 2053 | ||
2060 | switch (type) { | 2054 | switch (type) { |
2061 | case 3: /* Read last kernel messages */ | 2055 | case SYSLOG_ACTION_READ_ALL: /* Read last kernel messages */ |
2062 | case 10: /* Return size of the log buffer */ | 2056 | case SYSLOG_ACTION_SIZE_BUFFER: /* Return size of the log buffer */ |
2063 | rc = task_has_system(current, SYSTEM__SYSLOG_READ); | 2057 | rc = task_has_system(current, SYSTEM__SYSLOG_READ); |
2064 | break; | 2058 | break; |
2065 | case 6: /* Disable logging to console */ | 2059 | case SYSLOG_ACTION_CONSOLE_OFF: /* Disable logging to console */ |
2066 | case 7: /* Enable logging to console */ | 2060 | case SYSLOG_ACTION_CONSOLE_ON: /* Enable logging to console */ |
2067 | case 8: /* Set level of messages printed to console */ | 2061 | /* Set level of messages printed to console */ |
2062 | case SYSLOG_ACTION_CONSOLE_LEVEL: | ||
2068 | rc = task_has_system(current, SYSTEM__SYSLOG_CONSOLE); | 2063 | rc = task_has_system(current, SYSTEM__SYSLOG_CONSOLE); |
2069 | break; | 2064 | break; |
2070 | case 0: /* Close log */ | 2065 | case SYSLOG_ACTION_CLOSE: /* Close log */ |
2071 | case 1: /* Open log */ | 2066 | case SYSLOG_ACTION_OPEN: /* Open log */ |
2072 | case 2: /* Read from log */ | 2067 | case SYSLOG_ACTION_READ: /* Read from log */ |
2073 | case 4: /* Read/clear last kernel messages */ | 2068 | case SYSLOG_ACTION_READ_CLEAR: /* Read/clear last kernel messages */ |
2074 | case 5: /* Clear ring buffer */ | 2069 | case SYSLOG_ACTION_CLEAR: /* Clear ring buffer */ |
2075 | default: | 2070 | default: |
2076 | rc = task_has_system(current, SYSTEM__SYSLOG_MOD); | 2071 | rc = task_has_system(current, SYSTEM__SYSLOG_MOD); |
2077 | break; | 2072 | break; |
@@ -3334,7 +3329,7 @@ static int selinux_kernel_create_files_as(struct cred *new, struct inode *inode) | |||
3334 | 3329 | ||
3335 | if (ret == 0) | 3330 | if (ret == 0) |
3336 | tsec->create_sid = isec->sid; | 3331 | tsec->create_sid = isec->sid; |
3337 | return 0; | 3332 | return ret; |
3338 | } | 3333 | } |
3339 | 3334 | ||
3340 | static int selinux_kernel_module_request(char *kmod_name) | 3335 | static int selinux_kernel_module_request(char *kmod_name) |
@@ -5672,9 +5667,6 @@ static __init int selinux_init(void) | |||
5672 | 0, SLAB_PANIC, NULL); | 5667 | 0, SLAB_PANIC, NULL); |
5673 | avc_init(); | 5668 | avc_init(); |
5674 | 5669 | ||
5675 | secondary_ops = security_ops; | ||
5676 | if (!secondary_ops) | ||
5677 | panic("SELinux: No initial security operations\n"); | ||
5678 | if (register_security(&selinux_ops)) | 5670 | if (register_security(&selinux_ops)) |
5679 | panic("SELinux: Unable to register with kernel.\n"); | 5671 | panic("SELinux: Unable to register with kernel.\n"); |
5680 | 5672 | ||
@@ -5835,8 +5827,7 @@ int selinux_disable(void) | |||
5835 | selinux_disabled = 1; | 5827 | selinux_disabled = 1; |
5836 | selinux_enabled = 0; | 5828 | selinux_enabled = 0; |
5837 | 5829 | ||
5838 | /* Reset security_ops to the secondary module, dummy or capability. */ | 5830 | reset_security_ops(); |
5839 | security_ops = secondary_ops; | ||
5840 | 5831 | ||
5841 | /* Try to destroy the avc node cache */ | 5832 | /* Try to destroy the avc node cache */ |
5842 | avc_disable(); | 5833 | avc_disable(); |