open-src/app/xhost/xhost.patch
changeset 1276 52f85727ce94
parent 1068 0dc26c96a5af
child 1370 7a7a374453e5
--- a/open-src/app/xhost/xhost.patch	Mon Apr 23 10:37:02 2012 -0700
+++ b/open-src/app/xhost/xhost.patch	Mon Apr 23 15:08:10 2012 -0700
@@ -1,7 +1,8 @@
-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
+diff --git a/xhost.c b/xhost.c
+index 08f7c79..4a58a7a 100644
+--- a/xhost.c
++++ b/xhost.c
+@@ -142,6 +142,11 @@ extern int getdomainname(char *name, size_t len);
  #endif
  #endif
  
@@ -11,9 +12,9 @@
 +#include <stdlib.h>	/* getenv() */
 +
  static int change_host(Display *dpy, char *name, Bool add);
- static char *get_hostname(XHostAddress *ha);
+ static const char *get_hostname(XHostAddress *ha);
  static int local_xerror(Display *dpy, XErrorEvent *rep);
-@@ -211,10 +216,24 @@ main(int argc, char *argv[])
+@@ -211,15 +216,30 @@ main(int argc, char *argv[])
      char *cp;
  #endif
   
@@ -31,6 +32,13 @@
 +
      ProgramName = argv[0];
  
+     if (argc == 2 && !strcmp(argv[1], "-help")) {
+-	fprintf(stderr, "usage: %s [[+-]hostname ...]\n", argv[0]);
++	/* Internationalize messages for bug 4256527... S Swales 5/25/00 */
++	fprintf(stderr, gettext("usage: %s [[+-]hostname ...]\n"), argv[0]);
+ 	exit(1);
+     }
+ 
      if ((dpy = XOpenDisplay(NULL)) == NULL) {
 -	fprintf(stderr, "%s:  unable to open display \"%s\"\n",
 +	/* Internationalize messages for bug 4256527... S Swales 5/25/00 */
@@ -39,7 +47,7 @@
  		ProgramName, XDisplayName (NULL));
  	exit(1);
      }
-@@ -229,9 +248,11 @@ main(int argc, char *argv[])
+@@ -234,9 +254,11 @@ main(int argc, char *argv[])
  	sethostent(1);		/* don't close the data base each time */
  	list = XListHosts(dpy, &nhosts, &enabled);
  	if (enabled)
@@ -53,7 +61,7 @@
  
  	if (nhosts != 0) {
  	    for (i = 0; i < nhosts; i++ )  {
-@@ -260,16 +281,18 @@ main(int argc, char *argv[])
+@@ -265,16 +287,18 @@ main(int argc, char *argv[])
  			printf("SI:");
  			break;
  		    default:
@@ -75,16 +83,6 @@
  			   NAMESERVER_TIMEOUT);
  		    nameserver_timedout = 0;
  		} else
-@@ -282,7 +305,8 @@ main(int argc, char *argv[])
-     }
-  
-     if (argc == 2 && !strcmp(argv[1], "-help")) {
--	fprintf(stderr, "usage: %s [[+-]hostname ...]\n", argv[0]);
-+	/* Internationalize messages for bug 4256527... S Swales 5/25/00 */
-+	fprintf(stderr, gettext("usage: %s [[+-]hostname ...]\n"), argv[0]);
- 	exit(1);
-     }
- 
 @@ -291,26 +315,30 @@ main(int argc, char *argv[])
  	if (*arg == '-') {
  	    
@@ -120,12 +118,12 @@
  			     ProgramName, arg);
  		    nfailed++;
  		}
