diff options
author | Rodrigo Moya <rodrigo.moya@collabora.co.uk> | 2012-05-14 14:22:29 +0200 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2012-05-14 14:22:29 +0200 |
commit | 4bfd88357df995b40dd247848397b460129090cf (patch) | |
tree | ea48002a1bb35f64f0df29a6c5caa640b20b27df | |
parent | bd68730a970b6e8bf193e53f9e04bad6dfe96d85 (diff) | |
download | dbus-4bfd88357df995b40dd247848397b460129090cf.tar.gz |
Make DBusTransportAfbus join clients to the bus when authenticated
-rw-r--r-- | dbus/dbus-transport-afbus.c | 18 | ||||
-rw-r--r-- | dbus/dbus-transport-socket.c | 7 |
2 files changed, 22 insertions, 3 deletions
diff --git a/dbus/dbus-transport-afbus.c b/dbus/dbus-transport-afbus.c index f8ed372f..b4fe6e6e 100644 --- a/dbus/dbus-transport-afbus.c +++ b/dbus/dbus-transport-afbus.c @@ -29,6 +29,12 @@ #include "dbus-transport-socket.h" #include "dbus-watch.h" +/* FIXME: get this from glibc headers */ +#define SOL_BUS 280 + +#define BUS_ADD_ADDR 1 +#define BUS_JOIN_BUS 2 + /** * @defgroup DBusTransportAfbus AF_BUS-based DBusTransport implementation * @ingroup DBusInternals @@ -48,13 +54,21 @@ typedef struct DBusTransportAfbus DBusTransportAfbus; struct DBusTransportAfbus { DBusTransportSocket base; /**< Parent instance */ - int fd; /**< File descriptor. */ }; static void afbus_authenticated (DBusTransportSocket *socket_transport) { + /* Make the client join the bus when authenticated, so that it can send + * unicast messages to peers other than the daemon */ + if (setsockopt (_dbus_transport_get_socket_fd ((DBusTransport *) socket_transport, + SOL_BUS, + BUS_JOIN_BUS, + NULL, 0) != 0) + { + _dbus_verbose ("Could not join client to the bus\n"); + } } static const DBusTransportSocketVTable afbus_vtable = { @@ -86,8 +100,6 @@ _dbus_transport_new_for_afbus (int fd, server_guid, address)) goto failed_1; - afbus_transport->fd = fd; - return (DBusTransport *) afbus_transport; failed_1: diff --git a/dbus/dbus-transport-socket.c b/dbus/dbus-transport-socket.c index a45abbb6..0205165d 100644 --- a/dbus/dbus-transport-socket.c +++ b/dbus/dbus-transport-socket.c @@ -441,6 +441,13 @@ do_authentication (DBusTransport *transport, case DBUS_AUTH_STATE_AUTHENTICATED: _dbus_verbose (" %s auth state: authenticated\n", TRANSPORT_SIDE (transport)); + if (transport->is_server) + { + DBusTransportSocket *socket_transport = (DBusTransportSocket *) transport; + + if (socket_transport->vtable->authenticated != NULL) + socket_transport->vtable->authenticated (socket_transport); + } break; } } |