Name: libaccount-service
Summary: Account DB library
-Version: 0.4.4
+Version: 0.4.5
Release: 1
Group: Social & Content/API
License: Apache-2.0
BuildRequires: pkgconfig(gio-unix-2.0)
BuildRequires: pkgconfig(account-common)
BuildRequires: pkgconfig(db-util)
+BuildRequires: pkgconfig(pkgmgr-installer)
%if "%{?profile}" == "tv"
#include <sys/stat.h>
#include <sys/types.h>
#include <pwd.h>
+#include <pkgmgr_installer_info.h>
#include <dbg.h>
#include <account_free.h>
ACCOUNT_MEMSET(account_db_dir, 0x00, sizeof(account_db_dir));
ACCOUNT_MEMSET(account_db_path, 0x00, sizeof(account_db_path));
- uid = getuid();
+ if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+ ACCOUNT_ERROR("pkgmgr_installer_info_get_target_uid() fail");
+ return ACCOUNT_ERROR_DB_NOT_OPENED;
+ }
+
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;
goto RETURN;
}
- uid = getuid();
+ if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+ ACCOUNT_ERROR("pkgmgr_installer_info_get_target_uid() fail");
+ return ACCOUNT_ERROR_DB_NOT_OPENED;
+ }
+
if (uid != OWNER_ROOT && uid != GLOBAL_USER) {
_ERR("current process is not root user nor global user, uid=%d", uid);
goto RETURN;
goto RETURN;
}
- uid_t uid = getuid();
+ uid_t uid;
+ if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+ ACCOUNT_ERROR("pkgmgr_installer_info_get_target_uid() fail");
+ return ACCOUNT_ERROR_DB_NOT_OPENED;
+ }
+
if (uid != OWNER_ROOT && uid != GLOBAL_USER) {
_ERR("current daemon is not root user, uid=%d", uid);
goto RETURN;
ACCOUNT_RETURN_VAL((package_name != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("package_name is null!"));
- uid = getuid();
+ if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+ ACCOUNT_ERROR("pkgmgr_installer_info_get_target_uid() fail");
+ return ACCOUNT_ERROR_DB_NOT_OPENED;
+ }
+
if (uid != 0) {
_ERR("current process user is not root, uid=%d", uid);
return_code = ACCOUNT_ERROR_PERMISSION_DENIED;