diff options
author | Hwankyu Jhun <h.jhun@samsung.com> | 2016-06-08 08:13:18 +0900 |
---|---|---|
committer | Junghoon Park <jh9216.park@samsung.com> | 2016-06-08 18:45:03 -0700 |
commit | addbe2f4a2d0df8c4b3143ae4d6e536ef5419d79 (patch) | |
tree | 1af5a16ab7cc963be8008f4430d55b5456a9a5b9 /src/launchpad.c | |
parent | 7cc504d733debba38434b53ad82a4d142d1da844 (diff) | |
download | launchpad-addbe2f4a2d0df8c4b3143ae4d6e536ef5419d79.tar.gz launchpad-addbe2f4a2d0df8c4b3143ae4d6e536ef5419d79.tar.bz2 launchpad-addbe2f4a2d0df8c4b3143ae4d6e536ef5419d79.zip |
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 <h.jhun@samsung.com>
Diffstat (limited to 'src/launchpad.c')
-rwxr-xr-x | src/launchpad.c | 12 |
1 files changed, 7 insertions, 5 deletions
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); |