Revert "setPermissions should succeed when called with empty permissions & no permiss... 34/150534/1
authorDong Sun Lee <ds73.lee@samsung.com>
Mon, 18 Sep 2017 00:07:07 +0000 (00:07 +0000)
committerDong Sun Lee <ds73.lee@samsung.com>
Mon, 18 Sep 2017 00:07:07 +0000 (00:07 +0000)
This reverts commit 83ef2aa9939319fc25537036dde2c651ca4c935f.

This should be applied since tizen 4.0

Change-Id: I1eb2aa2d32a93762e2521870815ff5d84873e532

src/manager/service/ckm-logic.cpp

index 5f13444..36f2ea7 100644 (file)
@@ -1794,6 +1794,12 @@ int CKMLogic::setPermissionHelper(
        if (!handler.database.isNameLabelPresent(name, ownerLabel))
                return CKM_API_ERROR_DB_ALIAS_UNKNOWN;
 
+       // removing non-existing permissions: fail
+       if (permissionMask == Permission::NONE) {
+               if (!handler.database.getPermissionRow(name, ownerLabel, accessorLabel))
+                       return CKM_API_ERROR_INPUT_PARAM;
+       }
+
        // set permissions to the row owned by ownerLabel for accessorLabel
        handler.database.setPermission(name, ownerLabel, accessorLabel, permissionMask);
        transaction.commit();