From addbe2f4a2d0df8c4b3143ae4d6e536ef5419d79 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 8 Jun 2016 08:13:18 +0900 Subject: Fix checking the caller process The launchpad-process-pool is a user daemon. If the caller process is a system user, the launchpad-process-pool cannot access the proc info of the caller process. Change-Id: Idf60fbaeda8e9a80201b226882287f1aef25001e Signed-off-by: Hwankyu Jhun --- src/launchpad.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/launchpad.c b/src/launchpad.c index 54c4554..1933365 100755 --- a/src/launchpad.c +++ b/src/launchpad.c @@ -49,6 +49,7 @@ #define PROCESS_POOL_LAUNCHPAD_SOCK ".launchpad-process-pool-sock" #define LOADER_PATH_DEFAULT "/usr/bin/launchpad-loader" #define LOADER_INFO_PATH "/usr/share/aul" +#define REGULAR_UID_MIN 5000 typedef struct { int type; @@ -891,11 +892,10 @@ static int __check_caller_by_pid(int pid) char buf[PATH_MAX] = { 0, }; ret = _proc_get_attr_by_pid(pid, buf, sizeof(buf)); - if (ret < 0) return -1; - if (strcmp(buf, "User") == 0 || strcmp(buf, "System") == 0) + if (strcmp(buf, "User") == 0) return 0; return -1; @@ -969,9 +969,11 @@ static gboolean __handle_launch_event(gpointer data) goto end; } - if (__check_caller_by_pid(cr.pid) < 0) { - _E("Invalid caller pid"); - goto end; + if (cr.uid >= REGULAR_UID_MIN) { + if (__check_caller_by_pid(cr.pid) < 0) { + _E("Invalid caller pid"); + goto end; + } } kb = bundle_decode(pkt->data, pkt->len); -- cgit v1.2.3