From 68b0ddb78f0b147bffc45a337ca16d5d54df866f Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 13 Sep 2013 19:01:04 +0100 Subject: [PATCH 5/5] _dbus_read_credentials_socket: warn or fail at compile time if no support On a whitelist of OSs known to have working credentials-passing (currently FreeBSD, Linux, OpenBSD and NetBSD), it would be a regression for us to not have credentials-passing, so fail hard. On other OSs, raise a warning, which is not normally fatal but will alert developers on those platforms. --- dbus/dbus-sysdeps-unix.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c index 5904b4f..dfccf9a 100644 --- a/dbus/dbus-sysdeps-unix.c +++ b/dbus/dbus-sysdeps-unix.c @@ -1859,6 +1859,21 @@ _dbus_read_credentials_socket (int client_fd, _dbus_verbose ("Failed to getpeereid() credentials: %s\n", _dbus_strerror (errno)); } #else /* no supported mechanism */ + +#warning Socket credentials not supported on this Unix OS +#warning Please tell https://bugs.freedesktop.org/enter_bug.cgi?product=DBus + + /* Please add other operating systems known to support at least one of + * the mechanisms above to this list, keeping alphabetical order. + * Everything not in this list is best-effort. + */ +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \ + defined(__linux__) || \ + defined(__OpenBSD__) || \ + defined(__NetBSD__) +# error Credentials passing not working on this OS is a regression! +#endif + _dbus_verbose ("Socket credentials not supported on this OS\n"); #endif } -- 1.8.4.rc3