# Set required packages
INCLUDE(FindPkgConfig)
-SET(AUL-1_PKG_CHECK_MODULES dlog libprivilege-control app-checker rua glib-2.0 vconf pkgmgr-info privacy-manager-client)
+SET(AUL-1_PKG_CHECK_MODULES dlog app-checker rua glib-2.0 vconf pkgmgr-info privacy-manager-client)
pkg_check_modules(pkgs REQUIRED ${AUL-1_PKG_CHECK_MODULES} )
-pkg_check_modules(libpkgs REQUIRED dlog bundle dbus-glib-1 ail xdgmime app-checker libtzplatform-config pkgmgr-info libsystemd-daemon)
+pkg_check_modules(libpkgs REQUIRED dlog bundle dbus-glib-1 ail xdgmime app-checker libtzplatform-config pkgmgr-info libsystemd-daemon security-manager)
PKG_CHECK_MODULES(PKGS REQUIRED glib-2.0 gio-2.0 dlog bundle rua)
FIND_LIBRARY(LIB_DL dl)
_D("appid : %s", appid);
bundle_add(kb, AUL_K_PRIVACY_APPID, appid);
appid = PRIVACY_POPUP;
- bundle_del(kb, AUL_K_PKG_NAME);
- bundle_add(kb, AUL_K_PKG_NAME, appid);
+ bundle_del(kb, AUL_K_APPID);
+ bundle_add(kb, AUL_K_APPID, appid);
ai = appinfo_find(caller_uid, appid);
}
}
case APP_START:
case APP_START_RES:
kb = bundle_decode(pkt->data, pkt->len);
- appid = (char *)bundle_get_val(kb, AUL_K_PKG_NAME);
+ appid = (char *)bundle_get_val(kb, AUL_K_APPID);
if (cr.uid == 0) {
_E("Root user request to start app assumming this is done by system deamon... Please fix it...switch to DEFAULT_USER");
ret = _start_app(appid, kb, pkt->cmd, cr.pid, DEFAULT_USER, clifd);
case APP_KILL_BY_PID:
case APP_TERM_REQ_BY_PID:
kb = bundle_decode(pkt->data, pkt->len);
- appid = (char *)bundle_get_val(kb, AUL_K_PKG_NAME);
+ appid = (char *)bundle_get_val(kb, AUL_K_APPID);
ret = __app_process_by_pid(pkt->cmd, appid, &cr);
__real_send(clifd, ret);
break;
else {
strncat(r_info, dname, 8);
strncat(r_info, ":", 1);
- strncat(r_info, _get_pkgname(menu_info), MAX_PACKAGE_STR_SIZE);
+ strncat(r_info, _get_appid(menu_info), MAX_PACKAGE_STR_SIZE);
strncat(r_info, ":", 1);
strncat(r_info, _get_app_path(menu_info), MAX_PACKAGE_APP_PATH_SIZE);
strncat(r_info, ";", 1);
return 0;
}
-static int __get_pkgname_bypid(int pid, char *pkgname, int len)
+static int __get_appid_bypid(int pid, char *appid, int len)
{
char *cmdline;
app_info_from_db *menu_info;
free(cmdline);
return -1;
} else {
- snprintf(pkgname, len, "%s", _get_pkgname(menu_info));
+ snprintf(appid, len, "%s", _get_appid(menu_info));
}
free(cmdline);
pkt->cmd = APP_GET_APPID_BYPID_ERROR;
- if (__get_pkgname_bypid(pid, (char *)pkt->data, MAX_PACKAGE_STR_SIZE) == 0) {
+ if (__get_appid_bypid(pid, (char *)pkt->data, MAX_PACKAGE_STR_SIZE) == 0) {
SECURE_LOGD("appid for %d is %s", pid, pkt->data);
pkt->cmd = APP_GET_APPID_BYPID_OK;
goto out;
goto out;
_D("second change pgid = %d, pid = %d", pgid, pid);
- if (__get_pkgname_bypid(pgid, (char *)pkt->data, MAX_PACKAGE_STR_SIZE) == 0)
+ if (__get_appid_bypid(pgid, (char *)pkt->data, MAX_PACKAGE_STR_SIZE) == 0)
pkt->cmd = APP_GET_APPID_BYPID_OK;
out:
_static_ void __set_oom();
_static_ void __set_env(app_info_from_db * menu_info, bundle * kb);
-_static_ int __prepare_exec(const char *pkg_name,
+_static_ int __prepare_exec(const char *appId,
const char *app_path, app_info_from_db * menu_info,
bundle * kb);
_static_ int __fake_launch_app(int cmd, int pid, bundle * kb);
{
const char *str;
- setenv("PKG_NAME", _get_pkgname(menu_info), 1);
-
str = bundle_get_val(kb, AUL_K_STARTTIME);
if (str != NULL)
setenv("APP_START_TIME", str, 1);
setenv("HWACC", menu_info->hwacc, 1);
}
-_static_ int __prepare_exec(const char *pkg_name,
+_static_ int __prepare_exec(const char *appId,
const char *app_path, app_info_from_db * menu_info,
bundle * kb)
{
/* TODO : should be add to check permission in the kernel*/
setsid();
- __preexec_run(menu_info->pkg_type, pkg_name, app_path);
+ __preexec_run(menu_info->pkg_type, appId, app_path);
/* SET OOM*/
__set_oom();
/* SET PRIVILEGES*/
if(bundle_get_val(kb, AUL_K_PRIVACY_APPID) == NULL) {
- _D("pkg_name : %s / pkg_type : %s / app_path : %s ", pkg_name, menu_info->pkg_type, app_path);
- if ((ret = __set_access(pkg_name, menu_info->pkg_type, app_path)) < 0) {
+ _D("appId: %s / pkg_type : %s / app_path : %s ", appId, menu_info->pkg_type, app_path);
+ if ((ret = __set_access(appId, menu_info->pkg_type, app_path)) != 0) {
_D("fail to set privileges - check your package's credential : %d\n", ret);
return -1;
}
_static_ void __modify_bundle(bundle * kb, int caller_pid,
app_info_from_db * menu_info, int cmd)
{
- bundle_del(kb, AUL_K_PKG_NAME);
+ bundle_del(kb, AUL_K_APPID);
bundle_del(kb, AUL_K_EXEC);
bundle_del(kb, AUL_K_PACKAGETYPE);
bundle_del(kb, AUL_K_HWACC);
return;
}
-static app_info_from_db *_get_app_info_from_bundle_by_pkgname(
- const char *pkgname, bundle *kb)
+static app_info_from_db *_get_app_info_from_bundle_by_appid(
+ const char *appid, bundle *kb)
{
app_info_from_db *menu_info;
return NULL;
}
- menu_info->pkg_name = strdup(pkgname);
+ menu_info->appid = strdup(appid);
menu_info->app_path = strdup(bundle_get_val(kb, AUL_K_EXEC));
if (menu_info->app_path != NULL)
menu_info->original_app_path = strdup(menu_info->app_path);
app_pkt_t *pkt = NULL;
app_info_from_db *menu_info = NULL;
- const char *pkg_name = NULL;
+ const char *appId = NULL;
const char *app_path = NULL;
int pid = -1;
int uid = -1;
INIT_PERF(kb);
PERF("packet processing start");
- pkg_name = bundle_get_val(kb, AUL_K_PKG_NAME);
- SECURE_LOGD("pkg name : %s\n", pkg_name);
+ appId = bundle_get_val(kb, AUL_K_APPID);
+ SECURE_LOGD("appId : %s\n", appId);
/* get caller uid and check if not coming from someone else than AMD */
uid = __get_caller_uid(kb);
goto end;
}
- menu_info = _get_app_info_from_bundle_by_pkgname(pkg_name, kb);
+ menu_info = _get_app_info_from_bundle_by_appid(appId, kb);
if (menu_info == NULL) {
_D("package not found");
goto end;
}
__modify_bundle(kb, cr.pid, menu_info, pkt->cmd);
- pkg_name = _get_pkgname(menu_info);
+ appId = _get_appid(menu_info);
- _D("start %s: type=%s caller_uid=%d path=%s",pkg_name,menu_info->pkg_type,uid,app_path);
+ _D("start %s: type=%s caller_uid=%d path=%s",appId,menu_info->pkg_type,uid,app_path);
PERF("get package information & modify bundle done");
if( !strcmp(menu_info->pkg_type, "wgt") || !strcmp(menu_info->pkg_type, "rpm") || !strcmp(menu_info->pkg_type, "tpk"))
PERF("prepare exec - first done");
_D("lock up test log(no error) : prepare exec - first done");
- if (__prepare_exec(pkg_name, app_path,
+ if (__prepare_exec(appId, app_path,
menu_info, kb) < 0) {
SECURE_LOGE("preparing work fail to launch - "
- "can not launch %s\n", pkg_name);
+ "can not launch %s\n", appId);
exit(-1);
}
__send_app_launch_signal_dbus(pid);
__signal_unblock_sigchld();
- __add_history(pkg_name, app_path, pkt->data);
+ __add_history(appId, app_path, pkt->data);
}
}
return 0;
if(strcmp(info->appid,data) == 0) {
aul_kill_pid(info->pid);
- printf("\t Kill pkg_name: %s (%d)\n", info->appid,info->pid);
+ printf("\t Kill appId: %s (%d)\n", info->appid,info->pid);
}
return 0;
}
if (dispRunList) {
break;
}
- printf("\t pkg_name (PID)\n");
+ printf("\t appId (PID)\n");
if (aul_app_get_running_app_info(iterfunc_status, NULL)) {
printf("Fail to display the list of Running applications");
return -1;
preexec_initialized = 1;
}
-static inline void __preexec_run(const char *pkg_type, const char *pkg_name,
+static inline void __preexec_run(const char *pkg_type, const char *appid,
const char *app_path)
{
GSList *iter = NULL;
if (type_t) {
if (!strcmp(pkg_type, type_t->pkg_type)) {
if (type_t->dl_do_pre_exe != NULL) {
- type_t->dl_do_pre_exe((char *)pkg_name,
+ type_t->dl_do_pre_exe((char *)appid,
(char *)app_path);
_D("called dl_do_pre_exe() type: %s",
pkg_type);
{
}
-static inline void __preexec_run(const char *pkg_type, const char *pkg_name,
+static inline void __preexec_run(const char *pkg_type, const char *appid,
const char *app_path)
{
}
*/
-#ifdef DAC_ACTIVATE
-
-#include <privilege-control.h>
#include <tzplatform_config.h>
-#define INHOUSE_UID tzplatform_getuid(TZ_USER_NAME);
-static inline int __set_access(const char* pkg_name, const char* pkg_type, const char* app_path)
-{
- return perm_app_set_privilege(pkg_name, pkg_type, app_path);
-}
-
-#else
-
-static inline int __set_access(const char* pkg_name, const char* pkg_type, const char* app_path)
+#include <security-manager.h>
+static inline int __set_access(const char* appId, const char* pkg_type, const char* app_path)
{
- return 0;
+ return security_manager_prepare_app(appId) == SECURITY_MANAGER_SUCCESS ? 0 : -1;
}
-
-#endif
-
-
#define AUL_RETRIEVE_SERVICE "x_slp_service like '?'"
typedef struct {
- char *pkg_name; /* appid */
+ char *appid; /* appid */
char *app_path; /* exec */
char *original_app_path; /* exec */
char *pkg_type; /* x_slp_packagetype */
char *pkg_id;
} app_info_from_db;
-static inline char *_get_pkgname(app_info_from_db *menu_info)
+static inline char *_get_appid(app_info_from_db *menu_info)
{
- return menu_info ? menu_info->pkg_name : NULL;
+ return menu_info ? menu_info->appid : NULL;
}
static inline char *_get_app_path(app_info_from_db *menu_info)
static inline void _free_app_info_from_db(app_info_from_db *menu_info)
{
if (menu_info != NULL) {
- if (menu_info->pkg_name != NULL)
- free(menu_info->pkg_name);
+ if (menu_info->appid != NULL)
+ free(menu_info->appid);
if (menu_info->app_path != NULL)
free(menu_info->app_path);
if (menu_info->original_app_path != NULL)
return NULL;
}
+
if (getuid() != GLOBAL_USER)
ret = pkgmgrinfo_appinfo_get_usr_appinfo(appid, getuid(), &handle);
else
return NULL;
}
- menu_info->pkg_name = strdup(appid);
+ menu_info->appid = strdup(appid);
ret = pkgmgrinfo_appinfo_get_exec(handle, &exec);
if (ret != PMINFO_R_OK)
ret = pkgmgrinfo_appinfo_get_appid(appinfo, &appid);
if (ret == PMINFO_R_OK && appid) {
- menu_info->pkg_name = strdup(appid);
+ menu_info->appid = strdup(appid);
ret = PMINFO_R_ERROR;
}
ret = pkgmgrinfo_appinfo_filter_foreach_appinfo(filter,
__appinfo_func, (void *)menu_info);
- if ((ret != PMINFO_R_OK) || (menu_info->pkg_name == NULL)) {
+ if ((ret != PMINFO_R_OK) || (menu_info->appid == NULL)) {
pkgmgrinfo_appinfo_filter_destroy(filter);
_free_app_info_from_db(menu_info);
return NULL;
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(ail)
BuildRequires: xdgmime-devel, pkgconfig(xdgmime)
-BuildRequires: pkgconfig(libprivilege-control)
+BuildRequires: pkgconfig(security-manager)
BuildRequires: pkgconfig(app-checker)
BuildRequires: pkgconfig(app-checker-server)
BuildRequires: pkgconfig(rua)
%attr(0755,root,root) %{_bindir}/aul_mime.sh
%{_bindir}/aul_test
%{_bindir}/app_launcher
-%{_bindir}/amd_session_agent
+%caps(cap_mac_admin,cap_mac_override,cap_setgid=ei) %{_bindir}/amd_session_agent
%{_datadir}/aul/miregex/*
%{_datadir}/aul/service/*
%{_datadir}/aul/preload_list.txt
static void __clear_internal_key(bundle *kb)
{
bundle_del(kb, AUL_K_CALLER_PID);
- bundle_del(kb, AUL_K_PKG_NAME);
+ bundle_del(kb, AUL_K_APPID);
bundle_del(kb, AUL_K_WAIT_RESULT);
bundle_del(kb, AUL_K_SEND_RESULT);
bundle_del(kb, AUL_K_ARGV0);
* @brief start caller with kb
* @return callee's pid
*/
-int app_request_to_launchpad(int cmd, const char *pkgname, bundle *kb)
+int app_request_to_launchpad(int cmd, const char *appid, bundle *kb)
{
int must_free = 0;
int ret = 0;
- SECURE_LOGD("launch request : %s", pkgname);
+ SECURE_LOGD("launch request : %s", appid);
if (kb == NULL) {
kb = bundle_create();
must_free = 1;
} else
__clear_internal_key(kb);
- bundle_add(kb, AUL_K_PKG_NAME, pkgname);
+ bundle_add(kb, AUL_K_APPID, appid);
__set_stime(kb);
ret = app_send_cmd(AUL_UTIL_PID, cmd, kb);
void *user_param;
} internal_param_t;
-static int __get_pkgname_bypid(int pid, char *pkgname, int len);
+static int __get_appid_bypid(int pid, char *appid, int len);
SLPAPI int aul_app_is_running(const char *appid)
{
return AUL_R_OK;
}
-static int __get_pkgname_bypid(int pid, char *pkgname, int len)
+static int __get_appid_bypid(int pid, char *appid, int len)
{
char *cmdline;
app_info_from_db *menu_info;
free(cmdline);
return -1;
} else
- snprintf(pkgname, len, "%s", _get_pkgname(menu_info));
+ snprintf(appid, len, "%s", _get_appid(menu_info));
free(cmdline);
_free_app_info_from_db(menu_info);
int pgid;
if(pid == getpid() || getuid()==0 || geteuid()==0) {
- if (__get_pkgname_bypid(pid, appid, len) == 0) {
+ if (__get_appid_bypid(pid, appid, len) == 0) {
SECURE_LOGD("appid for %d is %s", pid, appid);
return AUL_R_OK;
}
return AUL_R_ERROR;
_D("second change pgid = %d, pid = %d", pgid, pid);
- if (__get_pkgname_bypid(pgid, appid, len) == 0)
+ if (__get_appid_bypid(pgid, appid, len) == 0)
return AUL_R_OK;
return AUL_R_ERROR;
int iterfunc(const aul_app_info *info, void *data)
{
printf("\t==========================\n");
- printf("\t pkg_name: %s\n", info->appid);
+ printf("\t appid: %s\n", info->appid);
printf("\t app_path: %s\n", info->app_path);
printf("\t running pid: %d\n", info->pid);
printf("\t==========================\n");
}
printf("\t==========================\n");
- printf("\t pkg_name: %s\n", info->pkg_name);
+ printf("\t appid: %s\n", info->appid);
printf("\t app_path: %s\n", info->app_path);
printf("\t is_minst: %d\n", 0);
printf("\t==========================\n");