Revert "Revert "Return error if there's no matched privilege"" 72/233472/2
authorYunjin Lee <yunjin-.lee@samsung.com>
Fri, 15 May 2020 03:26:55 +0000 (03:26 +0000)
committerYunjin Lee <yunjin-.lee@samsung.com>
Mon, 18 May 2020 05:03:26 +0000 (14:03 +0900)
This reverts commit e2782e16e5fad479c096e006b2adc6259820715c.

Change-Id: If29055cabd7601aa74e3fe14ffef7efd6576794c

doc/privilege-info_doc.h
packaging/privilege-info.spec
src/include/privilege_information.h
src/privilege_information.c
test/tc_privilege_info.c

index b8119dd..d47d785 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014-2020 Samsung Electronics Co., Ltd All Rights Reserved
  *
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
@@ -28,7 +28,7 @@
  * @section CAPI_SECURITY_FRAMEWORK_PRIVILEGE_INFO_MODULE_OVERVIEW Overview
  * A library for reading privilege information of the given privilege and API issue version.
  * It provides the display name or description of privileges.
- * If there's no matching privilege then it shows last token of given privilege or description string for undefined privileges.
+ * If there's no matching privilege then it returns error.
  *
  * @section CAPI_SECURITY_FRAMEWORK_PRIVILEGE_INFO_MODULE_FEATURE Related Features
  * This API is related with the following features:\n
index b4fc806..6201068 100644 (file)
@@ -107,7 +107,7 @@ install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj
 
 %post -n tc-privilege-info
 tpk-backend -y org.tizen.test-privilege-info --preload
-cyad -s -k MANIFESTS -c User::Pkg::org.tizen.test-privilege-info -u '*' -p http://tizen.org/privilege/contact.read -t DENY
+cyad -s -k MANIFESTS_GLOBAL -c User::Pkg::org.tizen.test-privilege-info -u '*' -p http://tizen.org/privilege/contact.read -t DENY
 
 %files -n privilege-info
 %{_libdir}/libprivilege-info.so*
index fa525da..29e83f2 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2018 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014-2020 Samsung Electronics Co., Ltd All Rights Reserved
  *
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
@@ -46,7 +46,8 @@ typedef enum {
        PRVINFO_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid function parameter */
        PRVINFO_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
        PRVINFO_ERROR_INTERNAL_ERROR = TIZEN_ERROR_UNKNOWN, /**< Unknown error */
-       PRVINFO_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED /**< Not supported (Since 5.0) */
+       PRVINFO_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported (Since 5.0) */
+       PRVINFO_ERROR_NO_MATCHING_PRIVILEGE = TIZEN_ERROR_PRIVILEGE_INFORMATION | 0x01 /**< No matched privilege (Since 6.0) */
 } privilege_info_error_e;
 
 
