summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus/bus-objects.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-11-20 20:58:39 +0100
committerLennart Poettering <lennart@poettering.net>2014-11-21 00:32:02 +0100
commit0ca454d474a13f363dcd5ef8dc97ca158569d3ed (patch)
tree63f0c82d17df51774aaad1459429cb7b9f2c4e86 /src/libsystemd/sd-bus/bus-objects.c
parent609c3029076da1ba423673161e5d0fc82ccca6b6 (diff)
sd-bus: create clean error when a property Set() call with incorrect signature is passed in
Diffstat (limited to 'src/libsystemd/sd-bus/bus-objects.c')
-rw-r--r--src/libsystemd/sd-bus/bus-objects.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libsystemd/sd-bus/bus-objects.c b/src/libsystemd/sd-bus/bus-objects.c
index 7981d65052..6162d12c1d 100644
--- a/src/libsystemd/sd-bus/bus-objects.c
+++ b/src/libsystemd/sd-bus/bus-objects.c
@@ -617,6 +617,9 @@ static int property_get_set_callbacks_run(
return r;
} else {
+ const char *signature = NULL;
+ char type = 0;
+
if (c->vtable->type != _SD_BUS_VTABLE_WRITABLE_PROPERTY)
return sd_bus_reply_method_errorf(m, SD_BUS_ERROR_PROPERTY_READ_ONLY, "Property '%s' is not writable.", c->member);
@@ -628,6 +631,13 @@ static int property_get_set_callbacks_run(
c->last_iteration = bus->iteration_counter;
+ r = sd_bus_message_peek_type(m, &type, &signature);
+ if (r < 0)
+ return r;
+
+ if (type != 'v' || !streq(strempty(signature), strempty(c->vtable->x.property.signature)))
+ return sd_bus_reply_method_errorf(m, SD_BUS_ERROR_INVALID_ARGS, "Incorrect parameters for property '%s', expected '%s', got '%s'.", c->member, strempty(c->vtable->x.property.signature), strempty(signature));
+
r = sd_bus_message_enter_container(m, 'v', c->vtable->x.property.signature);
if (r < 0)
return r;