]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - security/selinux/exports.c
CRED: Separate task security context from task_struct
[net-next-2.6.git] / security / selinux / exports.c
index 87d2bb3ea35574596536a9b67305f8f625042dea..cf02490cd1ebff3b59dd4aec63f7042ced8804f4 100644 (file)
 /* SECMARK reference count */
 extern atomic_t selinux_secmark_refcount;
 
-int selinux_sid_to_string(u32 sid, char **ctx, u32 *ctxlen)
-{
-       if (selinux_enabled)
-               return security_sid_to_context(sid, ctx, ctxlen);
-       else {
-               *ctx = NULL;
-               *ctxlen = 0;
-       }
-
-       return 0;
-}
-
-void selinux_get_inode_sid(const struct inode *inode, u32 *sid)
-{
-       if (selinux_enabled) {
-               struct inode_security_struct *isec = inode->i_security;
-               *sid = isec->sid;
-               return;
-       }
-       *sid = 0;
-}
-
-void selinux_get_ipc_sid(const struct kern_ipc_perm *ipcp, u32 *sid)
-{
-       if (selinux_enabled) {
-               struct ipc_security_struct *isec = ipcp->security;
-               *sid = isec->sid;
-               return;
-       }
-       *sid = 0;
-}
-
-void selinux_get_task_sid(struct task_struct *tsk, u32 *sid)
-{
-       if (selinux_enabled) {
-               struct task_security_struct *tsec = tsk->security;
-               *sid = tsec->sid;
-               return;
-       }
-       *sid = 0;
-}
-
 int selinux_string_to_sid(char *str, u32 *sid)
 {
        if (selinux_enabled)
@@ -81,7 +39,7 @@ EXPORT_SYMBOL_GPL(selinux_string_to_sid);
 int selinux_secmark_relabel_packet_permission(u32 sid)
 {
        if (selinux_enabled) {
-               struct task_security_struct *tsec = current->security;
+               struct task_security_struct *tsec = current->cred->security;
 
                return avc_has_perm(tsec->sid, sid, SECCLASS_PACKET,
                                    PACKET__RELABELTO, NULL);