summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHwankyu Jhun <h.jhun@samsung.com>2016-05-23 15:49:51 +0900
committerHwankyu Jhun <h.jhun@samsung.com>2016-05-25 11:58:23 +0900
commit1469ddee08792c5a0b2746dc373f53311739dc88 (patch)
tree5ced40101b9d309a54ad7cb98f860170c33fc2f7
parent87a2d51008a9d71334fd4fa183089c6e8f5cc349 (diff)
downloadapp-manager-1469ddee08792c5a0b2746dc373f53311739dc88.tar.gz
app-manager-1469ddee08792c5a0b2746dc373f53311739dc88.tar.bz2
app-manager-1469ddee08792c5a0b2746dc373f53311739dc88.zip
Remove the privileges
Change-Id: Ifec58c68c3c70f5698b24c7074d328b1ca6f90fe Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
-rw-r--r--include/app_context.h3
-rw-r--r--include/app_manager.h3
-rw-r--r--src/app_context.c18
-rw-r--r--src/app_manager.c99
-rw-r--r--src/app_manager_internal.h3
5 files changed, 24 insertions, 102 deletions
diff --git a/include/app_context.h b/include/app_context.h
index c0e3ae7..3941f1d 100644
--- a/include/app_context.h
+++ b/include/app_context.h
@@ -141,8 +141,6 @@ int app_context_get_package_id(app_context_h app_context, char **pkg_id);
/**
* @brief Gets the application state with the given application context.
* @since_tizen 3.0
- * @privlevel public
- * @privilege %http://tizen.org/privilege/packagemanager.info
* @remarks Note that application's state might be changed after you get app_context.
* This API just returns the state of application when you get the app_context.
* @param[in] app_context The application context
@@ -151,7 +149,6 @@ int app_context_get_package_id(app_context_h app_context, char **pkg_id);
* otherwise a negative error value
* @retval #APP_MANAGER_ERROR_NONE Successful
* @retval #APP_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_MANAGER_ERROR_PERMISSION_DENIED Permission denied
*/
int app_context_get_app_state(app_context_h app_context, app_state_e *state);
diff --git a/include/app_manager.h b/include/app_manager.h
index 9f43cc9..548d011 100644
--- a/include/app_manager.h
+++ b/include/app_manager.h
@@ -190,15 +190,12 @@ int app_manager_foreach_app_context(app_manager_app_context_cb callback, void *u
* @details You can iterate all the running application contexts using this API.
* This API is similar to app_manager_foreach_app_context() except that this API iterates application contexts including sub apps in application groups.
* @since_tizen 3.0
- * @privlevel public
- * @privilege %http://tizen.org/privilege/packagemanager.info
* @param[in] callback The callback function to invoke
* @param[in] user_data The user data to be passed to the callback function
* @return @c 0 on success,
* otherwise a negative error value
* @retval #APP_MANAGER_ERROR_NONE Successful
* @retval #APP_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_MANAGER_ERROR_PERMISSION_DENIED Permission denied
* @post This function invokes app_manager_app_context_cb() for each application context.
* @see app_manager_app_context_cb()
*/
diff --git a/src/app_context.c b/src/app_context.c
index 5509bac..b221509 100644
--- a/src/app_context.c
+++ b/src/app_context.c
@@ -181,12 +181,8 @@ int app_context_foreach_running_app_context(app_manager_app_context_cb callback,
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
ret = aul_app_get_all_running_app_info(app_context_foreach_running_app_context_cb, &foreach_context);
- if (ret != AUL_R_OK) {
- if (ret == AUL_R_EILLACC)
- return app_manager_error(APP_MANAGER_ERROR_PERMISSION_DENIED, __FUNCTION__, NULL);
- else
- return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL);
- }
+ if (ret != AUL_R_OK)
+ return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL);
return APP_MANAGER_ERROR_NONE;
}
@@ -339,15 +335,9 @@ API int app_context_get_package_id(app_context_h app_context, char **pkg_id)
API int app_context_get_app_state(app_context_h app_context, app_state_e *state)
{
- int ret;
-
if (app_context == NULL || state == NULL)
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- ret = app_manager_check_privilege(PRIVILEGE_PKGMGR_INFO);
- if (ret != APP_MANAGER_ERROR_NONE)
- return app_manager_error(ret, __FUNCTION__, NULL);
-
*state = app_context->app_state;
return APP_MANAGER_ERROR_NONE;
@@ -355,14 +345,14 @@ API int app_context_get_app_state(app_context_h app_context, app_state_e *state)
API int app_context_is_terminated(app_context_h app_context, bool *terminated)
{
+ char appid[APPID_MAX] = {0, };
+
if (app_context == NULL || terminated == NULL)
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
if (aul_app_is_running(app_context->app_id) == 1) {
*terminated = false;
} else {
- char appid[APPID_MAX] = {0, };
-
if (aul_app_get_appid_bypid(app_context->pid, appid, sizeof(appid)) == AUL_R_OK)
*terminated = false;
else
diff --git a/src/app_manager.c b/src/app_manager.c
index b7c0261..5839eaa 100644
--- a/src/app_manager.c
+++ b/src/app_manager.c
@@ -74,75 +74,15 @@ int app_manager_error(app_manager_error_e error, const char *function, const cha
return error;
}
-int app_manager_check_privilege(char *privilege)
-{
- cynara *p_cynara;
- int fd;
- int ret;
-
- char client[SMACK_LABEL_LEN + 1] = "";
- char uid[10] = {0,};
- char *client_session = "";
-
- if (privilege == NULL) {
- LOGE("invalid parameter");
- return APP_MANAGER_ERROR_INVALID_PARAMETER;
- }
-
- ret = cynara_initialize(&p_cynara, NULL);
- if (ret != CYNARA_API_SUCCESS) {
- LOGE("cynara_initialize [%d] failed!", ret);
- return APP_MANAGER_ERROR_IO_ERROR;
- }
-
- fd = open("/proc/self/attr/current", O_RDONLY);
- if (fd < 0) {
- LOGE("open [%d] failed!", errno);
- ret = APP_MANAGER_ERROR_IO_ERROR;
- goto out;
- }
-
- ret = read(fd, client, SMACK_LABEL_LEN);
- if (ret < 0) {
- LOGE("read [%d] failed!", errno);
- close(fd);
- ret = APP_MANAGER_ERROR_IO_ERROR;
- goto out;
- }
-
- close(fd);
-
- snprintf(uid, 10, "%d", getuid());
-
- ret = cynara_check(p_cynara, client, client_session, uid, privilege);
- if (ret != CYNARA_API_ACCESS_ALLOWED) {
- LOGE("cynara access check [%d] failed!", ret);
-
- if (ret == CYNARA_API_ACCESS_DENIED)
- ret = APP_MANAGER_ERROR_PERMISSION_DENIED;
- else
- ret = APP_MANAGER_ERROR_IO_ERROR;
-
- goto out;
- }
-
- ret = APP_MANAGER_ERROR_NONE;
-
-out:
- if (p_cynara)
- cynara_finish(p_cynara);
-
- return ret;
-}
-
API int app_manager_set_app_context_event_cb(app_manager_app_context_event_cb callback, void *user_data)
{
- int retval = app_context_set_event_cb(callback, user_data);
+ int retval;
+ retval = app_context_set_event_cb(callback, user_data);
if (retval != APP_MANAGER_ERROR_NONE)
return app_manager_error(retval, __FUNCTION__, NULL);
- else
- return APP_MANAGER_ERROR_NONE;
+
+ return APP_MANAGER_ERROR_NONE;
}
API void app_manager_unset_app_context_event_cb(void)
@@ -152,32 +92,35 @@ API void app_manager_unset_app_context_event_cb(void)
API int app_manager_foreach_app_context(app_manager_app_context_cb callback, void *user_data)
{
- int retval = app_context_foreach_app_context(callback, user_data);
+ int retval;
+ retval = app_context_foreach_app_context(callback, user_data);
if (retval != APP_MANAGER_ERROR_NONE)
return app_manager_error(retval, __FUNCTION__, NULL);
- else
- return APP_MANAGER_ERROR_NONE;
+
+ return APP_MANAGER_ERROR_NONE;
}
API int app_manager_foreach_running_app_context(app_manager_app_context_cb callback, void *user_data)
{
- int retval = app_context_foreach_running_app_context(callback, user_data);
+ int retval;
+ retval = app_context_foreach_running_app_context(callback, user_data);
if (retval != APP_MANAGER_ERROR_NONE)
return app_manager_error(retval, __FUNCTION__, NULL);
- else
- return APP_MANAGER_ERROR_NONE;
+
+ return APP_MANAGER_ERROR_NONE;
}
API int app_manager_get_app_context(const char *app_id, app_context_h *app_context)
{
- int retval = app_context_get_app_context(app_id, app_context);
+ int retval;
+ retval = app_context_get_app_context(app_id, app_context);
if (retval != APP_MANAGER_ERROR_NONE)
return app_manager_error(retval, __FUNCTION__, NULL);
- else
- return APP_MANAGER_ERROR_NONE;
+
+ return APP_MANAGER_ERROR_NONE;
}
API int app_manager_resume_app(app_context_h app_context)
@@ -219,11 +162,10 @@ API int app_manager_foreach_app_info(app_manager_app_info_cb callback, void *use
int retval;
retval = app_info_foreach_app_info(callback, user_data);
-
if (retval != APP_MANAGER_ERROR_NONE)
return app_manager_error(retval, __FUNCTION__, NULL);
- else
- return APP_MANAGER_ERROR_NONE;
+
+ return APP_MANAGER_ERROR_NONE;
}
API int app_manager_get_app_info(const char *app_id, app_info_h *app_info)
@@ -231,11 +173,10 @@ API int app_manager_get_app_info(const char *app_id, app_info_h *app_info)
int retval;
retval = app_info_create(app_id, app_info);
-
if (retval != APP_MANAGER_ERROR_NONE)
return app_manager_error(retval, __FUNCTION__, NULL);
- else
- return APP_MANAGER_ERROR_NONE;
+
+ return APP_MANAGER_ERROR_NONE;
}
API int app_manager_get_app_id(pid_t pid, char **app_id)
diff --git a/src/app_manager_internal.h b/src/app_manager_internal.h
index 2b8e90c..00c0c29 100644
--- a/src/app_manager_internal.h
+++ b/src/app_manager_internal.h
@@ -36,8 +36,6 @@ extern "C" {
* @{
*/
-#define PRIVILEGE_PKGMGR_INFO "http://tizen.org/privilege/packagemanager.info"
-
int app_manager_error(app_manager_error_e error, const char *function, const char *description);
int app_context_foreach_app_context(app_manager_app_context_cb callback, void *user_data);
@@ -54,7 +52,6 @@ int app_info_foreach_app_info(app_manager_app_info_cb callback, void *user_data)
int app_info_get_app_info(const char *app_id, app_info_h *app_info);
-int app_manager_check_privilege(char *privilege);
/**
* @}
*/