From 810d90e789bc587ee96f20f0382d7335471fde7c Mon Sep 17 00:00:00 2001 From: Ickhee Woo Date: Wed, 30 Nov 2016 20:44:52 +0900 Subject: [PATCH] adjust global DB path for owner user Change-Id: Ib511355543a5d6267c020843e1ffde6a4eefd096 Signed-off-by: Ickhee Woo --- packaging/libaccount-service.spec | 3 +-- src/account.c | 36 +++++++++++++++++++++++++------ src/account_offline.c | 2 +- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/packaging/libaccount-service.spec b/packaging/libaccount-service.spec index 85a106c..c5209a6 100644 --- a/packaging/libaccount-service.spec +++ b/packaging/libaccount-service.spec @@ -1,7 +1,6 @@ - Name: libaccount-service Summary: Account DB library -Version: 0.4.10 +Version: 0.4.11 Release: 1 Group: Social & Content/API License: Apache-2.0 diff --git a/src/account.c b/src/account.c index 9bdee93..f083f3d 100644 --- a/src/account.c +++ b/src/account.c @@ -1465,8 +1465,12 @@ ACCOUNT_API int account_query_account_by_account_id(int account_db_id, account_h return ACCOUNT_ERROR_PERMISSION_DENIED; } + uid_t uid = (int)getuid(); + if (uid < 5001) + uid = 5001; + 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); @@ -1510,8 +1514,12 @@ ACCOUNT_API int account_query_account_by_user_name(account_cb callback, const ch return ACCOUNT_ERROR_PERMISSION_DENIED; } + uid_t uid = (int)getuid(); + if (uid < 5001) + uid = 5001; + 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); @@ -1565,7 +1573,11 @@ ACCOUNT_API int account_query_account_by_package_name(account_cb callback, const return ACCOUNT_ERROR_DB_NOT_OPENED; } - bool is_success = account_manager_call_account_query_account_by_package_name_sync(acc_mgr, package_name, (int)getuid(), &account_list_variant, NULL, &error); + uid = (int)getuid(); + if (uid < 5001) + uid = 5001; + + 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); @@ -1617,8 +1629,12 @@ ACCOUNT_API int account_query_account_by_capability(account_cb callback, const c return ACCOUNT_ERROR_PERMISSION_DENIED; } + uid_t uid = (int)getuid(); + if (uid < 5001) + uid = 5001; + 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); @@ -1663,8 +1679,12 @@ ACCOUNT_API int account_query_account_by_capability_type(account_cb callback, co return ACCOUNT_ERROR_PERMISSION_DENIED; } + uid_t uid = (int)getuid(); + if (uid < 5001) + uid = 5001; + 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); @@ -1709,8 +1729,12 @@ ACCOUNT_API int account_query_capability_by_account_id(capability_cb callback, i return ACCOUNT_ERROR_PERMISSION_DENIED; } + uid_t uid = (int)getuid(); + if (uid < 5001) + uid = 5001; + 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); diff --git a/src/account_offline.c b/src/account_offline.c index 5e9f891..7aa8922 100644 --- a/src/account_offline.c +++ b/src/account_offline.c @@ -172,7 +172,7 @@ static int _account_global_db_open(int mode) return ACCOUNT_ERROR_PERMISSION_DENIED; } - ACCOUNT_GET_OWNER_DB_PATH(account_db_path, sizeof(account_db_path), 5001); + ACCOUNT_GET_GLOBAL_DB_PATH(account_db_path, sizeof(account_db_path)); _INFO("account_db_path canonicalized = %s", account_db_path); -- 2.34.1