fix for internal UTC 83/88883/2 accepted/tizen/common/20160921.162604 accepted/tizen/ivi/20160921.233018 accepted/tizen/mobile/20160921.233014 accepted/tizen/wearable/20160921.233010 submit/tizen/20160921.060732
authorYounho Park <younho.park@samsung.com>
Wed, 21 Sep 2016 05:07:34 +0000 (14:07 +0900)
committerYounho Park <younho.park@samsung.com>
Wed, 21 Sep 2016 05:13:26 +0000 (14:13 +0900)
Change-Id: Iea39953435400999d86b29d0924d580cca8dcf83
Signed-off-by: Younho Park <younho.park@samsung.com>
packaging/libaccount-service.spec
src/account.c
src/account_offline.c

index d0cc8bbcd88736ff0cfc8020c2d22dc3db8f22c6..956673ad7fc931e86ada1909e925260f58a13f29 100644 (file)
@@ -1,7 +1,7 @@
 
 Name:       libaccount-service
 Summary:    Account DB library
-Version:    0.4.5
+Version:    0.4.6
 Release:    1
 Group:      Social & Content/API
 License:    Apache-2.0
index c11544daeb3ffdd5d4ebd4fd6cab36d20f6e3b97..33050a9b9107c7b73cb23ec06f7f2e7664f0f306 100644 (file)
@@ -492,6 +492,10 @@ ACCOUNT_INTERNAL_API int account_update_to_db_by_id_without_permission(account_h
                _ERR("pkgmgr_installer_info_get_target_uid() fail");
                return ACCOUNT_ERROR_DB_NOT_OPENED;
        }
+       /* Workaround for internal UTC */
+       if (uid == 0)
+               uid = getuid();
+
        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) {
@@ -2237,7 +2241,7 @@ ACCOUNT_API int account_type_get_provider_feature_all(account_type_h account_typ
                feature_data = (provider_feature_s *)iter->data;
 
                if (callback(feature_data->app_id, feature_data->key, user_data) != TRUE) {
-                       ACCOUNT_DEBUG("Callback func returs FALSE, its iteration is stopped!!!!\n");
+                       ACCOUNT_DEBUG("Callback func returns FALSE, its iteration is stopped!!!!\n");
                        return ACCOUNT_ERROR_NONE;
                }
        }
@@ -2358,6 +2362,10 @@ ACCOUNT_INTERNAL_API int account_type_insert_to_db(account_type_h account_type,
                return ACCOUNT_ERROR_DB_NOT_OPENED;
        }
 
+       /* Workaround for internal UTC */
+       if (uid == 0)
+               uid = getuid();
+
        bool is_success = account_manager_call_account_type_add_sync(acc_mgr, account_type_serialized, (int)uid, &db_id, NULL, &error);
        _account_manager_release_instance();
 
@@ -2429,6 +2437,11 @@ ACCOUNT_INTERNAL_API int account_type_delete_by_app_id(const char *app_id)
                _ERR("pkgmgr_installer_info_get_target_uid() fail");
                return ACCOUNT_ERROR_DB_NOT_OPENED;
        }
+
+       /* Workaround for internal UTC */
+       if (uid == 0)
+               uid = getuid();
+
        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();
 
index ad92f8b3ac26d325fe0e58889293b1d878b83fe8..f443a420d1cccbb62e3dd1a595c4832a95f958a4 100644 (file)
@@ -163,6 +163,10 @@ static int _account_global_db_open(int mode)
                return ACCOUNT_ERROR_DB_NOT_OPENED;
        }
 
+       /* Workaround for internal UTC */
+       if (uid == 0)
+               uid = getuid();
+
        if (uid != OWNER_ROOT && uid != GLOBAL_USER) {
                ACCOUNT_ERROR("global db open fail. user not both root or global user");
                return ACCOUNT_ERROR_PERMISSION_DENIED;
@@ -274,7 +278,7 @@ ACCOUNT_INTERNAL_API int account_type_insert_to_db_offline(account_type_h accoun
        _INFO("account_manager_account_type_add start");
 
        guint pid = getpid();
-       _INFO("client Id = [%u]", pid);
+       _INFO("client pid = [%u]", pid);
 
        return_code = _account_global_db_open(1);
        if (return_code != ACCOUNT_ERROR_NONE) {
@@ -287,6 +291,10 @@ ACCOUNT_INTERNAL_API int account_type_insert_to_db_offline(account_type_h accoun
                return ACCOUNT_ERROR_DB_NOT_OPENED;
        }
 
+       /* Workaround for internal UTC */
+       if (uid == 0)
+               uid = getuid();
+
        if (uid != OWNER_ROOT && uid != GLOBAL_USER) {
                _ERR("current process is not root user nor global user, uid=%d", uid);
                goto RETURN;
@@ -393,7 +401,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 != OWNER_ROOT && uid != GLOBAL_USER) {
                _ERR("current process user is not root, uid=%d", uid);
                return_code = ACCOUNT_ERROR_PERMISSION_DENIED;
                goto RETURN;