From: Yunjin Lee Date: Wed, 22 Feb 2017 07:49:26 +0000 (+0900) Subject: Remove unused definitions and API X-Git-Tag: submit/tizen/20170519.013708~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1e77c771efd90dd1616e72420a6dc651431851d4;p=platform%2Fcore%2Fsecurity%2Fprivilege-checker.git Remove unused definitions and API - remove definition related to api_version length check - remove privilege_info_is_privacy2 (it was temporary support) Change-Id: I4677507b726eb9cf502086fee52307f4e708297a Signed-off-by: Yunjin Lee --- diff --git a/capi/include/privilege_info.h b/capi/include/privilege_info.h index a8dc7ec..3ba9881 100644 --- a/capi/include/privilege_info.h +++ b/capi/include/privilege_info.h @@ -131,14 +131,6 @@ EXPORT_API int privilege_info_is_internal(const char *privilege); */ EXPORT_API int privilege_info_is_privacy(const char *privilege); -/** - * @brief Determines whether the given privilege is privacy related or not.on the basis of whitelist - * @param [in] label The label - * @param [in] privilege The privilege - * @return 1 if true(=is privacy related privilege), 0 if false, and -1 on error - */ -EXPORT_API int privilege_info_is_privacy2(const char *label, const char *privilege); - /** * @brief Determines whether the privacy of given pkgid is user-settable * @param [in] pkgid The package id diff --git a/capi/src/privilege_info.c b/capi/src/privilege_info.c index 33081ee..4ece884 100755 --- a/capi/src/privilege_info.c +++ b/capi/src/privilege_info.c @@ -523,49 +523,6 @@ int privilege_info_is_privacy(const char* privilege) return ret; } -/* TBD: remove it */ -int privilege_info_is_privacy2(const char* label, const char* privilege) -{ - int ret; - - TryReturn(privilege != NULL, , PRVMGR_ERR_INVALID_PARAMETER, "[PRVMGR_ERR_INVALID_PARAMETER] privilege is NULL"); - if (label == NULL) - return privilege_info_is_privacy(privilege); - if (DISABLE_ASKUSER) - return 0; - if (access(ASKUSER_RUNTIME_DISABLE_PATH, F_OK) == 0) { - LOGD("askuser is disabled in run-time."); - return 0; - } - ret = privilege_db_manager_is('p', privilege); - TryReturn(ret >= 0, , -1, "privilege_db_manager_get_privacy_by_privilege failed. ret = %d", ret); - if (ret == 0) { - LOGD("not privacy"); - return 0; - } else { - char *privacy = NULL; - ret = privilege_db_manager_get_privacy_by_privilege(privilege, &privacy); - TryReturn(ret == PRIVILEGE_DB_MANAGER_ERR_NONE && privacy != NULL, , ret, "[DB_FAIL] privilege_db_manager_get_privacy_by_privilege failed. ret = %d", ret); - LOGD("privacy : %s", privacy); - if (!strcmp(privacy, LOCATION_PRIVACY)) { - ret = 1; - } else { - ret = privilege_db_manager_is_preloaded(label); - if (ret == 1) { /* Is preloaded */ - ret = 0; - } else if (ret == 0) { - ret = 1; - } else { - LOGD("privilege_db_manager_is_preloaded failed. ret = %d", ret); - ret = -1; - } - } - free(privacy); - LOGD("final ret = %d", ret); - return ret; - } -} - int privilege_info_is_privacy_white_list_application(const char* pkgid) { if (DISABLE_ASKUSER) @@ -577,7 +534,7 @@ int privilege_info_is_privacy_white_list_application(const char* pkgid) } TryReturn(pkgid != NULL, , PRVMGR_ERR_INVALID_PARAMETER, "[PRVMGR_ERR_INVALID_PARAMETER pkgid is NULL"); int ret = privilege_db_manager_is_privacy_white_list_application(pkgid); - if(ret == 1 || ret == 0) + if (ret == 1 || ret == 0) return ret; return -1; } diff --git a/capi/src/privilege_manager.c b/capi/src/privilege_manager.c index fc7ce6b..4c84b4a 100755 --- a/capi/src/privilege_manager.c +++ b/capi/src/privilege_manager.c @@ -26,10 +26,6 @@ #define MESSAGE_SIZE 512 -#define API_VERSION_PADDING ".0.0" -#define API_VERSION_PADDING_LEN strlen(API_VERSION_PADDING) -#define MAX_API_VERSION_LEN 5 - #define TryReturn(condition, expr, returnValue, ...)\ if (!(condition)) { \ _LOGE(__VA_ARGS__); \ diff --git a/test/tc-privilege-info.c b/test/tc-privilege-info.c index ee94f5a..5b661cb 100755 --- a/test/tc-privilege-info.c +++ b/test/tc-privilege-info.c @@ -495,117 +495,6 @@ static void __test_privilege_info_get_privilege_group_display_name() } -static void __test_privilege_info_is_privacy2() -{ - int ret = 0; - - printf("PRELOADED + NOT LOCATION PRIVACY -> ALLOW (not privacy)\n"); - printf("pkgid: User::Pkg::org.tizen.privacy-setting\n"); - printf("privilege : http://tizen.org/privilege/account.read\n"); - ret = privilege_info_is_privacy2("User::Pkg::org.tizen.privacy-setting", "http://tizen.org/privilege/account.read"); - if (ret == 0) { - success_cnt++; - printf("SUCCESS: http://tizen.org/privilege/account.read is PRIVACY but NOT LOCATION and pkg is PRELOADED\n"); - } else { - fail_cnt++; - printf("Test FAILED. ret = %d\n", ret); - } - __print_line(); - - printf("PRELOADED + LOCATION PRIVACY -> ASK (privacy)\n"); - printf("pkgid: User::Pkg::org.tizen.privacy-setting\n"); - printf("privilege : http://tizen.org/privilege/location.coarse\n"); - ret = privilege_info_is_privacy2("User::Pkg::org.tizen.privacy-setting", "http://tizen.org/privilege/location.coarse"); - if (ret == 1) { - success_cnt++; - printf("SUCCESS: http://tizen.org/privilege/internal/buxton/location is LOCATION PRIVACY and pkg is PRELOADED\n"); - } else { - fail_cnt++; - printf("Test FAILED. ret = %d\n", ret); - } - __print_line(); - - printf("PRELOADED + NOT PRIVACY -> ALLOW (not privacy)\n"); - printf("pkgid: User::Pkg::org.tizen.privacy-setting\n"); - printf("privilege : http://tizen.org/privilege/internet\n"); - ret = privilege_info_is_privacy2("User::Pkg::org.tizen.privacy-setting", "http://tizen.org/privilege/internet"); - if (ret == 0) { - success_cnt++; - printf("SUCCESS: http://tizen.org/privilege/internet is NOT PRIVACY\n"); - } else { - fail_cnt++; - printf("Test FAILED. ret = %d\n", ret); - } - __print_line(); - - printf("NOT PRELOADED + NOT LOCATION PRIVACY -> ASK (privacy)\n"); - printf("pkgid: User::Pkg::org.test.privacy\n"); - printf("privilege : http://tizen.org/privilege/account.read\n"); - ret = privilege_info_is_privacy2("User::Pkg::org.test.privacy", "http://tizen.org/privilege/account.read"); - if (ret == 1) { - success_cnt++; - printf("SUCCESS: http://tizen.org/privilege/account.read is PRIVACY but NOT LOCATION and pkg is NOT PRELOADED\n"); - } else { - fail_cnt++; - printf("Test FAILED. ret = %d\n", ret); - } - __print_line(); - - printf("NOT PRELOADED + LOCATION PRIVACY -> ASK (privacy)\n"); - printf("pkgid: User::Pkg::org.test.privacy\n"); - printf("privilege : http://tizen.org/privilege/location.coarse\n"); - ret = privilege_info_is_privacy2("User::Pkg::org.test.privacy", "http://tizen.org/privilege/location.coarse"); - if (ret == 1) { - success_cnt++; - printf("SUCCESS: http://tizen.org/privilege/location.coarse is LOCATION PRIVACY and pkg is NOT PRELOADED\n"); - } else { - fail_cnt++; - printf("Test FAILED. ret = %d\n", ret); - } - __print_line(); - - printf("NOT PRELOADED + NOT PRIVACY -> ALLOW (not privacy)\n"); - printf("pkgid: User::Pkg::org.test.privacy\n"); - printf("privilege : http://tizen.org/privilege/internet\n"); - ret = privilege_info_is_privacy2("User::Pkg::org.test.privacy", "http://tizen.org/privilege/internet"); - if (ret == 0) { - success_cnt++; - printf("SUCCESS: http://tizen.org/privilege/internet is NOT PRIVACY and pkg is NOT PRELOADED\n"); - } else { - fail_cnt++; - printf("Test FAILED. ret = %d\n", ret); - } - __print_line(); - - - printf("NULL + NOT LOCATION PRIVACY -> ASK (privacy)\n"); - printf("pkgid: NULL\n"); - printf("privilege : http://tizen.org/privilege/account.read\n"); - ret = privilege_info_is_privacy2(NULL, "http://tizen.org/privilege/account.read"); - if (ret == 1) { - success_cnt++; - printf("SUCCESS: http://tizen.org/privilege/account.read is PRIVACY but NOT LOCATION and pkg is NOT PRELOADED\n"); - } else { - fail_cnt++; - printf("Test FAILED. ret = %d\n", ret); - } - __print_line(); - - - printf("NULL + NOT PRIVACY -> ALLOW (not privacy)\n"); - printf("pkgid: NULL\n"); - printf("privilege : http://tizen.org/privilege/internet\n"); - ret = privilege_info_is_privacy2(NULL, "http://tizen.org/privilege/internet"); - if (ret == 0) { - success_cnt++; - printf("SUCCESS: http://tizen.org/privilege/internet is NOT PRIVACY and pkg is NOT PRELOADED\n"); - } else { - fail_cnt++; - printf("Test FAILED. ret = %d\n", ret); - } - __print_line(); -} - static void __test_privilege_info_get_privilege_type() { int ret = 0; @@ -888,11 +777,6 @@ int main() __tcinfo(function, "privilege_info_get_privacy_display"); __test_privilege_info_get_privacy_display(); - if (ENABLE_ASKUSER) { - __tcinfo(function, "privilege_info_is_privacy2"); - __test_privilege_info_is_privacy2(); - } - __tcinfo(function, "privilege_info_get_privilege_type"); __test_privilege_info_get_privilege_type();