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 | |
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')
-rw-r--r-- | security/smack/smack_access.c | 2 | ||||
-rw-r--r-- | security/smack/smack_lsm.c | 26 | ||||
-rw-r--r-- | security/smack/smackfs.c | 4 |
3 files changed, 15 insertions, 17 deletions
diff --git a/security/smack/smack_access.c b/security/smack/smack_access.c index b6dd4fc0fb0b..247cec3b5a43 100644 --- a/security/smack/smack_access.c +++ b/security/smack/smack_access.c | |||
@@ -164,7 +164,7 @@ int smk_curacc(char *obj_label, u32 mode) | |||
164 | { | 164 | { |
165 | int rc; | 165 | int rc; |
166 | 166 | ||
167 | rc = smk_access(current->cred->security, obj_label, mode); | 167 | rc = smk_access(current_security(), obj_label, mode); |
168 | if (rc == 0) | 168 | if (rc == 0) |
169 | return 0; | 169 | return 0; |
170 | 170 | ||
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); |
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c index c5ca279e0506..ca257dfdc75d 100644 --- a/security/smack/smackfs.c +++ b/security/smack/smackfs.c | |||
@@ -336,7 +336,7 @@ static void smk_cipso_doi(void) | |||
336 | 336 | ||
337 | audit_info.loginuid = audit_get_loginuid(current); | 337 | audit_info.loginuid = audit_get_loginuid(current); |
338 | audit_info.sessionid = audit_get_sessionid(current); | 338 | audit_info.sessionid = audit_get_sessionid(current); |
339 | audit_info.secid = smack_to_secid(current->cred->security); | 339 | audit_info.secid = smack_to_secid(current_security()); |
340 | 340 | ||
341 | rc = netlbl_cfg_map_del(NULL, &audit_info); | 341 | rc = netlbl_cfg_map_del(NULL, &audit_info); |
342 | if (rc != 0) | 342 | if (rc != 0) |
@@ -371,7 +371,7 @@ static void smk_unlbl_ambient(char *oldambient) | |||
371 | 371 | ||
372 | audit_info.loginuid = audit_get_loginuid(current); | 372 | audit_info.loginuid = audit_get_loginuid(current); |
373 | audit_info.sessionid = audit_get_sessionid(current); | 373 | audit_info.sessionid = audit_get_sessionid(current); |
374 | audit_info.secid = smack_to_secid(current->cred->security); | 374 | audit_info.secid = smack_to_secid(current_security()); |
375 | 375 | ||
376 | if (oldambient != NULL) { | 376 | if (oldambient != NULL) { |
377 | rc = netlbl_cfg_map_del(oldambient, &audit_info); | 377 | rc = netlbl_cfg_map_del(oldambient, &audit_info); |