gdbus: support unix:dir= addresses

unix:dir= addresses are exactly the same as unix:tmpdir= addresses,
already supported by GDBus, except they forbid use of abstract sockets.
This is convenient for situations where abstract sockets are
impermissible, such as when a D-Bus client inside a network namespace
needs to connect to a server running in a different network namespace.
An abstract socket cannot be shared between two processes in different
network namespaces.

Applications could use unix:path= addresses instead, so this is only a
convenience, but there's no good reason not to support unix:dir=.
Currently it is not supported simply because unix:dir= is a relatively
recent addition to the D-Bus spec.
This commit is contained in:
Michael Catanzaro
2019-06-11 22:35:19 -05:00
parent d2450c8124
commit fc597fa5f9
3 changed files with 20 additions and 10 deletions

View File

@@ -113,9 +113,13 @@ test_unix_address (void)
g_assert_false (g_dbus_is_address ("unix:path=/foo;abstract=/bar"));
assert_is_supported_address ("unix:path=/tmp/concrete;unix:abstract=/tmp/abstract");
assert_is_supported_address ("unix:tmpdir=/tmp");
assert_is_supported_address ("unix:dir=/tmp");
assert_not_supported_address ("unix:tmpdir=/tmp,path=/tmp");
assert_not_supported_address ("unix:tmpdir=/tmp,abstract=/tmp/foo");
assert_not_supported_address ("unix:tmpdir=/tmp,dir=/tmp");
assert_not_supported_address ("unix:path=/tmp,abstract=/tmp/foo");
assert_not_supported_address ("unix:path=/tmp,dir=/tmp");
assert_not_supported_address ("unix:abstract=/tmp/foo,dir=/tmp");
assert_not_supported_address ("unix:");
#endif
}