diff options
author | Lennart Poettering <lennart@poettering.net> | 2011-03-11 22:35:16 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-03-12 16:38:56 +0000 |
commit | f67f45979b48ce63fb82179a7ec261e5e3ec3395 (patch) | |
tree | 6beaf8fa5920f50d05c3246de45b550c7b931964 /dbus/dbus-connection.c | |
parent | 1a4d710d67391c1d7be2d7db6313e6c118acc773 (diff) | |
download | dbus-f67f45979b48ce63fb82179a7ec261e5e3ec3395.tar.gz |
transport: add new unixexec transport on Unix
The "unixexec:" transport will create a local AF_UNIX socket with
socketpair(), then fork and execute a binary on one side with STDIN and
STDOUT connected to it and then use the other side.
This is useful to implement D-Bus tunneling schemes, for example to get
a D-Bus connection to the system bus on a different host, similar how
udisks is already doing it. (udisks uses SSH TCP tunneling for this,
which is a bit ugly and less secure than this solution).
Suggested use is with connection strings like the following:
unixexec:path=ssh,argv1=foobar,argv2=system-bus-bridge
or:
unixexec:path=pkexec,argv1=system-bus-bridge
or even:
unixexec:path=sudo,argv1=system-bus-bridge
The first line would execute the binary 'system-bus-bridge' on host
'foobar' and then pass D-Bus traffic to it. This (hypothetical) bridge
binary would then forward the information to the local system bus.
The second and third line use this scheme locally to acquire a
privileged connection through pkexec resp. sudo: instead of connecting
directly to the bus, they use the same bridge binary which will forward
all information to the system bus.
The arguments of the protocol are 'path' for the first execlp()
argument, and argv0, argv1, and so on for the following arguments. argv0
can be left out in which case path will be used.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35230
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Diffstat (limited to 'dbus/dbus-connection.c')
-rw-r--r-- | dbus/dbus-connection.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c index 74a9007c..ac0b2c0e 100644 --- a/dbus/dbus-connection.c +++ b/dbus/dbus-connection.c @@ -6258,4 +6258,18 @@ dbus_connection_get_outgoing_unix_fds (DBusConnection *connection) return res; } +#ifdef DBUS_BUILD_TESTS +/** + * Returns the address of the transport object of this connection + * + * @param connection the connection + * @returns the address string + */ +const char* +_dbus_connection_get_address (DBusConnection *connection) +{ + return _dbus_transport_get_address (connection->transport); +} +#endif + /** @} */ |