summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/X11/Xlib.h12
-rw-r--r--man/XAddHost.man71
-rw-r--r--src/Host.c131
-rw-r--r--src/LiHosts.c95
4 files changed, 216 insertions, 93 deletions
diff --git a/include/X11/Xlib.h b/include/X11/Xlib.h
index e68ba1d2..3f4cca5c 100644
--- a/include/X11/Xlib.h
+++ b/include/X11/Xlib.h
@@ -1,4 +1,4 @@
-/* $XdotOrg: lib/X11/include/X11/Xlib.h,v 1.1.4.7.2.2 2004-03-04 17:46:38 eich Exp $ */
+/* $XdotOrg: lib/X11/include/X11/Xlib.h,v 1.1.4.7.2.2.2.1 2004-03-13 18:48:40 alanc Exp $ */
/* $Xorg: Xlib.h,v 1.6 2001/02/09 02:03:38 xorgcvs Exp $ */
/*
@@ -379,6 +379,16 @@ typedef struct {
} XHostAddress;
/*
+ * Data structure for ServerFamilyInterpreted addresses in host routines
+ */
+typedef struct {
+ int typelength; /* length of type string, in bytes */
+ int valuelength; /* length of value string, in bytes */
+ char *type; /* pointer to where to find the type string */
+ char *value; /* pointer to where to find the address */
+} XServerInterpretedAddress;
+
+/*
* Data structure for "image" data, used by image manipulation routines.
*/
typedef struct _XImage {
diff --git a/man/XAddHost.man b/man/XAddHost.man
index 45a1e515..46b1fca5 100644
--- a/man/XAddHost.man
+++ b/man/XAddHost.man
@@ -1,28 +1,34 @@
.\" Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1994, 1996 X Consortium
+.\" Copyright \(co 2004 Sun Microsystems, Inc.
.\"
-.\" Permission is hereby granted, free of charge, to any person obtaining
-.\" a copy of this software and associated documentation files (the
+.\" All rights reserved.
+.\"
+.\" 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, sublicense, and/or sell copies of the Software, and to
-.\" permit persons to whom the Software is furnished to do so, subject to
-.\" the following conditions:
-.\"
-.\" The above copyright notice and this permission notice shall be included
-.\" in all copies or substantial portions of the Software.
-.\"
+.\" 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 X CONSORTIUM 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.
-.\"
-.\" Except as contained in this notice, the name of the X Consortium 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 X Consortium.
+.\" 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 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.
.\"
.\" Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991 by
.\" Digital Equipment Corporation
@@ -41,7 +47,7 @@
.\" It is provided ``as is'' without express or implied warranty.
.\"
.\" $XFree86: xc/doc/man/X11/XAddHost.man,v 1.3 2003/04/28 22:17:54 herrb Exp $
-.\" $XdotOrg: lib/X11/man/XAddHost.man,v 1.1.4.3.4.1 2004-03-04 17:45:54 eich Exp $
+.\" $XdotOrg: lib/X11/man/XAddHost.man,v 1.1.4.3.4.1.2.1 2004-03-13 18:48:39 alanc Exp $
.\"
.ds xT X Toolkit Intrinsics \- C Language Interface
.ds xW Athena X Widgets \- C Language X Toolkit Interface
@@ -143,7 +149,7 @@
.ny0
.TH XAddHost 3X11 __xorgversion__ "XLIB FUNCTIONS"
.SH NAME
-XAddHost, XAddHosts, XListHosts, XRemoveHost, XRemoveHosts, XSetAccessControl, XEnableAccessControl, XDisableAccessControl, XHostAddress \- control host access and host control structure
+XAddHost, XAddHosts, XListHosts, XRemoveHost, XRemoveHosts, XSetAccessControl, XEnableAccessControl, XDisableAccessControl, XHostAddress, XServerInterpretedAddress \- control host access and host control structure
.SH SYNTAX
.HP
int XAddHost\^(\^Display *\fIdisplay\fP, XHostAddress *\fIhost\fP\^);
@@ -308,11 +314,34 @@ typedef struct {
The family member specifies which protocol address family to use
(for example, TCP/IP or DECnet) and can be
.ZN FamilyInternet ,
+.ZN FamilyInternet6 ,
+.ZN FamilyServerInterpreted ,
.ZN FamilyDECnet ,
or
.ZN FamilyChaos .
The length member specifies the length of the address in bytes.
The address member specifies a pointer to the address.
+.LP
+For the ServerInterpreted family, the length is ignored and the address
+member is a pointer to a
+.ZN XServerInterpretedAddress
+structure which contains:
+.LP
+.Ds 0
+.TA .5i 3i
+.ta .5i 3i
+typedef struct {
+ int typelength; /\(** length of type string, in bytes */
+ int valuelength; /\(** length of value string, in bytes */
+ char *type; /\(** pointer to where to find the type string */
+ char *value; /\(** pointer to where to find the address */
+} XServerInterpretedAddress;
+.De
+.LP
+The type and value members point to strings representing the type and value of
+the server interpreted entry. These strings may not be NULL-terminated so care
+should be used when accessing them. The typelength and valuelength members
+specify the length in byte of the type and value strings.
.SH DIAGNOSTICS
.TP 1i
.ZN BadAccess
diff --git a/src/Host.c b/src/Host.c
index b82878ef..a6527645 100644
--- a/src/Host.c
+++ b/src/Host.c
@@ -1,78 +1,125 @@
/* $Xorg: Host.c,v 1.4 2001/02/09 02:03:33 xorgcvs Exp $ */
+/* $XdotOrg: lib/X11/src/Host.c,v 1.1.4.1.6.1.2.1 2004-03-13 18:48:40 alanc Exp $ */
/*
Copyright 1986, 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.
+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
+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/lib/X11/Host.c,v 1.3 2001/01/17 19:41:37 dawes Exp $ */
+/* $XFree86: xc/lib/X11/Host.c,v 1.4 2001/12/14 19:54:01 dawes Exp $ */
-/* this might be rightly reguarded an os dependent file */
+/* this might be rightly regarded an os dependent file */
#include "Xlibint.h"
int
-XAddHost (dpy, host)
- register Display *dpy;
- XHostAddress *host;
- {
+XAddHost (
+ register Display *dpy,
+ XHostAddress *host)
+{
register xChangeHostsReq *req;
- register int length = (host->length + 3) & ~0x3; /* round up */
+ register int length;
+ XServerInterpretedAddress *siAddr;
+ int addrlen;
+
+ if (host->family == FamilyServerInterpreted) {
+ siAddr = (XServerInterpretedAddress *) host->address;
+ addrlen = siAddr->typelength + siAddr->valuelength + 1;
+ } else {
+ addrlen = host->length;
+ }
+
+ length = (addrlen + 3) & ~0x3; /* round up */
LockDisplay(dpy);
GetReqExtra (ChangeHosts, length, req);
req->mode = HostInsert;
req->hostFamily = host->family;
- req->hostLength = host->length;
- memcpy((char *) NEXTPTR(req,xChangeHostsReq), host->address, host->length);
+ req->hostLength = addrlen;
+ if (host->family == FamilyServerInterpreted) {
+ char *dest = (char *) NEXTPTR(req,xChangeHostsReq);
+ memcpy(dest, siAddr->type, siAddr->typelength);
+ dest[siAddr->typelength] = '\0';
+ memcpy(dest + siAddr->typelength + 1,siAddr->value,siAddr->valuelength);
+ } else {
+ memcpy((char *) NEXTPTR(req,xChangeHostsReq), host->address, addrlen);
+ }
UnlockDisplay(dpy);
SyncHandle();
return 1;
- }
+}
int
-XRemoveHost (dpy, host)
- register Display *dpy;
- XHostAddress *host;
- {
+XRemoveHost (
+ register Display *dpy,
+ XHostAddress *host)
+{
register xChangeHostsReq *req;
- register int length = (host->length + 3) & ~0x3; /* round up */
+ register int length;
+ XServerInterpretedAddress *siAddr;
+ int addrlen;
+
+ if (host->family == FamilyServerInterpreted) {
+ siAddr = (XServerInterpretedAddress *) host->address;
+ addrlen = siAddr->typelength + siAddr->valuelength + 1;
+ } else {
+ addrlen = host->length;
+ }
+
+ length = (addrlen + 3) & ~0x3; /* round up */
LockDisplay(dpy);
GetReqExtra (ChangeHosts, length, req);
req->mode = HostDelete;
req->hostFamily = host->family;
- req->hostLength = host->length;
- memcpy((char *) NEXTPTR(req,xChangeHostsReq), host->address, host->length);
+ req->hostLength = addrlen;
+ if (host->family == FamilyServerInterpreted) {
+ char *dest = (char *) NEXTPTR(req,xChangeHostsReq);
+ memcpy(dest, siAddr->type, siAddr->typelength);
+ dest[siAddr->typelength] = '\0';
+ memcpy(dest + siAddr->typelength + 1,siAddr->value,siAddr->valuelength);
+ } else {
+ memcpy((char *) NEXTPTR(req,xChangeHostsReq), host->address, addrlen);
+ }
UnlockDisplay(dpy);
SyncHandle();
return 1;
- }
+}
int
-XAddHosts (dpy, hosts, n)
- register Display *dpy;
- XHostAddress *hosts;
- int n;
+XAddHosts (
+ register Display *dpy,
+ XHostAddress *hosts,
+ int n)
{
register int i;
for (i = 0; i < n; i++) {
@@ -82,10 +129,10 @@ XAddHosts (dpy, hosts, n)
}
int
-XRemoveHosts (dpy, hosts, n)
- register Display *dpy;
- XHostAddress *hosts;
- int n;
+XRemoveHosts (
+ register Display *dpy,
+ XHostAddress *hosts,
+ int n)
{
register int i;
for (i = 0; i < n; i++) {
diff --git a/src/LiHosts.c b/src/LiHosts.c
index 2f22d71d..851bdc1a 100644
--- a/src/LiHosts.c
+++ b/src/LiHosts.c
@@ -1,27 +1,38 @@
/* $Xorg: LiHosts.c,v 1.4 2001/02/09 02:03:34 xorgcvs Exp $ */
+/* $XdotOrg: lib/X11/src/LiHosts.c,v 1.1.14.1 2004-03-13 18:48:40 alanc Exp $ */
/*
Copyright 1986, 1998 The Open Group
-
-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.
-
-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.
-
-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.
+Copyright 2004 Sun Microsystems, Inc.
+
+All rights reserved.
+
+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
+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 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.
*/
@@ -33,17 +44,18 @@ in this Software without prior written authorization from The Open Group.
* can be freed using XFree.
*/
-XHostAddress *XListHosts (dpy, nhosts, enabled)
- register Display *dpy;
- int *nhosts; /* RETURN */
- Bool *enabled; /* RETURN */
- {
+XHostAddress *XListHosts (
+ register Display *dpy,
+ int *nhosts, /* RETURN */
+ Bool *enabled) /* RETURN */
+{
register XHostAddress *outbuf = 0, *op;
xListHostsReply reply;
long nbytes;
unsigned char *buf, *bp;
register unsigned i;
register xListHostsReq *req;
+ XServerInterpretedAddress *sip;
*nhosts = 0;
LockDisplay(dpy);
@@ -56,9 +68,15 @@ XHostAddress *XListHosts (dpy, nhosts, enabled)
}
if (reply.nHosts) {
+ unsigned int l;
nbytes = reply.length << 2; /* compute number of bytes in reply */
+ l = (unsigned) (nbytes +
+ (reply.nHosts * sizeof(XHostAddress)) +
+ (reply.nHosts * sizeof(XServerInterpretedAddress)));
op = outbuf = (XHostAddress *)
- Xmalloc((unsigned) (nbytes + reply.nHosts * sizeof(XHostAddress)));
+ Xmalloc((unsigned) (nbytes +
+ (reply.nHosts * sizeof(XHostAddress)) +
+ (reply.nHosts * sizeof(XServerInterpretedAddress))));
if (! outbuf) {
_XEatData(dpy, (unsigned long) nbytes);
@@ -66,8 +84,10 @@ XHostAddress *XListHosts (dpy, nhosts, enabled)
SyncHandle();
return (XHostAddress *) NULL;
}
- bp = buf =
- ((unsigned char *) outbuf) + reply.nHosts * sizeof(XHostAddress);
+ sip = (XServerInterpretedAddress *)
+ (((unsigned char *) outbuf) + (reply.nHosts * sizeof(XHostAddress)));
+ bp = buf = ((unsigned char *) sip)
+ + (reply.nHosts * sizeof(XServerInterpretedAddress));
_XRead (dpy, (char *) buf, nbytes);
@@ -81,7 +101,24 @@ XHostAddress *XListHosts (dpy, nhosts, enabled)
op->family = ((xHostEntry *) bp)->family;
op->length =((xHostEntry *) bp)->length;
#endif
- op->address = (char *) (bp + SIZEOF(xHostEntry));
+ if (op->family == FamilyServerInterpreted) {
+ char *tp = (char *) (bp + SIZEOF(xHostEntry));
+ char *vp = memchr(tp, 0, op->length);
+
+ if (vp != NULL) {
+ sip->type = tp;
+ sip->typelength = vp - tp;
+ sip->value = vp + 1;
+ sip->valuelength = op->length - (sip->typelength + 1);
+ } else {
+ sip->type = sip->value = NULL;
+ sip->typelength = sip->valuelength = 0;
+ }
+ op->address = (char *) sip;
+ sip++;
+ } else {
+ op->address = (char *) (bp + SIZEOF(xHostEntry));
+ }
bp += SIZEOF(xHostEntry) + (((op->length + 3) >> 2) << 2);
op++;
}