diff options
author | James Morris <jmorris@namei.org> | 2006-06-09 00:28:25 -0700 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-06-17 21:29:55 -0700 |
commit | c749b29fae74ed59c507d84025b3298202b42609 (patch) | |
tree | c06b1fb17cce425692f7ab40b2df8c5b00d8c931 /security | |
parent | 29a395eac4c320c570e73f0a90d8953d80da8359 (diff) | |
download | op-kernel-dev-c749b29fae74ed59c507d84025b3298202b42609.zip op-kernel-dev-c749b29fae74ed59c507d84025b3298202b42609.tar.gz |
[SECMARK]: Add SELinux exports
Add and export new functions to the in-kernel SELinux API in support of the
new secmark-based packet controls.
Signed-off-by: James Morris <jmorris@namei.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'security')
-rw-r--r-- | security/selinux/exports.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/security/selinux/exports.c b/security/selinux/exports.c index ae4c73e..9d7737d 100644 --- a/security/selinux/exports.c +++ b/security/selinux/exports.c @@ -72,3 +72,25 @@ void selinux_get_task_sid(struct task_struct *tsk, u32 *sid) *sid = 0; } +int selinux_string_to_sid(char *str, u32 *sid) +{ + if (selinux_enabled) + return security_context_to_sid(str, strlen(str), sid); + else { + *sid = 0; + return 0; + } +} +EXPORT_SYMBOL_GPL(selinux_string_to_sid); + +int selinux_relabel_packet_permission(u32 sid) +{ + if (selinux_enabled) { + struct task_security_struct *tsec = current->security; + + return avc_has_perm(tsec->sid, sid, SECCLASS_PACKET, + PACKET__RELABELTO, NULL); + } + return 0; +} +EXPORT_SYMBOL_GPL(selinux_relabel_packet_permission); |