summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus/bus-control.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-01-07 19:29:14 +0100
committerLennart Poettering <lennart@poettering.net>2015-01-07 19:32:42 +0100
commit210a68826fac0f6525719cc6044c7858c655986a (patch)
treecac499e52ecfe455f1c83561ff2e94647cbc6bd7 /src/libsystemd/sd-bus/bus-control.c
parentb80c66ba9836456de5260e4a1b696ba25561f613 (diff)
sd-bus: always catch name requests for the special names "org.freedesktop.DBus" and "org.freedesktop.DBus.Local" and refuse them
Diffstat (limited to 'src/libsystemd/sd-bus/bus-control.c')
-rw-r--r--src/libsystemd/sd-bus/bus-control.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c
index b2394db3eb..2db1afb86d 100644
--- a/src/libsystemd/sd-bus/bus-control.c
+++ b/src/libsystemd/sd-bus/bus-control.c
@@ -137,6 +137,10 @@ _public_ int sd_bus_request_name(sd_bus *bus, const char *name, uint64_t flags)
assert_return(service_name_is_valid(name), -EINVAL);
assert_return(name[0] != ':', -EINVAL);
+ /* Don't allow requesting the special driver and local names */
+ if (STR_IN_SET(name, "org.freedesktop.DBus", "org.freedesktop.DBus.Local"))
+ return -EINVAL;
+
if (!BUS_IS_OPEN(bus->state))
return -ENOTCONN;
@@ -215,6 +219,10 @@ _public_ int sd_bus_release_name(sd_bus *bus, const char *name) {
assert_return(service_name_is_valid(name), -EINVAL);
assert_return(name[0] != ':', -EINVAL);
+ /* Don't allow requesting the special driver and local names */
+ if (STR_IN_SET(name, "org.freedesktop.DBus", "org.freedesktop.DBus.Local"))
+ return -EINVAL;
+
if (!BUS_IS_OPEN(bus->state))
return -ENOTCONN;
@@ -614,6 +622,9 @@ int bus_get_name_creds_kdbus(
uint64_t id;
int r;
+ if (streq(name, "org.freedesktop.DBus"))
+ return -ENOTSUP;
+
r = bus_kernel_parse_unique_name(name, &id);
if (r < 0)
return r;
@@ -871,6 +882,9 @@ _public_ int sd_bus_get_name_creds(
assert_return(service_name_is_valid(name), -EINVAL);
assert_return(bus->bus_client, -ENODATA);
+ if (streq(name, "org.freedesktop.DBus.Local"))
+ return -EINVAL;
+
if (!BUS_IS_OPEN(bus->state))
return -ENOTCONN;