[xorg-commit-diffs] xc/programs/xhost xhost.c, 1.1.4.3, 1.1.4.4 xhost.man, 1.1.4.3, 1.1.4.4

Egbert Eich xorg-commit at pdx.freedesktop.org
Thu Apr 15 03:17:49 PDT 2004


Committed by: eich

Update of /cvs/xorg/xc/programs/xhost
In directory pdx:/home/eich/tstbuild/xc/programs/xhost

Modified Files:
      Tag: XORG-CURRENT
	xhost.c xhost.man 
Log Message:
2004-04-15  Egbert Eich  <eich at freedesktop.org>
        Merged changes from RELEASE-1 branch
	


Index: xhost.c
===================================================================
RCS file: /cvs/xorg/xc/programs/xhost/xhost.c,v
retrieving revision 1.1.4.3
retrieving revision 1.1.4.4
diff -u -d -r1.1.4.3 -r1.1.4.4
--- a/xhost.c	5 Mar 2004 13:41:27 -0000	1.1.4.3
+++ b/xhost.c	15 Apr 2004 10:17:42 -0000	1.1.4.4
@@ -1,29 +1,38 @@
 /* $Xorg: xhost.c,v 1.4 2001/02/09 02:05:46 xorgcvs Exp $ */
+/* $XdotOrg$ */
 /*
 
 Copyright 1985, 1986, 1987, 1998  The Open Group
+Copyright 2004 Sun Microsystems, Inc.
 
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
+All rights reserved.
 
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, and/or sell copies of the Software, and to permit persons
+to whom the Software is furnished to do so, provided that the above
+copyright notice(s) and this permission notice appear in all copies of
+the Software and that both the above copyright notice(s) and this
+permission notice appear in supporting documentation.
 
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
-Except as contained in this notice, the name of The Open Group shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from The Open Group.
+Except as contained in this notice, the name of a copyright holder
+shall not be used in advertising or otherwise to promote the sale, use
+or other dealings in this Software without prior written authorization
+of the copyright holder.
+
+X Window System is a trademark of The Open Group.
 
 */
 /* $XFree86: xc/programs/xhost/xhost.c,v 3.26 2003/07/27 14:05:45 herrb Exp $ */
@@ -221,6 +230,12 @@
 		    case FamilyLocalHost:
 			printf("LOCAL:");
 			break;
+		    case FamilyServerInterpreted:
+			printf("SI:");
+			break;
+		    default:
+			printf("<unknown family type %d>:", list[i].family);
+			break;
 		    }
 		    printf ("%s", hostname);
 		} else {
@@ -349,6 +364,19 @@
 	return 0;
 #endif
     }
