[Xcb] Bug#522708: libxcb: Local socket connections do not work on hurd-i386

Samuel Thibault samuel.thibault at ens-lyon.org
Sun Apr 5 18:31:23 PDT 2009


Package: libxcb
Severity: important
Tags: patch

Hello,

Local socket connections currently do not work on hurd-i386 because
xcb_auth calls getpeername() on the client socket, but hurd-i386 does
not implement anything in that case (I actually wonder what reasonable
value could be returned).  In such case the xcb code does not actually
need the peer name anyway, here is a patch.

Samuel

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.29 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

-- 
Samuel
<N> (* If you have a precise idea of the intended use of the following code, please
<N>    write to Eduardo.Gimenez at inria.fr and ask for the prize :-)
<N>    -- Eduardo (11/8/97) *)
 -+- N sur #ens-mim - et c'était un des développeurs -+-
-------------- next part --------------
--- src/xcb_auth.c.orig	2009-04-06 02:04:04.310000000 +0100
+++ src/xcb_auth.c	2009-04-06 02:06:50.090000000 +0100
@@ -243,7 +243,14 @@
     int ret = 1;
 
     if (getpeername(fd, sockname, &socknamelen) == -1)
-        return 0;  /* can only authenticate sockets */
+    {
+        if (getsockname(fd, sockname, &socknamelen) == -1)
+            return 0;  /* can only authenticate sockets */
+        if (sockname->sa_family != AF_UNIX)
+            return 0;
+        /* Some systems like hpux or Hurd do not expose peer names 
+         * for UNIX Domain Sockets.  We do not need it anyway.  */
+    }
 
     authptr = get_authptr(sockname, socknamelen, display);
     if (authptr == 0)


More information about the Xcb mailing list