open-src/app/xhost/xhost.patch
changeset 1068 0dc26c96a5af
parent 851 d428083dbbdd
child 1276 52f85727ce94
--- a/open-src/app/xhost/xhost.patch	Mon Jan 31 13:13:15 2011 -0800
+++ b/open-src/app/xhost/xhost.patch	Wed Feb 02 11:28:42 2011 -0800
@@ -1,6 +1,7 @@
---- xhost.c	Mon Jul 10 19:53:04 2006
-+++ filemerge.out	Wed Jan 23 14:22:49 2008
-@@ -124,6 +124,11 @@
+diff -urp -x '*~' -x '*.orig' xhost.c xhost.c
+--- xhost.c	2010-10-30 09:45:28.000000000 -0700
++++ xhost.c	2011-01-28 18:14:02.723885503 -0800
+@@ -142,6 +142,11 @@ extern int getdomainname(char *name, siz
  #endif
  #endif
  
@@ -12,7 +13,7 @@
  static int change_host(Display *dpy, char *name, Bool add);
  static char *get_hostname(XHostAddress *ha);
  static int local_xerror(Display *dpy, XErrorEvent *rep);
-@@ -193,10 +198,24 @@
+@@ -211,10 +216,24 @@ main(int argc, char *argv[])
      char *cp;
  #endif
   
@@ -38,7 +39,7 @@
  		ProgramName, XDisplayName (NULL));
  	exit(1);
      }
-@@ -211,9 +230,11 @@
+@@ -229,9 +248,11 @@ main(int argc, char *argv[])
  	sethostent(1);		/* don't close the data base each time */
  	list = XListHosts(dpy, &nhosts, &enabled);
  	if (enabled)
@@ -52,7 +53,7 @@
  
  	if (nhosts != 0) {
  	    for (i = 0; i < nhosts; i++ )  {
-@@ -242,16 +263,18 @@
+@@ -260,16 +281,18 @@ main(int argc, char *argv[])
  			printf("SI:");
  			break;
  		    default:
@@ -74,7 +75,7 @@
  			   NAMESERVER_TIMEOUT);
  		    nameserver_timedout = 0;
  		} else
-@@ -264,7 +287,8 @@
+@@ -282,7 +305,8 @@ main(int argc, char *argv[])
      }
   
      if (argc == 2 && !strcmp(argv[1], "-help")) {
@@ -84,7 +85,7 @@
  	exit(1);
      }
  
-@@ -273,12 +297,14 @@
+@@ -291,26 +315,30 @@ main(int argc, char *argv[])
  	if (*arg == '-') {
  	    
  	    if (!argv[i][1] && ((i+1) == argc)) {
@@ -101,7 +102,6 @@
  			     ProgramName, arg);
  		    nfailed++;
  		}
