summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKunhoon Baik <knhoon.baik@samsung.com>2016-09-01 22:03:33 +0900
committerKunhoon Baik <knhoon.baik@samsung.com>2016-09-01 22:03:33 +0900
commit412b82d9b3869bba6686146fe849bc953c38a067 (patch)
tree27106e286bb4cb7999c1f4233083ea08de0063b7
parent9c075e855a52be97209ec9088ea34f13166bf744 (diff)
downloadsystem-plugin-412b82d9b3869bba6686146fe849bc953c38a067.tar.gz
system-plugin-412b82d9b3869bba6686146fe849bc953c38a067.tar.bz2
system-plugin-412b82d9b3869bba6686146fe849bc953c38a067.zip
User Session Helper : Enable slave propagationsubmit/tizen/20160902.065241
Change-Id: I685442f33f6d6cedfd919b50a79723c1dceb107c
-rw-r--r--packaging/system-plugin.spec2
-rw-r--r--src/systemd-user-helper/systemd-user-helper.c17
2 files changed, 15 insertions, 4 deletions
diff --git a/packaging/system-plugin.spec b/packaging/system-plugin.spec
index 3b7b4ae..858d295 100644
--- a/packaging/system-plugin.spec
+++ b/packaging/system-plugin.spec
@@ -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
diff --git a/src/systemd-user-helper/systemd-user-helper.c b/src/systemd-user-helper/systemd-user-helper.c
index 7291792..f6911d6 100644
--- a/src/systemd-user-helper/systemd-user-helper.c
+++ b/src/systemd-user-helper/systemd-user-helper.c
@@ -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;
}