-@@ -355,12 +383,14 @@ change_host(Display *dpy, char *name, Bo
+@@ -355,12 +383,14 @@ change_host(Display *dpy, char *name, Bool add)
      struct nodeent *np;
      static struct dn_naddr dnaddr;
  #endif				/* DNETCONN */
--    static char *add_msg = "being added to access control list";
--    static char *remove_msg = "being removed from access control list";
+-    static const char *add_msg = "being added to access control list";
+-    static const char *remove_msg = "being removed from access control list";
 +    const char *add_msg = gettext("being added to access control list");
 +    const char *remove_msg = gettext("being removed from access control list");
  
@@ -138,7 +136,7 @@
  	exit (1);
      }
      for (i = 0; i < namelen; i++) {
-@@ -372,8 +402,8 @@ change_host(Display *dpy, char *name, Bo
+@@ -372,8 +402,8 @@ change_host(Display *dpy, char *name, Bool add)
  	family = FamilyInternet;
  	name += 5;
  #else
@@ -149,7 +147,7 @@
  	return 0;
  #endif
      }
-@@ -383,8 +413,8 @@ change_host(Display *dpy, char *name, Bo
+@@ -383,8 +413,8 @@ change_host(Display *dpy, char *name, Bool add)
  	family = FamilyInternet6;
  	name += 6;
  #else
@@ -160,7 +158,7 @@
  	return 0;
  #endif
      }
-@@ -396,8 +426,8 @@ change_host(Display *dpy, char *name, Bo
+@@ -396,8 +426,8 @@ change_host(Display *dpy, char *name, Bool add)
  	family = FamilyInternet6;
  	name += 7;
  #else
@@ -171,7 +169,7 @@
  	return 0;
  #endif
      }
-@@ -407,8 +437,8 @@ change_host(Display *dpy, char *name, Bo
+@@ -407,8 +437,8 @@ change_host(Display *dpy, char *name, Bool add)
  	family = FamilyDECnet;
  	name += 5;
  #else
@@ -182,7 +180,7 @@
  	return 0;
  #endif
      }
-@@ -417,8 +447,8 @@ change_host(Display *dpy, char *name, Bo
+@@ -417,8 +447,8 @@ change_host(Display *dpy, char *name, Bool add)
  	family = FamilyNetname;
  	name += 4;
  #else
@@ -193,7 +191,7 @@
  	return 0;
  #endif
      }
-@@ -427,8 +457,8 @@ change_host(Display *dpy, char *name, Bo
+@@ -427,8 +457,8 @@ change_host(Display *dpy, char *name, Bool add)
  	family = FamilyKrb5Principal;
  	name +=4;
  #else
@@ -204,7 +202,7 @@
  	return 0;
  #endif
      }
-@@ -440,11 +470,21 @@ change_host(Display *dpy, char *name, Bo
+@@ -440,11 +470,21 @@ change_host(Display *dpy, char *name, Bool add)
  	name += 3;
      }
      if (family == FamilyWild && (cp = strchr(lname, ':'))) {
@@ -231,7 +229,7 @@
      }
      free(lname);
  
-@@ -454,8 +494,8 @@ change_host(Display *dpy, char *name, Bo
+@@ -454,8 +494,8 @@ change_host(Display *dpy, char *name, Bool add)
  
  	cp = strchr(name, ':');
  	if (cp == NULL || cp == name) {
@@ -242,7 +240,7 @@
  	      ProgramName, name);
  	    return 0;
  	}
-@@ -489,7 +529,8 @@ change_host(Display *dpy, char *name, Bo
+@@ -485,7 +525,8 @@ change_host(Display *dpy, char *name, Bool add)
  	    dnaddr = *dnaddrp;
  	} else {
  	    if ((np = getnodebyname (name)) == NULL) {
@@ -252,7 +250,7 @@
  			 ProgramName, name);
  		return 0;
  	    }
-@@ -515,7 +556,8 @@ change_host(Display *dpy, char *name, Bo
+@@ -511,7 +552,8 @@ change_host(Display *dpy, char *name, Bool add)
  	retval = krb5_parse_name(name, &princ);
  	if (retval) {
  	    krb5_init_ets();	/* init krb errs for error_message() */
@@ -262,7 +260,7 @@
  		    ProgramName, error_message(retval));
  	    return 0;
  	}
-@@ -541,7 +583,7 @@ change_host(Display *dpy, char *name, Bo
+@@ -537,7 +579,7 @@ change_host(Display *dpy, char *name, Bool add)
  	    XAddHost(dpy, &ha);
  	else
  	    XRemoveHost(dpy, &ha);
@@ -271,7 +269,7 @@
  	return 1;
      }
      /*
-@@ -560,12 +602,14 @@ change_host(Display *dpy, char *name, Bo
+@@ -556,12 +598,14 @@ change_host(Display *dpy, char *name, Bool add)
  	    *cp = '\0';
  	    pwd = getpwnam(name);
  	    if (!pwd) {
@@ -288,7 +286,7 @@
  		return 0;
  	    }
  	    netname = username;
-@@ -672,8 +716,11 @@ change_host(Display *dpy, char *name, Bo
+@@ -668,8 +712,11 @@ change_host(Display *dpy, char *name, Bool add)
  		familyMsg = "inet ";
  	    }
  
@@ -302,7 +300,7 @@
  	}
  	freeaddrinfo(addresses);
  	return 1;
-@@ -951,14 +998,16 @@ static int 
+@@ -947,14 +994,16 @@ static int
  local_xerror(Display *dpy, XErrorEvent *rep)
  {
      if ((rep->error_code == BadAccess) && (rep->request_code == X_ChangeHosts)) {