Add ownership of journal file 11/138611/2
authorJooseok Song <seogii.song@samsung.com>
Thu, 13 Jul 2017 03:07:57 +0000 (12:07 +0900)
committerJooseok Song <seogii.song@samsung.com>
Thu, 13 Jul 2017 06:21:47 +0000 (15:21 +0900)
Change-Id: Ic9c245a4ddb22864a6c8eb39ef526754797a61c7

packaging/libaccount-service.spec
src/account_offline.c

index c44a3b8..417104e 100644 (file)
@@ -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
index 2618adc..1bec0b6 100644 (file)
@@ -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);