fix for internal UTC 94/88794/2
authorIckhee Woo <ickhee.woo@samsung.com>
Tue, 20 Sep 2016 14:03:12 +0000 (23:03 +0900)
committerIckhee Woo <ickhee.woo@samsung.com>
Tue, 20 Sep 2016 14:07:22 +0000 (23:07 +0900)
Change-Id: I40868f4ede93c356aac6b6e7e794b74d3434bf71
Signed-off-by: Ickhee Woo <ickhee.woo@samsung.com>
src/account.c
src/account_offline.c

index c11544daeb3ffdd5d4ebd4fd6cab36d20f6e3b97..0de1e177ddeb670e726af8354972b3fc2a9b7cde 100644 (file)
@@ -243,8 +243,14 @@ ACCOUNT_API int account_insert_to_db(account_h account, int *account_db_id)
        int db_id = -1;
        GVariant *account_serialized = marshal_account(account_data);
 
+       uid_t uid = -1;
+       if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+               ACCOUNT_ERROR("pkgmgr_installer_info_get_target_uid() fail");
+               return ACCOUNT_ERROR_DB_FAILED;
+       }
+
        _INFO("3. Before account_manager_call_account_add_sync");
-       bool is_success = account_manager_call_account_add_sync(acc_mgr, account_serialized, (int)getuid(), &db_id, NULL, &error);
+       bool is_success = account_manager_call_account_add_sync(acc_mgr, account_serialized, (int)uid, &db_id, NULL, &error);
        _account_manager_release_instance();
 
        ACCOUNT_CATCH_ERROR((is_success != false), {}, _account_get_error_code(is_success, error), "Failed to get dbus.");
@@ -278,9 +284,15 @@ ACCOUNT_API int account_delete_from_db_by_id(int account_db_id)
                return ACCOUNT_ERROR_PERMISSION_DENIED;
        }
 
+       uid_t uid = -1;
+       if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+               ACCOUNT_ERROR("pkgmgr_installer_info_get_target_uid() fail");
+               return ACCOUNT_ERROR_DB_FAILED;
+       }
+
        _INFO("2. Before account_manager_call_account_query_account_by_account_id_sync");
        GVariant *account_serialized_old = NULL;
