diff options
author | Richard Hansen <rhansen@rhansen.org> | 2023-04-24 00:14:04 -0400 |
---|---|---|
committer | Robert Ancell <robert.ancell@gmail.com> | 2023-04-26 09:33:47 +1200 |
commit | 64e0aabe0d42a0138fec61bc2c3a7522072ef1f2 (patch) | |
tree | b21a0274b9efe35256240d4474547ad0978d6422 | |
parent | fa1ea6730fe7011d6f20e0589e9beb72af33eedd (diff) | |
download | lightdm-git-64e0aabe0d42a0138fec61bc2c3a7522072ef1f2.tar.gz |
tests: Use unix:dir instead of unix:tmpdir for dbus-daemon socket
Starting with dbus-daemon v1.15.2, unix:tmpdir no longer causes
dbus-daemon to create abstract sockets (for security reasons), so
unix:tmpdir is now equivalent to unix:dir. (Also, some systems don't
support abstract sockets.) Switch to unix:dir so that it is clear
that the tests expect a socket file to be created in the filesystem.
-rw-r--r-- | tests/data/session.conf | 2 | ||||
-rw-r--r-- | tests/data/system.conf | 2 | ||||
-rw-r--r-- | tests/src/libsystem.c | 21 |
3 files changed, 14 insertions, 11 deletions
diff --git a/tests/data/session.conf b/tests/data/session.conf index c5d96488..da5a41ab 100644 --- a/tests/data/session.conf +++ b/tests/data/session.conf @@ -1,6 +1,6 @@ <busconfig> <type>session</type> - <listen>unix:tmpdir=/tmp</listen> + <listen>unix:dir=/tmp</listen> <policy context="default"> <allow send_destination="*" eavesdrop="true"/> <allow eavesdrop="true"/> diff --git a/tests/data/system.conf b/tests/data/system.conf index 23105fd7..7e144a64 100644 --- a/tests/data/system.conf +++ b/tests/data/system.conf @@ -1,6 +1,6 @@ <busconfig> <type>system</type> - <listen>unix:tmpdir=/tmp</listen> + <listen>unix:dir=/tmp</listen> <policy context="default"> <allow send_destination="*" eavesdrop="true"/> <allow eavesdrop="true"/> diff --git a/tests/src/libsystem.c b/tests/src/libsystem.c index a02cfa12..a15e7df5 100644 --- a/tests/src/libsystem.c +++ b/tests/src/libsystem.c @@ -210,17 +210,20 @@ redirect_path (const gchar *path) /* * Don't redirect /tmp/dbus-* so that the test runner and its invoked * LightDM can interact with the D-Bus daemon launched by dbus-env.c. The - * D-Bus config has <listen>unix:tmpdir=/tmp</listen>, and with that config - * the D-Bus specification [1] says that the daemon will create a socket + * D-Bus config has <listen>unix:dir=/tmp</listen>, and with that config the + * D-Bus specification [1] says that the daemon will create a socket file * whose name matches /tmp/dbus-*. * - * (With unix:tmpdir, dbus-daemon is allowed, but not required, to create - * abstract sockets instead of file-based sockets. Abstract sockets are - * unaffected by the redirection of /tmp to $LIGHTDM_TEST_ROOT because they - * don't actually exist in the filesystem. An exception is required here - * anyway because not all systems support abstract sockets, and starting - * with v1.15.2 dbus-daemon doesn't use abstract sockets even on systems - * that support them [2].) + * (If the configs had unix:tmpdir instead of unix:dir, dbus-daemon would be + * allowed, but not required, to create abstract sockets instead of + * file-based sockets. Abstract sockets are unaffected by the redirection + * of /tmp to $LIGHTDM_TEST_ROOT because they don't actually exist in the + * filesystem. That seems like a good feature in this case, but not all + * systems support abstract sockets, and starting with v1.15.2 dbus-daemon + * doesn't use abstract sockets even on systems that support them [2]. + * Thus, an exception for /tmp/dbus-* is required here regardless. To avoid + * platform-specific cold code paths, unix:dir is used to force the use of + * normal socket files.) * * [1] https://dbus.freedesktop.org/doc/dbus-specification.html#transports-unix-domain-sockets-addresses * [2] https://gitlab.freedesktop.org/dbus/dbus/-/blob/35ade3c8f7aca16d1c6289828a2597859d1c503b/NEWS#L129-L147 |