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 086e283..4e24f85 100644 (file)
@@ -1310,7 +1310,7 @@ int main(int argc, char *argv[]) {
                                 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);
                 }
index 611bfdb..a68605c 100644 (file)
@@ -116,12 +116,14 @@ static int write_rules(const char* dstpath, const char* srcdir) {
 
 #endif
 
-int smack_setup(void) {
+int smack_setup(bool *loaded_policy) {
 
 #ifdef HAVE_SMACK
 
         int r;
 
+        assert(loaded_policy);
+
         r = write_rules("/sys/fs/smackfs/load2", SMACK_CONFIG);
         switch(r) {
         case -ENOENT:
@@ -163,6 +165,8 @@ int smack_setup(void) {
                 return 0;
         }
 
+        *loaded_policy = true;
+
 #endif
 
         return 0;
index ffe9184..8927096 100644 (file)
@@ -23,4 +23,4 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-int smack_setup(void);
+int smack_setup(bool *loaded_policy);