@@ -54,12 +55,14 @@ typedef enum {
  * @brief Gets the display name of the given privilege.
  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
  * @remarks @a display_name must be released using free().
+ * @remarks Since 6.0, it will return #PRVINFO_ERROR_NO_MATCHING_PRIVILEGE if the given @a privilege not exist.
  * @param[in] api_version The API version of the application to get privilege information
  * @param[in] privilege The privilege
  * @param[out] display_name The display name of the privilege
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #PRVINFO_ERROR_NONE Successful
+ * @retval #PRVINFO_ERROR_NO_MATCHING_PRIVILEGE No matched privilege
  * @retval #PRVINFO_ERROR_OUT_OF_MEMORY Out of memory
  * @retval #PRVINFO_ERROR_INVALID_PARAMETER Invalid function parameter
  * @retval #PRVINFO_ERROR_INTERNAL_ERROR Unknown error
@@ -71,7 +74,8 @@ int privilege_info_get_display_name(const char *api_version, const char *privile
  * @brief Gets the display name of the given privilege.
  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
  * @remarks @a display_name must be released using free().
- * @remarks package_type must be one of followings: "PRVINFO_PACKAGE_TYPE_NATIVE", "PRVINFO_PACKAGE_TYPE_WEB"
+ * @remarks @a package_type must be one of followings: "PRVINFO_PACKAGE_TYPE_NATIVE", "PRVINFO_PACKAGE_TYPE_WEB"
+ * @remarks Since 6.0, it will return #PRVINFO_ERROR_NO_MATCHING_PRIVILEGE if the given @a privilege not exist.
  * @param[in] package_type The type of application package
  * @param[in] api_version The API version of the application to get privilege information
  * @param[in] privilege The privilege
@@ -79,6 +83,7 @@ int privilege_info_get_display_name(const char *api_version, const char *privile
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #PRVINFO_ERROR_NONE Successful
+ * @retval #PRVINFO_ERROR_NO_MATCHING_PRIVILEGE No matched privilege
  * @retval #PRVINFO_ERROR_OUT_OF_MEMORY Out of memory
  * @retval #PRVINFO_ERROR_INVALID_PARAMETER Invalid function parameter
  * @retval #PRVINFO_ERROR_INTERNAL_ERROR Unknown error
@@ -90,12 +95,14 @@ int privilege_info_get_display_name_by_pkgtype(const char *package_type, const c
  * @brief Gets the description of the given privilege.
  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
  * @remarks @a description must be released using free().
+ * @remarks Since 6.0, it will return #PRVINFO_ERROR_NO_MATCHING_PRIVILEGE if the given @a privilege not exist.
  * @param[in] api_version The API version of the application to get privilege information
  * @param[in] privilege The privilege
  * @param[out] description The description of the privilege
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #PRVINFO_ERROR_NONE Successful
+ * @retval #PRVINFO_ERROR_NO_MATCHING_PRIVILEGE No matched privilege
  * @retval #PRVINFO_ERROR_OUT_OF_MEMORY Out of memory
  * @retval #PRVINFO_ERROR_INVALID_PARAMETER Invalid function parameter
  * @retval #PRVINFO_ERROR_INTERNAL_ERROR Unknown error
@@ -107,7 +114,8 @@ int privilege_info_get_description(const char *api_version, const char *privileg
  * @brief Gets the description of the given privilege.
  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
  * @remarks @a description must be released using free().
- * @remarks package_type must be one of followings: "PRVINFO_PACKAGE_TYPE_NATIVE", "PRVINFO_PACKAGE_TYPE_WEB"
+ * @remarks @a package_type must be one of followings: "PRVINFO_PACKAGE_TYPE_NATIVE", "PRVINFO_PACKAGE_TYPE_WEB"
+ * @remarks Since 6.0, it will return #PRVINFO_ERROR_NO_MATCHING_PRIVILEGE if the given @a privilege not exist.
  * @param[in] package_type The type of application package
  * @param[in] api_version The API version of the application to get privilege information
  * @param[in]  privilege The privilege
@@ -115,6 +123,7 @@ int privilege_info_get_description(const char *api_version, const char *privileg
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #PRVINFO_ERROR_NONE Successful
+ * @retval #PRVINFO_ERROR_NO_MATCHING_PRIVILEGE No matched privilege
  * @retval #PRVINFO_ERROR_OUT_OF_MEMORY Out of memory
  * @retval #PRVINFO_ERROR_INVALID_PARAMETER Invalid function parameter
  * @retval #PRVINFO_ERROR_INTERNAL_ERROR Unknown error
index aa1cffa..1c7687b 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2018 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014-2020 Samsung Electronics Co., Ltd All Rights Reserved
  *
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
 #define PI_API __attribute__((visibility("default")))
 #endif
 
-typedef enum {
-       PRVINFO_ERROR_NO_MATCHING_PRIVILEGE             = TIZEN_ERROR_PRIVILEGE_INFORMATION | 0x01
-} privilege_info_internal_error_e;
-
 int privilege_info_get_string_id(const char *package_type_string, int display, const char *api_version, const char *privilege, char **string_id)
 {
-       TryReturn(api_version != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL");
-       TryReturn(privilege != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL");
-
        char* temp = NULL;
        int ret;
        privilege_manager_package_type_e package_type;
@@ -87,10 +80,10 @@ int privilege_info_get_string_id(const char *package_type_string, int display, c
        else
                ret = privilege_db_manager_get_privilege_description(PRVMGR_PACKAGE_TYPE_CORE, privilege, api_version, &temp);
 
-       if (ret == PRIVILEGE_DB_MANAGER_ERR_NONE)
-               goto err_none;
+       if (ret == PRIVILEGE_DB_MANAGER_ERR_NONE && temp != NULL)
+               goto string_id_found;
        else if (ret != PRIVILEGE_DB_MANAGER_ERR_NO_EXIST_RESULT)
-               goto err_internal_error;
+               goto err;
 
        /* Check WEB */
 
@@ -107,35 +100,31 @@ get_string_id_with_package_type:
        else
                ret = privilege_db_manager_get_privilege_description(package_type, privilege, api_version, &temp);
 
-
-       if (ret == PRIVILEGE_DB_MANAGER_ERR_NONE)
-               goto err_none;
-       else if (ret == PRIVILEGE_DB_MANAGER_ERR_NO_EXIST_RESULT)
-               goto err_no_matching_privilege;
+       if (ret == PRIVILEGE_DB_MANAGER_ERR_NONE && temp != NULL)
+               goto string_id_found;
        else
-               goto err_internal_error;
+               goto err;
 
-err_none:
+string_id_found:
        *string_id = strdup(temp);
        TryReturn(*string_id != NULL, free(temp), PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation is failed.");
        free(temp);
        return PRVINFO_ERROR_NONE;
 
-err_no_matching_privilege:
+err:
        *string_id = NULL;
-       free(temp);
-       return PRVINFO_ERROR_NO_MATCHING_PRIVILEGE;
-
-err_internal_error:
-       free(temp);
-       return PRVINFO_ERROR_INTERNAL_ERROR;
+       if (temp != NULL)
+               free(temp);
+       if (ret == PRIVILEGE_DB_MANAGER_ERR_NO_EXIST_RESULT)
+               return PRVINFO_ERROR_NO_MATCHING_PRIVILEGE;
+       else
+               return PRVINFO_ERROR_INTERNAL_ERROR;
 }
 
 int privilege_info_get_string_by_string_id(const char *string_id, char **string)
 {
-       char *temp = NULL;
        TryReturn(string_id != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] string_id is NULL");
-
+       char* temp = NULL;
        temp = dgettext("privilege", string_id);
 
        *string = strdup(temp);
@@ -147,129 +136,80 @@ int privilege_info_get_string_by_string_id(const char *string_id, char **string)
 PI_API
 int privilege_info_get_display_name(const char *api_version, const char *privilege, char **display_name)
 {
-       int ret = 0;
-       char* string_id = NULL;
-
        TryReturn(api_version != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL");
        TryReturn(privilege != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL");
 
-       ret = privilege_info_get_string_id(NULL, 1, api_version, privilege, &string_id);
-
-       if (ret == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE) {
-               char* tempPrivilege = NULL;
-               char* token = NULL;
-               char* temp = NULL;
-               char* save = NULL;
+       int ret = 0;
+       char* string_id = NULL;
 
-               tempPrivilege = strdup(privilege);
-               TryReturn(tempPrivilege != NULL, free(tempPrivilege), PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] tempPrivilege's strdup is failed.");
+       ret = privilege_info_get_string_id(NULL, 1, api_version, privilege, &string_id);
 
-               token = strtok_r(tempPrivilege, "/", &save);
-               while (token) {
-                       temp = token;
-                       token = strtok_r(NULL, "/", &save);
-               }
-               TryReturn(temp != NULL, free(tempPrivilege), PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] invalid privilege <%s>", privilege);
-               *display_name = strdup(temp);
-               TryReturn(*display_name != NULL, free(tempPrivilege), PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
-               free(tempPrivilege);
-       } else if (ret == PRVINFO_ERROR_NONE) {
+       if (ret == PRVINFO_ERROR_NONE)
                ret = privilege_info_get_string_by_string_id(string_id, display_name);
+       if (string_id != NULL)
                free(string_id);
-               TryReturn(ret == PRVINFO_ERROR_NONE, , PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
-       } else {
-               return PRVINFO_ERROR_INTERNAL_ERROR;
-       }
-       return PRVINFO_ERROR_NONE;
+       return ret;
 }
 
 PI_API
 int privilege_info_get_description(const char *api_version, const char *privilege, char **description)
 {
-       int ret = 0;
-       char* string_id = NULL;
-
        TryReturn(api_version != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL");
        TryReturn(privilege != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL");
 
+       int ret = 0;
+       char* string_id = NULL;
+
        ret = privilege_info_get_string_id(NULL, 0, api_version, privilege, &string_id);
 
-       if (ret == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE) {
-               ret = privilege_info_get_string_by_string_id("IDS_TPLATFORM_BODY_THIS_PRIVILEGE_IS_NOT_DEFINED", description);
-               TryReturn(ret == PRVINFO_ERROR_NONE, , PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
-       } else if (ret == PRVINFO_ERROR_NONE) {
+       if (ret == PRVINFO_ERROR_NONE)
                ret = privilege_info_get_string_by_string_id(string_id, description);
+       if (string_id != NULL)
                free(string_id);
-               TryReturn(ret == PRVINFO_ERROR_NONE, , PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
-       } else {
-               return PRVINFO_ERROR_INTERNAL_ERROR;
-       }
-       return PRVINFO_ERROR_NONE;
+
+       return ret;
 }
 
 PI_API
 int privilege_info_get_display_name_by_pkgtype(const char *package_type, const char *api_version, const char *privilege, char **display_name)
 {
-       int ret = 0;
-       char* string_id = NULL;
-
        TryReturn(package_type != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] package_type is NULL");
        TryReturn(api_version != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL");
        TryReturn(privilege != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL");
 
+       int ret = 0;
+       char* string_id = NULL;
+
        ret = privilege_info_get_string_id(package_type, 1, api_version, privilege, &string_id);
        TryReturn(ret != PRVINFO_ERROR_INVALID_PARAMETER, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] invalid package_type : %s", package_type);
 
-       if (ret == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE) {
-               char* tempPrivilege = NULL;
-               char* token = NULL;
-               char* temp = NULL;
-               char* save = NULL;
-               tempPrivilege = strdup(privilege);
-               TryReturn(tempPrivilege != NULL, free(tempPrivilege), PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] tempPrivilege's strdup is failed.");
-               token = strtok_r(tempPrivilege, "/", &save);
-               while (token) {
-                       temp = token;
-                       token = strtok_r(NULL, "/", &save);
-               }
-               TryReturn(temp != NULL, free(tempPrivilege), PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] invalid privilege <%s>", privilege);
-               *display_name = strdup(temp);
-               TryReturn(*display_name != NULL, free(tempPrivilege), PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
-               free(tempPrivilege);
-       } else if (ret == PRVINFO_ERROR_NONE) {
+       if (ret == PRVINFO_ERROR_NONE)
                ret = privilege_info_get_string_by_string_id(string_id, display_name);
+       if (string_id != NULL)
                free(string_id);
-               TryReturn(ret == PRVINFO_ERROR_NONE, , PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
-       } else {
-               return PRVINFO_ERROR_INTERNAL_ERROR;
-       }
-       return PRVINFO_ERROR_NONE;
+
+       return ret;
 }
 
 PI_API
 int privilege_info_get_description_by_pkgtype(const char *package_type, const char *api_version, const char *privilege, char **description)
 {
-       int ret = 0;
-       char* string_id = NULL;
-
        TryReturn(package_type != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] package_type is NULL");
        TryReturn(api_version != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL");
        TryReturn(privilege != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL");
 
+       int ret = 0;
+       char* string_id = NULL;
+
        ret = privilege_info_get_string_id(package_type, 0, api_version, privilege, &string_id);
        TryReturn(ret != PRVINFO_ERROR_INVALID_PARAMETER, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] invalid package_type : %s", package_type);
 
-       if (ret == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE) {
-               ret = privilege_info_get_string_by_string_id("IDS_TPLATFORM_BODY_THIS_PRIVILEGE_IS_NOT_DEFINED", description);
-               TryReturn(ret == PRVINFO_ERROR_NONE, , PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
-       } else if (ret == PRVINFO_ERROR_NONE) {
+       if (ret == PRVINFO_ERROR_NONE)
                ret = privilege_info_get_string_by_string_id(string_id, description);
+       if (string_id != NULL)
                free(string_id);
-               TryReturn(ret == PRVINFO_ERROR_NONE, , PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
-       } else {
-               return PRVINFO_ERROR_INTERNAL_ERROR;
-       }
-       return PRVINFO_ERROR_NONE;
+
+       return ret;
 }
 
 PI_API
index ecc8b9f..c4f992b 100755 (executable)
@@ -43,13 +43,15 @@ static const char* __get_result_string(privilege_info_error_e ret)
                return "PRVINFO_ERROR_INTERNAL_ERROR";
        else if (ret == PRVINFO_ERROR_NOT_SUPPORTED)
                return "PRVINFO_ERROR_NOT_SUPPORTED";
+       else if (ret == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE)
+               return "PRVINFO_ERROR_NO_MATCHING_PRIVILEGE";
 
        return "PRVINFO_ERROR_NO_MATCHED_ERROR_MESSAGE";
 }
 
 static void __check_get_privilege_display_name_result(privilege_info_error_e expected_result, privilege_info_error_e result, const char* display_name)
 {
-       printf("expected result = %s, result = %s\n", __get_result_string(expected_result), __get_result_string(result));
+       printf("expected : %s\n  result : %s\n", __get_result_string(expected_result), __get_result_string(result));
 
        if (expected_result != result) {
                printf("not matched\n");
@@ -69,7 +71,7 @@ static void __check_get_privilege_display_name_result(privilege_info_error_e exp
                        } else {
                                printf("display_name = %s\n", display_name);
                        }
-               } else {
+               } else if (result == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE) {
                        if (display_name != NULL) {
                                printf("display_name = %s\n", display_name);
                                printf("display_name must be NULL\n");
@@ -90,7 +92,7 @@ static void __check_get_privilege_display_name_result(privilege_info_error_e exp
 
 static void __check_get_privilege_description_result(privilege_info_error_e expected_result, privilege_info_error_e result, const char* description)
 {
-       printf("expected result = %s, result = %s\n", __get_result_string(expected_result), __get_result_string(result));
+       printf("expected : %s\n  result : %s\n", __get_result_string(expected_result), __get_result_string(result));
 
        if (expected_result != result) {
                printf("not matched\n");
@@ -110,7 +112,7 @@ static void __check_get_privilege_description_result(privilege_info_error_e expe
                        } else {
                                printf("description = %s\n", description);
                        }
-               } else {
+               } else if (result == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE) {
                        if (description != NULL) {
                                printf("description = %s\n", description);
                                printf("description must be NULL\n");
@@ -131,7 +133,7 @@ static void __check_get_privilege_description_result(privilege_info_error_e expe
 
 static void __check_get_privacy_display_name_result(privilege_info_error_e expected_result, privilege_info_error_e result, const char* privacy_display)
 {
-       printf("expectd result %s, result = %s\n", __get_result_string(expected_result), __get_result_string(result));
+       printf("expected : %s\n  result : %s\n", __get_result_string(expected_result), __get_result_string(result));
 
        if (expected_result != result) {
                printf("not matched\n");
@@ -159,14 +161,12 @@ static void __test_privilege_info_get_display_name()
        printf("-----------------------------------------------------------\n");
        printf("api_version : 2.3\n");
        printf("privilege : http://tizen.org/privilege/window.priority.set\n");
-       printf("expected result : PRVINFO_ERROR_NONE\n");
        ret = privilege_info_get_display_name("2.3", "http://tizen.org/privilege/window.priority.set", &display_name);
        __check_get_privilege_display_name_result(PRVINFO_ERROR_NONE, ret, display_name);
 
        printf("-----------------------------------------------------------\n");
        printf("api_version : 2.3\n");
        printf("privilege : http://tizen.org/privilege/mediacapture\n");
-       printf("expected result : PRVINFO_ERROR_NONE\n");
        if (display_name != NULL) {
                free(display_name);
                display_name = NULL;
@@ -178,19 +178,17 @@ static void __test_privilege_info_get_display_name()
        printf("Not existing privilege\n");
        printf("api_version : 2.3\n");
        printf("privilege : http://tizen.org/privilege/RRRRRRRRRR\n");
-       printf("expected result : PRVINFO_ERROR_NONE\n");
        if (display_name != NULL) {
                free(display_name);
                display_name = NULL;
        }
        ret = privilege_info_get_display_name("2.3", "http://tizen.org/privilege/RRRRRRRRRR", &display_name);
-       __check_get_privilege_display_name_result(PRVINFO_ERROR_NONE, ret, display_name);
+       __check_get_privilege_display_name_result(PRVINFO_ERROR_NO_MATCHING_PRIVILEGE, ret, display_name);
 
        printf("-----------------------------------------------------------\n");
        printf("Invalid parameter\n");
        printf("api_version : NULL\n");
        printf("privilege : http://tizen.org/privilege/window.priority.set\n");
-       printf("expected result : PRVINFO_ERROR_NONE\n");
        if (display_name != NULL) {
                free(display_name);
                display_name = NULL;
@@ -200,6 +198,7 @@ static void __test_privilege_info_get_display_name()
 
        free(display_name);
 }
+
 static void __test_privilege_info_get_display_name_by_pkgtype()
 {
        int ret;
@@ -209,7 +208,6 @@ static void __test_privilege_info_get_display_name_by_pkgtype()
        printf("pkgtype : PRVINFO_PACKAGE_TYPE_NATIVE\n");
        printf("api_version : 2.3\n");
        printf("privilege : http://tizen.org/privilege/window.priority.set\n");
-       printf("expected result : PRVINFO_ERROR_NONE\n");
        ret = privilege_info_get_display_name_by_pkgtype("PRVINFO_PACKAGE_TYPE_NATIVE", "2.3", "http://tizen.org/privilege/window.priority.set", &display_name);
        __check_get_privilege_display_name_result(PRVINFO_ERROR_NONE, ret, display_name);
 
@@ -217,7 +215,6 @@ static void __test_privilege_info_get_display_name_by_pkgtype()
        printf("pkgtype : PRVINFO_PACKAGE_TYPE_WEB\n");
        printf("api_version : 2.3\n");
        printf("privilege : http://tizen.org/privilege/mediacapture\n");
-       printf("expected result : PRVINFO_ERROR_NONE\n");
        if (display_name != NULL) {
                free(display_name);
                display_name = NULL;
@@ -230,32 +227,29 @@ static void __test_privilege_info_get_display_name_by_pkgtype()
        printf("pkgtype : PRVINFO_PACKAGE_TYPE_NATIVE\n");
        printf("api_version : 2.3\n");
        printf("privilege : http://tizen.org/privilege/mediacapture\n");
-       printf("expected result : PRVINFO_ERROR_NONE\n");
        if (display_name != NULL) {
                free(display_name);
                display_name = NULL;
        }
        ret = privilege_info_get_display_name_by_pkgtype("PRVINFO_PACKAGE_TYPE_NATIVE", "2.3", "http://tizen.org/privilege/mediacapture", &display_name);
-       __check_get_privilege_display_name_result(PRVINFO_ERROR_NONE, ret, display_name);
+       __check_get_privilege_display_name_result(PRVINFO_ERROR_NO_MATCHING_PRIVILEGE, ret, display_name);
 
 
        printf("-----------------------------------------------------------\n");
        printf("Not existing privilege\n");
        printf("api_version : 2.3\n");
        printf("privilege : http://tizen.org/privilege/RRRRRRRRRR\n");
-       printf("expected result : PRVINFO_ERROR_NONE\n");
        if (display_name != NULL) {
                free(display_name);
                display_name = NULL;
        }
        ret = privilege_info_get_display_name_by_pkgtype("PRVINFO_PACKAGE_TYPE_WEB", "2.3", "http://tizen.org/privilege/RRRRRRRRRR", &display_name);
-       __check_get_privilege_display_name_result(PRVINFO_ERROR_NONE, ret, display_name);
+       __check_get_privilege_display_name_result(PRVINFO_ERROR_NO_MATCHING_PRIVILEGE, ret, display_name);
 
        printf("-----------------------------------------------------------\n");
        printf("Invalid parameter\n");
        printf("api_version : 2.3\n");
        printf("privilege : http://tizen.org/privilege/mediacapture\n");
-       printf("expected result : PRVINFO_ERROR_NONE\n");
        if (display_name != NULL) {
                free(display_name);
                display_name = NULL;
@@ -274,14 +268,12 @@ static void __test_privilege_info_get_description()
        printf("-----------------------------------------------------------\n");
        printf("api_version : 2.3\n");
        printf("privilege : http://tizen.org/privilege/window.priority.set\n");
-       printf("expected result : PRVINFO_ERROR_NONE\n");
        ret = privilege_info_get_description("2.3", "http://tizen.org/privilege/window.priority.set", &description);
        __check_get_privilege_description_result(PRVINFO_ERROR_NONE, ret, description);
 
        printf("-----------------------------------------------------------\n");
        printf("api_version : 2.3\n");
        printf("privilege : http://tizen.org/privilege/mediacapture\n");
-       printf("expected result : PRVINFO_ERROR_NONE\n");
        if (description != NULL) {
                free(description);
                description = NULL;
@@ -293,19 +285,17 @@ static void __test_privilege_info_get_description()
        printf("Not existing privilege\n");
        printf("api_version : 2.3\n");
        printf("privilege : http://tizen.org/privilege/RRRRRRRRRR\n");
-       printf("expected result : PRVINFO_ERROR_NONE\n");
        if (description != NULL) {
                free(description);
                description = NULL;
        }
        ret = privilege_info_get_description("2.3", "http://tizen.org/privilege/RRRRRRRRRR", &description);
-       __check_get_privilege_description_result(PRVINFO_ERROR_NONE, ret, description);
+       __check_get_privilege_description_result(PRVINFO_ERROR_NO_MATCHING_PRIVILEGE, ret, description);
 
        printf("-----------------------------------------------------------\n");
        printf("Invalid parameter\n");
        printf("api_version : 2.3\n");
        printf("privilege : http://tizen.org/privilege/mediacapture\n");
-       printf("expected result : PRVINFO_ERROR_NONE\n");
        if (description != NULL) {
                free(description);
                description = NULL;
@@ -324,14 +314,12 @@ static void __test_privilege_info_get_description_by_pkgtype()
        printf("-----------------------------------------------------------\n");
        printf("api_version : 2.3\n");
        printf("privilege : http://tizen.org/privilege/window.priority.set\n");
-       printf("expected result : PRVINFO_ERROR_NONE\n");
        ret = privilege_info_get_description_by_pkgtype("PRVINFO_PACKAGE_TYPE_NATIVE", "2.3", "http://tizen.org/privilege/window.priority.set", &description);
        __check_get_privilege_description_result(PRVINFO_ERROR_NONE, ret, description);
 
        printf("-----------------------------------------------------------\n");
        printf("api_version : 2.3\n");
        printf("privilege : http://tizen.org/privilege/mediacapture\n");
-       printf("expected result : PRVINFO_ERROR_NONE\n");
        if (description != NULL) {
                free(description);
                description = NULL;
@@ -344,31 +332,28 @@ static void __test_privilege_info_get_description_by_pkgtype()
        printf("pkgtype : PRVINFO_PACKAGE_TYPE_NATIVE\n");
        printf("api_version : 2.3\n");
        printf("privilege : http://tizen.org/privilege/mediacapture\n");
-       printf("expected result : PRVINFO_ERROR_NONE\n");
        if (description != NULL) {
                free(description);
                description = NULL;
        }
        ret = privilege_info_get_description_by_pkgtype("PRVINFO_PACKAGE_TYPE_NATIVE", "2.3", "http://tizen.org/privilege/mediacapture", &description);
-       __check_get_privilege_description_result(PRVINFO_ERROR_NONE, ret, description);
+       __check_get_privilege_description_result(PRVINFO_ERROR_NO_MATCHING_PRIVILEGE, ret, description);
 
        printf("-----------------------------------------------------------\n");
        printf("Not existing privilege\n");
        printf("api_version : 2.3\n");
        printf("privilege : http://tizen.org/privilege/RRRRRRRRRR\n");
-       printf("expected result : PRVINFO_ERROR_NONE\n");
        if (description != NULL) {
                free(description);
                description = NULL;
        }
        ret = privilege_info_get_description_by_pkgtype("PRVINFO_PACKAGE_TYPE_NATIVE", "2.3", "http://tizen.org/privilege/RRRRRRRRRR", &description);
-       __check_get_privilege_description_result(PRVINFO_ERROR_NONE, ret, description);
+       __check_get_privilege_description_result(PRVINFO_ERROR_NO_MATCHING_PRIVILEGE, ret, description);
 
        printf("-----------------------------------------------------------\n");
        printf("Invalid parameter\n");
        printf("api_version : 2.3\n");
        printf("privilege : NULL\n");
-       printf("expected result : PRVINFO_ERROR_INVALID_PARAMETER\n");
        if (description != NULL) {
                free(description);
                description = NULL;
@@ -428,15 +413,15 @@ static void __test_privilege_info_get_privacy_display_name()
 
 static void __check_privilege_info_get_privilege_info(privilege_info_error_e expected_result, privilege_info_error_e result, GList* privilege_info_list, int return_result)
 {
-       printf("expected result = %s, result = %s\n", __get_result_string(expected_result), __get_result_string(result));
+       printf("expected : %s\n  result : %s\n", __get_result_string(expected_result), __get_result_string(result));
 
        if (expected_result != result) {
                __change_color_to_yellow();
-               printf("not mached\n");
+               printf("not matched\n");
                __change_color_to_origin();
        } else {
                __change_color_to_green();
-               printf("mached\n");
+               printf("matched\n");
                __change_color_to_origin();
        }
 
@@ -468,7 +453,6 @@ static void __test_privilege_info_get_privilege_info_list()
        printf("privilege name : http://tizen.org/privilege/call\n");
        printf("privilege name : http://tizen.org/privilege/content.read\n");
        printf("privilege name : http://tizen.org/privilege/filesystem.read\n");
-       printf("expected result : PRVINFO_ERROR_NONE\n");
        privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/call");
        privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/content.read");
        privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/filesystem.read");
@@ -486,7 +470,6 @@ static void __test_privilege_info_get_privilege_info_list()
        printf("privilege name : http://tizen.org/privilege/call\n");
        printf("privilege name : http://tizen.org/privilege/systemsettings.admin\n");
        printf("privilege name : http://tizen.org/privilege/bookmark.admin\n");
-       printf("expected result : PRVINFO_ERROR_NONE\n");
        privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/call");
        privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/systemsettings.admin");
        privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/bookmark.admin");
@@ -504,7 +487,6 @@ static void __test_privilege_info_get_privilege_info_list()
        printf("privilege name : http://tizen.org/privilege/call\n");
        printf("privilege name : http://tizen.org/privilege/alarm.xxxx\n");
        printf("privilege name : http://tizen.org/privilege/account.xxx\n");
-       printf("expected result : PRVINFO_ERROR_NONE\n");
        privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/call");
        privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/alarm.xxxx");
        privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/account.xxx");
@@ -522,7 +504,6 @@ static void __test_privilege_info_get_privilege_info_list()
        printf("privilege name : http://tizen.org/privilege/call\n");
        printf("privilege name : http://tizen.org/privilege/content.read\n");
        printf("privilege name : http://tizen.org/privilege/filesystem.read\n");
-       printf("expected result : PRVINFO_ERROR_NONE\n");
        privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/call");
        privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/content.read");
        privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/filesystem.read");
@@ -540,7 +521,6 @@ static void __test_privilege_info_get_privilege_info_list()
        printf("privilege name : http://tizen.org/privilege/xxxx\n");
        printf("privilege name : http://tizen.org/privilege/alarm.xxxx\n");
        printf("privilege name : http://tizen.org/privilege/account.xxx\n");
-       printf("expected result : PRVINFO_ERROR_NONE\n");
        privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/xxxx");
        privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/alarm.xxxx");
        privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/account.xxx");