summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaptiste DURAND <baptiste.durand@open.eurogiciel.org>2014-07-01 15:53:03 +0200
committerBaptiste DURAND <baptiste.durand@open.eurogiciel.org>2014-07-01 16:30:33 +0200
commit2a774153e07a81f3df7e4340d6a206ca4a8115a1 (patch)
treef966827318b4f4bc2b8b9ac69742c5d06a515530
parentbff3ebf37e1034bd54ce436e57e087a236f52e2d (diff)
downloadaul-1-2a774153e07a81f3df7e4340d6a206ca4a8115a1.tar.gz
aul-1-2a774153e07a81f3df7e4340d6a206ca4a8115a1.tar.bz2
aul-1-2a774153e07a81f3df7e4340d6a206ca4a8115a1.zip
Change smack label on AMD cmd socket => add chsmack call in service Remove app from running list when app is closed. => Append buffer null end byte + Fix User check Change-Id: I068ca441c7085ee2830e6ac8e520e7ef5c842287 Signed-off-by: Baptiste DURAND <baptiste.durand@open.eurogiciel.org>
-rwxr-xr-xam_daemon/amd_main.c8
-rwxr-xr-xam_daemon/amd_request.c6
-rw-r--r--packaging/ac.service2
-rwxr-xr-xsrc/simple_util.c2
4 files changed, 10 insertions, 8 deletions
diff --git a/am_daemon/amd_main.c b/am_daemon/amd_main.c
index 8bebe139..2c477eca 100755
--- a/am_daemon/amd_main.c
+++ b/am_daemon/amd_main.c
@@ -118,7 +118,7 @@ static int __remove_item_running_list(int pid, uid_t user)
for (iter = r_app_info_list; iter != NULL; iter = g_slist_next(iter))
{
info_t = (r_app_info_t *)iter->data;
- if( (pid == info_t->pid) && (user == info_t->user || 0 == info_t->pid )) {
+ if( (pid == info_t->pid) && (user == info_t->user || 0 == info_t->user )) {
r_app_info_list = g_slist_remove(r_app_info_list, info_t);
free(info_t);
break;
@@ -223,14 +223,14 @@ static void __vconf_cb(keynode_t *key, void *data)
}
}
-int __app_dead_handler(int pid)
+int __app_dead_handler(int pid, uid_t user)
{
// this function was called in single user mode as a callback to aul_listen_app_dead_signal
// but in multiuser mode, AMD daemon can't listen any more on DBUS system to catch those events
// AMD Agents must connect to AMD Daemon to signal a dead process
_unregister_key_event(pid);
- __remove_item_running_list(pid, getuid());
- _status_remove_app_info_list(pid, getuid());
+ __remove_item_running_list(pid, user);
+ _status_remove_app_info_list(pid, user);
return 0;
}
diff --git a/am_daemon/amd_request.c b/am_daemon/amd_request.c
index f8b2d756..fc8a21b1 100755
--- a/am_daemon/amd_request.c
+++ b/am_daemon/amd_request.c
@@ -53,7 +53,7 @@ struct cginfo *_rcg;
static int __send_result_to_client(int fd, int res);
static gboolean __request_handler(gpointer data);
-extern int __app_dead_handler(int pid);
+extern int __app_dead_handler(int pid, uid_t user);
static int __send_result_to_client(int fd, int res)
{
@@ -297,7 +297,7 @@ static int __handle_dead_signal(bundle* kb,int clifd, struct ucred * pcr) {
}
if (strcmp(caller,"/usr/bin/amd_session_agent")) {
- _D("handle_dead_signal: caller is not amd session agent");
+ _D("handle_dead_signal: caller is not amd session agent, %d : '%s'", pcr->pid,caller);
free(caller);
return -1;
}
@@ -314,7 +314,7 @@ static int __handle_dead_signal(bundle* kb,int clifd, struct ucred * pcr) {
_D("APP_DEAD_SIGNAL : %d",pid);
- ret=__app_dead_handler(pid);
+ ret=__app_dead_handler(pid,pcr->uid);
return ret;
}
diff --git a/packaging/ac.service b/packaging/ac.service
index 2c393fcf..aaf20df7 100644
--- a/packaging/ac.service
+++ b/packaging/ac.service
@@ -7,6 +7,8 @@ Description=Start the Access Control server
[Service]
EnvironmentFile=-/etc/sysconfig/prelaunch
+ExecStartPre=/usr/bin/mkdir -p -m 1777 /tmp/alaunch
+ExecStartPre=/usr/bin/chsmack -a * /tmp/alaunch
ExecStart=/usr/bin/amd
OOMScoreAdjust=-100
diff --git a/src/simple_util.c b/src/simple_util.c
index 71165960..95c7d14a 100755
--- a/src/simple_util.c
+++ b/src/simple_util.c
@@ -197,7 +197,7 @@ char *__proc_get_exe_bypid(int pid)
len=readlink(buf,buf2,MAX_CMD_BUFSZ);
if (len<=0)
return NULL;
-
+ buf2[len] = 0;
return strdup(buf2);
}