diff options
author | Filipe Brandenburger <filbranden@google.com> | 2018-03-09 03:20:56 -0800 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-03-09 12:20:56 +0100 |
commit | 416be1a03baed3b6b1a1a481576cd77bc322ca2b (patch) | |
tree | 9aa5c3945206f40fab869839b0a00471a32dc1b3 /src | |
parent | 906bdbf5e79870f6997fc0925348f9412f3c5f3e (diff) | |
download | systemd-416be1a03baed3b6b1a1a481576cd77bc322ca2b.tar.gz |
core/socket: support binary inside chroot when looking for SELinux label (#8405)
Otherwise having a .socket unit start a .service running a binary under
a chroot fails as the unit is unable to determine the SELinux label of
the binary.
Diffstat (limited to 'src')
-rw-r--r-- | src/core/socket.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/core/socket.c b/src/core/socket.c index 41988788b8..b3c09f67c0 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -1439,7 +1439,9 @@ fail: } static int socket_determine_selinux_label(Socket *s, char **ret) { + Service *service; ExecCommand *c; + const char *path; int r; assert(s); @@ -1461,11 +1463,13 @@ static int socket_determine_selinux_label(Socket *s, char **ret) { if (!UNIT_ISSET(s->service)) goto no_label; - c = SERVICE(UNIT_DEREF(s->service))->exec_command[SERVICE_EXEC_START]; + service = SERVICE(UNIT_DEREF(s->service)); + c = service->exec_command[SERVICE_EXEC_START]; if (!c) goto no_label; - r = mac_selinux_get_create_label_from_exe(c->path, ret); + path = prefix_roota(service->exec_context.root_directory, c->path); + r = mac_selinux_get_create_label_from_exe(path, ret); if (IN_SET(r, -EPERM, -EOPNOTSUPP)) goto no_label; } |