diff options
author | David Howells <dhowells@redhat.com> | 2008-11-13 18:39:18 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2008-11-13 18:39:18 -0500 |
commit | 86a264abe542cfececb4df129bc45a0338d8cdb9 (patch) | |
tree | 30152f04ba847f311028d5ca697f864c16c7ebb3 /security/smack/smack_lsm.c | |
parent | f1752eec6145c97163dbce62d17cf5d928e28a27 (diff) |
CRED: Wrap current->cred and a few other accessors
Wrap current->cred and a few other accessors to hide their actual
implementation.
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: James Morris <jmorris@namei.org>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security/smack/smack_lsm.c')
-rw-r--r-- | security/smack/smack_lsm.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index cc837314fb0e..e8a4fcb1ad04 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c | |||
@@ -143,7 +143,7 @@ static int smack_ptrace_traceme(struct task_struct *ptp) | |||
143 | static int smack_syslog(int type) | 143 | static int smack_syslog(int type) |
144 | { | 144 | { |
145 | int rc; | 145 | int rc; |
146 | char *sp = current->cred->security; | 146 | char *sp = current_security(); |
147 | 147 | ||
148 | rc = cap_syslog(type); | 148 | rc = cap_syslog(type); |
149 | if (rc != 0) | 149 | if (rc != 0) |
@@ -375,7 +375,7 @@ static int smack_sb_umount(struct vfsmount *mnt, int flags) | |||
375 | */ | 375 | */ |
376 | static int smack_inode_alloc_security(struct inode *inode) | 376 | static int smack_inode_alloc_security(struct inode *inode) |
377 | { | 377 | { |
378 | inode->i_security = new_inode_smack(current->cred->security); | 378 | inode->i_security = new_inode_smack(current_security()); |
379 | if (inode->i_security == NULL) | 379 | if (inode->i_security == NULL) |
380 | return -ENOMEM; | 380 | return -ENOMEM; |
381 | return 0; | 381 | return 0; |
@@ -820,7 +820,7 @@ static int smack_file_permission(struct file *file, int mask) | |||
820 | */ | 820 | */ |
821 | static int smack_file_alloc_security(struct file *file) | 821 | static int smack_file_alloc_security(struct file *file) |
822 | { | 822 | { |
823 | file->f_security = current->cred->security; | 823 | file->f_security = current_security(); |
824 | return 0; | 824 | return 0; |
825 | } | 825 | } |
826 | 826 | ||
@@ -918,7 +918,7 @@ static int smack_file_fcntl(struct file *file, unsigned int cmd, | |||
918 | */ | 918 | */ |
919 | static int smack_file_set_fowner(struct file *file) | 919 | static int smack_file_set_fowner(struct file *file) |
920 | { | 920 | { |
921 | file->f_security = current->cred->security; | 921 | file->f_security = current_security(); |
922 | return 0; | 922 | return 0; |
923 | } | 923 | } |
924 | 924 | ||
@@ -986,8 +986,7 @@ static int smack_file_receive(struct file *file) | |||
986 | */ | 986 | */ |
987 | static int smack_cred_alloc_security(struct cred *cred) | 987 | static int smack_cred_alloc_security(struct cred *cred) |
988 | { | 988 | { |
989 | cred->security = current->cred->security; | 989 | cred->security = current_security(); |
990 | |||
991 | return 0; | 990 | return 0; |
992 | } | 991 | } |
993 | 992 | ||
@@ -1225,7 +1224,7 @@ static void smack_task_to_inode(struct task_struct *p, struct inode *inode) | |||
1225 | */ | 1224 | */ |
1226 | static int smack_sk_alloc_security(struct sock *sk, int family, gfp_t gfp_flags) | 1225 | static int smack_sk_alloc_security(struct sock *sk, int family, gfp_t gfp_flags) |
1227 | { | 1226 | { |
1228 | char *csp = current->cred->security; | 1227 | char *csp = current_security(); |
1229 | struct socket_smack *ssp; | 1228 | struct socket_smack *ssp; |
1230 | 1229 | ||
1231 | ssp = kzalloc(sizeof(struct socket_smack), gfp_flags); | 1230 | ssp = kzalloc(sizeof(struct socket_smack), gfp_flags); |
@@ -1450,7 +1449,7 @@ static int smack_flags_to_may(int flags) | |||
1450 | */ | 1449 | */ |
1451 | static int smack_msg_msg_alloc_security(struct msg_msg *msg) | 1450 | static int smack_msg_msg_alloc_security(struct msg_msg *msg) |
1452 | { | 1451 | { |
1453 | msg->security = current->cred->security; | 1452 | msg->security = current_security(); |
1454 | return 0; | 1453 | return 0; |
1455 | } | 1454 | } |
1456 | 1455 | ||
@@ -1486,7 +1485,7 @@ static int smack_shm_alloc_security(struct shmid_kernel *shp) | |||
1486 | { | 1485 | { |
1487 | struct kern_ipc_perm *isp = &shp->shm_perm; | 1486 | struct kern_ipc_perm *isp = &shp->shm_perm; |
1488 | 1487 | ||
1489 | isp->security = current->cred->security; | 1488 | isp->security = current_security(); |
1490 | return 0; | 1489 | return 0; |
1491 | } | 1490 | } |
1492 | 1491 | ||
@@ -1595,7 +1594,7 @@ static int smack_sem_alloc_security(struct sem_array *sma) | |||
1595 | { | 1594 | { |
1596 | struct kern_ipc_perm *isp = &sma->sem_perm; | 1595 | struct kern_ipc_perm *isp = &sma->sem_perm; |
1597 | 1596 | ||
1598 | isp->security = current->cred->security; | 1597 | isp->security = current_security(); |
1599 | return 0; | 1598 | return 0; |
1600 | } | 1599 | } |
1601 | 1600 | ||
@@ -1699,7 +1698,7 @@ static int smack_msg_queue_alloc_security(struct msg_queue *msq) | |||
1699 | { | 1698 | { |
1700 | struct kern_ipc_perm *kisp = &msq->q_perm; | 1699 | struct kern_ipc_perm *kisp = &msq->q_perm; |
1701 | 1700 | ||
1702 | kisp->security = current->cred->security; | 1701 | kisp->security = current_security(); |
1703 | return 0; | 1702 | return 0; |
1704 | } | 1703 | } |
1705 | 1704 | ||
@@ -1854,7 +1853,7 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode) | |||
1854 | struct super_block *sbp; | 1853 | struct super_block *sbp; |
1855 | struct superblock_smack *sbsp; | 1854 | struct superblock_smack *sbsp; |
1856 | struct inode_smack *isp; | 1855 | struct inode_smack *isp; |
1857 | char *csp = current->cred->security; | 1856 | char *csp = current_security(); |
1858 | char *fetched; | 1857 | char *fetched; |
1859 | char *final; | 1858 | char *final; |
1860 | struct dentry *dp; | 1859 | struct dentry *dp; |
@@ -2290,8 +2289,7 @@ static void smack_sock_graft(struct sock *sk, struct socket *parent) | |||
2290 | return; | 2289 | return; |
2291 | 2290 | ||
2292 | ssp = sk->sk_security; | 2291 | ssp = sk->sk_security; |
2293 | ssp->smk_in = current->cred->security; | 2292 | ssp->smk_in = ssp->smk_out = current_security(); |
2294 | ssp->smk_out = current->cred->security; | ||
2295 | ssp->smk_packet[0] = '\0'; | 2293 | ssp->smk_packet[0] = '\0'; |
2296 | 2294 | ||
2297 | rc = smack_netlabel(sk); | 2295 | rc = smack_netlabel(sk); |