2013-10-27 10:10:01 +01:00
|
|
|
Index: xauth-1.0.8/gethost.c
|
2012-04-14 11:32:44 +02:00
|
|
|
===================================================================
|
2013-10-27 10:10:01 +01:00
|
|
|
--- xauth-1.0.8.orig/gethost.c
|
|
|
|
+++ xauth-1.0.8/gethost.c
|
|
|
|
@@ -156,7 +156,8 @@ struct addrlist *get_address_info (
|
2012-04-14 11:32:44 +02:00
|
|
|
int family,
|
2012-04-15 12:51:48 +02:00
|
|
|
const char *fulldpyname,
|
2012-04-14 11:32:44 +02:00
|
|
|
int prefix,
|
|
|
|
- char *host)
|
|
|
|
+ char *host,
|
|
|
|
+ char *localhostname)
|
|
|
|
{
|
|
|
|
struct addrlist *retval = NULL;
|
|
|
|
int len = 0;
|
2013-10-27 10:10:01 +01:00
|
|
|
@@ -183,7 +184,7 @@ struct addrlist *get_address_info (
|
2012-04-14 11:32:44 +02:00
|
|
|
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;
|
2013-10-27 10:10:01 +01:00
|
|
|
@@ -233,7 +234,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
|
|
|
|
@@ -248,7 +249,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
|
|
|
|
@@ -303,7 +304,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.0.8/parsedpy.c
|
2012-04-14 11:32:44 +02:00
|
|
|
===================================================================
|
2013-10-27 10:10:01 +01:00
|
|
|
--- xauth-1.0.8.orig/parsedpy.c
|
|
|
|
+++ xauth-1.0.8/parsedpy.c
|
2012-04-15 12:51:48 +02:00
|
|
|
@@ -70,20 +70,23 @@ copystring (const char *src, int len)
|
2012-04-14 11:32:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
char *
|
|
|
|
-get_local_hostname (char *buf, int maxlen)
|
|
|
|
+get_local_hostname (char *buf, int maxlen, char *localhostname)
|
|
|
|
{
|
|
|
|
buf[0] = '\0';
|
|
|
|
+ if (localhostname)
|
2012-04-15 12:51:48 +02:00
|
|
|
+ strncpy(buf, localhostname, maxlen);
|
2012-04-14 11:32:44 +02:00
|
|
|
+ else
|
|
|
|
(void) XmuGetHostname (buf, maxlen);
|
|
|
|
return (buf[0] ? buf : NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef UNIXCONN
|
|
|
|
static char *
|
|
|
|
-copyhostname (void)
|
|
|
|
+copyhostname (char *localhostname)
|
|
|
|
{
|
|
|
|
char buf[256];
|
|
|
|
|
2012-04-15 12:51:48 +02:00
|
|
|
- return (get_local_hostname (buf, sizeof buf) ?
|
|
|
|
+ return (get_local_hostname (buf, sizeof buf, localhostname) ?
|
2012-04-14 11:32:44 +02:00
|
|
|
copystring (buf, strlen (buf)) : NULL);
|
|
|
|
}
|
|
|
|
#endif
|
2012-04-15 12:51:48 +02:00
|
|
|
@@ -93,6 +96,7 @@ copyhostname (void)
|
2012-04-14 11:32:44 +02:00
|
|
|
*/
|
2012-04-15 12:51:48 +02:00
|
|
|
Bool
|
|
|
|
parse_displayname (const char *displayname,
|
2012-04-14 11:32:44 +02:00
|
|
|
+ char *localhostname,
|
|
|
|
int *familyp, /* return */
|
|
|
|
char **hostp, /* return */
|
|
|
|
int *dpynump, /* return */
|
2012-04-15 12:51:48 +02:00
|
|
|
@@ -134,7 +138,7 @@ parse_displayname (const char *displayna
|
2012-04-14 11:32:44 +02:00
|
|
|
host = copystring ("0", 1);
|
|
|
|
family = FamilyDECnet;
|
|
|
|
} else {
|
|
|
|
- host = copyhostname ();
|
|
|
|
+ host = copyhostname (localhostname);
|
|
|
|
family = FamilyInternet;
|
|
|
|
}
|
|
|
|
#endif
|
2013-10-27 10:10:01 +01:00
|
|
|
Index: xauth-1.0.8/process.c
|
2012-04-14 11:32:44 +02:00
|
|
|
===================================================================
|
2013-10-27 10:10:01 +01:00
|
|
|
--- xauth-1.0.8.orig/process.c
|
|
|
|
+++ xauth-1.0.8/process.c
|
|
|
|
@@ -470,7 +470,7 @@ read_auth_entries(FILE *fp, Bool numeric
|
2012-04-14 11:32:44 +02:00
|
|
|
}
|
|
|
|
|
2012-04-15 12:51:48 +02:00
|
|
|
static Bool
|
|
|
|
-get_displayname_auth(const char *displayname, AuthList **authl)
|
|
|
|
+get_displayname_auth(const char *displayname, AuthList **authl, char *localhostname)
|
2012-04-14 11:32:44 +02:00
|
|
|
{
|
|
|
|
int family;
|
|
|
|
char *host = NULL, *rest = NULL;
|
2013-10-27 10:10:01 +01:00
|
|
|
@@ -490,11 +490,13 @@ get_displayname_auth(const char *display
|
2012-04-14 11:32:44 +02:00
|
|
|
prelen = (cp - displayname);
|
2012-04-15 12:51:48 +02:00
|
|
|
|
2012-04-14 11:32:44 +02:00
|
|
|
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;
|
2013-10-27 10:10:01 +01:00
|
|
|
@@ -1240,13 +1242,18 @@ iterdpy (const char *inputfilename, int
|
2012-04-14 11:32:44 +02:00
|
|
|
Xauth *tmp_auth;
|
|
|
|
AuthList *proto_head, *proto;
|
|
|
|
AuthList *l, *next;
|
2012-04-15 12:51:48 +02:00
|
|
|
-
|
2012-04-14 11:32:44 +02:00
|
|
|
+ /*
|
|
|
|
+ * get saved local address from environment in case the host
|
|
|
|
+ * name has changed after the credential was added.
|
|
|
|
+ */
|
|
|
|
+ char *xlocalhostname = getenv("XAUTHLOCALHOSTNAME");
|
|
|
|
+
|
|
|
|
/*
|
|
|
|
* iterate
|
|
|
|
*/
|
|
|
|
for (i = start; i < argc; i++) {
|
2012-04-15 12:51:48 +02:00
|
|
|
const char *displayname = argv[i];
|
2012-04-14 11:32:44 +02:00
|
|
|
- if (!get_displayname_auth (displayname, &proto_head)) {
|
|
|
|
+ if (!get_displayname_auth (displayname, &proto_head, xlocalhostname)) {
|
|
|
|
prefix (inputfilename, lineno);
|
|
|
|
baddisplayname (displayname, argv[0]);
|
|
|
|
errors++;
|
2013-10-27 10:10:01 +01:00
|
|
|
@@ -1601,7 +1608,7 @@ do_add(const char *inputfilename, int li
|
2012-04-14 11:32:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- if (!get_displayname_auth (dpyname, &list)) {
|
|
|
|
+ if (!get_displayname_auth (dpyname, &list, NULL)) {
|
|
|
|
prefix (inputfilename, lineno);
|
|
|
|
baddisplayname (dpyname, argv[0]);
|
|
|
|
free (key);
|
2013-10-27 10:10:01 +01:00
|
|
|
Index: xauth-1.0.8/xauth.h
|
2012-04-14 11:32:44 +02:00
|
|
|
===================================================================
|
2013-10-27 10:10:01 +01:00
|
|
|
--- xauth-1.0.8.orig/xauth.h
|
|
|
|
+++ xauth-1.0.8/xauth.h
|
2012-04-15 12:51:48 +02:00
|
|
|
@@ -48,10 +48,10 @@ struct addrlist {
|
2012-04-14 11:32:44 +02:00
|
|
|
};
|
|
|
|
|
2012-04-15 12:51:48 +02:00
|
|
|
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 );
|
2012-04-14 11:32:44 +02:00
|
|
|
-extern char *get_local_hostname ( char *buf, int maxlen );
|
2012-04-15 12:51:48 +02:00
|
|
|
-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 );
|
2012-04-14 11:32:44 +02:00
|
|
|
extern int auth_finalize ( void );
|
2012-04-15 12:51:48 +02:00
|
|
|
extern int process_command ( const char *inputfilename, int lineno, int argc, const char **argv );
|