diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-11-24 22:11:53 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-11-25 14:28:34 +0100 |
commit | 359c09b1c1afa5a5ed4002940d7d6e61b74b7e3b (patch) | |
tree | 1a63bccf433afe0fcc74db9c140ee6821a60e5eb /src/libsystemd/sd-bus | |
parent | 40ed1a4574152337479f7f9c01763b84847ff09f (diff) |
sd-bus: don't fail when querying creds and dbus1 refuses to tell us the selinux context
Diffstat (limited to 'src/libsystemd/sd-bus')
-rw-r--r-- | src/libsystemd/sd-bus/bus-control.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c index 7db912b64b..b887d32579 100644 --- a/src/libsystemd/sd-bus/bus-control.c +++ b/src/libsystemd/sd-bus/bus-control.c @@ -797,6 +797,7 @@ static int bus_get_name_creds_dbus1( } if (mask & SD_BUS_CREDS_SELINUX_CONTEXT) { + _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; const void *p = NULL; size_t sz = 0; @@ -806,22 +807,24 @@ static int bus_get_name_creds_dbus1( "/org/freedesktop/DBus", "org.freedesktop.DBus", "GetConnectionSELinuxSecurityContext", - NULL, + &error, &reply, "s", unique ? unique : name); - if (r < 0) - return r; - - r = sd_bus_message_read_array(reply, 'y', &p, &sz); - if (r < 0) - return r; + if (r < 0) { + if (!sd_bus_error_has_name(&error, "org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown")) + return r; + } else { + r = sd_bus_message_read_array(reply, 'y', &p, &sz); + if (r < 0) + return r; - c->label = strndup(p, sz); - if (!c->label) - return -ENOMEM; + c->label = strndup(p, sz); + if (!c->label) + return -ENOMEM; - c->mask |= SD_BUS_CREDS_SELINUX_CONTEXT; + c->mask |= SD_BUS_CREDS_SELINUX_CONTEXT; + } } r = bus_creds_add_more(c, mask, pid, 0); |