simple UNIX_FD pass test?

David Sommerseth dbus at lists.topphemmelig.net
Thu Nov 15 17:23:29 UTC 2018


On 12/11/2018 16:18, Felipe Gasper wrote:
> Hello,
> 
> 	I’m working on support for unix FD passing in Protocol::DBus.
> 
> 	What would be a simple way to test my implementation? Is there maybe a built-in (or systemd) method call that always returns unix FDs or some such?
> 
> 	Thank you!

I've used the unit test code available in glib2, both to better understand and
to test passing of FDs.

Client/caller side implementation:
<https://gitlab.gnome.org/GNOME/glib/blob/master/gio/tests/gdbus-example-unix-fd-client.c#L14>

Server/service side implementation:
<https://gitlab.gnome.org/GNOME/glib/blob/master/gio/tests/gdbus-example-server.c#L123>

In my project (openvpn3-linux) we're using glib2 for the D-Bus implementation,
so for us these implementations was fairly straight forward to adopt; even
though we're using slightly different and more high-level functions [IIRC: 0,
1].  But our own unit tests works well against the glib2 unit tests, so we
believe we managed to nail it :)  (We're just in the middle of cleaning up our
code using this feature, so it isn't public just yet - but most likely next
week or so)

[0]
<https://developer.gnome.org/gio/stable/GDBusConnection.html#g-dbus-connection-call-with-unix-fd-list-sync>
[1]
<https://developer.gnome.org/gio/stable/GDBusMessage.html#g-dbus-message-get-unix-fd-list>


-- 
kind regards,

David Sommerseth
OpenVPN Inc



More information about the dbus mailing list