user_ext: move user_ext to system-plugin-feature-user_ext 71/171071/1 accepted/tizen/unified/20180411.065624 submit/tizen/20180411.035808
authorINSUN PYO <insun.pyo@samsung.com>
Mon, 26 Feb 2018 08:20:15 +0000 (17:20 +0900)
committerINSUN PYO <insun.pyo@samsung.com>
Mon, 26 Feb 2018 08:20:32 +0000 (17:20 +0900)
Signed-off-by: INSUN PYO <insun.pyo@samsung.com>
Change-Id: Id1b25994ccfd8c779d27f78f390850e28cffa0e2

src/systemd-user-helper/systemd-user-helper.c

index 05b9db6757f6cac1a507e67ab4d7d3057b16000e..60dc3e17be7282d2e9fbd9a000dd0fe38c3188fb 100644 (file)
@@ -84,89 +84,10 @@ int mac_smack_use(void)
        return cached_use;
 }
 
-static int mount_user_ext(char *username)
-{
-       char *mount_point = NULL;
-       char *mount_option = NULL;
-       uid_t mnt_uid;
-       gid_t mnt_gid;
-       struct group *p_grp = NULL, grp_buf;
-       char buf[MAX_GRP_BUF_SIZE];
-       int r;
-
-       mnt_uid = atoi(username);
-       if (mnt_uid <= 0)
-               return -1;
-
-       r = asprintf(&mount_point, "/run/user_ext/%s", username);
-       if (r < 0) {
-               fprintf(stderr, "Failed to set mount point for user_ext\n");
-               return r;
-       }
-
-       (void) mkdir(mount_point, 0750);
-
-       r = getgrnam_r(GRP_NAME_SYSTEM_SHARE, &grp_buf, buf, sizeof(buf), &p_grp);
-       if (r == 0 && p_grp != NULL) {
-               mnt_gid = p_grp->gr_gid;
-       } else {
-               free(mount_point);
-               return -2;
-       }
-
-       if (mac_smack_use())
-               r = asprintf(&mount_option, "mode=0750,smackfsroot=*,uid=%d,gid=%d,size=%s", mnt_uid, mnt_gid, MOUNT_SIZE);
-       else
-               r = asprintf(&mount_option, "mode=0750,uid=%d,gid=%d,size=%s", mnt_uid, mnt_gid, MOUNT_SIZE);
-
-       if (r < 0) {
-               fprintf(stderr, "Failed to set mount option for user_ext\n");
-               free(mount_point);
-               return r;
-       }
-
-       r = mount("tmpfs", mount_point, "tmpfs", MS_NODEV|MS_NOSUID|MS_NOEXEC, mount_option);
-       free(mount_point);
-       free(mount_option);
-
-       if (r < 0) {
-               fprintf(stderr, "Failed to mount user_ext\n");
-               return r;
-       }
-       return 0;
-}
-
-static int umount_user_ext(char *username)
-{
-       int r;
-       char *mount_point = NULL;
-
-       r = asprintf(&mount_point, "/run/user_ext/%s", username);
-       if (r < 0) {
-               fprintf(stderr, "Failed to set mount point for user_ext\n");
-               return r;
-       }
-       r = umount2(mount_point, MNT_DETACH);
-       if (r < 0) {
-               fprintf(stderr, "Failed to umount user_ext\n");
-               free(mount_point);
-               return r;
-       }
-       r = rmdir(mount_point);
-       if (r < 0) {
-               fprintf(stderr, "Failed to rmdir user_ext\n");
-               free(mount_point);
-               return r;
-       }
-       free(mount_point);
-       return 0;
-}
-
 static int stop_process(char *username)
 {
        int r;
 
-       (void)umount_user_ext(username);
        r = umount2(tzplatform_getenv(TZ_USER_CONTENT), MNT_DETACH);
        if (r < 0) {
                fprintf(stderr, "Warning : Failed to umount user content\n");
@@ -400,12 +321,6 @@ int main(int argc, char *argv[])
                return -2;
        }
 
-       r = mount_user_ext(username);
-       if (r < 0) {
-               fprintf(stderr, "mount user_ext failed\n");
-               return r;
-       }
-
        /* pre-processing */
        r = normal_user_preprocess(username);
        if (r < 0) {