Merge branch 'dbus-1.10'

This commit is contained in:
Simon McVittie 2015-10-26 12:11:35 +00:00
commit 71a9153d85
7 changed files with 67 additions and 13 deletions

7
NEWS
View file

@ -18,6 +18,10 @@ Fixes:
This was not exploitable as a denial of service, because the check
for a privileged user is done first. (fd.o #92298, Simon McVittie)
• On Linux with --enable-user-session, add the bus address to the
environment of systemd services for better backwards compatibility
(fd.o #92612, Jan Alexander Steffens)
• Print 64-bit integers on non-GNU Unix platforms (fd.o #92043, Natanael Copa)
• On Windows, fix the logic for replacing the installation prefix
@ -32,6 +36,9 @@ Fixes:
and ${prefix}/share, use relative paths between bus configuration files
to allow the tree to be relocated (fd.o #92028, Simon McVittie)
• Make more of the regression tests pass in Windows builds (fd.o #92538,
Simon McVittie)
D-Bus 1.10.0 (2015-08-25)
==

View file

@ -3,6 +3,7 @@ Description=D-Bus User Message Bus Socket
[Socket]
ListenStream=%t/bus
ExecStartPost=-@SYSTEMCTL@ --user set-environment DBUS_SESSION_BUS_ADDRESS=unix:path=%t/bus
[Install]
WantedBy=sockets.target

View file

@ -103,6 +103,7 @@ if(DBUS_WITH_GLIB)
add_test_executable(test-fdpass ${CMAKE_SOURCE_DIR}/../test/fdpass.c ${TEST_LIBRARIES})
add_test_executable(test-loopback ${CMAKE_SOURCE_DIR}/../test/loopback.c ${TEST_LIBRARIES})
add_test_executable(test-marshal ${CMAKE_SOURCE_DIR}/../test/marshal.c ${TEST_LIBRARIES})
add_test_executable(test-monitor ${CMAKE_SOURCE_DIR}/../test/monitor.c ${TEST_LIBRARIES})
add_test_executable(test-refs ${CMAKE_SOURCE_DIR}/../test/internals/refs.c ${TEST_LIBRARIES})
add_test_executable(test-relay ${CMAKE_SOURCE_DIR}/../test/relay.c ${TEST_LIBRARIES})
add_test_executable(test-syntax ${CMAKE_SOURCE_DIR}/../test/syntax.c ${TEST_LIBRARIES})

View file

@ -1163,6 +1163,12 @@ if test x$enable_systemd = xyes -a x$have_systemd != xyes ; then
AC_MSG_ERROR([Explicitly requested systemd support, but systemd not found])
fi
# If not found in $PATH, we might still have systemd and systemctl at runtime
# (perhaps dbus is being compiled in a minimal chroot with no systemd).
# Assume the upstream-recommended location. Distributors with split /usr
# can override this with ./configure SYSTEMCTL=/bin/systemctl
AC_PATH_PROG([SYSTEMCTL], [systemctl], [/usr/bin/systemctl])
# libaudit detection
if test x$enable_libaudit = xno ; then
have_libaudit=no;

View file

@ -151,11 +151,17 @@ installable_tests += \
test-marshal \
test-refs \
test-relay \
test-sd-activation \
test-syntax \
test-syslog \
test-uid-permissions \
$(NULL)
if DBUS_UNIX
installable_tests += \
test-sd-activation \
$(NULL)
endif DBUS_UNIX
installable_manual_tests += \
manual-authz \
$(NULL)
@ -216,6 +222,7 @@ test_dbus_daemon_eavesdrop_LDADD = \
$(GLIB_LIBS) \
$(NULL)
if DBUS_UNIX
test_sd_activation_SOURCES = \
sd-activation.c \
$(NULL)
@ -223,6 +230,7 @@ test_sd_activation_LDADD = \
libdbus-testutils.la \
$(GLIB_LIBS) \
$(NULL)
endif
test_marshal_SOURCES = marshal.c
test_marshal_LDADD = \

View file

@ -128,11 +128,13 @@ static Config no_eavesdrop_config = {
FALSE
};
#ifdef DBUS_UNIX
static Config fake_systemd_config = {
"valid-config-files/systemd-activation.conf",
NULL,
FALSE
};
#endif
static Config side_effects_config = {
NULL,
@ -1158,6 +1160,8 @@ test_selective (Fixture *f,
g_assert (m == NULL);
}
#ifdef DBUS_UNIX
/* currently only used for the systemd activation test */
static void
expect_new_connection (Fixture *f)
{
@ -1184,6 +1188,7 @@ expect_new_connection (Fixture *f)
dbus_message_unref (m);
}
/* currently only used for the systemd activation test */
static void
take_well_known_name (Fixture *f,
DBusConnection *connection,
@ -1197,6 +1202,7 @@ take_well_known_name (Fixture *f,
g_assert_cmpint (ret, ==, DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER);
}
/* currently only used for the systemd activation test */
static void
expect_take_well_known_name (Fixture *f,
DBusConnection *connection,
@ -1426,6 +1432,7 @@ test_activation (Fixture *f,
"com.example.Nope");
dbus_message_unref (m);
}
#endif /* DBUS_UNIX */
static void
teardown (Fixture *f,
@ -1516,8 +1523,12 @@ main (int argc,
setup, test_unicast_signal, teardown);
g_test_add ("/monitor/no-eavesdrop", Fixture, &no_eavesdrop_config,
setup, test_unicast_signal, teardown);
#ifdef DBUS_UNIX
/* this relies on the systemd activation code path */
g_test_add ("/monitor/activation", Fixture, &fake_systemd_config,
setup, test_activation, teardown);
#endif
return g_test_run ();
}

View file

@ -93,22 +93,14 @@ child_setup (gpointer user_data)
static gchar *
spawn_dbus_daemon (const gchar *binary,
const gchar *configuration,
const gchar *listen_address,
TestUser user,
GPid *daemon_pid)
{
GError *error = NULL;
GString *address;
gint address_fd;
const gchar *const argv[] = {
binary,
configuration,
"--nofork",
"--print-address=1", /* stdout */
#ifdef DBUS_UNIX
"--systemd-activation",
#endif
NULL
};
GPtrArray *argv;
#ifdef DBUS_UNIX
const struct passwd *pwd = NULL;
#endif
@ -166,8 +158,23 @@ spawn_dbus_daemon (const gchar *binary,
#endif
}
argv = g_ptr_array_new_with_free_func (g_free);
g_ptr_array_add (argv, g_strdup (binary));
g_ptr_array_add (argv, g_strdup (configuration));
g_ptr_array_add (argv, g_strdup ("--nofork"));
g_ptr_array_add (argv, g_strdup ("--print-address=1")); /* stdout */
if (listen_address != NULL)
g_ptr_array_add (argv, g_strdup (listen_address));
#ifdef DBUS_UNIX
g_ptr_array_add (argv, g_strdup ("--systemd-activation"));
#endif
g_ptr_array_add (argv, NULL);
g_spawn_async_with_pipes (NULL, /* working directory */
(gchar **) argv, /* g_s_a_w_p() is not const-correct :-( */
(gchar **) argv->pdata,
NULL, /* envp */
G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH,
#ifdef DBUS_UNIX
@ -182,6 +189,8 @@ spawn_dbus_daemon (const gchar *binary,
&error);
g_assert_no_error (error);
g_ptr_array_free (argv, TRUE);
address = g_string_new (NULL);
/* polling until the dbus-daemon writes out its address is a bit stupid,
@ -223,8 +232,14 @@ test_get_dbus_daemon (const gchar *config_file,
{
gchar *dbus_daemon;
gchar *arg;
const gchar *listen_address = NULL;
gchar *address;
/* we often have to override this because on Windows, the default may be
* autolaunch:, which is globally-scoped and hence unsuitable for
* regression tests */
listen_address = "--address=" TEST_LISTEN;
if (config_file != NULL)
{
@ -239,6 +254,10 @@ test_get_dbus_daemon (const gchar *config_file,
arg = g_strdup_printf (
"--config-file=%s/%s",
g_getenv ("DBUS_TEST_DATA"), config_file);
/* The configuration file is expected to give a suitable address,
* do not override it */
listen_address = NULL;
}
else if (g_getenv ("DBUS_TEST_DATADIR") != NULL)
{
@ -276,7 +295,8 @@ test_get_dbus_daemon (const gchar *config_file,
}
else
{
address = spawn_dbus_daemon (dbus_daemon, arg, user, daemon_pid);
address = spawn_dbus_daemon (dbus_daemon, arg,
listen_address, user, daemon_pid);
}
g_free (dbus_daemon);