1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-02 10:51:20 +03:00

sd-bus: don't fail when querying creds and dbus1 refuses to tell us the selinux context

This commit is contained in:
Lennart Poettering 2014-11-24 22:11:53 +01:00
parent 40ed1a4574
commit 359c09b1c1

View File

@ -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,13 +807,14 @@ static int bus_get_name_creds_dbus1(
"/org/freedesktop/DBus",
"org.freedesktop.DBus",
"GetConnectionSELinuxSecurityContext",
NULL,
&error,
&reply,
"s",
unique ? unique : name);
if (r < 0)
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;
@ -823,6 +825,7 @@ static int bus_get_name_creds_dbus1(
c->mask |= SD_BUS_CREDS_SELINUX_CONTEXT;
}
}
r = bus_creds_add_more(c, mask, pid, 0);
if (r < 0)