@@ -24,12 +24,19 @@ struct kern_ipc_perm;
* selinux_is_enabled - is SELinux enabled?
*/
bool selinux_is_enabled(void);
+int security_current_sid_to_context(char **scontext, u32 *scontext_len);
#else
static inline bool selinux_is_enabled(void)
{
return false;
}
+
+static inline int
+security_current_sid_to_context(char **scontext, u32 *scontext_len)
+{
+ return -EINVAL;
+}
#endif /* CONFIG_SECURITY_SELINUX */
#endif /* _LINUX_SELINUX_H */
@@ -6492,3 +6492,17 @@ int selinux_disable(void)
return 0;
}
#endif
+
+/**
+ * RPCSEC_GSS Version 3 Full Mode labeling needs this interface
+ * or one like it.
+ */
+int security_current_sid_to_context(char **scontext, u32 *scontext_len)
+{
+ const struct task_security_struct *ts = current_security();
+
+ if (!selinux_enabled)
+ return -EINVAL;
+ return security_sid_to_context(ts->sid, scontext, scontext_len);
+}
+EXPORT_SYMBOL_GPL(security_current_sid_to_context);