-       bool is_success = account_manager_call_account_query_account_by_account_id_sync(acc_mgr, account_db_id, (int)getuid(), &account_serialized_old, NULL, &error);
+       bool is_success = account_manager_call_account_query_account_by_account_id_sync(acc_mgr, account_db_id, (int)uid, &account_serialized_old, NULL, &error);
 
        if (!is_success) {
                error_code = _account_get_error_code(is_success, error);
@@ -292,7 +304,7 @@ ACCOUNT_API int account_delete_from_db_by_id(int account_db_id)
        g_clear_error(&error);
 
        _INFO("3. Before account_manager_call_account_delete_from_db_by_id_sync");
-       is_success = account_manager_call_account_delete_from_db_by_id_sync(acc_mgr, account_db_id, (int)getuid(), NULL, &error);
+       is_success = account_manager_call_account_delete_from_db_by_id_sync(acc_mgr, account_db_id, (int)uid, NULL, &error);
        _account_manager_release_instance();
 
        if (!is_success) {
@@ -324,8 +336,14 @@ ACCOUNT_API int account_delete_from_db_by_user_name(char *user_name, char *packa
                return ACCOUNT_ERROR_PERMISSION_DENIED;
        }
 
+       uid_t uid = -1;
+       if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+               ACCOUNT_ERROR("pkgmgr_installer_info_get_target_uid() fail");
+               return ACCOUNT_ERROR_DB_FAILED;
+       }
+
        GVariant *account_list_variant = NULL;
-       bool is_success = account_manager_call_account_query_account_by_user_name_sync(acc_mgr, user_name, (int)getuid(), &account_list_variant, NULL, &error);
+       bool is_success = account_manager_call_account_query_account_by_user_name_sync(acc_mgr, user_name, (int)uid, &account_list_variant, NULL, &error);
 
        error_code = _account_get_error_code(is_success, error);
        g_clear_error(&error);
@@ -343,7 +361,7 @@ ACCOUNT_API int account_delete_from_db_by_user_name(char *user_name, char *packa
                return ACCOUNT_ERROR_NO_DATA;
        }
 
-       is_success = account_manager_call_account_delete_from_db_by_user_name_sync(acc_mgr, user_name, package_name, (int)getuid(), NULL, &error);
+       is_success = account_manager_call_account_delete_from_db_by_user_name_sync(acc_mgr, user_name, package_name, (int)uid, NULL, &error);
        _account_manager_release_instance();
 
        if (!is_success) {
@@ -376,7 +394,7 @@ int _account_delete_from_db_by_package_name(const char *package_name, bool permi
 /*
        //First get account list of user_name, used for gSSO DB deletion
        GVariant* account_list_variant = NULL;
-       bool is_success = account_manager_call_account_query_account_by_package_name_sync(acc_mgr, account_db_path, package_name, (int)getuid(), &account_list_variant, NULL, &error);
+       bool is_success = account_manager_call_account_query_account_by_package_name_sync(acc_mgr, account_db_path, package_name, (int)uid, &account_list_variant, NULL, &error);
 
        error_code = _account_get_error_code(is_success, error);
        if (error_code != ACCOUNT_ERROR_NONE)
@@ -394,7 +412,14 @@ int _account_delete_from_db_by_package_name(const char *package_name, bool permi
                return ACCOUNT_ERROR_NO_DATA;
        }
 */
-       bool is_success = account_manager_call_account_delete_from_db_by_package_name_sync(acc_mgr, package_name, permission, (int)getuid(), NULL, &error);
+
+       uid_t uid = -1;
+       if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+               ACCOUNT_ERROR("pkgmgr_installer_info_get_target_uid() fail");
+               return ACCOUNT_ERROR_DB_FAILED;
+       }
+
+       bool is_success = account_manager_call_account_delete_from_db_by_package_name_sync(acc_mgr, package_name, permission, (int)uid, NULL, &error);
        _account_manager_release_instance();
 
        if (!is_success) {
@@ -430,9 +455,15 @@ ACCOUNT_API int account_update_to_db_by_id(account_h account, int account_id)
                return ACCOUNT_ERROR_PERMISSION_DENIED;
        }
 
+       uid_t uid = -1;
+       if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+               ACCOUNT_ERROR("pkgmgr_installer_info_get_target_uid() fail");
+               return ACCOUNT_ERROR_DB_FAILED;
+       }
+
        _INFO("2. Before account_manager_call_account_query_account_by_account_id_sync");
        GVariant *account_serialized_old = NULL;
-       bool is_success = account_manager_call_account_query_account_by_account_id_sync(acc_mgr, account_id, (int)getuid(), &account_serialized_old, NULL, &error);
+       bool is_success = account_manager_call_account_query_account_by_account_id_sync(acc_mgr, account_id, (int)uid, &account_serialized_old, NULL, &error);
 
        if (!is_success) {
                error_code = _account_get_error_code(is_success, error);
@@ -445,7 +476,7 @@ ACCOUNT_API int account_update_to_db_by_id(account_h account, int account_id)
 
        _INFO("3. Before account_manager_call_account_update_to_db_by_id_sync");
        GVariant *account_serialized = marshal_account((account_s *)account);
-       is_success = account_manager_call_account_update_to_db_by_id_sync(acc_mgr, account_serialized, account_id, (int)getuid(), NULL, &error);
+       is_success = account_manager_call_account_update_to_db_by_id_sync(acc_mgr, account_serialized, account_id, (int)uid, NULL, &error);
        _account_manager_release_instance();
 
        if (!is_success) {
@@ -490,8 +521,9 @@ ACCOUNT_INTERNAL_API int account_update_to_db_by_id_without_permission(account_h
        uid_t uid = -1;
        if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
                _ERR("pkgmgr_installer_info_get_target_uid() fail");
-               return ACCOUNT_ERROR_DB_NOT_OPENED;
+               return ACCOUNT_ERROR_DB_FAILED;
        }
+
        bool is_success = account_manager_call_account_query_account_by_account_id_sync(acc_mgr, account_id, (int)uid, &account_serialized_old, NULL, &error);
 
        if (!is_success) {
@@ -513,7 +545,7 @@ ACCOUNT_INTERNAL_API int account_update_to_db_by_id_without_permission(account_h
        }
 
        _INFO("before call update() : account_id[%d]", account_id);
-       is_success = account_manager_call_account_update_to_db_by_id_ex_sync(acc_mgr, account_serialized, account_id, (int)getuid(), NULL, &error);
+       is_success = account_manager_call_account_update_to_db_by_id_ex_sync(acc_mgr, account_serialized, account_id, (int)uid, NULL, &error);
 
        _INFO("after call update() : is_success=%d", is_success);
        _account_manager_release_instance();
@@ -546,9 +578,15 @@ ACCOUNT_API int account_update_to_db_by_user_name(account_h account, const char
                return ACCOUNT_ERROR_PERMISSION_DENIED;
        }
 
+       uid_t uid = -1;
+       if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+               ACCOUNT_ERROR("pkgmgr_installer_info_get_target_uid() fail");
+               return ACCOUNT_ERROR_DB_FAILED;
+       }
+
        GVariant *account_serialized_old = NULL;
        account_s *account_data = (account_s *)account;
-       bool is_success = account_manager_call_account_query_account_by_account_id_sync(acc_mgr, account_data->id, (int)getuid(), &account_serialized_old, NULL, &error);
+       bool is_success = account_manager_call_account_query_account_by_account_id_sync(acc_mgr, account_data->id, (int)uid, &account_serialized_old, NULL, &error);
 
        if (!is_success) {
                error_code = _account_get_error_code(is_success, error);
@@ -560,7 +598,7 @@ ACCOUNT_API int account_update_to_db_by_user_name(account_h account, const char
        g_clear_error(&error);
 
        GVariant *account_serialized = marshal_account(account_data);
-       is_success = account_manager_call_account_update_to_db_by_user_name_sync(acc_mgr, account_serialized, user_name, package_name, (int)getuid(), NULL, &error);
+       is_success = account_manager_call_account_update_to_db_by_user_name_sync(acc_mgr, account_serialized, user_name, package_name, (int)uid, NULL, &error);
        _account_manager_release_instance();
 
        if (!is_success) {
@@ -1408,8 +1446,14 @@ ACCOUNT_API int account_foreach_account_from_db(account_cb callback, void *user_
                return ACCOUNT_ERROR_PERMISSION_DENIED;
        }
 
+       uid_t uid = -1;
+       if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+               ACCOUNT_ERROR("pkgmgr_installer_info_get_target_uid() fail");
+               return ACCOUNT_ERROR_DB_FAILED;
+       }
+
        GVariant *account_list_variant = NULL;
-       bool is_success = account_manager_call_account_query_all_sync(acc_mgr, (int)getuid(), &account_list_variant, NULL, &error);
+       bool is_success = account_manager_call_account_query_all_sync(acc_mgr, (int)uid, &account_list_variant, NULL, &error);
        _account_manager_release_instance();
 
        int error_code = _account_get_error_code(is_success, error);
@@ -1458,8 +1502,14 @@ ACCOUNT_API int account_query_account_by_account_id(int account_db_id, account_h
                return ACCOUNT_ERROR_PERMISSION_DENIED;
        }
 
+       uid_t uid = -1;
+       if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+               ACCOUNT_ERROR("pkgmgr_installer_info_get_target_uid() fail");
+               return ACCOUNT_ERROR_DB_FAILED;
+       }
+
        GVariant *account_variant = NULL;
-       bool is_success = account_manager_call_account_query_account_by_account_id_sync(acc_mgr, account_db_id, (int)getuid(), &account_variant, NULL, &error);
+       bool is_success = account_manager_call_account_query_account_by_account_id_sync(acc_mgr, account_db_id, (int)uid, &account_variant, NULL, &error);
        _account_manager_release_instance();
 
        int error_code = _account_get_error_code(is_success, error);
@@ -1503,8 +1553,14 @@ ACCOUNT_API int account_query_account_by_user_name(account_cb callback, const ch
                return ACCOUNT_ERROR_PERMISSION_DENIED;
        }
 
+       uid_t uid = -1;
+       if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+               ACCOUNT_ERROR("pkgmgr_installer_info_get_target_uid() fail");
+               return ACCOUNT_ERROR_DB_FAILED;
+       }
+
        GVariant *account_list_variant = NULL;
-       bool is_success = account_manager_call_account_query_account_by_user_name_sync(acc_mgr, user_name, (int)getuid(), &account_list_variant, NULL, &error);
+       bool is_success = account_manager_call_account_query_account_by_user_name_sync(acc_mgr, user_name, (int)uid, &account_list_variant, NULL, &error);
        _account_manager_release_instance();
 
        int error_code = _account_get_error_code(is_success, error);
@@ -1555,10 +1611,10 @@ ACCOUNT_API int account_query_account_by_package_name(account_cb callback, const
        uid_t uid = -1;
        if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
                _ERR("pkgmgr_installer_info_get_target_uid() fail");
-               return ACCOUNT_ERROR_DB_NOT_OPENED;
+               return ACCOUNT_ERROR_DB_FAILED;
        }
 
-       bool is_success = account_manager_call_account_query_account_by_package_name_sync(acc_mgr, package_name, (int)getuid(), &account_list_variant, NULL, &error);
+       bool is_success = account_manager_call_account_query_account_by_package_name_sync(acc_mgr, package_name, (int)uid, &account_list_variant, NULL, &error);
        _account_manager_release_instance();
 
        int error_code = _account_get_error_code(is_success, error);
@@ -1610,8 +1666,14 @@ ACCOUNT_API int account_query_account_by_capability(account_cb callback, const c
                return ACCOUNT_ERROR_PERMISSION_DENIED;
        }
 
+       uid_t uid = -1;
+       if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+               ACCOUNT_ERROR("pkgmgr_installer_info_get_target_uid() fail");
+               return ACCOUNT_ERROR_DB_FAILED;
+       }
+
        GVariant *account_list_variant = NULL;
-       bool is_success = account_manager_call_account_query_account_by_capability_sync(acc_mgr, capability_type, capability_value, (int)getuid(), &account_list_variant, NULL, &error);
+       bool is_success = account_manager_call_account_query_account_by_capability_sync(acc_mgr, capability_type, capability_value, (int)uid, &account_list_variant, NULL, &error);
        _account_manager_release_instance();
 
        int error_code = _account_get_error_code(is_success, error);
@@ -1656,8 +1718,14 @@ ACCOUNT_API int account_query_account_by_capability_type(account_cb callback, co
                return ACCOUNT_ERROR_PERMISSION_DENIED;
        }
 
+       uid_t uid = -1;
+       if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+               ACCOUNT_ERROR("pkgmgr_installer_info_get_target_uid() fail");
+               return ACCOUNT_ERROR_DB_FAILED;
+       }
+
        GVariant *account_list_variant = NULL;
-       bool is_success = account_manager_call_account_query_account_by_capability_type_sync(acc_mgr, capability_type, (int)getuid(), &account_list_variant, NULL, &error);
+       bool is_success = account_manager_call_account_query_account_by_capability_type_sync(acc_mgr, capability_type, (int)uid, &account_list_variant, NULL, &error);
        _account_manager_release_instance();
 
        int error_code = _account_get_error_code(is_success, error);
@@ -1702,8 +1770,14 @@ ACCOUNT_API int account_query_capability_by_account_id(capability_cb callback, i
                return ACCOUNT_ERROR_PERMISSION_DENIED;
        }
 
+       uid_t uid = -1;
+       if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+               ACCOUNT_ERROR("pkgmgr_installer_info_get_target_uid() fail");
+               return ACCOUNT_ERROR_DB_FAILED;
+       }
+
        GVariant *capability_list_variant = NULL;
