File bug-262309_xcb-xauthlocalhostname.diff of Package libxcb

--- src/xcb_auth.c.orig	2009-05-29 17:48:24.000000000 +0200
+++ src/xcb_auth.c	2009-05-29 17:56:01.000000000 +0200
@@ -100,2 +100,3 @@ static Xauth *get_authptr(struct sockadd
     int dispbuflen;
+    Xauth *authptr = NULL;
 
@@ -143,6 +143,16 @@ static Xauth *get_authptr(struct sockadd
 
-    return XauGetBestAuthByAddr (family,
-                                 (unsigned short) addrlen, addr,
-                                 (unsigned short) dispbuflen, dispbuf,
-                                 N_AUTH_PROTOS, authnames, authnameslen);
+    authptr = XauGetBestAuthByAddr (family,
+				   (unsigned short) addrlen, addr,
+				   (unsigned short) dispbuflen, dispbuf,
+				   N_AUTH_PROTOS, authnames, authnameslen);
+    // && !phostname
+    if ((!authptr || !authptr->data_length) && family == FamilyLocal) {
+	if ( (addr = getenv("XAUTHLOCALHOSTNAME")) ) {
+	    authptr = XauGetBestAuthByAddr (family,
+					   (unsigned short) strlen(addr), addr,
+					   (unsigned short) dispbuflen, dispbuf,
+					   N_AUTH_PROTOS, authnames, authnameslen);
+	}
+    }
+    return authptr;
 }