summaryrefslogtreecommitdiffstats
path: root/include/linux/selinux.h
diff options
context:
space:
mode:
authorJames Morris <jmorris@namei.org>2006-06-09 00:28:25 -0700
committerDavid S. Miller <davem@sunset.davemloft.net>2006-06-17 21:29:55 -0700
commitc749b29fae74ed59c507d84025b3298202b42609 (patch)
treec06b1fb17cce425692f7ab40b2df8c5b00d8c931 /include/linux/selinux.h
parent29a395eac4c320c570e73f0a90d8953d80da8359 (diff)
downloadop-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 'include/linux/selinux.h')
-rw-r--r--include/linux/selinux.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/include/linux/selinux.h b/include/linux/selinux.h
index 4047bcd..aad4e39 100644
--- a/include/linux/selinux.h
+++ b/include/linux/selinux.h
@@ -118,6 +118,27 @@ void selinux_get_ipc_sid(const struct kern_ipc_perm *ipcp, u32 *sid);
*/
void selinux_get_task_sid(struct task_struct *tsk, u32 *sid);
+/**
+ * selinux_string_to_sid - map a security context string to a security ID
+ * @str: the security context string to be mapped
+ * @sid: ID value returned via this.
+ *
+ * Returns 0 if successful, with the SID stored in sid. A value
+ * of zero for sid indicates no SID could be determined (but no error
+ * occurred).
+ */
+int selinux_string_to_sid(char *str, u32 *sid);
+
+/**
+ * selinux_relabel_packet_permission - check permission to relabel a packet
+ * @sid: ID value to be applied to network packet (via SECMARK, most likely)
+ *
+ * Returns 0 if the current task is allowed to label packets with the
+ * supplied security ID. Note that it is implicit that the packet is always
+ * being relabeled from the default unlabled value, and that the access
+ * control decision is made in the AVC.
+ */
+int selinux_relabel_packet_permission(u32 sid);
#else
@@ -172,6 +193,17 @@ static inline void selinux_get_task_sid(struct task_struct *tsk, u32 *sid)
*sid = 0;
}
+static inline int selinux_string_to_sid(const char *str, u32 *sid)
+{
+ *sid = 0;
+ return 0;
+}
+
+static inline int selinux_relabel_packet_permission(u32 sid)
+{
+ return 0;
+}
+
#endif /* CONFIG_SECURITY_SELINUX */
#endif /* _LINUX_SELINUX_H */
OpenPOWER on IntegriCloud