chiark / gitweb /
selinux: retest selinux after we loaded the policy
authorLennart Poettering <lennart@poettering.net>
Mon, 29 Aug 2011 21:36:10 +0000 (23:36 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 29 Aug 2011 21:36:10 +0000 (23:36 +0200)
src/label.c
src/label.h
src/selinux-setup.c

index a5994622c70ecef5e7ef03efb5e78503348a6151..fb9a1b426210c473385bba4e0f62daa6f90c943b 100644 (file)
@@ -33,8 +33,9 @@
 
 static struct selabel_handle *label_hnd = NULL;
 
+static int use_selinux_cached = -1;
+
 static inline bool use_selinux(void) {
-        static int use_selinux_cached = -1;
 
         if (use_selinux_cached < 0)
                 use_selinux_cached = is_selinux_enabled() > 0;
@@ -42,6 +43,10 @@ static inline bool use_selinux(void) {
         return use_selinux_cached;
 }
 
+void label_retest_selinux(void) {
+        use_selinux_cached = -1;
+}
+
 #endif
 
 int label_init(void) {
index 321d21f650ec36bf901a7f951fe9c947aae1b8a1..6e48efaa0755aef129eb9e01d00949e8daeb28c5 100644 (file)
@@ -43,4 +43,6 @@ int label_get_create_label_from_exe(const char *exe, char **label);
 
 int label_mkdir(const char *path, mode_t mode);
 
+void label_retest_selinux(void);
+
 #endif
index dc101b13bae1d5efc24c1a21c14606072502142c..2abd99e6a26bd2593bce7e179ee677096b161047 100644 (file)
@@ -73,6 +73,8 @@ int selinux_setup(bool *loaded_policy) {
                char timespan[FORMAT_TIMESPAN_MAX];
                char *label;
 
+               label_retest_selinux();
+
                /* Transition to the new context */
                r = label_get_create_label_from_exe(SYSTEMD_BINARY_PATH, &label);
                if (r < 0 || label == NULL) {