[RFC] Patch to allow a DBusConnection to be recreated from an fd
Simon McVittie
simon.mcvittie at collabora.co.uk
Tue Mar 5 12:40:37 PST 2013
On 05/03/13 19:26, Thiago Macieira wrote:
> I don't see any harm in obtaining the connection
> address, and I do think that creating a connection from an already-opened file
> descriptor could be very useful. For example, some pre-handshake could be
> performed on that file descriptor, or it could be transported over something
> different.
If we go this route, I'd prefer it to be its own transport similar to
unixexec - "unixfd:fd=3,state=before_0" or something - rather than
introducing open_from_fd(), which appears to mean "ignore the address
parameter and use this fd instead, hopefully they match". It should have
the same "it's really a socket, not something weird like a pair of
pipes" property as unixexec.
In fact, I think this is how unixexec should have worked all along -
then we wouldn't have unixexec's rather unfortunate security properties
("if you can tell someone a D-Bus address to connect to, you can make
them execute code").
The states through which a D-Bus connection goes are approximately:
* before initial '\0'
* after initial '\0' but before SASL (x)
* during SASL (x)
* after SASL but before Hello
* Hello sent, reply with unique name not received (x)
* between messages
* during an incoming or outgoing message (x)
(at the points marked (x), handing off the connection makes little
sense; included for completeness).
S
More information about the dbus
mailing list