X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flibsystemd%2Fsd-bus%2Fbus-objects.c;h=6162d12c1d38854776a9c8a2f47078d89044843a;hb=705a415f684f8e9ee19983e5859de00bbb1477cb;hp=0ab1119b583d679da2588e039903dce0c2c01bab;hpb=ff02f101cb7db516bf1732bb74c42cb3b6259af1;p=elogind.git diff --git a/src/libsystemd/sd-bus/bus-objects.c b/src/libsystemd/sd-bus/bus-objects.c index 0ab1119b5..6162d12c1 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; @@ -1682,6 +1692,11 @@ static int add_object_vtable_internal( goto fail; } + if (v->flags & SD_BUS_VTABLE_PROPERTY_CONST) { + r = -EINVAL; + goto fail; + } + /* Fall through */ case _SD_BUS_VTABLE_PROPERTY: {