diff options
author | Simon McVittie <smcv@collabora.com> | 2017-05-31 20:33:14 +0100 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2017-06-08 16:59:48 +0100 |
commit | 175c6c14d3c995585f365ba013c8267674e868ba (patch) | |
tree | 58e6b918e35b017a39b80ccdbc7627738be6b6da /bus | |
parent | db5bab32febc297255d785ea3c11cc4b38862614 (diff) | |
download | dbus-175c6c14d3c995585f365ba013c8267674e868ba.tar.gz |
driver: Generate child node elements in introspection
This makes the /org/freedesktop/DBus path discoverable.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101257
Diffstat (limited to 'bus')
-rw-r--r-- | bus/driver.c | 27 | ||||
-rw-r--r-- | bus/driver.h | 3 | ||||
-rw-r--r-- | bus/main.c | 2 |
3 files changed, 28 insertions, 4 deletions
diff --git a/bus/driver.c b/bus/driver.c index 4e9b67cb..c3f344ad 100644 --- a/bus/driver.c +++ b/bus/driver.c @@ -2537,7 +2537,8 @@ write_args_for_direction (DBusString *xml, dbus_bool_t bus_driver_generate_introspect_string (DBusString *xml, - dbus_bool_t is_canonical_path) + dbus_bool_t is_canonical_path, + DBusMessage *message) { const InterfaceHandler *ih; const MessageHandler *mh; @@ -2580,6 +2581,28 @@ bus_driver_generate_introspect_string (DBusString *xml, return FALSE; } + if (message != NULL) + { + /* Make the bus driver object path discoverable */ + if (dbus_message_has_path (message, "/")) + { + if (!_dbus_string_append (xml, + " <node name=\"org/freedesktop/DBus\"/>\n")) + return FALSE; + } + else if (dbus_message_has_path (message, "/org")) + { + if (!_dbus_string_append (xml, + " <node name=\"freedesktop/DBus\"/>\n")) + return FALSE; + } + else if (dbus_message_has_path (message, "/org/freedesktop")) + { + if (!_dbus_string_append (xml, " <node name=\"DBus\"/>\n")) + return FALSE; + } + } + if (!_dbus_string_append (xml, "</node>\n")) return FALSE; @@ -2618,7 +2641,7 @@ bus_driver_handle_introspect (DBusConnection *connection, is_canonical_path = dbus_message_has_path (message, DBUS_PATH_DBUS); - if (!bus_driver_generate_introspect_string (&xml, is_canonical_path)) + if (!bus_driver_generate_introspect_string (&xml, is_canonical_path, message)) goto oom; v_STRING = _dbus_string_get_const_data (&xml); diff --git a/bus/driver.h b/bus/driver.h index 61bbf778..2964b6d4 100644 --- a/bus/driver.h +++ b/bus/driver.h @@ -46,6 +46,7 @@ dbus_bool_t bus_driver_send_service_owner_changed (const char *service_name BusTransaction *transaction, DBusError *error); dbus_bool_t bus_driver_generate_introspect_string (DBusString *xml, - dbus_bool_t canonical_path); + dbus_bool_t canonical_path, + DBusMessage *message); #endif /* BUS_DRIVER_H */ @@ -189,7 +189,7 @@ introspect (void) if (!_dbus_string_init (&xml)) goto oom; - if (!bus_driver_generate_introspect_string (&xml, TRUE)) + if (!bus_driver_generate_introspect_string (&xml, TRUE, NULL)) { _dbus_string_free (&xml); goto oom; |