appinfo_t* _appinfo_create(bundle *kb);
void _appinfo_free(appinfo_t *menu_info);
char *_appinfo_get_app_path(appinfo_t *menu_info);
+int _proc_get_attr_by_pid(int pid, char *buf, int size);
#endif
return -1;
}
+static int __check_caller_by_pid(int pid)
+{
+ int ret;
+ 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)
+ return 0;
+
+ return -1;
+}
+
static gboolean __handle_launch_event(gpointer data)
{
loader_context_t *lc = (loader_context_t*) data;
goto end;
}
+ if (__check_caller_by_pid(cr.pid) < 0) {
+ _E("Invalid caller pid");
+ goto end;
+ }
+
kb = bundle_decode(pkt->data, pkt->len);
if (!kb) {
_E("bundle decode error");
return strdup(buf);
}
+
+int _proc_get_attr_by_pid(int pid, char *buf, int size)
+{
+ char path[PATH_MAX] = { 0, };
+ int ret;
+
+ snprintf(path, sizeof(path), "/proc/%d/attr/current", pid);
+ ret = __read_proc(path, buf, size);
+ if (ret <= 0)
+ return -1;
+
+ return 0;
+}
+