<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>RHEL 6.5<BR>&nbsp;<BR>I have tried this using a&nbsp;filestran pattern but it doesn't&nbsp;seem to work.<br>&nbsp;<BR><div>&gt; Date: Wed, 25 Mar 2015 09:32:32 +0100<br>&gt; From: mgrepl@redhat.com<br>&gt; To: swazup@hotmail.com; selinux@lists.fedoraproject.org<br>&gt; Subject: Re: How do I create a directory in C that will follow selinux file context rules?<br>&gt; <br>&gt; On 03/24/2015 10:45 PM, Jayson Hurst wrote:<br>&gt; &gt; I need to create a directory in a C binary.<br>&gt; &gt;  <br>&gt; &gt; I am currently doing something similar to this:<br>&gt; &gt;  <br>&gt; &gt;  <br>&gt; &gt; <br>&gt; &gt; status = mkdir("/home/cnd/mod1", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);<br>&gt; &gt; <br>&gt; &gt;  <br>&gt; &gt; <br>&gt; &gt; But when the directory is created it ends up with the wrong SELinux context. It inherits it's parent's context and <br>&gt; &gt; <br>&gt; &gt; not the one defined in file context.<br>&gt; <br>&gt; What is your OS?<br>&gt; <br>&gt; &gt; <br>&gt; &gt;  <br>&gt; &gt; <br>&gt; &gt; Is there a C call that can be used that understands how to correctly create and label SElinux directories?<br>&gt; &gt; <br>&gt; &gt; <br>&gt; &gt; <br>&gt; &gt; --<br>&gt; &gt; selinux mailing list<br>&gt; &gt; selinux@lists.fedoraproject.org<br>&gt; &gt; https://admin.fedoraproject.org/mailman/listinfo/selinux<br>&gt; &gt; <br>&gt; <br>&gt; <br>&gt; -- <br>&gt; Miroslav Grepl<br>&gt; Software Engineering, SELinux Solutions<br>&gt; Red Hat, Inc.<br></div>                                               </div></body>
</html>