From: Ickhee Woo Date: Wed, 21 Sep 2016 02:02:26 +0000 (-0700) Subject: Revert "fix for internal UTC" X-Git-Tag: submit/tizen/20160921.060732~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7599de33aba8521aa15dd76ba25455e6fcdf856c;p=platform%2Fcore%2Fapi%2Flibaccount-service.git Revert "fix for internal UTC" This reverts commit ca242638b0fa0b465da2d2e435d0f395765b3d67. Change-Id: I17b1677697e2c44e40882f9997980f11464d1ae9 --- diff --git a/src/account.c b/src/account.c index 0de1e17..c11544d 100644 --- a/src/account.c +++ b/src/account.c @@ -243,14 +243,8 @@ 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)uid, &db_id, NULL, &error); + bool is_success = account_manager_call_account_add_sync(acc_mgr, account_serialized, (int)getuid(), &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."); @@ -284,15 +278,9 @@ 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)uid, &account_serialized_old, NULL, &error); + 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); if (!is_success) { error_code = _account_get_error_code(is_success, error); @@ -304,7 +292,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)uid, NULL, &error); + is_success = account_manager_call_account_delete_from_db_by_id_sync(acc_mgr, account_db_id, (int)getuid(), NULL, &error); _account_manager_release_instance(); if (!is_success) { @@ -336,14 +324,8 @@ 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)uid, &account_list_variant, NULL, &error); + bool is_success = account_manager_call_account_query_account_by_user_name_sync(acc_mgr, user_name, (int)getuid(), &account_list_variant, NULL, &error); error_code = _account_get_error_code(is_success, error); g_clear_error(&error); @@ -361,7 +343,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)uid, NULL, &error); + is_success = account_manager_call_account_delete_from_db_by_user_name_sync(acc_mgr, user_name, package_name, (int)getuid(), NULL, &error); _account_manager_release_instance(); if (!is_success) { @@ -394,7 +376,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)uid, &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)getuid(), &account_list_variant, NULL, &error); error_code = _account_get_error_code(is_success, error); if (error_code != ACCOUNT_ERROR_NONE) @@ -412,14 +394,7 @@ int _account_delete_from_db_by_package_name(const char *package_name, bool permi return ACCOUNT_ERROR_NO_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; - } - - bool is_success = account_manager_call_account_delete_from_db_by_package_name_sync(acc_mgr, package_name, permission, (int)uid, NULL, &error); + bool is_success = account_manager_call_account_delete_from_db_by_package_name_sync(acc_mgr, package_name, permission, (int)getuid(), NULL, &error); _account_manager_release_instance(); if (!is_success) { @@ -455,15 +430,9 @@ 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)uid, &account_serialized_old, NULL, &error); + bool is_success = account_manager_call_account_query_account_by_account_id_sync(acc_mgr, account_id, (int)getuid(), &account_serialized_old, NULL, &error); if (!is_success) { error_code = _account_get_error_code(is_success, error); @@ -476,7 +445,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)uid, NULL, &error); + is_success = account_manager_call_account_update_to_db_by_id_sync(acc_mgr, account_serialized, account_id, (int)getuid(), NULL, &error); _account_manager_release_instance(); if (!is_success) { @@ -521,9 +490,8 @@ 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_FAILED; + return ACCOUNT_ERROR_DB_NOT_OPENED; } - 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) { @@ -545,7 +513,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)uid, NULL, &error); + is_success = account_manager_call_account_update_to_db_by_id_ex_sync(acc_mgr, account_serialized, account_id, (int)getuid(), NULL, &error); _INFO("after call update() : is_success=%d", is_success); _account_manager_release_instance(); @@ -578,15 +546,9 @@ 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)uid, &account_serialized_old, NULL, &error); + 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); if (!is_success) { error_code = _account_get_error_code(is_success, error); @@ -598,7 +560,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)uid, NULL, &error); + 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); _account_manager_release_instance(); if (!is_success) { @@ -1446,14 +1408,8 @@ 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)uid, &account_list_variant, NULL, &error); + bool is_success = account_manager_call_account_query_all_sync(acc_mgr, (int)getuid(), &account_list_variant, NULL, &error); _account_manager_release_instance(); int error_code = _account_get_error_code(is_success, error); @@ -1502,14 +1458,8 @@ 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)uid, &account_variant, NULL, &error); + bool is_success = account_manager_call_account_query_account_by_account_id_sync(acc_mgr, account_db_id, (int)getuid(), &account_variant, NULL, &error); _account_manager_release_instance(); int error_code = _account_get_error_code(is_success, error); @@ -1553,14 +1503,8 @@ 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)uid, &account_list_variant, NULL, &error); + bool is_success = account_manager_call_account_query_account_by_user_name_sync(acc_mgr, user_name, (int)getuid(), &account_list_variant, NULL, &error); _account_manager_release_instance(); int error_code = _account_get_error_code(is_success, error); @@ -1611,10 +1555,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_FAILED; + return ACCOUNT_ERROR_DB_NOT_OPENED; } - bool is_success = account_manager_call_account_query_account_by_package_name_sync(acc_mgr, package_name, (int)uid, &account_list_variant, NULL, &error); + bool is_success = account_manager_call_account_query_account_by_package_name_sync(acc_mgr, package_name, (int)getuid(), &account_list_variant, NULL, &error); _account_manager_release_instance(); int error_code = _account_get_error_code(is_success, error); @@ -1666,14 +1610,8 @@ 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)uid, &account_list_variant, NULL, &error); + 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); _account_manager_release_instance(); int error_code = _account_get_error_code(is_success, error); @@ -1718,14 +1656,8 @@ 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)uid, &account_list_variant, NULL, &error); + bool is_success = account_manager_call_account_query_account_by_capability_type_sync(acc_mgr, capability_type, (int)getuid(), &account_list_variant, NULL, &error); _account_manager_release_instance(); int error_code = _account_get_error_code(is_success, error); @@ -1770,14 +1702,8 @@ 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)uid, &capability_list_variant, NULL, &error); + bool is_success = account_manager_call_account_query_capability_by_account_id_sync(acc_mgr, account_id, (int)getuid(), &capability_list_variant, NULL, &error); _account_manager_release_instance(); int error_code = _account_get_error_code(is_success, error); @@ -1830,14 +1756,8 @@ 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)uid, &temp_count, NULL, &error); + bool is_success = account_manager_call_account_get_total_count_from_db_sync(acc_mgr, include_hidden, (int)getuid(), &temp_count, NULL, &error); _account_manager_release_instance(); int error_code = _account_get_error_code(is_success, error); @@ -1883,13 +1803,7 @@ ACCOUNT_API int account_update_sync_status_by_id(int account_db_id, const accoun 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; - } - - bool is_success = account_manager_call_account_update_sync_status_by_id_sync(acc_mgr, account_db_id, sync_status, (int)uid, NULL, &error); + bool is_success = account_manager_call_account_update_sync_status_by_id_sync(acc_mgr, account_db_id, sync_status, (int)getuid(), NULL, &error); _account_manager_release_instance(); error_code = _account_get_error_code(is_success, error); @@ -2136,14 +2050,8 @@ 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)uid, &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)getuid(), &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); @@ -2200,13 +2108,7 @@ ACCOUNT_API bool account_type_query_supported_feature(const char *app_id, const return false; } - 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); + bool is_success = account_manager_call_account_type_query_supported_feature_sync(acc_mgr, app_id, capability, (int)getuid(), &is_supported, NULL, &error); _account_manager_release_instance(); _INFO("account_manager_call_account_type_query_supported_feature_sync end=[%d]", is_success); @@ -2498,13 +2400,7 @@ ACCOUNT_INTERNAL_API int account_type_update_to_db_by_app_id(const account_type_ return ACCOUNT_ERROR_INVALID_PARAMETER; } - 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); + 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); _account_manager_release_instance(); error_code = _account_get_error_code(is_success, error); @@ -2531,9 +2427,8 @@ 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_FAILED; + return ACCOUNT_ERROR_DB_NOT_OPENED; } - 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(); @@ -2558,14 +2453,8 @@ 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)uid, &label_list_variant, NULL, &error); + 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); _account_manager_release_instance(); int ret = _account_get_error_code(is_success, error); @@ -2611,16 +2500,10 @@ 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)uid, &account_type_variant, NULL, &error); + bool is_success = account_manager_call_account_type_query_by_app_id_sync(acc_mgr, app_id, (int)getuid(), &account_type_variant, NULL, &error); _account_manager_release_instance(); int ret = _account_get_error_code(is_success, error); @@ -2661,15 +2544,9 @@ 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)uid, &account_type_list_variant, NULL, &error); + bool is_success = account_manager_call_account_type_query_all_sync(acc_mgr, (int)getuid(), &account_type_list_variant, NULL, &error); _account_manager_release_instance(); _INFO("after account_type_query_all_sync()"); @@ -2719,15 +2596,9 @@ 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)uid, &label_temp, NULL, &error); + bool is_success = account_manager_call_account_type_query_label_by_locale_sync(acc_mgr, app_id, locale, (int)getuid(), &label_temp, NULL, &error); _account_manager_release_instance(); _INFO("after account_type_query_label_by_locale_sync() : is_success=%d", is_success); @@ -2767,14 +2638,8 @@ 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)uid, &account_type_list_variant, NULL, &error); + bool is_success = account_manager_call_account_type_query_by_provider_feature_sync(acc_mgr, key, (int)getuid(), &account_type_list_variant, NULL, &error); _account_manager_release_instance(); int ret = _account_get_error_code(is_success, error); @@ -2824,13 +2689,7 @@ ACCOUNT_API int account_type_query_app_id_exist(const char *app_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; - } - - bool is_success = account_manager_call_account_type_query_app_id_exist_sync(acc_mgr, app_id, (int)uid, NULL, &error); + bool is_success = account_manager_call_account_type_query_app_id_exist_sync(acc_mgr, app_id, (int)getuid(), NULL, &error); _account_manager_release_instance(); error_code = _account_get_error_code(is_success, error); diff --git a/src/account_offline.c b/src/account_offline.c index ad92f8b..a58b542 100644 --- a/src/account_offline.c +++ b/src/account_offline.c @@ -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 != OWNER_ROOT || uid != GLOBAL_USER) { + if (uid != 0) { _ERR("current process user is not root, uid=%d", uid); return_code = ACCOUNT_ERROR_PERMISSION_DENIED; goto RETURN;