summaryrefslogtreecommitdiff
path: root/src/manager.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-06-18 23:12:48 +0200
committerLennart Poettering <lennart@poettering.net>2010-06-18 23:12:48 +0200
commitc952c6ece28b6c0f774f823c917f458fe3424993 (patch)
tree03de0a764b996486406baeedd5721b6338334ea8 /src/manager.c
parente55224ca655e6c4ec745a84ae5a051a9e6e5f74f (diff)
service: add minimal access control logic for notifcation socket
Diffstat (limited to 'src/manager.c')
-rw-r--r--src/manager.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/manager.c b/src/manager.c
index 5e627ba9c6..c2d5e5f0ef 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -70,7 +70,6 @@ static int manager_setup_notify(Manager *m) {
struct sockaddr_un un;
} sa;
struct epoll_event ev;
- char *ne[2], **t;
int one = 1;
assert(m);
@@ -106,19 +105,9 @@ static int manager_setup_notify(Manager *m) {
if (epoll_ctl(m->epoll_fd, EPOLL_CTL_ADD, m->notify_watch.fd, &ev) < 0)
return -errno;
- if (asprintf(&ne[0], "NOTIFY_SOCKET=@%s", sa.un.sun_path+1) < 0)
+ if (!(m->notify_socket = strdup(sa.un.sun_path+1)))
return -ENOMEM;
- ne[1] = NULL;
- t = strv_env_merge(2, m->environment, ne);
- free(ne[0]);
-
- if (!t)
- return -ENOMEM;
-
- strv_free(m->environment);
- m->environment = t;
-
return 0;
}
@@ -451,6 +440,8 @@ void manager_free(Manager *m) {
if (m->notify_watch.fd >= 0)
close_nointr_nofail(m->notify_watch.fd);
+ free(m->notify_socket);
+
lookup_paths_free(&m->lookup_paths);
strv_free(m->environment);
@@ -1672,7 +1663,7 @@ static int manager_process_notify_fd(Manager *m) {
log_debug("Got notification message for unit %s", u->meta.id);
if (UNIT_VTABLE(u)->notify_message)
- UNIT_VTABLE(u)->notify_message(u, tags);
+ UNIT_VTABLE(u)->notify_message(u, ucred->pid, tags);
strv_free(tags);
}