+#ifdef ACCEPT_INETV6 /* Allow inetv6 as an alias for inet6 for compatibility
+			with original X11 over IPv6 draft. */
+    else if (!strncmp("inetv6:", lname, 7)) {
+#if (defined(TCPCONN) || defined(STREAMSCONN)) && \
+    defined(IPv6) && defined(AF_INET6)
+	family = FamilyInternet6;
+	name += 7;
+#else
+	fprintf (stderr, "%s: not compiled for IPv6\n", ProgramName);
+	return 0;
+#endif
+    }
+#endif /* ACCEPT_INETV6 */
     else if (!strncmp("dnet:", lname, 5)) {
 #ifdef DNETCONN
 	family = FamilyDECnet;
@@ -379,6 +407,10 @@
     else if (!strncmp("local:", lname, 6)) {
 	family = FamilyLocalHost;
     }
+    else if (!strncmp("si:", lname, 3)) {
+	family = FamilyServerInterpreted;
+	name += 3;
+    }
     if (family == FamilyWild && (cp = strchr(lname, ':'))) {
 	*cp = '\0';
 	fprintf (stderr, "%s: unknown address family \"%s\"\n",
@@ -387,10 +419,42 @@
     }
     free(lname);
 
+    if (family == FamilyServerInterpreted) {
+	XServerInterpretedAddress siaddr;
+	int namelen;
+
+	cp = strchr(name, ':');
+	if (cp == NULL || cp == name) {
+	    fprintf(stderr, 
+	   "%s: type must be specified for server interpreted family \"%s\"\n",
+	      ProgramName, name);
+	    return 0;
+	}
+	ha.family = FamilyServerInterpreted;
+	ha.address = (char *) &siaddr;
+	namelen = strlen(name);
+	siaddr.type = malloc(namelen);
+	if (siaddr.type == NULL) {
+	    return 0;
+	}
+	memcpy(siaddr.type, name, namelen);
+	siaddr.typelength = cp - name;
+	siaddr.type[siaddr.typelength] = '\0';
+	siaddr.value = siaddr.type + siaddr.typelength + 1;
+	siaddr.valuelength = namelen - (siaddr.typelength + 1);
+	if (add)
+	    XAddHost(dpy, &ha);
+	else
+	    XRemoveHost(dpy, &ha);
+	free(siaddr.type);
+	printf( "%s %s\n", name, add ? add_msg : remove_msg);
+	return 1;
+    }
+
 #ifdef DNETCONN
-    if (family == FamilyDECnet ||
+    if (family == FamilyDECnet || ((family == FamilyWild) &&
 	(cp = strchr(name, ':')) && (*(cp + 1) == ':') &&
-	!(*cp = '\0')) {
+	!(*cp = '\0'))) {
 	ha.family = FamilyDECnet;
 	if (dnaddrp = dnet_addr(name)) {
 	    dnaddr = *dnaddrp;
@@ -815,6 +879,34 @@
     if (ha->family == FamilyLocalHost) {
 	return "";
     }
+    if (ha->family == FamilyServerInterpreted) {
+	XServerInterpretedAddress *sip;
+	static char *addressString;
+	static size_t addressStringSize;
+	size_t neededSize;
+
+	sip = (XServerInterpretedAddress *) ha->address;
+	neededSize = sip->typelength + sip->valuelength + 2;
+
+	if (addressStringSize < neededSize) {
+	    if (addressString != NULL) {
+		free(addressString);
+	    }
+	    addressStringSize = neededSize;
+	    addressString = malloc(addressStringSize);
+	}
+	if (addressString != NULL) {
+	    char *cp = addressString;
+
+	    memcpy(cp, sip->type, sip->typelength);
+	    cp += sip->typelength;
+	    *cp++ = ':';
+	    memcpy(cp, sip->value, sip->valuelength);
+	    cp += sip->valuelength;
+	    *cp = '\0';
+	}
+	return addressString;
+    }
     return (NULL);
 }
 

Index: xhost.man
===================================================================
RCS file: /cvs/xorg/xc/programs/xhost/xhost.man,v
retrieving revision 1.1.4.3
retrieving revision 1.1.4.4
diff -u -d -r1.1.4.3 -r1.1.4.4
--- a/xhost.man	5 Mar 2004 13:41:27 -0000	1.1.4.3
+++ b/xhost.man	15 Apr 2004 10:17:42 -0000	1.1.4.4
@@ -1,27 +1,35 @@
 .\" $Xorg: xhost.man,v 1.4 2001/02/09 02:05:46 xorgcvs Exp $
+.\" $XdotOrg$
+.\"
 .\" Copyright 1988, 1998  The Open Group
+.\" Copyright 2004 Sun Microsystems, Inc.
 .\" 
-.\" Permission to use, copy, modify, distribute, and sell this software and its
-.\" documentation for any purpose is hereby granted without fee, provided that
-.\" the above copyright notice appear in all copies and that both that
-.\" copyright notice and this permission notice appear in supporting
-.\" documentation.
-.\" 
-.\" The above copyright notice and this permission notice shall be included
-.\" in all copies or substantial portions of the Software.
+.\" Permission is hereby granted, free of charge, to any person obtaining a
+.\" copy of this software and associated documentation files (the
+.\" "Software"), to deal in the Software without restriction, including
+.\" without limitation the rights to use, copy, modify, merge, publish,
+.\" distribute, and/or sell copies of the Software, and to permit persons
+.\" to whom the Software is furnished to do so, provided that the above
+.\" copyright notice(s) and this permission notice appear in all copies of
+.\" the Software and that both the above copyright notice(s) and this
+.\" permission notice appear in supporting documentation.
 .\" 
 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-.\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
-.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-.\" OTHER DEALINGS IN THE SOFTWARE.
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+.\" OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+.\" HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+.\" INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+.\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+.\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+.\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\" 
-.\" Except as contained in this notice, the name of The Open Group shall
-.\" not be used in advertising or otherwise to promote the sale, use or
-.\" other dealings in this Software without prior written authorization
-.\" from The Open Group.
+.\" Except as contained in this notice, the name of a copyright holder
+.\" shall not be used in advertising or otherwise to promote the sale, use
+.\" or other dealings in this Software without prior written authorization
+.\" of the copyright holder.
+.\" 
+.\" X Window System is a trademark of The Open Group.
 .\"
 .\" $XFree86: xc/programs/xhost/xhost.man,v 1.8tsi Exp $
 .\"
@@ -91,6 +99,7 @@
 nis	Secure RPC network name
 krb	Kerberos V5 principal
 local	contains only one name, the empty string
+si	Server Interpreted
 .fi
 .PP
 The family is case insensitive.
@@ -106,6 +115,11 @@
 Otherwise they are assumed to be Internet addresses. If compiled to support
 IPv6, then all IPv4 and IPv6 addresses returned by getaddrinfo(3) are added to
 the access list in the appropriate inet or inet6 family.
+.PP
+Server interpreted addresses consist of a case-sensitive type tag and a
+string representing a given value, separated by a colon.  For example,
+"si:hostname:almas" is a server interpreted address of type \fIhostname\fP,
+with a value of \fIalmas\fP.
 .SH DIAGNOSTICS
 For each name added to the access control list,
 a line of the form "\fIname\fP being added to access control list"
@@ -116,7 +130,7 @@
 .SH FILES
 /etc/X*.hosts
 .SH "SEE ALSO"
-X(__miscmansuffix__), Xsecurity(__miscmansuffix__), Xserver(1), xdm(1), getaddrinfo(3)
+X(__miscmansuffix__), Xsecurity(__miscmansuffix__), Xserver(1), xdm(1), xauth(1), getaddrinfo(3)
 .SH ENVIRONMENT
 .TP 8
 .B DISPLAY
@@ -130,10 +144,11 @@
 .I ``display''
 from the access list).
 .PP
-The X server stores network addresses, not host names.  This is not
-really a bug.  If somehow you change a host's network address while
-the server is still running, \fIxhost\fP must be used to add the new
-address and/or remove the old address.
+The X server stores network addresses, not host names, unless you use
+the server-interpreted hostname type address.  If somehow you change a
+host's network address while the server is still running, and you are
+using a network-address based form of authentication, \fIxhost\fP must
+be used to add the new address and/or remove the old address.
 .SH AUTHORS
 Bob Scheifler, MIT Laboratory for Computer Science,
 .br




More information about the xorg-commit-diffs mailing list