-       bool is_success = account_manager_call_account_query_capability_by_account_id_sync(acc_mgr, account_id, (int)getuid(), &capability_list_variant, NULL, &error);
+       bool is_success = account_manager_call_account_query_capability_by_account_id_sync(acc_mgr, account_id, (int)uid, &capability_list_variant, NULL, &error);
        _account_manager_release_instance();
 
        int error_code = _account_get_error_code(is_success, error);
@@ -1756,8 +1830,14 @@ static int _account_get_total_count(int *count, bool include_hidden)
                return ACCOUNT_ERROR_PERMISSION_DENIED;
        }
 
+       uid_t uid = -1;
+       if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+               ACCOUNT_ERROR("pkgmgr_installer_info_get_target_uid() fail");
+               return ACCOUNT_ERROR_DB_FAILED;
+       }
+
        int temp_count = -1;
-       bool is_success = account_manager_call_account_get_total_count_from_db_sync(acc_mgr, include_hidden, (int)getuid(), &temp_count, NULL, &error);
+       bool is_success = account_manager_call_account_get_total_count_from_db_sync(acc_mgr, include_hidden, (int)uid, &temp_count, NULL, &error);
        _account_manager_release_instance();
 
        int error_code = _account_get_error_code(is_success, error);
@@ -1803,7 +1883,13 @@ ACCOUNT_API int account_update_sync_status_by_id(int account_db_id, const accoun
                return ACCOUNT_ERROR_PERMISSION_DENIED;
        }
 
