]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
_dbus_read_credentials_socket: warn or fail at compile time if no support
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Fri, 13 Sep 2013 18:01:04 +0000 (19:01 +0100)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Mon, 23 Sep 2013 10:24:20 +0000 (11:24 +0100)
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 <walters@verbum.org>
dbus/dbus-sysdeps-unix.c

index 17c8411cf7935c28cdb15705bf21cc220ef0226f..07080045fac1a44db9bf0e86001f4ea64d0f0771 100644 (file)
@@ -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
   }