-@@ -285,7 +311,8 @@
  	    }
  	} else {
  	    if (*arg == '+' && !argv[i][1] && ((i+1) == argc)) {
@@ -111,7 +111,6 @@
  		XDisableAccessControl(dpy);
  	    } else {
  		if (*arg == '+') {
-@@ -292,7 +319,8 @@
  		    arg = argv[i][1]? &argv[i][1] : argv[++i];
  		}
  		if (!change_host (dpy, arg, True)) {
@@ -121,26 +120,7 @@
  			     ProgramName, arg);
  		    nfailed++;
  		}
-@@ -324,6 +352,7 @@
-     krb5_data kbuf;
- #endif
- #ifdef NEEDSOCKETS
-+#ifndef AMTCPCONN
-     static struct in_addr addr;	/* so we can point at it */
- #if defined(IPv6) && defined(AF_INET6)
-     static struct in6_addr addr6; /* so we can point at it */
-@@ -330,7 +359,10 @@
- #else
-     struct hostent *hp;
- #endif
-+#else
-+    static ipaddr_t addr;
- #endif
-+#endif
-     char *cp;
- #ifdef DNETCONN
-     struct dn_naddr *dnaddrp;
-@@ -337,12 +369,14 @@
+@@ -355,12 +383,14 @@ change_host(Display *dpy, char *name, Bo
      struct nodeent *np;
      static struct dn_naddr dnaddr;
  #endif				/* DNETCONN */
@@ -158,12 +138,7 @@
  	exit (1);
      }
      for (i = 0; i < namelen; i++) {
-@@ -350,12 +384,12 @@
-     }
-     lname[namelen] = '\0';
-     if (!strncmp("inet:", lname, 5)) {
--#if defined(TCPCONN) || defined(STREAMSCONN)
-+#if defined(TCPCONN) || defined(STREAMSCONN) || defined(AMTCPCONN)
+@@ -372,8 +402,8 @@ change_host(Display *dpy, char *name, Bo
  	family = FamilyInternet;
  	name += 5;
  #else
@@ -174,7 +149,7 @@
  	return 0;
  #endif
      }
-@@ -365,8 +399,8 @@
+@@ -383,8 +413,8 @@ change_host(Display *dpy, char *name, Bo
  	family = FamilyInternet6;
  	name += 6;
  #else
@@ -185,7 +160,7 @@
  	return 0;
  #endif
      }
-@@ -378,8 +412,8 @@
+@@ -396,8 +426,8 @@ change_host(Display *dpy, char *name, Bo
  	family = FamilyInternet6;
  	name += 7;
  #else
@@ -196,7 +171,7 @@
  	return 0;
  #endif
      }
-@@ -389,8 +423,8 @@
+@@ -407,8 +437,8 @@ change_host(Display *dpy, char *name, Bo
  	family = FamilyDECnet;
  	name += 5;
  #else
@@ -207,7 +182,7 @@
  	return 0;
  #endif
      }
-@@ -399,8 +433,8 @@
+@@ -417,8 +447,8 @@ change_host(Display *dpy, char *name, Bo
  	family = FamilyNetname;
  	name += 4;
  #else
@@ -218,7 +193,7 @@
  	return 0;
  #endif
      }
-@@ -409,8 +443,8 @@
+@@ -427,8 +457,8 @@ change_host(Display *dpy, char *name, Bo
  	family = FamilyKrb5Principal;
  	name +=4;
  #else
@@ -229,7 +204,7 @@
  	return 0;
  #endif
      }
-@@ -422,11 +456,21 @@
+@@ -440,11 +470,21 @@ change_host(Display *dpy, char *name, Bo
  	name += 3;
      }
      if (family == FamilyWild && (cp = strchr(lname, ':'))) {
@@ -256,7 +231,7 @@
      }
      free(lname);
  
-@@ -436,8 +480,8 @@
+@@ -454,8 +494,8 @@ change_host(Display *dpy, char *name, Bo
  
  	cp = strchr(name, ':');
  	if (cp == NULL || cp == name) {
@@ -267,7 +242,7 @@
  	      ProgramName, name);
  	    return 0;
  	}
-@@ -471,7 +515,8 @@
+@@ -489,7 +529,8 @@ change_host(Display *dpy, char *name, Bo
  	    dnaddr = *dnaddrp;
  	} else {
  	    if ((np = getnodebyname (name)) == NULL) {
@@ -277,7 +252,7 @@
  			 ProgramName, name);
  		return 0;
  	    }
-@@ -497,7 +542,8 @@
+@@ -515,7 +556,8 @@ change_host(Display *dpy, char *name, Bo
  	retval = krb5_parse_name(name, &princ);
  	if (retval) {
  	    krb5_init_ets();	/* init krb errs for error_message() */
@@ -287,7 +262,7 @@
  		    ProgramName, error_message(retval));
  	    return 0;
  	}
-@@ -523,7 +569,7 @@
+@@ -541,7 +583,7 @@ change_host(Display *dpy, char *name, Bo
  	    XAddHost(dpy, &ha);
  	else
  	    XRemoveHost(dpy, &ha);
@@ -296,7 +271,7 @@
  	return 1;
      }
      /*
-@@ -542,12 +588,14 @@
+@@ -560,12 +602,14 @@ change_host(Display *dpy, char *name, Bo
  	    *cp = '\0';
  	    pwd = getpwnam(name);
  	    if (!pwd) {
@@ -313,21 +288,7 @@
  		return 0;
  	    }
  	    netname = username;
-@@ -570,8 +618,13 @@
-     /*
-      * First see if inet_addr() can grok the name; if so, then use it.
-      */
-+#ifndef AMTCPCONN
-     if (((family == FamilyWild) || (family == FamilyInternet)) &&
- 	((addr.s_addr = inet_addr(name)) != -1)) {
-+#else
-+    if (((family == FamilyWild) || (family == FamilyInternet)) &&
-+	((addr = inet_addr(name)) != -1)) {
-+#endif
- 	ha.family = FamilyInternet;
- 	ha.length = 4;		/* but for Cray would be sizeof(addr.s_addr) */
- 	ha.address = (char *)&addr; /* but for Cray would be &addr.s_addr */
-@@ -654,8 +707,11 @@
+@@ -672,8 +716,11 @@ change_host(Display *dpy, char *name, Bo
  		familyMsg = "inet ";
  	    }
  
@@ -341,37 +302,7 @@
  	}
  	freeaddrinfo(addresses);
  	return 1;
-@@ -715,7 +771,7 @@
- static char *
- get_hostname(XHostAddress *ha)
- {
--#if (defined(TCPCONN) || defined(STREAMSCONN)) &&	\
-+#if (defined(TCPCONN) || defined(STREAMSCONN) || defined(AMTCPCONN)) && \
-      (!defined(IPv6) || !defined(AF_INET6))
-     static struct hostent *hp = NULL;
- #endif
-@@ -733,7 +789,7 @@
-     struct sigaction sa;
- #endif
- 
--#if defined(TCPCONN) || defined(STREAMSCONN)
-+#if defined(TCPCONN) || defined(STREAMSCONN) || defined(AMTCPCONN)
- #if defined(IPv6) && defined(AF_INET6)
-     if ((ha->family == FamilyInternet) || (ha->family == FamilyInternet6)) {
- 	struct sockaddr_storage saddr;
-@@ -823,7 +879,11 @@
- 	alarm(0);
- 	if (hp)
- 	    return (hp->h_name);
-+#ifndef AMTCPCONN
- 	else return (inet_ntoa(*((struct in_addr *)(ha->address))));
-+#else
-+	else return (inet_ntoa(*((ipaddr_t *)(ha->address))));
-+#endif
-     }
- #endif /* IPv6 */
- #endif
-@@ -933,14 +993,16 @@
+@@ -951,14 +998,16 @@ static int 
  local_xerror(Display *dpy, XErrorEvent *rep)
  {
      if ((rep->error_code == BadAccess) && (rep->request_code == X_ChangeHosts)) {