In some cases, it is needed to check if the sender of a Set message is allowed to make an operation. This adds a way for users of GDBus to do simple checks like this. --- gdbus/gdbus.h | 2 ++ gdbus/object.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/gdbus/gdbus.h b/gdbus/gdbus.h index 6f5a012..fbd313d 100644 --- a/gdbus/gdbus.h +++ b/gdbus/gdbus.h @@ -293,6 +293,8 @@ void g_dbus_pending_property_error_valist(GDBusPendingReply id, const char *name, const char *format, va_list args); void g_dbus_pending_property_error(GDBusPendingReply id, const char *name, const char *format, ...); +const char *g_dbus_pending_property_get_sender(GDBusPendingPropertySet id); + void g_dbus_emit_property_changed(DBusConnection *connection, const char *path, const char *interface, const char *name); diff --git a/gdbus/object.c b/gdbus/object.c index 1a54b3f..c1fc91e 100644 --- a/gdbus/object.c +++ b/gdbus/object.c @@ -498,6 +498,20 @@ void g_dbus_pending_property_error(GDBusPendingReply id, const char *name, va_end(args); } +const char *g_dbus_pending_property_get_sender(GDBusPendingPropertySet id) +{ + GSList *l; + + for (l = pending_property_set; l != NULL; l = l->next) { + struct property_data *propdata = l->data; + + if (propdata->id == id) + return dbus_message_get_sender(propdata->message); + } + + return NULL; +} + static void reset_parent(gpointer data, gpointer user_data) { struct generic_data *child = data; -- 1.8.1 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html