core: refuse accepting a scope controller unless we are called on the API bus

Let's make sure clients get early errors if they try something weird.
This commit is contained in:
Lennart Poettering 2017-11-23 20:02:00 +01:00
parent abdb9b08f6
commit f2c49c8658

View file

@ -119,6 +119,11 @@ static int bus_scope_set_transient_property(
const char *controller;
char *c;
/* We can't support direct connections with this, as direct connections know no service or unique name
* concept, but the Controller field stores exactly that. */
if (sd_bus_message_get_bus(message) != UNIT(s)->manager->api_bus)
return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED, "Sorry, Controller= logic only supported via the bus.");
r = sd_bus_message_read(message, "s", &controller);
if (r < 0)
return r;