Fix offline api issue and Remove debug code 22/143422/2 accepted/tizen/4.0/unified/20170828.223932 accepted/tizen/unified/20170816.053903 submit/tizen/20170810.013957 submit/tizen_4.0/20170828.100002 tizen_4.0.IoT.p1_release tizen_4.0.m2_release
authorJooseok Song <seogii.song@samsung.com>
Thu, 10 Aug 2017 01:13:31 +0000 (10:13 +0900)
committerJooseok Song <seogii.song@samsung.com>
Thu, 10 Aug 2017 01:26:13 +0000 (10:26 +0900)
Change-Id: Idc22e8992a191c47ebf11d028176f60c5811a840

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

index 44f8d9f7ccfa08fb6a67642e8e2750914e197067..eee23425ee0068bc965583c633a6046367c14e21 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libaccount-service
 Summary:    Account DB library
-Version:    0.4.17
+Version:    0.4.18
 Release:    1
 Group:      Social & Content/API
 License:    Apache-2.0
index b7e970371ad1723ce84af51c53d3c2640f9901c1..20982f3540694737ff6deea8778d49b489c1a099 100644 (file)
@@ -80,10 +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)
@@ -104,10 +104,10 @@ static int _account_user_db_open(sqlite3 **p_hAccountDB, int mode, uid_t uid)
                ret = chmod(account_db_path, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
                ACCOUNT_DEBUG("chmod result = [%d]", ret);
 
-               //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);
+               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);
@@ -151,12 +151,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");
@@ -173,6 +175,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);
 
@@ -192,10 +195,10 @@ static int _account_global_db_open(int mode)
                        ret = chmod(account_db_path, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
                        ACCOUNT_DEBUG("chmod result = [%d]", ret);
 
-                       //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);
+                       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);
@@ -272,7 +275,6 @@ static int _account_global_db_close(void)
 ACCOUNT_INTERNAL_API int account_type_insert_to_db_offline(account_type_h account_type, int *account_type_id)
 {
        _INFO("account_type_insert_to_db starting");
-       fprintf(stderr, "\\n account_type_insert_to_db_offline \\n");
 
        ACCOUNT_RETURN_VAL((account_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT TYPE HANDLE IS NULL"));
        ACCOUNT_RETURN_VAL((account_type_id != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT TYPE ID POINTER IS NULL"));
@@ -283,7 +285,6 @@ ACCOUNT_INTERNAL_API int account_type_insert_to_db_offline(account_type_h accoun
        account_type_s *account_type_data = NULL;
 
        _INFO("account_manager_account_type_add start");
-       fprintf(stderr, "\\n account_manager_account_type_add \\n");
 
        guint pid = getpid();
        _INFO("client pid = [%u]", pid);
@@ -291,13 +292,11 @@ ACCOUNT_INTERNAL_API int account_type_insert_to_db_offline(account_type_h accoun
        return_code = _account_global_db_open(1);
        if (return_code != ACCOUNT_ERROR_NONE) {
                _ERR("_account_global_db_open() error, ret = %d", return_code);
-               fprintf(stderr, "\\n _account_global_db_open() error, ret = %d \\n", return_code);
                goto RETURN;
        }
 
        if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
                ACCOUNT_ERROR("pkgmgr_installer_info_get_target_uid() fail");
-               fprintf(stderr, "\\n pkgmgr_installer_info_get_target_uid() fail \\n");
                return ACCOUNT_ERROR_DB_NOT_OPENED;
        }
 
@@ -308,30 +307,24 @@ ACCOUNT_INTERNAL_API int account_type_insert_to_db_offline(account_type_h accoun
 
        if (uid != OWNER_ROOT && uid != GLOBAL_USER) {
                _ERR("current process is not root user nor global user, uid=%d", uid);
-               fprintf(stderr, "\\n current process is not root user nor global user, uid=%d \\n", uid);
                goto RETURN;
        }
 
        account_type_data = (account_type_s *)account_type;
        if (account_type_data->app_id == NULL) {
                _ERR("app id of account_type_h is null");
-               fprintf(stderr, "\\n app id of account_type_h is null");
                return ACCOUNT_ERROR_INVALID_PARAMETER;
        }
        if (_account_type_check_duplicated(g_hAccountGlobalDB, account_type_data->app_id)) {
                _ERR("account_type duplicated, app_id=[%s]", account_type_data->app_id);
-               fprintf(stderr, "account_type duplicated, app_id=[%s]\\n", account_type_data->app_id);
                return ACCOUNT_ERROR_DUPLICATED;
        }
 
        _INFO("before _account_type_insert_to_db");
-       fprintf(stderr, "\\n before _account_type_insert_to_dbl");
        return_code = _account_type_insert_to_db(g_hAccountGlobalDB, account_type_data, &db_id);
        _INFO("after _account_type_insert_to_db");
-       fprintf(stderr, "\\n after _account_type_insert_to_dbl");
        if (return_code != ACCOUNT_ERROR_NONE) {
                _ERR("_account_type_insert_to_db error");
-               fprintf(stderr, "\\n _account_type_insert_to_db error : %d\\n", return_code);
                goto RETURN;
        }
 
@@ -340,15 +333,13 @@ ACCOUNT_INTERNAL_API int account_type_insert_to_db_offline(account_type_h accoun
 
 RETURN:
        _INFO("account_manager_account_type_add end");
-       fprintf(stderr, "\\n account_manager_account_type_add end\\n");
 
        if (g_hAccountUserDB == NULL)
                return return_code;
 
        return_code = _account_global_db_close();
        if (return_code != ACCOUNT_ERROR_NONE)
-               fprintf(stderr, "_account_global_db_close() fail[%d]", return_code);
-               //ACCOUNT_DEBUG("_account_global_db_close() fail[%d]", return_code);
+               ACCOUNT_DEBUG("_account_global_db_close() fail[%d]", return_code);
 
        return return_code;
 }