User Session Helper : Enable slave propagation 08/86508/1 submit/tizen/20160902.065241
authorKunhoon Baik <knhoon.baik@samsung.com>
Thu, 1 Sep 2016 13:03:33 +0000 (22:03 +0900)
committerKunhoon Baik <knhoon.baik@samsung.com>
Thu, 1 Sep 2016 13:03:33 +0000 (22:03 +0900)
Change-Id: I685442f33f6d6cedfd919b50a79723c1dceb107c

packaging/system-plugin.spec
src/systemd-user-helper/systemd-user-helper.c

index 3b7b4ae32ba2190c1a24dfade00009b04b9366cc..858d29518dd2d2f890fedd6dfacc03aed5418b70 100644 (file)
@@ -302,7 +302,7 @@ mv %{_sysconfdir}/fstab_lazymnt %{_sysconfdir}/fstab
 
 %files -n systemd-user-helper
 %manifest systemd-user-helper.manifest
-%caps(cap_sys_admin,cap_mac_admin,cap_setgid=ei) %{_bindir}/systemd_user_helper
+%caps(cap_sys_admin,cap_mac_admin,cap_mac_override,cap_dac_override,cap_setgid=ei) %{_bindir}/systemd_user_helper
 
 %posttrans -n systemd-user-helper
 cp -a /usr/lib/systemd/system/user\@.service /usr/lib/systemd/system/__user@.service
index 729179223b7e625b0b0788578f969c28bba3adfd..f6911d6568ac9c3120cfcb16ee89b4ea0e618a7b 100644 (file)
@@ -19,6 +19,7 @@
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <errno.h>
 
 #include <sched.h>
 #include <sys/mount.h>
@@ -27,7 +28,7 @@
 
 #define LEGACY_CONTENTS_DIR "/opt/usr/media"
 
-#define LAZYMOUNT_LIB "/usr/lib/liblazymount.so"
+#define LAZYMOUNT_LIB "/usr/lib/liblazymount.so.0"
 #define CONTAINER_LIB "/usr/lib/security/pam_krate.so"
 
 #define LOAD_SYMBOL(handle, sym, name) \
@@ -49,6 +50,13 @@ static int normal_user_preprocess(char *username)
                fprintf(stderr,"unshare failed\n");
                return r;
        }
+
+       r = mount(NULL, "/", NULL, MS_SLAVE | MS_REC, NULL);
+       if (r < 0) {
+               fprintf(stderr,"Failed to change the propagation type of root to SLAVE\n");
+               return r;
+       }
+
        return 0;
 }
 
@@ -58,7 +66,7 @@ static int normal_user_postprocess(char *username)
        r = mount(tzplatform_getenv(TZ_USER_CONTENT),
                        LEGACY_CONTENTS_DIR, NULL, MS_BIND, NULL);
        if (r < 0) {
-               fprintf(stderr, "user content bind mount failed\n");
+               fprintf(stderr, "user content bind mount failed - %d\n",errno);
                return r;
        }
        return 0;
@@ -125,8 +133,10 @@ static int wait_condition(void)
        int (*wait_mount_user)(void);
 
        r = access(LAZYMOUNT_LIB,F_OK);
-       if (r < 0)
+       if (r < 0){
+               fprintf(stderr, "cannot find lazymount module - No support lazymount\n");
                return 0;
+       }
 
        h = dlopen(LAZYMOUNT_LIB, RTLD_LAZY);
        if (!h) {
@@ -141,6 +151,7 @@ static int wait_condition(void)
                fprintf(stderr, "wait_mout_user failed\n");
                return r;
        }
+
        return 0;
 }