-       bool is_success = account_manager_call_account_update_sync_status_by_id_sync(acc_mgr, account_db_id, sync_status, (int)getuid(), NULL, &error);
+       uid_t uid = -1;
+       if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+               ACCOUNT_ERROR("pkgmgr_installer_info_get_target_uid() fail");
+               return ACCOUNT_ERROR_DB_FAILED;
+       }
+
+       bool is_success = account_manager_call_account_update_sync_status_by_id_sync(acc_mgr, account_db_id, sync_status, (int)uid, NULL, &error);
        _account_manager_release_instance();
 
        error_code = _account_get_error_code(is_success, error);
@@ -2050,8 +2136,14 @@ ACCOUNT_API int account_type_query_provider_feature_by_app_id(provider_feature_c
                return ACCOUNT_ERROR_PERMISSION_DENIED;
        }
 
+       uid_t uid = -1;
+       if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+               ACCOUNT_ERROR("pkgmgr_installer_info_get_target_uid() fail");
+               return ACCOUNT_ERROR_DB_FAILED;
+       }
+
        GVariant *feature_list_variant = NULL;
-       bool is_success = account_manager_call_account_type_query_provider_feature_by_app_id_sync(acc_mgr, app_id, (int)getuid(), &feature_list_variant, NULL, &error);
+       bool is_success = account_manager_call_account_type_query_provider_feature_by_app_id_sync(acc_mgr, app_id, (int)uid, &feature_list_variant, NULL, &error);
        _account_manager_release_instance();
 
        _INFO("account_manager_call_account_type_query_provider_feature_by_app_id_sync end=[%d]", is_success);
