int pkgmgr_client_reinstall(pkgmgr_client *pc, const char *pkg_type, const char *pkgid,
const char *optional_file, pkgmgr_mode mode,
pkgmgr_handler event_cb, void *data);
-
+int pkgmgr_client_usr_reinstall(pkgmgr_client * pc, const char *pkg_type, const char *pkgid,
+ const char *optional_file, pkgmgr_mode mode,
+ pkgmgr_handler event_cb, void *data, uid_t uid);
/**
* @brief This API uninstalls package.
*
* @retval PKGMGR_R_ECOMM communication error
*/
int pkgmgr_client_get_size(pkgmgr_client * pc, const char *pkgid, pkgmgr_getsize_type get_type, pkgmgr_handler event_cb, void *data);
+int pkgmgr_client_usr_get_size(pkgmgr_client * pc, const char *pkgid, pkgmgr_getsize_type get_type, pkgmgr_handler event_cb, void *data, uid_t uid);
/**
* @brief This API provides package list
return ret;
}
-static int __get_size_process(pkgmgr_client * pc, const char *pkgid, pkgmgr_getsize_type get_type, pkgmgr_handler event_cb, void *data)
+static int __get_size_process(pkgmgr_client * pc, const char *pkgid, uid_t uid, pkgmgr_getsize_type get_type, pkgmgr_handler event_cb, void *data)
{
char *req_key = NULL;
int ret =0;
tryvm_if(cookie == NULL, ret = PKGMGR_R_ERROR, "__get_cookie_from_security_server is NULL");
/* request */
- ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_GET_SIZE, pkgtype, pkgid, args, cookie, 1);
+ ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_GET_SIZE, pkgtype, pkgid, args, cookie, uid, 1);
if (ret < 0)
_LOGE("comm_client_request failed, ret=%d\n", ret);
tryvm_if(cookie == NULL, ret = PKGMGR_R_ERROR, "__get_cookie_from_security_server is NULL");
/* 6. request */
- ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_TO_MOVER, pkgtype, pkgid, args, cookie, 1);
+ ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_TO_MOVER, pkgtype, pkgid, args, cookie,uid, 1);
if (ret < 0)
_LOGE("comm_client_request failed, ret=%d\n", ret);
/* 3. request activate */
if (service_type == PM_REQUEST_KILL_APP)
- ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_KILL_APP, pkgtype, pkgid, NULL, NULL, 1);
+ ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_KILL_APP, pkgtype, pkgid, NULL, NULL, uid, 1);
else if (service_type == PM_REQUEST_CHECK_APP)
- ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_CHECK_APP, pkgtype, pkgid, NULL, NULL, 1);
+ ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_CHECK_APP, pkgtype, pkgid, NULL, NULL, uid, 1);
if (ret < 0)
_LOGE("request failed, ret=%d\n", ret);
/******************* end of quote ************************/
/* 6. request install */
- ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_TO_INSTALLER, pkgtype, pkg_path, args, cookie, 1);
+ ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_TO_INSTALLER, pkgtype, pkg_path, args, cookie, uid, 1);
tryvm_if(ret < 0, ret = PKGMGR_R_ECOMM, "request failed, ret=%d", ret);
ret = req_id;
const char *optional_file, pkgmgr_mode mode,
pkgmgr_handler event_cb, void *data)
{
+ return pkgmgr_client_usr_reinstall(pc, pkg_type, pkgid, optional_file, mode, event_cb, data,GLOBAL_USER);
+}
+
+API int pkgmgr_client_usr_reinstall(pkgmgr_client * pc, const char *pkg_type, const char *pkgid,
+ const char *optional_file, pkgmgr_mode mode,
+ pkgmgr_handler event_cb, void *data, uid_t uid)
+{
char *pkgtype = NULL;
char *installer_path = NULL;
char *req_key = NULL;
/******************* end of quote ************************/
/* 6. request install */
- ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_TO_INSTALLER, pkgtype, pkgid, args, cookie, 1);
+ ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_TO_INSTALLER, pkgtype, pkgid, args, cookie, uid, 1);
tryvm_if(ret < 0, ret = PKGMGR_R_ECOMM, "request failed");
ret = req_id;
caller_pkgid = __get_caller_pkgid(uid);
if (caller_pkgid == NULL)
- _LOGE("caller dont have pkgid..\n");
+ _LOGD("caller dont have pkgid..\n");
/* Check for NULL value of pc */
retvm_if(pc == NULL, PKGMGR_R_EINVAL, "package manager client handle is NULL\n");
/******************* end of quote ************************/
/* 6. request install */
- ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_TO_INSTALLER, pkgtype, pkgid, args, cookie, 1);
+ ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_TO_INSTALLER, pkgtype, pkgid, args, cookie, uid, 1);
tryvm_if(ret < 0, ret = PKGMGR_R_ECOMM, "calloc failed");
ret = req_id;
/* 6. request install */
ret = comm_client_request(mpc->info.request.cc, req_key,
COMM_REQ_TO_MOVER, pkgtype, pkgid,
- args, cookie, 1);
+ args, cookie, uid, 1);
if (ret < 0) {
_LOGE("request failed, ret=%d\n", ret);
/******************* end of quote ************************/
/* 6. request install */
- ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_TO_MOVER, pkgtype, pkgid, args, cookie, 1);
+ ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_TO_MOVER, pkgtype, pkgid, args, cookie, uid, 1);
tryvm_if(ret < 0, ret = PKGMGR_R_ECOMM, "calloc failed");
ret = req_id;
retvm_if(req_key == NULL, PKGMGR_R_EINVAL, "req_key is NULL");
/* 3. request activate */
- ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_TO_ACTIVATOR, pkgtype, pkgid, "1 PKG", cookie, 1);
+ ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_TO_ACTIVATOR, pkgtype, pkgid, "1 PKG", cookie, uid, 1);
tryvm_if(ret < 0, ret = PKGMGR_R_ECOMM, "request failed, ret=%d", ret);
ret = PKGMGR_R_OK;
retvm_if(req_key == NULL, PKGMGR_R_EINVAL, "req_key is NULL");
/* 3. request activate */
- ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_TO_ACTIVATOR, pkgtype, pkgid, "0 PKG", cookie, 1);
+ ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_TO_ACTIVATOR, pkgtype, pkgid, "0 PKG", cookie, uid, 1);
tryvm_if(ret < 0, ret = PKGMGR_R_ECOMM, "request failed, ret=%d", ret);
ret = PKGMGR_R_OK;
retvm_if(req_key == NULL, PKGMGR_R_EINVAL, "req_key is NULL");
/* 3. request activate */
- ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_TO_ACTIVATOR, pkgtype, appid, "1 APP", cookie, 1);
+ ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_TO_ACTIVATOR, pkgtype, appid, "1 APP", cookie, uid, 1);
tryvm_if(ret < 0, ret = PKGMGR_R_ECOMM, "request failed, ret=%d", ret);
ret = PKGMGR_R_OK;
/******************* end of quote ************************/
/* 3. request activate */
- ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_TO_ACTIVATOR, pkgtype, appid, argsr, cookie, 1);
+ ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_TO_ACTIVATOR, pkgtype, appid, argsr, cookie, uid, 1);
tryvm_if(ret < 0, ret = PKGMGR_R_ECOMM, "request failed, ret=%d", ret);
ret = PKGMGR_R_OK;
retvm_if(req_key == NULL, PKGMGR_R_EINVAL, "req_key is NULL");
/* 3. request activate */
- ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_TO_ACTIVATOR, pkgtype, appid, "0 APP", cookie, 1);
+ ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_TO_ACTIVATOR, pkgtype, appid, "0 APP", cookie, uid, 1);
tryvm_if(ret < 0, ret = PKGMGR_R_ECOMM, "request failed, ret=%d", ret);
ret = PKGMGR_R_OK;
/* 6. request clear */
ret = comm_client_request(mpc->info.request.cc, req_key,
COMM_REQ_TO_CLEARER, pkgtype, appid,
- args, cookie, 1);
+ args, cookie, uid, 1);
if (ret < 0) {
_LOGE("request failed, ret=%d\n", ret);
tryvm_if(pc == NULL, ret = PKGMGR_R_EINVAL, "pc is NULL\n");
tryvm_if((service_mode < PM_GET_TOTAL_SIZE) || (service_mode >= PM_GET_MAX), ret = PKGMGR_R_EINVAL, "service_mode is wrong\n");
- ret = __get_size_process(pc, pkgid, (pkgmgr_getsize_type)service_mode, event_cb, data);
+ ret = __get_size_process(pc, pkgid, uid, (pkgmgr_getsize_type)service_mode, event_cb, data);
break;
case PM_REQUEST_KILL_APP:
return ret;
}
+
API int pkgmgr_client_get_size(pkgmgr_client * pc, const char *pkgid, pkgmgr_getsize_type get_type, pkgmgr_handler event_cb, void *data)
{
+ return pkgmgr_client_usr_get_size(pc, pkgid, get_type, event_cb, data, GLOBAL_USER);
+}
+
+API int pkgmgr_client_usr_get_size(pkgmgr_client * pc, const char *pkgid, pkgmgr_getsize_type get_type, pkgmgr_handler event_cb, void *data, uid_t uid)
+{
char *req_key = NULL;
int ret =0;
char *pkgtype = "rpm";
tryvm_if(cookie == NULL, ret = PKGMGR_R_ERROR, "__get_cookie_from_security_server is NULL");
/* request */
- ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_GET_SIZE, pkgtype, pkgid, args, cookie, 1);
+ ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_GET_SIZE, pkgtype, pkgid, args, cookie, uid, 1);
if (ret < 0)
_LOGE("comm_client_request failed, ret=%d\n", ret);
API int comm_client_request(comm_client *cc, const char *req_id,
const int req_type, const char *pkg_type,
const char *pkgid, const char *args,
- const char *cookie, int is_block);
+ const char *cookie, uid_t uid, int is_block);
API int comm_client_set_status_callback(int comm_status_type, comm_client *cc, status_cb cb, void *cb_data);
#endif /* __COMM_CLIENT_H__ */
const char *pkgid,
const char *args,
const char *cookie,
+ uid_t uid,
int is_block)
-{
+{
DBusError err;
DBusMessage *msg = NULL;
int r = COMM_RET_ERROR; /* Default return */
DBUS_TYPE_STRING, &pkgid,
DBUS_TYPE_STRING, &args,
DBUS_TYPE_STRING, &cookie,
+ DBUS_TYPE_INT32, &uid,
DBUS_TYPE_INVALID)) {
r = -3;
ERR("dbus_message_append_args fail");
<arg type="s" name="pkgid" direction="in" />
<arg type="s" name="args" direction="in" />
<arg type="s" name="cookie" direction="in" />
+ <arg type="i" name="uid" direction="in" />
<arg type="i" name="ret" direction="out" />
</method>
</interface>
GCallback pkgmgr_request(PkgMgrObject *obj, const gchar *req_id,
const gint req_type, const gchar *pkg_type,
const gchar *pkgid, const gchar *args,
- const gchar *cookie, gint *ret, GError *err);
+ const gchar *cookie, uid_t uid, gint *ret, GError *err);
/* Include stub header */
#include "comm_pkg_mgr_server_dbus_bindings.h"
const gchar *pkg_type,
const gchar *pkgid,
const gchar *args,
- const gchar *cookie, gint *ret, GError *err)
+ const gchar *cookie, uid_t uid, gint *ret, GError *err)
{
dbg("Called");
*ret = COMM_RET_OK; /* TODO: fix this! */
* */
if (obj->req_cb) {
- dbg("Call request callback(obj, %s, %d, %s, %s, %s, *ret)",
- req_id, req_type, pkg_type, pkgid, args);
- obj->req_cb(obj->req_cb_data, req_id, req_type, pkg_type,
+ dbg("Call request callback(obj, %lu, %s, %d, %s, %s, %s, *ret)",
+ uid, req_id, req_type, pkg_type, pkgid, args);
+ obj->req_cb(obj->req_cb_data, uid, req_id, req_type, pkg_type,
pkgid, args, cookie, ret);
} else {
dbg("Attempt to call request callback,"
API GType pkg_mgr_object_get_type(void);
#define PKG_MGR_TYPE_OBJECT (pkg_mgr_object_get_type())
-typedef void (*request_callback) (void *cb_data, const char *req_id,
+typedef void (*request_callback) (void *cb_data, uid_t uid, const char *req_id,
const int req_type, const char *pkg_type,
const char *pkgid, const char *args,
const char *cookie, int *ret);
gint ret;
ret = comm_client_request(cc, "__test__req_key", COMM_REQ_TO_INSTALLER,
"dpkg", "test_pkg", "arg1 arg2 arg3",
- "this_is_a_cookie", 0);
+ "this_is_a_cookie", getuid(), 0);
printf("client: waiting signal...\n");
comm_client_set_status_callback(COMM_STATUS_BROADCAST_ALL,
typedef struct {
char req_id[MAX_REQ_ID_LEN];
int req_type;
+ uid_t uid;
char pkg_type[MAX_PKG_TYPE_LEN];
char pkgid[MAX_PKG_NAME_LEN];
char args[MAX_PKG_ARGS_LEN];
static int backend_flag = 0; /* 0 means that backend process is not running */
static int drawing_popup = 0; /* 0 means that pkgmgr-server has no popup now */
+typedef struct {
+ char **env;
+ uid_t uid;
+ gid_t gid;
+} user_ctx;
+
+
/* For pkgs with no desktop file, inotify callback wont be called.
* To handle that case ail_db_update is initialized as 1
* This flag will be used to ensure that pkgmgr server does not exit
}
-void req_cb(void *cb_data, const char *req_id, const int req_type,
+void req_cb(void *cb_data, uid_t uid, const char *req_id, const int req_type,
const char *pkg_type, const char *pkgid, const char *args,
const char *cookie, int *ret)
{
strncpy(item->pkgid, pkgid, sizeof(item->pkgid) - 1);
strncpy(item->args, args, sizeof(item->args) - 1);
strncpy(item->cookie, cookie, sizeof(item->cookie) - 1);
-
+ item->uid = uid;
+ /* uid equals to GLOBALUSER means that the installation or action is made at Global level.
+ * At this time, we are not able to check the credentials of this dbus message (due to gdbus API to implement the pkgmgr-server)
+ * So we cannot check if the user that makes request has permisssion to do it.
+ * Note theses CAPI could be used by deamon (user is root or system user) or web/native API framework (user id is one of regular users)
+ * In consequence a bug is filed :
+ *
+ * Logic has to be implmemented:
+ * RUID means the id of the user that make the request (retreived from credential of the message)
+ * UID is the uid in argument of the request
+ *
+ * if RUID == UID & UID is regular user == TRUE ==> Granted
+ * if UID == GLOBAL_USER & RUID is ADMIN == TRUE ==> Granted
+ * if RUID == (ROOT or System USER) & UID is Regular USER ==> Granted
+ * if UID != Regular USER & UID != GLOBAL USER == TRUE ==> NOT GRANTED
+ * if RUID == Regular USER & UID != RUID == True ==> NOT GRANTED
+ * */
if (sig_reg == 0) {
struct sigaction act;
return 0;
}
+
+user_ctx* getUserContext(uid_t uid)
+{
+ /* we can use getpwnam because this is used only after a
+ * fork and just before an execv
+ * No concurrencial call can corrupt the data
+ * returned by getpwuid
+ */
+ user_ctx *context_res;
+ char ** env;
+ struct passwd * pwd;
+ int len;
+ int ret = 0;
+
+ pwd = getpwuid(uid);
+ if (!pwd)
+ return NULL;
+
+ do {
+ context_res = (user_ctx *)malloc(sizeof(user_ctx));
+ if (!context_res) {
+ ret = -1;
+ break;
+ }
+ env = (char**)malloc(3* sizeof(char *));
+ if (!env) {
+ ret = -1;
+ break;
+ }
+ // Build environment context
+ len = snprintf(NULL,0, "HOME=%s", pwd->pw_dir);
+ env[0] = (char*)malloc((len + 1)* sizeof(char));
+ if(env[0] == NULL) {
+ ret = -1;
+ break;
+ }
+ sprintf(env[0], "HOME=%s", pwd->pw_dir);
+ len = snprintf(NULL,0, "USER=%s", pwd->pw_name);
+ env[1] = (char*)malloc((len + 1)* sizeof(char));
+ if(env[1] == NULL) {
+ ret = -1;
+ break;
+ }
+
+ sprintf(env[1], "USER=%s", pwd->pw_name);
+ env[2] = NULL;
+ } while (0);
+
+ if(ret == -1) {
+ free(context_res);
+ context_res = NULL;
+ int i = 0;
+ //env variable ends by NULL element
+ while (env[i]) {
+ free(env[i]);
+ i++;
+ }
+ free(env);
+ env = NULL;
+ } else {
+ context_res->env = env;
+ context_res->uid = uid;
+ context_res->gid = pwd->pw_gid;
+ }
+ return context_res;
+}
+
+
gboolean queue_job(void *data)
{
/* DBG("queue_job start"); */
switch ((ptr + x)->pid) {
case 0: /* child */
DBG("before run _get_backend_cmd()");
+ user_ctx* user_context;
/*Check for efl-tpk app*/
backend_cmd = _get_backend_cmd(item->pkg_type);
}
/* Execute backend !!! */
- ret = execv(backend_cmd, args_vector);
-
+ user_context = getUserContext(item->uid);
+ if(user_context) {
+ setgid(user_context->gid);
+ setuid(item->uid);
+ ret = execve(backend_cmd, args_vector,user_context->env);
+ } else {
+ ret = -1;
+ perror("fail to retreive user context");
+ exit(1);
+ }
/* Code below: exec failure. Should not be happened! */
DBG(">>>>>> OOPS 2!!!");
strncpy(data->msg->req_id, item->req_id, strlen(item->req_id));
data->msg->req_type = item->req_type;
+ data->msg->uid = item->uid;
strncpy(data->msg->pkg_type, item->pkg_type, strlen(item->pkg_type));
strncpy(data->msg->pkgid, item->pkgid, strlen(item->pkgid));
strncpy(data->msg->args, item->args, strlen(item->args));
strncpy(ret->req_id, cur->msg->req_id, strlen(cur->msg->req_id));
ret->req_type = cur->msg->req_type;
+ ret->uid = cur->msg->uid;
strncpy(ret->pkg_type, cur->msg->pkg_type, strlen(cur->msg->pkg_type));
strncpy(ret->pkgid, cur->msg->pkgid, strlen(cur->msg->pkgid));
strncpy(ret->args, cur->msg->args, strlen(cur->msg->args));
mode = PM_QUIET;
if (data.des_path[0] == '\0')
{
- if(uid != GLOBAL_USER)
- {
- ret =
- pkgmgr_client_usr_install(pc, data.pkg_type, NULL,
- data.pkg_path, NULL, mode,
- __return_cb, pc, uid);
- }else
- {
- ret =
- pkgmgr_client_install(pc, data.pkg_type, NULL,
- data.pkg_path, NULL, mode,
- __return_cb, pc);
- }
+ ret =
+ pkgmgr_client_usr_install(pc, data.pkg_type, NULL,
+ data.pkg_path, NULL, mode,
+ __return_cb, pc, uid);
}else{
- if(uid != GLOBAL_USER)
- {
- ret =
- pkgmgr_client_usr_install(pc, data.pkg_type,
- data.des_path, data.pkg_path,
- NULL, mode, __return_cb, pc, uid);
- }else
- {
- ret =
- pkgmgr_client_install(pc, data.pkg_type,
- data.des_path, data.pkg_path,
- NULL, mode, __return_cb, pc);
- }
- }if (ret < 0){
+ ret =
+ pkgmgr_client_usr_install(pc, data.pkg_type,
+ data.des_path, data.pkg_path,
+ NULL, mode, __return_cb, pc, uid);
+
+ }
+ if (ret < 0){
data.result = PKGCMD_ERR_FATAL_ERROR;
if (access(data.pkg_path, F_OK) != 0)
data.result = PKGCMD_ERR_PACKAGE_NOT_FOUND;
}
ret =
- pkgmgr_client_uninstall(pc, data.pkg_type, data.pkgid,
- mode, __return_cb, NULL);
+ pkgmgr_client_usr_uninstall(pc, data.pkg_type, data.pkgid,
+ mode, __return_cb, NULL,uid);
if (ret < 0){
data.result = PKGCMD_ERR_FATAL_ERROR;
if (access(data.pkg_path, F_OK) != 0)
}
mode = PM_QUIET;
- ret = pkgmgr_client_reinstall(pc, data.pkg_type, data.pkgid, NULL, mode, __return_cb, pc);
+ ret = pkgmgr_client_usr_reinstall(pc, data.pkg_type, data.pkgid, NULL, mode, __return_cb, pc, uid);
if (ret < 0){
data.result = PKGCMD_ERR_FATAL_ERROR;
if (access(data.pkg_path, F_OK) != 0)
printf("package is not installed\n");
break;
}
- if(uid != GLOBAL_USER)
- {
- ret = pkgmgr_client_usr_clear_user_data(pc, data.pkg_type,
+ ret = pkgmgr_client_usr_clear_user_data(pc, data.pkg_type,
data.pkgid, mode, uid);
- }else
- {
- ret = pkgmgr_client_clear_user_data(pc, data.pkg_type,
- data.pkgid, mode);
- }
if (ret < 0)
break;
ret = data.result;
if ( strcmp(data.pkg_type, "app") == 0 ) {
if (strlen(data.label) == 0) {
- if (uid != GLOBAL_USER)
- ret = pkgmgr_client_usr_activate_app(pc, data.pkgid, uid);
- else
- ret = pkgmgr_client_activate_app(pc, data.pkgid);
+ ret = pkgmgr_client_usr_activate_app(pc, data.pkgid, uid);
if (ret < 0)
break;
} else {
char *largv[3] = {NULL, };
largv[0] = "-l";
largv[1] = data.label;
- if(uid != GLOBAL_USER)
- ret = pkgmgr_client_usr_activate_appv(pc, data.pkgid, largv, uid);
- else
- ret = pkgmgr_client_activate_appv(pc, data.pkgid, largv);
+ ret = pkgmgr_client_usr_activate_appv(pc, data.pkgid, largv, uid);
if (ret < 0)
break;
}
} else {
- if (uid != GLOBAL_USER)
ret = pkgmgr_client_usr_activate(pc, data.pkg_type, data.pkgid, uid);
- else
- ret = pkgmgr_client_activate(pc, data.pkg_type, data.pkgid);
- if (ret < 0)
- break;
+ if (ret < 0)
+ break;
}
ret = data.result;
}
if ( strcmp(data.pkg_type, "app") == 0 ) {
- if (uid != GLOBAL_USER)
- ret = pkgmgr_client_usr_deactivate_app(pc, data.pkgid, uid);
- else
- ret = pkgmgr_client_deactivate_app(pc, data.pkgid);
+ ret = pkgmgr_client_usr_deactivate_app(pc, data.pkgid, uid);
if (ret < 0)
break;
}else {
- if(uid != GLOBAL_USER)
- ret = pkgmgr_client_usr_deactivate(pc, data.pkg_type, data.pkgid, uid);
- else
- ret = pkgmgr_client_deactivate(pc, data.pkg_type, data.pkgid);
+ ret = pkgmgr_client_usr_deactivate(pc, data.pkg_type, data.pkgid, uid);
if (ret < 0)
break;
}
break;
}
if (data.quiet == 0)
- {
- if(uid != GLOBAL_USER)
- ret = pkgmgr_client_usr_move(pc, data.pkg_type, data.pkgid, data.type, mode, uid);
- else
- ret = pkgmgr_client_move(pc, data.pkg_type, data.pkgid, data.type, mode);
- }else
- {
- if (uid != GLOBAL_USER)
- ret = pkgmgr_client_usr_request_service(PM_REQUEST_MOVE, data.type, pc, NULL, data.pkgid, uid, NULL, NULL, NULL);
- else
- ret = pkgmgr_client_request_service(PM_REQUEST_MOVE, data.type, pc, NULL, data.pkgid, NULL, NULL, NULL);
- }
+ ret = pkgmgr_client_usr_move(pc, data.pkg_type, data.pkgid, data.type, mode, uid);
+ else
+ ret = pkgmgr_client_usr_request_service(PM_REQUEST_MOVE, data.type, pc, NULL, data.pkgid, uid, NULL, NULL, NULL);
+
printf("pkg[%s] move result = %d\n", data.pkgid, ret);
if (ret < 0)
}
if (data.request == KILLAPP_REQ) {
- if (uid != GLOBAL_USER)
- ret = pkgmgr_client_usr_request_service(PM_REQUEST_KILL_APP, NULL, pc, NULL, data.pkgid, uid, NULL, NULL, &pid);
- else
- ret = pkgmgr_client_request_service(PM_REQUEST_KILL_APP, NULL, pc, NULL, data.pkgid, NULL, NULL, &pid);
+ ret = pkgmgr_client_usr_request_service(PM_REQUEST_KILL_APP, NULL, pc, NULL, data.pkgid, uid, NULL, NULL, &pid);
if (ret < 0){
data.result = PKGCMD_ERR_FATAL_ERROR;
break;
printf("Pkgid: %s is already Terminated\n", data.pkgid);
} else if (data.request == CHECKAPP_REQ) {
- if (uid != GLOBAL_USER)
- ret = pkgmgr_client_usr_request_service(PM_REQUEST_CHECK_APP, NULL, pc, NULL, data.pkgid, uid, NULL, NULL, &pid);
- else
- ret = pkgmgr_client_request_service(PM_REQUEST_CHECK_APP, NULL, pc, NULL, data.pkgid, NULL, NULL, &pid);
+ ret = pkgmgr_client_usr_request_service(PM_REQUEST_CHECK_APP, NULL, pc, NULL, data.pkgid, uid, NULL, NULL, &pid);
if (ret < 0){
data.result = PKGCMD_ERR_FATAL_ERROR;
break;
break;
case CSC_REQ:
- if (uid != GLOBAL_USER)
- ret = pkgmgr_client_usr_request_service(PM_REQUEST_CSC, 0, NULL, NULL, NULL, uid, data.des_path, NULL, (void *)data.pkg_path);
- else
- ret = pkgmgr_client_request_service(PM_REQUEST_CSC, 0, NULL, NULL, NULL, data.des_path, NULL, (void *)data.pkg_path);
+ ret = pkgmgr_client_usr_request_service(PM_REQUEST_CSC, 0, NULL, NULL, NULL, uid, data.des_path, NULL, (void *)data.pkg_path);
if (ret < 0)
data.result = PKGCMD_ERR_FATAL_ERROR;
break;
}
if (data.type == 9) {
- if (uid != GLOBAL_USER)
- ret = pkgmgrinfo_pkginfo_get_usr_list(__pkg_list_cb, (void *)pc, uid);
- else
- ret = pkgmgrinfo_pkginfo_get_list(__pkg_list_cb, (void *)pc);
+ ret = pkgmgrinfo_pkginfo_get_usr_list(__pkg_list_cb, (void *)pc, uid);
break;
}
- if (uid != GLOBAL_USER)
- ret = pkgmgr_client_usr_request_service(PM_REQUEST_GET_SIZE, data.type, pc, NULL, data.pkgid, uid, NULL, NULL, NULL);
- else
- ret = pkgmgr_client_request_service(PM_REQUEST_GET_SIZE, data.type, pc, NULL, data.pkgid, NULL, NULL, NULL);
+ ret = pkgmgr_client_usr_request_service(PM_REQUEST_GET_SIZE, data.type, pc, NULL, data.pkgid, uid, NULL, NULL, NULL);
if (ret < 0){
data.result = PKGCMD_ERR_FATAL_ERROR;
break;