Merge to Fedora kernel-2.6.18-1.2224_FC5 patched with stable patch-2.6.18.1-vs2.0...
[linux-2.6.git] / security / selinux / exports.c
index ae4c73e..9d7737d 100644 (file)
@@ -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);