@@ -2108,7 +2200,13 @@ ACCOUNT_API bool account_type_query_supported_feature(const char *app_id, const
                return false;
        }
 
-       bool is_success = account_manager_call_account_type_query_supported_feature_sync(acc_mgr, app_id, capability, (int)getuid(), &is_supported, NULL, &error);
+       uid_t uid = -1;
+       if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+               ACCOUNT_ERROR("pkgmgr_installer_info_get_target_uid() fail");
+               return ACCOUNT_ERROR_DB_FAILED;
+       }
+
+       bool is_success = account_manager_call_account_type_query_supported_feature_sync(acc_mgr, app_id, capability, (int)uid, &is_supported, NULL, &error);
        _account_manager_release_instance();
 
        _INFO("account_manager_call_account_type_query_supported_feature_sync end=[%d]", is_success);
@@ -2400,7 +2498,13 @@ ACCOUNT_INTERNAL_API int account_type_update_to_db_by_app_id(const account_type_
                return ACCOUNT_ERROR_INVALID_PARAMETER;
        }
 
-       bool is_success = account_manager_call_account_type_update_to_db_by_app_id_sync(acc_mgr, account_type_variant, app_id, (int)getuid(), NULL, &error);
+       uid_t uid = -1;
+       if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+               ACCOUNT_ERROR("pkgmgr_installer_info_get_target_uid() fail");
+               return ACCOUNT_ERROR_DB_FAILED;
+       }
+
+       bool is_success = account_manager_call_account_type_update_to_db_by_app_id_sync(acc_mgr, account_type_variant, app_id, (int)uid, NULL, &error);
        _account_manager_release_instance();
 
        error_code = _account_get_error_code(is_success, error);
