GNOME Bugzilla – Bug 673943
Add test-case checking interoperability with the libdbus-1.so implementation of DBUS_COOKIE_SHA1
Last modified: 2012-04-14 16:43:42 UTC
Just gotten reports that this may not currently work. Since the DBUS_COOKIE_SHA1 authentication method is rarely used, it's likely it will just bit-rot without a proper test. Should guard the tests behind HAVE_DBUS1.
This actually turned out to be a libdbus-1 bug, see https://bugs.freedesktop.org/show_bug.cgi?id=48580 I still have a couple of nice test cases for this, though, will attach it in a bit. Won't be able to enable these tests until there's a release of libdbus-1 we can depend on though.
Created attachment 211895 [details] [review] Add a way to pick authentication mechanism First we need to have a way to pick what authentication mechanisms to use. This is new API so mark is as 2.34. Need to wait for 2.32 to branch before committing this to master, obviously.
Created attachment 211896 [details] [review] Check interop with libdbus-1 Once we have a way to pick auth mechanisms, it's fairly straightforward to check that we interoperate with libdbus-1. Note that there are two cases 1. GDBus being a client and libdbus-1 being a server; and 2. libdbus-1 being a client and GDBus being a server and that we need to test both (and only the second one currently fail).
Btw, here's the routput when running the new tests using a patched libdbus-1 and with G_DBUS_DEBUG=authentication $ G_DBUS_DEBUG=authentication LD_LIBRARY_PATH=/home/davidz/Hacking/dbus/dbus/.libs ./gdbus-dbus-cookie-sha1-interop /gdbus/dbus-cookie-sha1-interop/gdbus-client: GDBus-debug:Auth: CLIENT: initiating GDBus-debug:Auth: CLIENT: sent credentials `GCredentials:linux-ucred:pid=20697,uid=500,gid=500' GDBus-debug:Auth: CLIENT: writing `AUTH\r\n' GDBus-debug:Auth: CLIENT: WaitingForReject GDBus-debug:Auth: CLIENT: WaitingForReject, read 'REJECTED EXTERNAL DBUS_COOKIE_SHA1 ANONYMOUS' GDBus-debug:Auth: CLIENT: Trying to choose mechanism GDBus-debug:Auth: CLIENT: Trying mechanism `DBUS_COOKIE_SHA1' GDBus-debug:Auth: CLIENT: writing `AUTH DBUS_COOKIE_SHA1 353030\r\n' GDBus-debug:Auth: CLIENT: WaitingForData GDBus-debug:Auth: CLIENT: WaitingForData, read=`DATA 6f72675f667265656465736b746f705f67656e6572616c2031303534363634313330203532663934383235376133633063303664646562646366393663616464353261' GDBus-debug:Auth: CLIENT: writing `DATA 47326d5831663435795968434b41594f2034363731376534313766633063623837396130663034306366643636666331653263663234633433\r\n' GDBus-debug:Auth: CLIENT: WaitingForOK GDBus-debug:Auth: CLIENT: WaitingForOK, read `OK 436d711a81c83b0a385b707c00014918' GDBus-debug:Auth: CLIENT: writing `NEGOTIATE_UNIX_FD\r\n' GDBus-debug:Auth: CLIENT: WaitingForAgreeUnixFD GDBus-debug:Auth: CLIENT: WaitingForAgreeUnixFD, read=`AGREE_UNIX_FD' GDBus-debug:Auth: CLIENT: writing `BEGIN\r\n' GDBus-debug:Auth: CLIENT: Done, authenticated=1 OK /gdbus/dbus-cookie-sha1-interop/gdbus-server: GDBus-debug:Auth: SERVER: initiating GDBus-debug:Auth: SERVER: received credentials `GCredentials:linux-ucred:pid=0' GDBus-debug:Auth: SERVER: WaitingForAuth GDBus-debug:Auth: SERVER: WaitingForAuth, read `AUTH EXTERNAL 353030' GDBus-debug:Auth: SERVER: writing `REJECTED DBUS_COOKIE_SHA1\r\n' GDBus-debug:Auth: SERVER: WaitingForAuth GDBus-debug:Auth: SERVER: WaitingForAuth, read `AUTH DBUS_COOKIE_SHA1 353030' GDBus-debug:Auth: SERVER: writing `DATA 6f72675f67746b5f67646275735f67656e6572616c203120444234766e683279324d4d3850367633\r\n' GDBus-debug:Auth: SERVER: WaitingForData GDBus-debug:Auth: SERVER: WaitingForData, read `DATA 30643634323562353031396164666335616638383038653863356230633165612066303437393961313537373366346433396663346163636633646133363438373662613132636637' GDBus-debug:Auth: SERVER: writing `OK 4ba30ef6b908575cb91bd28a4f864fe0\r\n' GDBus-debug:Auth: SERVER: WaitingForBegin GDBus-debug:Auth: SERVER: WaitingForBegin, read `NEGOTIATE_UNIX_FD' GDBus-debug:Auth: SERVER: writing `AGREE_UNIX_FD\r\n' GDBus-debug:Auth: SERVER: WaitingForBegin GDBus-debug:Auth: SERVER: WaitingForBegin, read `BEGIN' GDBus-debug:Auth: SERVER: Done, authenticated=1
Created attachment 211942 [details] [review] Interop v2 The D-Bus bug-fix has been committed, see https://bugs.freedesktop.org/show_bug.cgi?id=48580#c7 so update this patch to run the test only if using these versions or newer.
I've branched 2.32 now, so I think this can go in
OK, I made the tests a bit more general so they also check that EXTERNAL works. I also had to remove a g_warning() from gio/gsocketcontrolmessage.c which was fallout from alexl's recent socket credentials commit.