aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux
diff options
context:
space:
mode:
Diffstat (limited to 'security/selinux')
-rw-r--r--security/selinux/exports.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/security/selinux/exports.c b/security/selinux/exports.c
index 333c4c7824d8..07ddce7bf374 100644
--- a/security/selinux/exports.c
+++ b/security/selinux/exports.c
@@ -14,6 +14,7 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/selinux.h> 16#include <linux/selinux.h>
17#include <linux/fs.h>
17 18
18#include "security.h" 19#include "security.h"
19#include "objsec.h" 20#include "objsec.h"
@@ -26,3 +27,26 @@ void selinux_task_ctxid(struct task_struct *tsk, u32 *ctxid)
26 else 27 else
27 *ctxid = 0; 28 *ctxid = 0;
28} 29}
30
31int selinux_ctxid_to_string(u32 ctxid, char **ctx, u32 *ctxlen)
32{
33 if (selinux_enabled)
34 return security_sid_to_context(ctxid, ctx, ctxlen);
35 else {
36 *ctx = NULL;
37 *ctxlen = 0;
38 }
39
40 return 0;
41}
42
43void selinux_get_inode_sid(const struct inode *inode, u32 *sid)
44{
45 if (selinux_enabled) {
46 struct inode_security_struct *isec = inode->i_security;
47 *sid = isec->sid;
48 return;
49 }
50 *sid = 0;
51}
52