apply pkgmgr-installer. 59/81759/1 accepted/tizen/common/20160812.140749 accepted/tizen/ivi/20160818.053158 accepted/tizen/mobile/20160818.053119 accepted/tizen/wearable/20160818.053142 submit/tizen/20160811.062803 submit/tizen/20160818.020045
authorjiseob.jang <jiseob.jang@samsung.com>
Thu, 28 Jul 2016 07:44:52 +0000 (16:44 +0900)
committerjiseob.jang <jiseob.jang@samsung.com>
Thu, 28 Jul 2016 07:44:52 +0000 (16:44 +0900)
Change-Id: I799940636487f82b69389f9c3bb2743fdfef0660
Signed-off-by: jiseob.jang <jiseob.jang@samsung.com>
CMakeLists.txt
packaging/account-parser.spec
src/account.c

index 315424c..184b0b1 100644 (file)
@@ -7,6 +7,7 @@ pkg_check_modules(account_pkgs REQUIRED
        capi-base-common
        libxml-2.0
        pkgmgr-info
+       pkgmgr-installer
        glib-2.0
        accounts-svc
        capi-appfw-app-manager
index 28c128b..26a25ec 100644 (file)
@@ -1,6 +1,6 @@
 Name:          account-parser
 Summary:       Account Parser Library
-Version:       0.1.0
+Version:       0.1.1
 Release:       0
 Group:         Social & Content/Other
 License:       Apache-2.0
@@ -14,6 +14,7 @@ BuildRequires:  pkgconfig(libxml-2.0)
 BuildRequires:  pkgconfig(glib-2.0)
 BuildRequires:  pkgconfig(pkgmgr)
 BuildRequires:  pkgconfig(pkgmgr-info)
+BuildRequires:  pkgconfig(pkgmgr-installer)
 BuildRequires:  pkgconfig(capi-appfw-app-manager)
 BuildRequires:  pkgconfig(libtzplatform-config)
 
index d1576b4..d020158 100644 (file)
@@ -23,6 +23,7 @@
 #include <account-types.h>
 #include <account_internal.h>
 #include <pkgmgr-info.h>
+#include <pkgmgr_installer_info.h>
 #include <app_manager.h>
 #include <tzplatform_config.h>
 
@@ -446,7 +447,11 @@ int _register_account_provider(xmlDocPtr docPtr, char* account_provider_app_id)
        {
                int account_type_db_id = 0;
                uid_t uid = -1;
-               uid = getuid();
+               if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+                       _E("pkgmgr_installer_info_get_target_uid() fail");
+                       goto CATCH;
+               }
+
                if (uid == OWNER_ROOT || uid == GLOBAL_USER) {
                        ret = account_type_insert_to_db_offline(account_type_handle, &account_type_db_id);
                } else {
@@ -485,7 +490,10 @@ int _unregister_account_provider(pkgmgrinfo_appinfo_h package_info_handle, void*
 
        int ret = ACCOUNT_ERROR_NONE;
        uid_t uid = -1;
-       uid = getuid();
+       if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+               _E("pkgmgr_installer_info_get_target_uid() fail");
+               goto CATCH;
+       }
 
        //To Do : delete accounts of this app from all user db.
        if (uid == OWNER_ROOT || uid == GLOBAL_USER) {
@@ -526,7 +534,11 @@ int _on_package_app_list_received_cb(pkgmgrinfo_appinfo_h handle, void *user_dat
        pkgmgrinfo_appinfo_get_appid(handle, &app_id);
        _D("appid : %s", app_id);
 
-       uid = getuid();
+       if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+               _E("pkgmgr_installer_info_get_target_uid() fail");
+               return -1;
+       }
+
        if (uid == OWNER_ROOT || uid == GLOBAL_USER) {
                ret = account_type_delete_by_app_id_offline((char*)app_id);
        } else {
@@ -566,7 +578,11 @@ int PKGMGR_PARSER_PLUGIN_UNINSTALL(xmlDocPtr docPtr, const char* packageId)
        int ret = -1;
        uid_t uid = 0;
 
-       uid = getuid();
+       if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+               _E("pkgmgr_installer_info_get_target_uid() fail");
+               return -1;
+       }
+
        if (uid == OWNER_ROOT || uid == GLOBAL_USER) {
                ret = pkgmgrinfo_pkginfo_get_pkginfo(packageId, &package_info_handle);
        } else {
@@ -603,7 +619,11 @@ int PKGMGR_PARSER_PLUGIN_PRE_UPGRADE(const char* packageId)
        int ret = -1;
        uid_t uid = 0;
 
-       uid = getuid();
+       if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+               _E("pkgmgr_installer_info_get_target_uid() fail");
+               return -1;
+       }
+
        if (uid == OWNER_ROOT || uid == GLOBAL_USER) {
                ret = pkgmgrinfo_pkginfo_get_pkginfo(packageId, &package_info_handle);
        } else {