From: Jooseok Song Date: Thu, 13 Jul 2017 03:07:57 +0000 (+0900) Subject: Add ownership of journal file X-Git-Tag: submit/tizen/20170728.003408~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F11%2F138611%2F2;p=platform%2Fcore%2Fapi%2Flibaccount-service.git Add ownership of journal file Change-Id: Ic9c245a4ddb22864a6c8eb39ef526754797a61c7 --- diff --git a/packaging/libaccount-service.spec b/packaging/libaccount-service.spec index c44a3b8..417104e 100644 --- a/packaging/libaccount-service.spec +++ b/packaging/libaccount-service.spec @@ -1,6 +1,6 @@ Name: libaccount-service Summary: Account DB library -Version: 0.4.14 +Version: 0.4.15 Release: 1 Group: Social & Content/API License: Apache-2.0 diff --git a/src/account_offline.c b/src/account_offline.c index 2618adc..1bec0b6 100644 --- a/src/account_offline.c +++ b/src/account_offline.c @@ -80,11 +80,10 @@ static int _account_user_db_open(sqlite3 **p_hAccountDB, int mode, uid_t uid) int rc = 0; char account_db_dir[256] = {0, }; char account_db_path[256] = {0, }; - - ACCOUNT_MEMSET(account_db_dir, 0x00, sizeof(account_db_dir)); - ACCOUNT_MEMSET(account_db_path, 0x00, sizeof(account_db_path)); + char account_db_jn_path[256] = {0, }; ACCOUNT_GET_USER_DB_PATH(account_db_path, sizeof(account_db_path), uid); + ACCOUNT_GET_USER_DB_PATH(account_db_jn_path, sizeof(account_db_jn_path), uid); _INFO("account_db_path canonicalized = %s", account_db_path); if (!g_hAccountUserDB) @@ -98,11 +97,18 @@ static int _account_user_db_open(sqlite3 **p_hAccountDB, int mode, uid_t uid) ACCOUNT_DEBUG("chown result = [%d]", ret); ret = chmod(account_db_dir, S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH); ACCOUNT_DEBUG("chmod result = [%d]", ret); + rc = db_util_open(account_db_path, p_hAccountDB, DB_UTIL_REGISTER_HOOK_METHOD); ret = chown(account_db_path, SERVICE_FW_UID, SERVICE_FW_GID); ACCOUNT_DEBUG("chown result = [%d]", ret); ret = chmod(account_db_path, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); ACCOUNT_DEBUG("chmod result = [%d]", ret); + + rc = db_util_open(account_db_jn_path, &g_hAccountGlobalDB, DB_UTIL_REGISTER_HOOK_METHOD); + ret = chown(account_db_jn_path, SERVICE_FW_UID, SERVICE_FW_GID); + ACCOUNT_DEBUG("chown result = [%d]", ret); + ret = chmod(account_db_jn_path, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); + ACCOUNT_DEBUG("chmod result = [%d]", ret); } else { if (mode == ACCOUNT_DB_OPEN_READWRITE) rc = db_util_open(account_db_path, p_hAccountDB, DB_UTIL_REGISTER_HOOK_METHOD); @@ -146,12 +152,14 @@ static int _account_global_db_open(int mode) int rc = 0; char account_db_dir[256] = {0, }; char account_db_path[256] = {0, }; + char account_db_jn_path[256] = {0, }; uid_t uid = -1; _INFO("start to get DB path"); ACCOUNT_MEMSET(account_db_dir, 0x00, sizeof(account_db_dir)); ACCOUNT_MEMSET(account_db_path, 0x00, sizeof(account_db_path)); + ACCOUNT_MEMSET(account_db_jn_path, 0x00, sizeof(account_db_jn_path)); if (pkgmgr_installer_info_get_target_uid(&uid) < 0) { ACCOUNT_ERROR("pkgmgr_installer_info_get_target_uid() fail"); @@ -168,6 +176,7 @@ static int _account_global_db_open(int mode) } ACCOUNT_GET_GLOBAL_DB_PATH(account_db_path, sizeof(account_db_path)); + ACCOUNT_GET_GLOBAL_JN_PATH(account_db_jn_path, sizeof(account_db_jn_path)); _INFO("account_db_path canonicalized = %s", account_db_path); @@ -180,11 +189,18 @@ static int _account_global_db_open(int mode) ACCOUNT_DEBUG("chown result = [%d]", ret); ret = chmod(account_db_dir, S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH); ACCOUNT_DEBUG("chmod result = [%d]", ret); + rc = db_util_open(account_db_path, &g_hAccountGlobalDB, DB_UTIL_REGISTER_HOOK_METHOD); ret = chown(account_db_path, SERVICE_FW_UID, SERVICE_FW_GID); ACCOUNT_DEBUG("chown result = [%d]", ret); ret = chmod(account_db_path, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); ACCOUNT_DEBUG("chmod result = [%d]", ret); + + rc = db_util_open(account_db_jn_path, &g_hAccountGlobalDB, DB_UTIL_REGISTER_HOOK_METHOD); + ret = chown(account_db_jn_path, SERVICE_FW_UID, SERVICE_FW_GID); + ACCOUNT_DEBUG("chown result = [%d]", ret); + ret = chmod(account_db_jn_path, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); + ACCOUNT_DEBUG("chmod result = [%d]", ret); } else { if (mode == ACCOUNT_DB_OPEN_READWRITE) rc = db_util_open(account_db_path, &g_hAccountGlobalDB, DB_UTIL_REGISTER_HOOK_METHOD);