From 17fcbf45181e7d864631b9e714f7a7b72e2b006c Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 13 Sep 2013 19:01:04 +0100 Subject: [PATCH] _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. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=60340 Reviewed-by: Colin Walters --- 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 17c8411cf..07080045f 100644 --- a/dbus/dbus-sysdeps-unix.c +++ b/dbus/dbus-sysdeps-unix.c @@ -1841,6 +1841,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 } -- 2.47.3