fix wrong behavior of pkg_getsize 55/91655/1 accepted/tizen/common/20161011.061126 accepted/tizen/ivi/20161011.234023 accepted/tizen/mobile/20161011.234005 accepted/tizen/tv/20161011.234014 accepted/tizen/wearable/20161011.233941 submit/tizen/20161011.002253
authorjongmyeongko <jongmyeong.ko@samsung.com>
Mon, 10 Oct 2016 14:35:34 +0000 (23:35 +0900)
committerjongmyeongko <jongmyeong.ko@samsung.com>
Mon, 10 Oct 2016 14:35:34 +0000 (23:35 +0900)
- set uid/gid for pkg_getsize

Change-Id: I57c33ae74d33148350520776d34db24bcc5ba6c9
Signed-off-by: jongmyeongko <jongmyeong.ko@samsung.com>
src/pkgmgr-server.c

index 6ef1661..764894a 100644 (file)
@@ -533,6 +533,18 @@ int set_environement(user_ctx *ctx)
        if (!ctx)
                return -1;
 
+       if (ctx->uid != APPFW_UID) {
+               if (setuid(ctx->uid)) {
+                       ERR("setuid failed: %d", errno);
+                       return -1;
+               }
+
+               if (setgid(ctx->gid)) {
+                       ERR("setgid failed: %d", errno);
+                       return -1;
+               }
+       }
+
        n = getgroups(0, NULL);
        if (n < 0) {
                ERR("Failed to get the number of supplementary group IDs");