logind: change smack label /run/user/%UID/system_share to "*"
authorINSUN PYO <insun.pyo@samsung.com>
Wed, 7 Mar 2018 07:40:53 +0000 (16:40 +0900)
committerŁukasz Stelmach <l.stelmach@samsung.com>
Mon, 12 Feb 2024 15:37:43 +0000 (16:37 +0100)
src/login/logind-user.c

index 15d0fed..d4b6e05 100644 (file)
@@ -21,6 +21,7 @@
 #include <string.h>
 #include <sys/mount.h>
 #include <unistd.h>
+#include <sys/xattr.h>
 
 #include "alloc-util.h"
 #include "bus-common-errors.h"
@@ -351,6 +352,12 @@ static int user_mkdir_system_share_path(User *u) {
         if (r < 0)
                 return log_error_errno(r, "Failed to create '%s': %m", t);
 
+        if (mac_smack_use()) {
+                r = lsetxattr(t, "security.SMACK64", SMACK_STAR_LABEL, strlen(SMACK_STAR_LABEL), 0);
+                if (r < 0)
+                        return log_error_errno(r, "Failed to apply smack label * to '%s': %m", t);
+        }
+
         return 0;
 }