Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:dirkmueller:Factory
xauth
xauth-tolerant-hostname-changes.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File xauth-tolerant-hostname-changes.diff of Package xauth
Index: xauth-1.1.3/gethost.c =================================================================== --- xauth-1.1.3.orig/gethost.c +++ xauth-1.1.3/gethost.c @@ -150,7 +150,8 @@ struct addrlist *get_address_info ( int family, const char *fulldpyname, int prefix, - char *host) + char *host, + char *localhostname) { struct addrlist *retval = NULL; int len = 0; @@ -176,7 +177,7 @@ struct addrlist *get_address_info ( if (prefix == 0 && (strncmp (fulldpyname, "unix:", 5) == 0 || fulldpyname[0] == ':')) { - if (!get_local_hostname (buf, sizeof buf)) { + if (!get_local_hostname (buf, sizeof buf, localhostname)) { len = 0; } else { src = buf; @@ -252,7 +253,7 @@ struct addrlist *get_address_info ( src = &(sin->sin_addr); if (*(const in_addr_t *) src == htonl(INADDR_LOOPBACK)) { family = FamilyLocal; - if (get_local_hostname (buf, sizeof buf)) { + if (get_local_hostname (buf, sizeof buf, localhostname)) { src = buf; len = strlen (buf); } else @@ -267,7 +268,7 @@ struct addrlist *get_address_info ( if (!IN6_IS_ADDR_V4MAPPED((const struct in6_addr *)src)) { if (IN6_IS_ADDR_LOOPBACK((const struct in6_addr *)src)) { family = FamilyLocal; - if (get_local_hostname (buf, sizeof buf)) { + if (get_local_hostname (buf, sizeof buf, localhostname)) { src = buf; len = strlen (buf); } else @@ -322,7 +323,7 @@ struct addrlist *get_address_info ( src = (char *) &hostinetaddr; if (*(const in_addr_t *) src == htonl(INADDR_LOOPBACK)) { family = FamilyLocal; - if (get_local_hostname (buf, sizeof buf)) { + if (get_local_hostname (buf, sizeof buf, localhostname)) { src = buf; len = strlen (buf); } else { Index: xauth-1.1.3/parsedpy.c =================================================================== --- xauth-1.1.3.orig/parsedpy.c +++ xauth-1.1.3/parsedpy.c @@ -70,20 +70,23 @@ copystring (const char *src, int len) char * -get_local_hostname (char *buf, int maxlen) +get_local_hostname (char *buf, int maxlen, char *localhostname) { buf[0] = '\0'; + if (localhostname) + strncpy(buf, localhostname, maxlen); + else (void) XmuGetHostname (buf, maxlen); return (buf[0] ? buf : NULL); } #ifndef UNIXCONN static char * -copyhostname (void) +copyhostname (char *localhostname) { char buf[256]; - return (get_local_hostname (buf, sizeof buf) ? + return (get_local_hostname (buf, sizeof buf, localhostname) ? copystring (buf, strlen (buf)) : NULL); } #endif @@ -93,6 +96,7 @@ copyhostname (void) */ Bool parse_displayname (const char *displayname, + char *localhostname, int *familyp, /* return */ char **hostp, /* return */ int *dpynump, /* return */ @@ -134,7 +138,7 @@ parse_displayname (const char *displayna host = copystring ("0", 1); family = FamilyDECnet; } else { - host = copyhostname (); + host = copyhostname (localhostname); family = FamilyInternet; } #endif Index: xauth-1.1.3/process.c =================================================================== --- xauth-1.1.3.orig/process.c +++ xauth-1.1.3/process.c @@ -491,7 +491,7 @@ read_auth_entries(FILE *fp, Bool numeric } static Bool -get_displayname_auth(const char *displayname, AuthList **authl) +get_displayname_auth(const char *displayname, AuthList **authl, char *localhostname) { int family; char *host = NULL, *rest = NULL; @@ -511,11 +511,13 @@ get_displayname_auth(const char *display prelen = (cp - displayname); if (!parse_displayname (displayname + ((prelen > 0) ? prelen + 1 : 0), + localhostname, &family, &host, &dpynum, &scrnum, &rest)) { return False; } - addrlist_head = get_address_info(family, displayname, prelen, host); + addrlist_head = get_address_info(family, displayname, prelen, host, + localhostname); if (addrlist_head) { char buf[40]; /* want to hold largest display num */ unsigned short dpylen; @@ -1288,6 +1290,12 @@ iterdpy (const char *inputfilename, int int errors = 0; /* + * get saved local address from environment in case the host + * name has changed after the credential was added. + */ + char *xlocalhostname = getenv("XAUTHLOCALHOSTNAME"); + + /* * iterate */ for (int i = start; i < argc; i++) { @@ -1296,7 +1304,7 @@ iterdpy (const char *inputfilename, int AuthList *next; int status; - if (!get_displayname_auth (displayname, &proto_head)) { + if (!get_displayname_auth (displayname, &proto_head, xlocalhostname)) { prefix (inputfilename, lineno); baddisplayname (displayname, argv[0]); errors++; @@ -1659,7 +1667,7 @@ do_add(const char *inputfilename, int li } } - if (!get_displayname_auth (dpyname, &list)) { + if (!get_displayname_auth (dpyname, &list, NULL)) { prefix (inputfilename, lineno); baddisplayname (dpyname, argv[0]); free (key); Index: xauth-1.1.3/xauth.h =================================================================== --- xauth-1.1.3.orig/xauth.h +++ xauth-1.1.3/xauth.h @@ -48,10 +48,10 @@ struct addrlist { }; extern const char *get_hostname ( Xauth *auth ); -extern struct addrlist *get_address_info ( int family, const char *fulldpyname, int prefix, char *host); +extern struct addrlist *get_address_info ( int family, const char *fulldpyname, int prefix, char *host, char *localhostname); extern char *copystring ( const char *src, int len ); -extern char *get_local_hostname ( char *buf, int maxlen ); -extern Bool parse_displayname ( const char *displayname, int *familyp, char **hostp, int *dpynump, int *scrnump, char **restp ); +extern char *get_local_hostname ( char *buf, int maxlen, char *localhostname ); +extern Bool parse_displayname ( const char *displayname, char *localhostname, int *familyp, char **hostp, int *dpynump, int *scrnump, char **restp ); extern int auth_initialize ( const char *authfilename ); extern int auth_finalize ( void ); extern int process_command ( const char *inputfilename, int lineno, int argc, const char **argv );
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor