From: Samuel Thibault Date: Fri, 12 Mar 2010 22:51:32 +0000 (+0100) Subject: Fix authentication on hpux and Hurd X-Git-Url: http://git.demorecorder.com/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d18d03d6f37ec220805855d840950716e22354e4;hp=53a9834e4cdd11aba8c1cc49347f09a958107de8;p=free-sw%2Fxcb%2Flibxcb Fix authentication on hpux and Hurd libxcb's 010e5661 (Fix XDM-AUTHORIZATION-1 (bug #14202)) mistakenly inverted a few lines of code, making local socket authentication fail on hpux and Hurd: when getpeername fails, sockname needs to be initialized by getsockname before its address family can be checked. Signed-off-by: Samuel Thibault Signed-off-by: Julien Danjou --- diff --git a/src/xcb_auth.c b/src/xcb_auth.c index 104f2f0..00aad23 100644 --- a/src/xcb_auth.c +++ b/src/xcb_auth.c @@ -260,10 +260,10 @@ int _xcb_get_auth_info(int fd, xcb_auth_info_t *info, int display) * case anyway.*/ if (getpeername(fd, sockname, &socknamelen) == -1) { - if (sockname->sa_family != AF_UNIX) - return 0; /* except for AF_UNIX, sockets should have peernames */ if (getsockname(fd, sockname, &socknamelen) == -1) return 0; /* can only authenticate sockets */ + if (sockname->sa_family != AF_UNIX) + return 0; /* except for AF_UNIX, sockets should have peernames */ gotsockname = 1; }