user-runtime-dir: fix selinux regression
authorAlan Jenkins <alan.christopher.jenkins@gmail.com>
Mon, 3 Sep 2018 10:10:24 +0000 (11:10 +0100)
committerPeter Michael Green <plugwash@raspbian.org>
Thu, 20 Sep 2018 22:47:19 +0000 (23:47 +0100)
Fix #9993.  When this code was split out to user-runtime-dir, it forgot to
include the call to mac_selinux_init().  So mkdir_label() stopped working.

Fixes: a9f0f5e50104 ("logind: split %t directory creation to a helper
unit")

(cherry picked from commit 81375d802672f34205bef9f301c58854af5fc568)

Gbp-Pq: Name user-runtime-dir-fix-selinux-regression.patch

src/login/user-runtime-dir.c

index 1bb26c99e483253ff8c97e670138d92144a61f38..790de0e2498e4c89c29d2c8cbb8959b0e7454511 100644 (file)
@@ -10,6 +10,7 @@
 #include "mount-util.h"
 #include "path-util.h"
 #include "rm-rf.h"
+#include "selinux-util.h"
 #include "smack-util.h"
 #include "stdio-util.h"
 #include "string-util.h"
@@ -144,6 +145,12 @@ int main(int argc, char *argv[]) {
                 return EXIT_FAILURE;
         }
 
+        r = mac_selinux_init();
+        if (r < 0) {
+                log_error_errno(r, "Could not initialize labelling: %m\n");
+                return EXIT_FAILURE;
+        }
+
         umask(0022);
 
         user = argv[2];