Change ownership of downloaded file to client's uid 95/267095/1 accepted/tizen/unified/20211129.035311 submit/tizen/20211126.065740
authorSeonah Moon <seonah1.moon@samsung.com>
Thu, 25 Nov 2021 08:47:55 +0000 (17:47 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Thu, 25 Nov 2021 08:49:46 +0000 (17:49 +0900)
Increase version to 2.3.0 for Tizen 7.0

Change-Id: Ib4c79ee3b20404546a0e459d8964635f143de755

packaging/download-provider.spec
provider/download-provider-plugin-download-agent.c

index 4bdd3df..6ffefad 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       download-provider
 Summary:    Download the contents in background
-Version:    2.2.7
+Version:    2.3.0
 Release:    0
 Group:      Development/Libraries
 License:    Apache-2.0
index 76796f3..521921f 100755 (executable)
@@ -229,19 +229,16 @@ static int __set_file_permission_to_client(dp_client_slots_fmt *slot, dp_request
                return DP_ERROR_IO_ERROR;
        }
 
-       // Don't need to change the owner and group of a file.
-       if (strncmp(saved_path, "/opt/media/", 11) != 0) {
-               close(fd);
-               return DP_ERROR_NONE;
-       }
-
-       if (fchown(fd, cred.uid, cred.gid) != 0) {
+       // Change the owner to client's uid.
+       if (fchown(fd, cred.uid, lstat_info.st_gid) != 0) {
                TRACE_ERROR("[ERROR][%d] permission user:%d group:%d",
                                request->id, cred.uid, cred.gid);
                close(fd);
                return DP_ERROR_PERMISSION_DENIED;
        }
 
+       TRACE_INFO("file owner has been changed to %d.", cred.uid);
+
        close(fd);
        return DP_ERROR_NONE;
 }
@@ -285,8 +282,7 @@ static void __finished_cb(finished_info_t *info, void *user_req_data,
        TRACE_SECURE_DEBUG("[FINISH][%d][%s]", request->id, info->saved_path);
        if (info->err == DA_RESULT_OK) {
                if (info->saved_path != NULL) {
-                       if (strncmp(DP_SDCARD_MNT_POINT, info->saved_path, strlen(DP_SDCARD_MNT_POINT)) != 0)
-                               errorcode = __set_file_permission_to_client(slot, request, info->saved_path);
+                       errorcode = __set_file_permission_to_client(slot, request, info->saved_path);
                } else {
                        TRACE_ERROR("[ERROR][%d] No SavedPath", request->id);
                        errorcode = DP_ERROR_INVALID_DESTINATION;