From c3dc292db814f2ce0b0bf5aff73b1c9a2d5a2ebd Mon Sep 17 00:00:00 2001 From: Bart Massey Date: Tue, 7 Apr 2009 09:59:52 -0700 Subject: [PATCH] cleaned up auth a bit --- src/xcb_auth.c | 17 +++++++++-------- 1 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/xcb_auth.c b/src/xcb_auth.c index 93a6f68..f233cde 100644 --- a/src/xcb_auth.c +++ b/src/xcb_auth.c @@ -242,15 +242,16 @@ int _xcb_get_auth_info(int fd, xcb_auth_info_t *info, int display) Xauth *authptr = 0; int ret = 1; - if (getpeername(fd, sockname, &socknamelen) == -1) - { - if (getsockname(fd, sockname, &socknamelen) == -1) - return 0; /* can only authenticate sockets */ - if (sockname->sa_family != AF_UNIX) + if (getsockname(fd, sockname, &socknamelen) == -1) + return 0; /* can only authenticate sockets */ + + /* Some systems like hpux or Hurd do not expose peer names + * for UNIX Domain Sockets. get_authptr() ignores the + * socket info in the UNIX Domain case anyway. But we + * of course need the peer info for internet auth. */ + if (sockname->sa_family != AF_UNIX && + getpeername(fd, sockname, &socknamelen) == -1) 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) -- 1.6.2.1