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;
}
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;