chiark / gitweb /
smack: set loaded_policy in smack_setup()
authorŁukasz Stelmach <l.stelmach@samsung.com>
Thu, 19 Dec 2013 14:15:54 +0000 (15:15 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 24 Feb 2014 16:36:13 +0000 (17:36 +0100)
With loaded_policy set to true mount_setup() relabels /dev properly.

src/core/main.c
src/core/smack-setup.c
src/core/smack-setup.h

index 086e283dc63de4761b48680e4d1454acf717bb96..4e24f851e264f91a943b13a8b6d04ee2656325d1 100644 (file)
@@ -1310,7 +1310,7 @@ int main(int argc, char *argv[]) {
                                 goto finish;
                         if (ima_setup() < 0)
                                 goto finish;
                                 goto finish;
                         if (ima_setup() < 0)
                                 goto finish;
-                        if (smack_setup() < 0)
+                        if (smack_setup(&loaded_policy) < 0)
                                 goto finish;
                         dual_timestamp_get(&security_finish_timestamp);
                 }
                                 goto finish;
                         dual_timestamp_get(&security_finish_timestamp);
                 }
index 611bfdb2df155b20e51bf84ff95a478246c50ec9..a68605c27216407a49e45a8d007bda77af5c9372 100644 (file)
@@ -116,12 +116,14 @@ static int write_rules(const char* dstpath, const char* srcdir) {
 
 #endif
 
 
 #endif
 
-int smack_setup(void) {
+int smack_setup(bool *loaded_policy) {
 
 #ifdef HAVE_SMACK
 
         int r;
 
 
 #ifdef HAVE_SMACK
 
         int r;
 
+        assert(loaded_policy);
+
         r = write_rules("/sys/fs/smackfs/load2", SMACK_CONFIG);
         switch(r) {
         case -ENOENT:
         r = write_rules("/sys/fs/smackfs/load2", SMACK_CONFIG);
         switch(r) {
         case -ENOENT:
@@ -163,6 +165,8 @@ int smack_setup(void) {
                 return 0;
         }
 
                 return 0;
         }
 
+        *loaded_policy = true;
+
 #endif
 
         return 0;
 #endif
 
         return 0;
index ffe91843c335bc17dee644fccbe79a8ee3243602..892709669b826e45944763a18fbb45a52a27b455 100644 (file)
@@ -23,4 +23,4 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-int smack_setup(void);
+int smack_setup(bool *loaded_policy);