diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2015-06-06 21:24:45 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2015-06-10 09:12:57 -0400 |
commit | c4e6556c46cea1b7195cfb81c8cfab8342ebd852 (patch) | |
tree | f43fc60c642f65e03b2fd0183b377ad543d054d3 /src/libsystemd/sd-bus/bus-socket.c | |
parent | d868f2a3a1cc97b1e081b7692e80a1182efccda4 (diff) |
sd-bus: store selinux context at connection time
This appears to be the right time to do it for SOCK_STREAM
unix sockets.
Also: condition bus_get_owner_creds_dbus1 was reversed. Split
it out to a separate variable for clarity and fix.
https://bugzilla.redhat.com/show_bug.cgi?id=1224211
Diffstat (limited to 'src/libsystemd/sd-bus/bus-socket.c')
-rw-r--r-- | src/libsystemd/sd-bus/bus-socket.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libsystemd/sd-bus/bus-socket.c b/src/libsystemd/sd-bus/bus-socket.c index facfd737e6..bcd49efb20 100644 --- a/src/libsystemd/sd-bus/bus-socket.c +++ b/src/libsystemd/sd-bus/bus-socket.c @@ -588,10 +588,17 @@ void bus_socket_setup(sd_bus *b) { } static void bus_get_peercred(sd_bus *b) { + int r; + assert(b); /* Get the peer for socketpair() sockets */ b->ucred_valid = getpeercred(b->input_fd, &b->ucred) >= 0; + + /* Get the SELinux context of the peer */ + r = getpeersec(b->input_fd, &b->label); + if (r < 0 && r != -EOPNOTSUPP) + log_debug_errno(r, "Failed to determine peer security context: %m"); } static int bus_socket_start_auth_client(sd_bus *b) { |