@@ -2427,8 +2531,9 @@ ACCOUNT_INTERNAL_API int account_type_delete_by_app_id(const char *app_id)
        uid_t uid = -1;
        if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
                _ERR("pkgmgr_installer_info_get_target_uid() fail");
-               return ACCOUNT_ERROR_DB_NOT_OPENED;
+               return ACCOUNT_ERROR_DB_FAILED;
        }
+
        bool is_success = account_manager_call_account_type_delete_by_app_id_sync(acc_mgr, app_id, (int)uid, NULL, &error);
        _account_manager_release_instance();
 
@@ -2453,8 +2558,14 @@ ACCOUNT_API int account_type_query_label_by_app_id(account_label_cb callback, co
                return ACCOUNT_ERROR_PERMISSION_DENIED;
        }
 
+       uid_t uid = -1;
+       if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+               ACCOUNT_ERROR("pkgmgr_installer_info_get_target_uid() fail");
+               return ACCOUNT_ERROR_DB_FAILED;
+       }
+
        GVariant *label_list_variant = NULL;
-       bool is_success = account_manager_call_account_type_query_label_by_app_id_sync(acc_mgr, app_id, (int)getuid(), &label_list_variant, NULL, &error);
+       bool is_success = account_manager_call_account_type_query_label_by_app_id_sync(acc_mgr, app_id, (int)uid, &label_list_variant, NULL, &error);
        _account_manager_release_instance();
 
        int ret = _account_get_error_code(is_success, error);
@@ -2500,10 +2611,16 @@ ACCOUNT_API int account_type_query_by_app_id(const char *app_id, account_type_h
                return ACCOUNT_ERROR_PERMISSION_DENIED;
        }
 
+       uid_t uid = -1;
+       if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+               ACCOUNT_ERROR("pkgmgr_installer_info_get_target_uid() fail");
+               return ACCOUNT_ERROR_DB_FAILED;
+       }
+
        GVariant *account_type_variant = NULL;
        account_type_s *in_data = (account_type_s *)*account_type;
 
-       bool is_success = account_manager_call_account_type_query_by_app_id_sync(acc_mgr, app_id, (int)getuid(), &account_type_variant, NULL, &error);
+       bool is_success = account_manager_call_account_type_query_by_app_id_sync(acc_mgr, app_id, (int)uid, &account_type_variant, NULL, &error);
        _account_manager_release_instance();
 
        int ret = _account_get_error_code(is_success, error);
@@ -2544,9 +2661,15 @@ ACCOUNT_API int account_type_foreach_account_type_from_db(account_type_cb callba
                return ACCOUNT_ERROR_PERMISSION_DENIED;
        }
 
