Accepting request 556398 from home:michalsrb:branches:X11:XOrg

- n_If-auth-with-credentials-for-hostname-fails-retry-with-XAUTHLOCALHOSTNAME.patch
  * Modify this patch to do what it say - retry not only if the current hostname is
    not found in the xauthority file, but also when it is rejected by X server.
    (bnc#1043221)

OBS-URL: https://build.opensuse.org/request/show/556398
OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/libxcb?expand=0&rev=45
This commit is contained in:
Stefan Dirsch 2017-12-12 09:06:20 +00:00 committed by Git OBS Bridge
parent df8c0ba7cf
commit 62d4e8587c
2 changed files with 80 additions and 30 deletions

View File

@ -4,6 +4,14 @@ Mon Dec 11 12:13:21 UTC 2017 - sndirsch@suse.com
- fixes build against python3 (package rename of
python-xcb-proto-devel to python3-xcb-proto-devel)
-------------------------------------------------------------------
Thu Nov 30 15:11:43 UTC 2017 - msrb@suse.com
- n_If-auth-with-credentials-for-hostname-fails-retry-with-XAUTHLOCALHOSTNAME.patch
* Modify this patch to do what it say - retry not only if the current hostname is
not found in the xauthority file, but also when it is rejected by X server.
(bnc#1043221)
-------------------------------------------------------------------
Thu May 19 09:40:43 UTC 2016 - sndirsch@suse.com

View File

@ -11,11 +11,11 @@ Signed-off-by: Egbert Eich <eich@suse.de>
src/xcb_auth.c | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/src/xcb_auth.c b/src/xcb_auth.c
index 6eb6528..777c772 100644
--- a/src/xcb_auth.c
+++ b/src/xcb_auth.c
@@ -109,7 +109,7 @@ static int authname_match(enum auth_protos kind, char *name, size_t namelen)
Index: libxcb-1.12/src/xcb_auth.c
===================================================================
--- libxcb-1.12.orig/src/xcb_auth.c
+++ libxcb-1.12/src/xcb_auth.c
@@ -109,7 +109,7 @@ static int authname_match(enum auth_prot
#define SIN6_ADDR(s) (&((struct sockaddr_in6 *)s)->sin6_addr)
@ -24,7 +24,7 @@ index 6eb6528..777c772 100644
{
char *addr = 0;
int addrlen = 0;
@@ -119,6 +119,8 @@ static Xauth *get_authptr(struct sockaddr *sockname, int display)
@@ -119,6 +119,8 @@ static Xauth *get_authptr(struct sockadd
int dispbuflen;
Xauth *authptr = NULL;
@ -33,7 +33,7 @@ index 6eb6528..777c772 100644
family = FamilyLocal; /* 256 */
switch(sockname->sa_family)
{
@@ -161,10 +163,13 @@ static Xauth *get_authptr(struct sockaddr *sockname, int display)
@@ -161,10 +163,13 @@ static Xauth *get_authptr(struct sockadd
addrlen = strlen(addr);
}
@ -51,7 +51,7 @@ index 6eb6528..777c772 100644
// && !phostname
if ((!authptr || !authptr->data_length) && family == FamilyLocal) {
if ( (addr = getenv("XAUTHLOCALHOSTNAME")) ) {
@@ -172,6 +177,7 @@ static Xauth *get_authptr(struct sockaddr *sockname, int display)
@@ -172,6 +177,7 @@ static Xauth *get_authptr(struct sockadd
(unsigned short) strlen(addr), addr,
(unsigned short) dispbuflen, dispbuf,
N_AUTH_PROTOS, authnames, authnameslen);
@ -59,34 +59,76 @@ index 6eb6528..777c772 100644
}
}
return authptr;
@@ -328,6 +334,7 @@ int _xcb_get_auth_info(int fd, xcb_auth_info_t *info, int display)
int gotsockname = 0;
Xauth *authptr = 0;
int ret = 1;
+ int stage = 0;
@@ -320,7 +326,7 @@ static struct sockaddr *get_peer_sock_na
return NULL;
}
/* Some systems like hpux or Hurd do not expose peer names
* for UNIX Domain Sockets, but this is irrelevant,
@@ -344,8 +351,8 @@ int _xcb_get_auth_info(int fd, xcb_auth_info_t *info, int display)
}
-int _xcb_get_auth_info(int fd, xcb_auth_info_t *info, int display)
+int _xcb_get_auth_info(int fd, xcb_auth_info_t *info, int display, int *stage)
{
/* code adapted from Xlib/ConnDis.c, xtrans/Xtranssocket.c,
xtrans/Xtransutils.c */
@@ -345,7 +351,7 @@ int _xcb_get_auth_info(int fd, xcb_auth_
gotsockname = 1;
}
-
- authptr = get_authptr(sockname, display);
+retry:
+ authptr = get_authptr(sockname, display, &stage);
+ authptr = get_authptr(sockname, display, stage);
if (authptr == 0)
{
free(sockname);
@@ -371,7 +378,10 @@ int _xcb_get_auth_info(int fd, xcb_auth_info_t *info, int display)
if(!ret)
{
free(info->name);
- goto no_auth; /* cannot build auth record */
+ info->name = 0;
+ info->namelen = 0;
+ XauDisposeAuth(authptr);
+ goto retry; /* cannot build auth record */
Index: libxcb-1.12/src/xcbint.h
===================================================================
--- libxcb-1.12.orig/src/xcbint.h
+++ libxcb-1.12/src/xcbint.h
@@ -219,7 +219,7 @@ int _xcb_conn_wait(xcb_connection_t *c,
/* xcb_auth.c */
-int _xcb_get_auth_info(int fd, xcb_auth_info_t *info, int display);
+int _xcb_get_auth_info(int fd, xcb_auth_info_t *info, int display, int *stage);
#ifdef GCC_HAS_VISIBILITY
#pragma GCC visibility pop
Index: libxcb-1.12/src/xcb_util.c
===================================================================
--- libxcb-1.12.orig/src/xcb_util.c
+++ libxcb-1.12/src/xcb_util.c
@@ -494,6 +494,7 @@ xcb_connection_t *xcb_connect_to_display
char *protocol = NULL;
xcb_auth_info_t ourauth;
xcb_connection_t *c;
+ int stage = 0;
int parsed = _xcb_parse_display(displayname, &host, &protocol, &display, screenp);
@@ -510,6 +511,7 @@ xcb_connection_t *xcb_connect_to_display
}
#endif
+ retry:
fd = _xcb_open(host, protocol, display);
if(fd == -1) {
@@ -525,7 +527,7 @@ xcb_connection_t *xcb_connect_to_display
goto out;
}
free(sockname);
- if(_xcb_get_auth_info(fd, &ourauth, display))
+ if(_xcb_get_auth_info(fd, &ourauth, display, &stage))
{
c = xcb_connect_to_fd(fd, &ourauth);
free(ourauth.name);
@@ -534,8 +536,11 @@ xcb_connection_t *xcb_connect_to_display
else
c = xcb_connect_to_fd(fd, 0);
- if(c->has_error)
+ if(c->has_error) {
+ if (stage < 2)
+ goto retry;
goto out;
+ }
/* Make sure requested screen number is in bounds for this server */
if((screenp != NULL) && (*screenp >= (int) c->setup->roots_len)) {