From 0a6310fe16d56cfcf1d3eea46b71a18ad5fe02a1 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 25 Aug 2015 19:54:18 +0100 Subject: [PATCH 1/4] mention o.fd.DBus.Verbose in the NEWS too --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index c54bb7f5..cabe4b85 100644 --- a/NEWS +++ b/NEWS @@ -59,6 +59,8 @@ New bus APIs: • org.freedesktop.DBus.Stats interface (semi-privileged) · now enabled by default · new GetAllMatchRules method +• org.freedesktop.DBus.Verbose interface (not normally compiled) + · toggles the effect of DBUS_VERBOSE New executables: From 36d864e4697bc6e1eeffb32092bd78b108362ab5 Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Sun, 20 Sep 2015 13:47:23 +0200 Subject: [PATCH 2/4] Make Windows dbus-daemon look for the config file we install The canonical location for bus setup changed from ${sysconfdir}/dbus-1 to ${datadir}/dbus-1 (or their CMake equivalents) in version 1.9.18. Also stop trying to use bus/session.conf from the build tree, which will not work if our ${prefix} contains an older ${sysconfdir}/dbus-1/session.conf. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92028 Reviewed-by: Ralf Habacker --- dbus/dbus-sysdeps-util-win.c | 22 ++++++++++++ dbus/dbus-sysdeps-win.c | 65 ------------------------------------ dbus/dbus-sysdeps-win.h | 4 --- 3 files changed, 22 insertions(+), 69 deletions(-) diff --git a/dbus/dbus-sysdeps-util-win.c b/dbus/dbus-sysdeps-util-win.c index e83c5397..57c353e9 100644 --- a/dbus/dbus-sysdeps-util-win.c +++ b/dbus/dbus-sysdeps-util-win.c @@ -1647,6 +1647,28 @@ _dbus_get_standard_system_servicedirs (DBusList **dirs) return TRUE; } +static dbus_bool_t +_dbus_get_config_file_name (DBusString *str, + const char *basename) +{ + DBusString tmp; + + if (!_dbus_string_append (str, _dbus_windows_get_datadir ())) + return FALSE; + + _dbus_string_init_const (&tmp, "dbus-1"); + + if (!_dbus_concat_dir_and_file (str, &tmp)) + return FALSE; + + _dbus_string_init_const (&tmp, basename); + + if (!_dbus_concat_dir_and_file (str, &tmp)) + return FALSE; + + return TRUE; +} + /** * Append the absolute path of the system.conf file * (there is no system bus on Windows so this can just diff --git a/dbus/dbus-sysdeps-win.c b/dbus/dbus-sysdeps-win.c index b3b459f8..69644b00 100644 --- a/dbus/dbus-sysdeps-win.c +++ b/dbus/dbus-sysdeps-win.c @@ -3330,71 +3330,6 @@ _dbus_get_install_root(char *prefix, int len) return TRUE; } -/** - find config file either from installation or build root according to - the following path layout - install-root/ - bin/dbus-daemon[d].exe - etc/.conf *or* etc/dbus-1/.conf - (the former above is what dbus4win uses, the latter above is - what a "normal" Unix-style "make install" uses) - - build-root/ - bin/dbus-daemon[d].exe - bus/.conf -*/ -dbus_bool_t -_dbus_get_config_file_name(DBusString *config_file, char *s) -{ - char path[MAX_PATH*2]; - int path_size = sizeof(path); - - if (!_dbus_get_install_root(path,path_size)) - return FALSE; - - if(strlen(s) + 4 + strlen(path) > sizeof(path)-2) - return FALSE; - strcat(path,"etc\\"); - strcat(path,s); - if (_dbus_file_exists(path)) - { - // find path from executable - if (!_dbus_string_append (config_file, path)) - return FALSE; - } - else - { - if (!_dbus_get_install_root(path,path_size)) - return FALSE; - if(strlen(s) + 11 + strlen(path) > sizeof(path)-2) - return FALSE; - strcat(path,"etc\\dbus-1\\"); - strcat(path,s); - - if (_dbus_file_exists(path)) - { - if (!_dbus_string_append (config_file, path)) - return FALSE; - } - else - { - if (!_dbus_get_install_root(path,path_size)) - return FALSE; - if(strlen(s) + 4 + strlen(path) > sizeof(path)-2) - return FALSE; - strcat(path,"bus\\"); - strcat(path,s); - - if (_dbus_file_exists(path)) - { - if (!_dbus_string_append (config_file, path)) - return FALSE; - } - } - } - return TRUE; -} - /* See comment in dbus-sysdeps-unix.c */ dbus_bool_t _dbus_lookup_session_address (dbus_bool_t *supported, diff --git a/dbus/dbus-sysdeps-win.h b/dbus/dbus-sysdeps-win.h index a5367705..e9b30d7a 100644 --- a/dbus/dbus-sysdeps-win.h +++ b/dbus/dbus-sysdeps-win.h @@ -84,10 +84,6 @@ _dbus_win_sid_to_name_and_domain (dbus_uid_t uid, dbus_bool_t _dbus_file_exists (const char *filename); -DBUS_PRIVATE_EXPORT -dbus_bool_t _dbus_get_config_file_name(DBusString *config_file, - char *s); - DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_get_install_root(char *prefix, int len); From 171cdd50fb153c355b70bec8da5181e0b523dbd2 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 18 Sep 2015 16:22:29 +0100 Subject: [PATCH 3/4] Fix creation of Exec path for files not in prefix Doing strcat() into a static buffer produces incorrect results for the second and subsequent services if they are not in the ${prefix}; for example, if the first call should have returned "C:\bar\bin\service1" and the second should have returned "C:\bar\bin\service2", the second result would actually be "C:\bar\bin\service1C:\bar\bin\service2". Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83539 Reviewed-by: Simon McVittie [smcv: added commit message; used strncpy/strncat to avoid overflow] Reviewed-by: Ralf Habacker --- dbus/dbus-sysdeps-util-win.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/dbus/dbus-sysdeps-util-win.c b/dbus/dbus-sysdeps-util-win.c index 57c353e9..096ffee3 100644 --- a/dbus/dbus-sysdeps-util-win.c +++ b/dbus/dbus-sysdeps-util-win.c @@ -1493,12 +1493,19 @@ _dbus_replace_install_prefix (const char *configure_time_path) if ((!_dbus_get_install_root(runtime_prefix, len) || strncmp (configure_time_path, DBUS_PREFIX "/", strlen (DBUS_PREFIX) + 1))) { - strcat (retval, configure_time_path); - return retval; - } + strncpy (retval, configure_time_path, sizeof (retval) - 1); + /* strncpy does not guarantee to 0-terminate the string */ + retval[sizeof (retval) - 1] = '\0'; + } else { + size_t remaining; - strcpy (retval, runtime_prefix); - strcat (retval, configure_time_path + strlen (DBUS_PREFIX) + 1); + strncpy (retval, runtime_prefix, sizeof (retval) - 1); + retval[sizeof (retval) - 1] = '\0'; + remaining = sizeof (retval) - 1 - strlen (retval); + strncat (retval, + configure_time_path + strlen (DBUS_PREFIX) + 1, + remaining); + } /* Somehow, in some situations, backslashes get collapsed in the string. * Since windows C library accepts both forward and backslashes as From 54199f6903175d40a68b130f348456687364f51a Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 30 Sep 2015 15:49:06 +0100 Subject: [PATCH 4/4] NEWS --- NEWS | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index cabe4b85..b5b94368 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,10 @@ D-Bus 1.10.2 (UNRELEASED) == -... +Fixes: + +• On Windows, fix the logic for replacing the installation prefix + in service files' Exec lines (fd.o #83539; Milan Crha, Simon McVittie) D-Bus 1.10.0 (2015-08-25) ==