libxcb/bug-262309_xcb-xauthlocalhostname.diff
Michal Srb f326c8fde7 Accepting request 561848 from home:michalsrb:branches:bnc1073996:X11:XOrg
- n_If-auth-with-credentials-for-hostname-fails-retry-with-XAUTHLOCALHOSTNAME.patch
  * Prevent infinite loop also in case DISPLAY is non-local.

- Use spaces instead of tabs in the patches (as does the original
  source code) to avoid confusion.
- n_If-auth-with-credentials-for-hostname-fails-retry-with-XAUTHLOCALHOSTNAME.patch
  * If authentication (with *stage == 0) failed and the variable
    XAUTHLOCALHOSTNAME wasn't set, we were never getting to stage 2
    in the original patch, causing calls to xcb_connect_to_display
    to be stuck in an infinite loop.
    Now we also go to stage 2 if the variable isn't set.

OBS-URL: https://build.opensuse.org/request/show/561848
OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/libxcb?expand=0&rev=47
2018-01-05 11:15:21 +00:00

25 lines
1.1 KiB
Diff

--- 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
@@ -119,2 +119,3 @@ static Xauth *get_authptr(struct sockadd
int dispbuflen;
+ Xauth *authptr = NULL;
@@ -163,6 +163,16 @@ static Xauth *get_authptr(struct sockadd
- return XauGetBestAuthByAddr (family,
+ 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;
}