Move mount namespace logic from systemd-user-helper code to systemd service file. 92/183092/1 accepted/tizen/unified/20180726.140749 submit/tizen/20180725.225251
authorINSUN PYO <insun.pyo@samsung.com>
Mon, 2 Jul 2018 07:13:08 +0000 (16:13 +0900)
committerINSUN PYO <insun.pyo@samsung.com>
Mon, 2 Jul 2018 07:14:07 +0000 (16:14 +0900)
Signed-off-by: INSUN PYO <insun.pyo@samsung.com>
Change-Id: Ia0fccee5f243a12de5f902641ccb855e6daa7909

src/systemd-user-helper/systemd-user-helper.c
units/session-utils.conf

index 60dc3e17be7282d2e9fbd9a000dd0fe38c3188fb..f3686e09de0164c3bb6e27e0f67de5130bb340db 100644 (file)
@@ -74,16 +74,6 @@ static const char *systemd_arg[] = {
        NULL
 };
 
-int mac_smack_use(void)
-{
-       static int cached_use = -1;
-
-       if (cached_use < 0)
-               cached_use = access("/sys/fs/smackfs/", F_OK) >= 0;
-
-       return cached_use;
-}
-
 static int stop_process(char *username)
 {
        int r;
@@ -100,25 +90,6 @@ static int stop_process(char *username)
        return 0;
 }
 
-static int normal_user_preprocess(char *username)
-{
-       int r;
-
-       r = unshare(CLONE_NEWNS);
-       if (r < 0) {
-               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;
-}
-
 static int normal_user_postprocess(char *username)
 {
        int r;
@@ -321,13 +292,6 @@ int main(int argc, char *argv[])
                return -2;
        }
 
-       /* pre-processing */
-       r = normal_user_preprocess(username);
-       if (r < 0) {
-               fprintf(stderr, "normal user preprocess failed\n");
-               return r;
-       }
-
        /* If container supports below funcs, below line should be enabled. */
        support_container = (access(CONTAINER_LIB, F_OK) == 0) ? 1 : 0;
        if (support_container) {
index 1abc8378cc9afc0fdfbca03b384de08f0c69fcc8..291ef1be7103ad448d0cdb3e15712d7443128279 100644 (file)
@@ -6,3 +6,5 @@ ExecStart=/usr/bin/systemd-user-helper start %i
 ExecStop=/usr/bin/systemd-user-helper stop %i
 
 PIDFile=/run/user/%i/.systemd.pid
+
+MountFlags=slave