return ret;
}
-static int __check_admin_privilege_by_cookie(const char *e_cookie)
-{
- guchar *cookie = NULL;
- gsize size;
- int ret = PMINFO_R_ERROR;
-
- if (e_cookie == NULL) {
- _LOGE("e_cookie is NULL!!!");
- return PMINFO_R_ERROR;
- }
-
- cookie = g_base64_decode(e_cookie, &size);
- if (cookie == NULL) {
- _LOGE("Unable to decode cookie!!!");
- return PMINFO_R_ERROR;
- }
-
- ret = security_server_check_privilege_by_cookie((const char *)cookie, "privilege::tizen::packagemanager.admin rw", "rw");
- if (ret == SECURITY_SERVER_API_SUCCESS)
- ret = PMINFO_R_OK;
-
-
- if (cookie){
- g_free(cookie);
- cookie = NULL;
- }
-
- return ret;
-}
-
-
static int __get_position_from_pkg_type(char *pkgtype)
{
int i = 0;
}
#ifdef _APPFW_FEATURE_DRM_ENABLE
-int decrypt_pkg_cb(const char *drm_file_path, const char *decrypted_file_path, const char *cookie, int *ret)
+int decrypt_pkg_cb(const char *drm_file_path, const char *decrypted_file_path, int *ret)
{
__register_signal_handler();
_LOGE(">> in callback >> package_manager_drm_decrypt_license is called.");
- if (drm_file_path == NULL || decrypted_file_path == NULL || cookie == NULL) {
+ if (drm_file_path == NULL || decrypted_file_path == NULL) {
_LOGE("Invalid parameter.");
*ret = PKGMGR_R_EINVAL;
__set_drm_busy(0);
}
int retval = 0;
const char *smack_label = "*";
- int cookie_result = 0;
-
- cookie_result = __check_admin_privilege_by_cookie(cookie);
- if (cookie_result < 0){
- _LOGE("__check_admin_privilege_by_cookie result fail[%d]", cookie_result);
- *ret = PKGMGR_R_EPRIV;
- return -1;
- }
retval = drm_tizen_decrypt_package(drm_file_path, strlen(drm_file_path), decrypted_file_path, strlen(decrypted_file_path));
if (retval != 1) {
return 0;
}
-int reg_license_cb(const char *resp_data, const char *cookie, int *ret)
+int reg_license_cb(const char *resp_data, int *ret)
{
__register_signal_handler();
_LOGE(">> in callback >> package_manager_drm_register_license is called.");
- if (resp_data == NULL || cookie == NULL) {
+ if (resp_data == NULL) {
_LOGE("Invalid parameter.");
*ret = PKGMGR_R_EINVAL;
__set_drm_busy(0);
return -1;
}
int retval = 0;
- int cookie_result = 0;
-
- cookie_result = __check_admin_privilege_by_cookie(cookie);
- if (cookie_result < 0){
- _LOGE("__check_admin_privilege_by_cookie result fail[%d]", cookie_result);
- *ret = PKGMGR_R_EPRIV;
- return -1;
- }
-
retval = drm_tizen_register_license(resp_data, strlen(resp_data));
if (retval != 1) {
_LOGE("drm_tizen_register_license is failed.");
return 0;
}
-int gen_license_req_cb(const char *resp_data, const char *cookie, char **req_data, char **license_url, int *ret)
+int gen_license_req_cb(const char *resp_data, char **req_data, char **license_url, int *ret)
{
__register_signal_handler();
_LOGE(">> in callback >> package_manager_drm_generate_license_request is called.");
- if (resp_data == NULL || req_data == NULL || license_url == NULL || cookie == NULL) {
+ if (resp_data == NULL || req_data == NULL || license_url == NULL) {
_LOGE("Invalid parameter.");
*ret = PKGMGR_R_EINVAL;
__set_drm_busy(0);
unsigned int temp_req_len = sizeof(temp_req_data);
char temp_license_url[1024] = {0,};
unsigned int temp_license_url_len = sizeof(temp_license_url);
- int cookie_result = 0;
-
- cookie_result = __check_admin_privilege_by_cookie(cookie);
- if (cookie_result < 0){
- _LOGE("__check_admin_privilege_by_cookie result fail[%d]", cookie_result);
- *ret = PKGMGR_R_EPRIV;
- return -1;
- }
-
retval = drm_tizen_generate_license_request(resp_data, strlen(resp_data), temp_req_data, &temp_req_len, temp_license_url, &temp_license_url_len);
if (retval != 1) {
_LOGE("drm_tizen_generate_license_request is failed.");
switch (item->req_type) {
case COMM_REQ_TO_INSTALL:
+ case COMM_REQ_TO_UNINSTALL:
/* check caller privilege */
cookie_result = __check_privilege_by_cookie(cookie, item->req_type);
if (cookie_result < 0){
g_idle_add(queue_job, NULL);
*ret = PKGMGR_R_OK;
break;
- case COMM_REQ_TO_UNINSTALL:
- /* check caller privilege */
- cookie_result = __check_privilege_by_cookie(cookie, item->req_type);
- if (cookie_result < 0){
- _LOGE("__check_privilege_by_cookie result fail[%d]", cookie_result);
- *ret = PKGMGR_R_EPRIV;
- goto err;
- }
-
- /* quiet mode */
- err = _pm_queue_push(item);
- p = __get_position_from_pkg_type(item->pkg_type);
- if (p < 0) {
- _LOGE("invalid or unsupported package");
- *ret = PKGMGR_R_ERROR;
- break;
- }
- __set_backend_mode(p);
- if (err == 0)
- g_idle_add(queue_job, NULL);
- *ret = PKGMGR_R_OK;
- break;
case COMM_REQ_ACTIVATE_PKG:
err = _pm_queue_push(item);
p = __get_position_from_pkg_type(item->pkg_type);
*ret = PKGMGR_R_OK;
break;
case COMM_REQ_TO_CLEARER:
+ /* get pkgtype from msg-args */
+ if (_zone_set_type_and_backend(item, zone)) {
+ *ret = PKGMGR_R_ERROR;
+ goto err;
+ }
+
/* In case of clearer, there is no popup */
err = _pm_queue_push(item);
p = __get_position_from_pkg_type(item->pkg_type);
goto err;
}
+ /* get pkgtype from msg-args */
+ if (_zone_set_type_and_backend(item, zone)) {
+ *ret = PKGMGR_R_ERROR;
+ goto err;
+ }
+
/* In case of mover, there is no popup */
err = _pm_queue_push(item);
p = __get_position_from_pkg_type(item->pkg_type);
switch (item->req_type) {
case COMM_REQ_TO_INSTALL:
+ case COMM_REQ_TO_UNINSTALL:
/* check caller privilege */
cookie_result = __check_privilege_by_cookie(cookie, item->req_type);
if (cookie_result < 0){
g_idle_add(queue_job, NULL);
*ret = PKGMGR_R_OK;
break;
- case COMM_REQ_TO_UNINSTALL:
- /* check caller privilege */
- cookie_result = __check_privilege_by_cookie(cookie, item->req_type);
- if (cookie_result < 0){
- _LOGE("__check_privilege_by_cookie result fail[%d]\n", cookie_result);
- *ret = PKGMGR_R_EPRIV;
- goto err;
- }
-
- _LOGE("pkg type[%s]", item->pkg_type);
-
- /* quiet mode */
- err = _pm_queue_push(item);
- p = __get_position_from_pkg_type(item->pkg_type);
- if (p < 0) {
- _LOGE("invalid or unsupported package");
- *ret = PKGMGR_R_ERROR;
- break;
- }
- __set_backend_mode(p);
- if (err == 0)
- g_idle_add(queue_job, NULL);
- *ret = PKGMGR_R_OK;
- break;
-
-
case COMM_REQ_ACTIVATE_PKG:
err = _pm_queue_push(item);
p = __get_position_from_pkg_type(item->pkg_type);
int ret = 0;
char *backend_cmd = NULL;
- char **args_vector = NULL;
/* queue is empty and backend process is not running */
if ( (item == NULL) || (item->req_type == -1) ) {
switch (item->req_type) {
case COMM_REQ_TO_INSTALL:
+ case COMM_REQ_TO_UNINSTALL:
_LOGD("before run _get_backend_path(%s)", item->backend_installer);
backend_cmd = _get_backend_cmd(item->backend_installer);
if (NULL == backend_cmd) {
_LOGD("Try to exec [%s][%s]", item->pkg_type, backend_cmd);
fprintf(stdout, "Try to exec [%s][%s]\n", item->pkg_type, backend_cmd);
- args_vector = __generate_argv(item->args);
+ char **args_vector = __generate_argv(item->args);
args_vector[0] = backend_cmd;
/* Execute backend !!! */
__exec_with_arg_vector(backend_cmd, args_vector, item->zone);
free(backend_cmd);
break;
- case COMM_REQ_TO_UNINSTALL:
- args_vector = __generate_argv(item->args);
-
- _LOGD("Try to exec [%s][%s]", item->pkg_type, args_vector[0]);
- fprintf(stdout, "Try to exec [%s][%s]\n", item->pkg_type, args_vector[0]);
-
- /* Execute backend !!! */
- __exec_with_arg_vector(args_vector[0], args_vector, item->zone);
case COMM_REQ_ACTIVATE_PKG:
_LOGE("ACTIVATE_PKG start [pkgid = %s]",item->pkgid);
break;
case COMM_REQ_TO_MOVER:
case COMM_REQ_TO_CLEARER:
- args_vector = __generate_argv(item->args);
+ _LOGD("before run _get_backend_path()");
+ backend_cmd = _get_backend_cmd(item->backend_installer);
+ if (!backend_cmd) {
+ backend_cmd = _get_backend_cmd(item->pkg_type);
+ if (!backend_cmd) {
+ _LOGE("failed to get backend cmd");
+ break;
+ }
+ }
- _LOGD("Try to exec [%s][%s]", item->pkg_type, args_vector[0]);
- fprintf(stdout, "Try to exec [%s][%s]\n", item->pkg_type, args_vector[0]);
+ _LOGD("Try to exec [%s][%s]", item->pkg_type, backend_cmd);
+ fprintf(stdout, "Try to exec [%s][%s]\n", item->pkg_type, backend_cmd);
+
+ char **args_vectors = __generate_argv(item->args);
+ args_vectors[0] = backend_cmd;
/* Execute backend !!! */
- __exec_with_arg_vector(args_vector[0], args_vector, item->zone);
+ __exec_with_arg_vector(backend_cmd, args_vectors, item->zone);
+ free(backend_cmd);
break;
case COMM_REQ_GET_SIZE:
__exec_with_arg_vector("usr/bin/pkg_getsize", __generate_argv(item->args), item->zone);