summaryrefslogtreecommitdiff
path: root/src/bus-driverd/bus-driverd.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-12-21 18:21:49 +0100
committerLennart Poettering <lennart@poettering.net>2013-12-21 18:21:49 +0100
commitaa56560dbbd485e61fb527214a5211d4b683b3e8 (patch)
tree0f42c0a86ac55636bbad90d57bf5618fefecb0ed /src/bus-driverd/bus-driverd.c
parent8875e122f0014758a987e2de3eafbd6a8bfef515 (diff)
bus: when client asks driverd for credentials of a name, return a useful error if that name doesn't exist on the bus
Diffstat (limited to 'src/bus-driverd/bus-driverd.c')
-rw-r--r--src/bus-driverd/bus-driverd.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/bus-driverd/bus-driverd.c b/src/bus-driverd/bus-driverd.c
index 61491a34d9..0fff698e95 100644
--- a/src/bus-driverd/bus-driverd.c
+++ b/src/bus-driverd/bus-driverd.c
@@ -377,6 +377,8 @@ static int driver_get_security_ctx(sd_bus *bus, sd_bus_message *m, void *userdat
assert_return(service_name_is_valid(arg0), -EINVAL);
r = sd_bus_get_owner(bus, arg0, SD_BUS_CREDS_SELINUX_CONTEXT, &creds);
+ if (r == -ENOENT)
+ return sd_bus_error_setf(error, SD_BUS_ERROR_NAME_HAS_NO_OWNER, "Name %s is currently not owned by anyone.", arg0);
if (r < 0)
return r;
@@ -403,6 +405,8 @@ static int driver_get_pid(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bus
assert_return(service_name_is_valid(arg0), -EINVAL);
r = sd_bus_get_owner(bus, arg0, SD_BUS_CREDS_PID, &creds);
+ if (r == -ENOENT)
+ return sd_bus_error_setf(error, SD_BUS_ERROR_NAME_HAS_NO_OWNER, "Name %s is currently not owned by anyone.", arg0);
if (r < 0)
return r;
@@ -421,6 +425,8 @@ static int driver_get_user(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bu
assert_return(service_name_is_valid(arg0), -EINVAL);
r = sd_bus_get_owner(bus, arg0, SD_BUS_CREDS_UID, &creds);
+ if (r == -ENOENT)
+ return sd_bus_error_setf(error, SD_BUS_ERROR_NAME_HAS_NO_OWNER, "Name %s is currently not owned by anyone.", arg0);
if (r < 0)
return r;
@@ -451,6 +457,8 @@ static int driver_get_name_owner(sd_bus *bus, sd_bus_message *m, void *userdata,
assert_return(service_name_is_valid(arg0), -EINVAL);
r = sd_bus_get_owner(bus, arg0, SD_BUS_CREDS_UNIQUE_NAME, &creds);
+ if (r == -ENOENT)
+ return sd_bus_error_setf(error, SD_BUS_ERROR_NAME_HAS_NO_OWNER, "Name %s is currently not owned by anyone.", arg0);
if (r < 0)
return r;