+       uid_t uid = -1;
+       if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+               ACCOUNT_ERROR("pkgmgr_installer_info_get_target_uid() fail");
+               return ACCOUNT_ERROR_DB_FAILED;
+       }
+
        GVariant *account_type_list_variant = NULL;
        _INFO("before account_type_query_all_sync()");
-       bool is_success = account_manager_call_account_type_query_all_sync(acc_mgr, (int)getuid(), &account_type_list_variant, NULL, &error);
+       bool is_success = account_manager_call_account_type_query_all_sync(acc_mgr, (int)uid, &account_type_list_variant, NULL, &error);
        _account_manager_release_instance();
 
        _INFO("after account_type_query_all_sync()");
@@ -2596,9 +2719,15 @@ ACCOUNT_API int account_type_query_label_by_locale(const char *app_id, const cha
                return ACCOUNT_ERROR_PERMISSION_DENIED;
        }
 
+       uid_t uid = -1;
+       if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+               ACCOUNT_ERROR("pkgmgr_installer_info_get_target_uid() fail");
+               return ACCOUNT_ERROR_DB_FAILED;
+       }
+
        char *label_temp = NULL;
        _INFO("before account_type_query_label_by_locale_sync()");
-       bool is_success = account_manager_call_account_type_query_label_by_locale_sync(acc_mgr, app_id, locale, (int)getuid(), &label_temp, NULL, &error);
+       bool is_success = account_manager_call_account_type_query_label_by_locale_sync(acc_mgr, app_id, locale, (int)uid, &label_temp, NULL, &error);
        _account_manager_release_instance();
 
        _INFO("after account_type_query_label_by_locale_sync() : is_success=%d", is_success);
@@ -2638,8 +2767,14 @@ ACCOUNT_API int account_type_query_by_provider_feature(account_type_cb callback,
                return ACCOUNT_ERROR_PERMISSION_DENIED;
        }
 
+       uid_t uid = -1;
+       if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+               ACCOUNT_ERROR("pkgmgr_installer_info_get_target_uid() fail");
+               return ACCOUNT_ERROR_DB_FAILED;
+       }
+
        GVariant *account_type_list_variant = NULL;
-       bool is_success = account_manager_call_account_type_query_by_provider_feature_sync(acc_mgr, key, (int)getuid(), &account_type_list_variant, NULL, &error);
+       bool is_success = account_manager_call_account_type_query_by_provider_feature_sync(acc_mgr, key, (int)uid, &account_type_list_variant, NULL, &error);
        _account_manager_release_instance();
 
        int ret = _account_get_error_code(is_success, error);
@@ -2689,7 +2824,13 @@ ACCOUNT_API int account_type_query_app_id_exist(const char *app_id)
                return ACCOUNT_ERROR_PERMISSION_DENIED;
        }
 
-       bool is_success = account_manager_call_account_type_query_app_id_exist_sync(acc_mgr, app_id, (int)getuid(), NULL, &error);
+       uid_t uid = -1;
+       if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+               ACCOUNT_ERROR("pkgmgr_installer_info_get_target_uid() fail");
+               return ACCOUNT_ERROR_DB_FAILED;
+       }
+
+       bool is_success = account_manager_call_account_type_query_app_id_exist_sync(acc_mgr, app_id, (int)uid, NULL, &error);
        _account_manager_release_instance();
 
        error_code = _account_get_error_code(is_success, error);
index a58b542e70bc57bf9c70c41d24e720f6ef069104..ad92f8b3ac26d325fe0e58889293b1d878b83fe8 100644 (file)
@@ -393,7 +393,7 @@ ACCOUNT_INTERNAL_API int account_delete_from_db_by_package_name_offline(const ch
                return ACCOUNT_ERROR_DB_NOT_OPENED;
        }
 
-       if (uid != 0) {
+       if (uid != OWNER_ROOT || uid != GLOBAL_USER) {
                _ERR("current process user is not root, uid=%d", uid);
                return_code = ACCOUNT_ERROR_PERMISSION_DENIED;
                goto RETURN;