diff options
author | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-14 15:54:38 +0000 |
---|---|---|
committer | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-14 15:54:38 +0000 |
commit | d1eb0ee78fbb0c109f9fa8e1bc05907608fc4299 (patch) | |
tree | 0c5074aceb601091d42e095e30ddd2b6cf48c0ba |
R6.6 is the Xorg base-lineXORG-MAINXORG-STABLE
-rw-r--r-- | A8Eq.c | 47 | ||||
-rw-r--r-- | AA16.c | 48 | ||||
-rw-r--r-- | AA32.c | 48 | ||||
-rw-r--r-- | AA8.c | 48 | ||||
-rw-r--r-- | Alloc.c | 61 | ||||
-rw-r--r-- | AofA8.c | 48 | ||||
-rw-r--r-- | CA8.c | 46 | ||||
-rw-r--r-- | CmpKey.c | 44 | ||||
-rw-r--r-- | DA16.c | 42 | ||||
-rw-r--r-- | DA32.c | 42 | ||||
-rw-r--r-- | DA8.c | 42 | ||||
-rw-r--r-- | DAofA8.c | 46 | ||||
-rw-r--r-- | DecKey.c | 45 | ||||
-rw-r--r-- | Fill.c | 93 | ||||
-rw-r--r-- | Flush.c | 75 | ||||
-rw-r--r-- | GenKey.c | 70 | ||||
-rw-r--r-- | IncKey.c | 45 | ||||
-rw-r--r-- | RA16.c | 69 | ||||
-rw-r--r-- | RA32.c | 69 | ||||
-rw-r--r-- | RA8.c | 69 | ||||
-rw-r--r-- | RAofA8.c | 72 | ||||
-rw-r--r-- | RC16.c | 49 | ||||
-rw-r--r-- | RC32.c | 53 | ||||
-rw-r--r-- | RC8.c | 44 | ||||
-rw-r--r-- | RHead.c | 45 | ||||
-rw-r--r-- | RR.c | 40 | ||||
-rw-r--r-- | RaA16.c | 48 | ||||
-rw-r--r-- | RaA32.c | 48 | ||||
-rw-r--r-- | RaA8.c | 48 | ||||
-rw-r--r-- | RaAoA8.c | 48 | ||||
-rw-r--r-- | Unwrap.c | 89 | ||||
-rw-r--r-- | WA16.c | 48 | ||||
-rw-r--r-- | WA32.c | 48 | ||||
-rw-r--r-- | WA8.c | 48 | ||||
-rw-r--r-- | WAofA8.c | 48 | ||||
-rw-r--r-- | WC16.c | 45 | ||||
-rw-r--r-- | WC32.c | 49 | ||||
-rw-r--r-- | WC8.c | 44 | ||||
-rw-r--r-- | Whead.c | 59 | ||||
-rw-r--r-- | Wrap.c | 127 | ||||
-rw-r--r-- | Wrap.h | 10 | ||||
-rw-r--r-- | include/X11/Xdmcp.h | 141 |
42 files changed, 2348 insertions, 0 deletions
@@ -0,0 +1,47 @@ +/* + * $Xorg: A8Eq.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +int +XdmcpARRAY8Equal (array1, array2) + ARRAY8Ptr array1, array2; +{ + int i; + + if (array1->length != array2->length) + return FALSE; + for (i = 0; i < (int)array1->length; i++) + if (array1->data[i] != array2->data[i]) + return FALSE; + return TRUE; +} @@ -0,0 +1,48 @@ +/* + * $Xorg: AA16.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +int +XdmcpAllocARRAY16 (array, length) + ARRAY16Ptr array; + int length; +{ + CARD16Ptr newData; + + newData = (CARD16Ptr) Xalloc (length * sizeof (CARD16)); + if (!newData) + return FALSE; + array->length = length; + array->data = newData; + return TRUE; +} @@ -0,0 +1,48 @@ +/* + * $Xorg: AA32.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +int +XdmcpAllocARRAY32 (array, length) + ARRAY32Ptr array; + int length; +{ + CARD32Ptr newData; + + newData = (CARD32Ptr) Xalloc (length * sizeof (CARD32)); + if (!newData) + return FALSE; + array->length = length; + array->data = newData; + return TRUE; +} @@ -0,0 +1,48 @@ +/* + * $Xorg: AA8.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +int +XdmcpAllocARRAY8 (array, length) + ARRAY8Ptr array; + int length; +{ + CARD8Ptr newData; + + newData = (CARD8Ptr) Xalloc (length * sizeof (CARD8)); + if (!newData) + return FALSE; + array->length = length; + array->data = newData; + return TRUE; +} @@ -0,0 +1,61 @@ +/* + * $Xorg: Alloc.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +/* stubs for use when Xalloc, Xrealloc and Xfree are not defined */ + +extern char *malloc (), *realloc (); + +long * +Xalloc (amount) + unsigned amount; +{ + if (amount == 0) + amount = 1; + return (long *) malloc (amount); +} + +long * +Xrealloc (old, amount) + long *old; + unsigned amount; +{ + if (amount == 0) + amount = 1; + if (!old) + return (long *) malloc (amount); + return (long *) realloc ((char *) old, amount); +} + +void +Xfree (old) + long *old; +{ + if (old) + free ((char *) old); +} @@ -0,0 +1,48 @@ +/* + * $Xorg: AofA8.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +int +XdmcpAllocARRAYofARRAY8 (array, length) + ARRAYofARRAY8Ptr array; + int length; +{ + ARRAY8Ptr newData; + + newData = (ARRAY8Ptr) Xalloc (length * sizeof (ARRAY8)); + if (!newData) + return FALSE; + array->length = length; + array->data = newData; + return TRUE; +} @@ -0,0 +1,46 @@ +/* + * $Xorg: CA8.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> +#include <X11/Xfuncs.h> + +int +XdmcpCopyARRAY8 (src, dst) + ARRAY8Ptr src, dst; +{ + dst->length = src->length; + dst->data = (CARD8 *) Xalloc (dst->length * sizeof (CARD8)); + if (!dst->data) + return FALSE; + memmove (dst->data, src->data, src->length * sizeof (CARD8)); + return TRUE; +} diff --git a/CmpKey.c b/CmpKey.c new file mode 100644 index 0000000..6d7692b --- /dev/null +++ b/CmpKey.c @@ -0,0 +1,44 @@ +/* + * $Xorg: CmpKey.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +XdmcpCompareKeys (a, b) + XdmAuthKeyPtr a, b; +{ + int i; + + for (i = 0; i < 8; i++) + if (a->data[i] != b->data[i]) + return FALSE; + return TRUE; +} @@ -0,0 +1,42 @@ +/* + * $Xorg: DA16.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +void +XdmcpDisposeARRAY16 (array) + ARRAY16Ptr array; +{ + if (array->data != NULL) Xfree (array->data); + array->length = 0; + array->data = NULL; +} @@ -0,0 +1,42 @@ +/* + * $Xorg: DA32.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +void +XdmcpDisposeARRAY32 (array) + ARRAY32Ptr array; +{ + if (array->data != NULL) Xfree (array->data); + array->length = 0; + array->data = NULL; +} @@ -0,0 +1,42 @@ +/* + * $Xorg: DA8.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +void +XdmcpDisposeARRAY8 (array) + ARRAY8Ptr array; +{ + if (array->data != NULL) Xfree (array->data); + array->length = 0; + array->data = NULL; +} diff --git a/DAofA8.c b/DAofA8.c new file mode 100644 index 0000000..0e818a3 --- /dev/null +++ b/DAofA8.c @@ -0,0 +1,46 @@ +/* + * $Xorg: DAofA8.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +void +XdmcpDisposeARRAYofARRAY8 (array) + ARRAYofARRAY8Ptr array; +{ + int i; + + for (i = 0; i < (int)array->length; i++) + XdmcpDisposeARRAY8 (&array->data[i]); + if (array->data != NULL) Xfree (array->data); + array->length = 0; + array->data = NULL; +} diff --git a/DecKey.c b/DecKey.c new file mode 100644 index 0000000..781df51 --- /dev/null +++ b/DecKey.c @@ -0,0 +1,45 @@ +/* + * $Xorg: DecKey.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +void +XdmcpDecrementKey (key) + XdmAuthKeyPtr key; +{ + int i; + + i = 7; + while (key->data[i]-- == 0) + if (--i < 0) + break; +} @@ -0,0 +1,93 @@ +/* + * $Xorg: Fill.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#ifdef WIN32 +#define _WILLWINSOCK_ +#endif +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +#ifdef STREAMSCONN +#include <tiuser.h> +#else +#ifdef WIN32 +#include <X11/Xwinsock.h> +#else +#include <sys/socket.h> +#endif +#endif + +int +XdmcpFill (fd, buffer, from, fromlen) + int fd; + XdmcpBufferPtr buffer; + XdmcpNetaddr from; /* return */ + int *fromlen; /* return */ +{ + BYTE *newBuf; +#ifdef STREAMSCONN + struct t_unitdata dataunit; + int gotallflag, result; +#endif + + if (buffer->size < XDM_MAX_MSGLEN) + { + newBuf = (BYTE *) Xalloc (XDM_MAX_MSGLEN); + if (newBuf) + { + Xfree (buffer->data); + buffer->data = newBuf; + buffer->size = XDM_MAX_MSGLEN; + } + } + buffer->pointer = 0; +#ifdef STREAMSCONN + dataunit.addr.buf = from; + dataunit.addr.maxlen = *fromlen; + dataunit.opt.maxlen = 0; /* don't care to know about options */ + dataunit.udata.buf = (char *)buffer->data; + dataunit.udata.maxlen = buffer->size; + result = t_rcvudata (fd, &dataunit, &gotallflag); + if (result < 0) { + return FALSE; + } + buffer->count = dataunit.udata.len; + *fromlen = dataunit.addr.len; +#else + buffer->count = recvfrom (fd, (char*)buffer->data, buffer->size, 0, + (struct sockaddr *)from, fromlen); +#endif + if (buffer->count < 6) { + buffer->count = 0; + return FALSE; + } + return TRUE; +} @@ -0,0 +1,75 @@ +/* + * $Xorg: Flush.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#ifdef WIN32 +#define _WILLWINSOCK_ +#endif +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +#ifdef STREAMSCONN +#include <tiuser.h> +#else +#ifdef WIN32 +#include <X11/Xwinsock.h> +#else +#include <sys/socket.h> +#endif +#endif + +int +XdmcpFlush (fd, buffer, to, tolen) + int fd; + XdmcpBufferPtr buffer; + XdmcpNetaddr to; + int tolen; +{ + int result; + +#ifdef STREAMSCONN + struct t_unitdata dataunit; + + dataunit.addr.buf = to; + dataunit.addr.len = tolen; + dataunit.opt.len = 0; /* default options */ + dataunit.udata.buf = (char *)buffer->data; + dataunit.udata.len = buffer->pointer; + result = t_sndudata(fd, &dataunit); + if (result < 0) + return FALSE; +#else + result = sendto (fd, (char *)buffer->data, buffer->pointer, 0, + (struct sockaddr *)to, tolen); + if (result != buffer->pointer) + return FALSE; +#endif + return TRUE; +} diff --git a/GenKey.c b/GenKey.c new file mode 100644 index 0000000..783ed92 --- /dev/null +++ b/GenKey.c @@ -0,0 +1,70 @@ +/* + * $Xorg: GenKey.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +static getbits (data, dst) + long data; + unsigned char *dst; +{ + dst[0] = (data ) & 0xff; + dst[1] = (data >> 8) & 0xff; + dst[2] = (data >> 16) & 0xff; + dst[3] = (data >> 24) & 0xff; +} + +#ifdef X_NOT_STDC_ENV +#define Time_t long +extern Time_t time (); +#else +#define Time_t time_t +#endif + +#if defined(SYSV) || defined(SVR4) +#define srandom srand48 +#define random lrand48 +#endif + +long random(); + +void +XdmcpGenerateKey (key) + XdmAuthKeyPtr key; +{ + long lowbits, highbits; + + srandom ((int)getpid() ^ time((Time_t *)0)); + lowbits = random (); + highbits = random (); + getbits (lowbits, key->data); + getbits (highbits, key->data + 4); +} diff --git a/IncKey.c b/IncKey.c new file mode 100644 index 0000000..c4382d9 --- /dev/null +++ b/IncKey.c @@ -0,0 +1,45 @@ +/* + * $Xorg: IncKey.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +void +XdmcpIncrementKey (key) + XdmAuthKeyPtr key; +{ + int i; + + i = 7; + while (++key->data[i] == 0) + if (--i < 0) + break; +} @@ -0,0 +1,69 @@ +/* + * $Xorg: RA16.c,v 1.5 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +int +XdmcpReadARRAY16 (buffer, array) + XdmcpBufferPtr buffer; + ARRAY16Ptr array; +{ + int i; + + if (!XdmcpReadCARD8 (buffer, &array->length)) { + + /* Must set array->data to NULL to guarantee safe call of + * XdmcpDisposeARRAY*(array) (which calls Xfree(array->data)); + * see defect 7329 */ + array->data = 0; + return FALSE; + } + if (!array->length) + { + array->data = NULL; + return TRUE; + } + array->data = (CARD16 *) Xalloc (array->length * sizeof (CARD16)); + if (!array->data) + return FALSE; + for (i = 0; i < (int)array->length; i++) + { + if (!XdmcpReadCARD16 (buffer, &array->data[i])) + { + Xfree (array->data); + array->data = NULL; + array->length = 0; + return FALSE; + } + } + return TRUE; +} @@ -0,0 +1,69 @@ +/* + * $Xorg: RA32.c,v 1.5 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +int +XdmcpReadARRAY32 (buffer, array) + XdmcpBufferPtr buffer; + ARRAY32Ptr array; +{ + int i; + + if (!XdmcpReadCARD8 (buffer, &array->length)) { + + /* Must set array->data to NULL to guarantee safe call of + * XdmcpDisposeARRAY*(array) (which calls Xfree(array->data)); + * see defect 7329 */ + array->data = 0; + return FALSE; + } + if (!array->length) + { + array->data = NULL; + return TRUE; + } + array->data = (CARD32 *) Xalloc (array->length * sizeof (CARD32)); + if (!array->data) + return FALSE; + for (i = 0; i < (int)array->length; i++) + { + if (!XdmcpReadCARD32 (buffer, &array->data[i])) + { + Xfree (array->data); + array->data = NULL; + array->length = 0; + return FALSE; + } + } + return TRUE; +} @@ -0,0 +1,69 @@ +/* + * $Xorg: RA8.c,v 1.5 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +int +XdmcpReadARRAY8 (buffer, array) + XdmcpBufferPtr buffer; + ARRAY8Ptr array; +{ + int i; + + if (!XdmcpReadCARD16 (buffer, &array->length)) { + + /* Must set array->data to NULL to guarantee safe call of + * XdmcpDisposeARRAY*(array) (which calls Xfree(array->data)); + * see defect 7329 */ + array->data = 0; + return FALSE; + } + if (!array->length) + { + array->data = NULL; + return TRUE; + } + array->data = (CARD8 *) Xalloc (array->length * sizeof (CARD8)); + if (!array->data) + return FALSE; + for (i = 0; i < (int)array->length; i++) + { + if (!XdmcpReadCARD8 (buffer, &array->data[i])) + { + Xfree (array->data); + array->data = NULL; + array->length = 0; + return FALSE; + } + } + return TRUE; +} diff --git a/RAofA8.c b/RAofA8.c new file mode 100644 index 0000000..b4b2cea --- /dev/null +++ b/RAofA8.c @@ -0,0 +1,72 @@ +/* + * $Xorg: RAofA8.c,v 1.6 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +int +XdmcpReadARRAYofARRAY8 (buffer, array) + XdmcpBufferPtr buffer; + ARRAYofARRAY8Ptr array; +{ + int i; + + if (!XdmcpReadCARD8 (buffer, &array->length)) { + + /* Must set array->data to NULL to guarantee safe call of + * XdmcpDisposeARRAY*(array) (which calls Xfree(array->data)); + * see defect 7329 */ + array->data = 0; + return FALSE; + } + if (!array->length) + { + array->data = NULL; + return TRUE; + } + array->data = (ARRAY8 *) Xalloc (array->length * sizeof (ARRAY8)); + if (!array->data) + return FALSE; + for (i = 0; i < (int)array->length; i++) + { + if (!XdmcpReadARRAY8 (buffer, &array->data[i])) + { + + /* All arrays allocated thus far in the loop must be freed + * if there is an error in the read. + * See Defect 7328 */ + array->length = i; + XdmcpDisposeARRAYofARRAY8(array); + return FALSE; + } + } + return TRUE; +} @@ -0,0 +1,49 @@ +/* + * $Xorg: RC16.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +int +XdmcpReadCARD16 (buffer, valuep) + XdmcpBufferPtr buffer; + CARD16Ptr valuep; +{ + CARD8 high, low; + + if (XdmcpReadCARD8 (buffer, &high) && + XdmcpReadCARD8 (buffer, &low)) + { + *valuep = (((CARD16) high) << 8) | ((CARD16) low); + return TRUE; + } + return FALSE; +} @@ -0,0 +1,53 @@ +/* + * $Xorg: RC32.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +int +XdmcpReadCARD32 (buffer, valuep) + XdmcpBufferPtr buffer; + CARD32Ptr valuep; +{ + CARD8 byte0, byte1, byte2, byte3; + if (XdmcpReadCARD8 (buffer, &byte0) && + XdmcpReadCARD8 (buffer, &byte1) && + XdmcpReadCARD8 (buffer, &byte2) && + XdmcpReadCARD8 (buffer, &byte3)) + { + *valuep = (((CARD32) byte0) << 24) | + (((CARD32) byte1) << 16) | + (((CARD32) byte2) << 8) | + (((CARD32) byte3)); + return TRUE; + } + return FALSE; +} @@ -0,0 +1,44 @@ +/* + * $Xorg: RC8.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +int +XdmcpReadCARD8 (buffer, valuep) + XdmcpBufferPtr buffer; + CARD8Ptr valuep; +{ + if (buffer->pointer >= buffer->count) + return FALSE; + *valuep = (CARD8) buffer->data[buffer->pointer++]; + return TRUE; +} @@ -0,0 +1,45 @@ +/* + * $Xorg: RHead.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +int +XdmcpReadHeader (buffer, header) + XdmcpBufferPtr buffer; + XdmcpHeaderPtr header; +{ + if (XdmcpReadCARD16 (buffer, &header->version) && + XdmcpReadCARD16 (buffer, &header->opcode) && + XdmcpReadCARD16 (buffer, &header->length)) + return TRUE; + return FALSE; +} @@ -0,0 +1,40 @@ +/* + * $Xorg: RR.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +int +XdmcpReadRemaining (buffer) + XdmcpBufferPtr buffer; +{ + return buffer->count - buffer->pointer; +} @@ -0,0 +1,48 @@ +/* + * $Xorg: RaA16.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +int +XdmcpReallocARRAY16 (array, length) + ARRAY16Ptr array; + int length; +{ + CARD16Ptr newData; + + newData = (CARD16Ptr) Xrealloc (array->data, length * sizeof (CARD16)); + if (!newData) + return FALSE; + array->length = length; + array->data = newData; + return TRUE; +} @@ -0,0 +1,48 @@ +/* + * $Xorg: RaA32.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +int +XdmcpReallocARRAY32 (array, length) + ARRAY32Ptr array; + int length; +{ + CARD32Ptr newData; + + newData = (CARD32Ptr) Xrealloc (array->data, length * sizeof (CARD32)); + if (!newData) + return FALSE; + array->length = length; + array->data = newData; + return TRUE; +} @@ -0,0 +1,48 @@ +/* + * $Xorg: RaA8.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +int +XdmcpReallocARRAY8 (array, length) + ARRAY8Ptr array; + int length; +{ + CARD8Ptr newData; + + newData = (CARD8Ptr) Xrealloc (array->data, length * sizeof (CARD8)); + if (!newData) + return FALSE; + array->length = length; + array->data = newData; + return TRUE; +} diff --git a/RaAoA8.c b/RaAoA8.c new file mode 100644 index 0000000..e1378ec --- /dev/null +++ b/RaAoA8.c @@ -0,0 +1,48 @@ +/* + * $Xorg: RaAoA8.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +int +XdmcpReallocARRAYofARRAY8 (array, length) + ARRAYofARRAY8Ptr array; + int length; +{ + ARRAY8Ptr newData; + + newData = (ARRAY8Ptr) Xrealloc (array->data, length * sizeof (ARRAY8)); + if (!newData) + return FALSE; + array->length = length; + array->data = newData; + return TRUE; +} diff --git a/Unwrap.c b/Unwrap.c new file mode 100644 index 0000000..c839788 --- /dev/null +++ b/Unwrap.c @@ -0,0 +1,89 @@ +/* + * $Xorg: Unwrap.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +#ifdef HASXDMAUTH + +/* + * The following function exists only to demonstrate the + * desired functional interface for this routine. You will + * need to add the appropriate algorithm if you wish to + * use XDM-AUTHENTICATION-1/XDM-AUTHORIZATION-1. + * + * The interface for this routine is quite simple. All three + * arguments are arrays of 8 unsigned characters, the first two + * are 64 bits of useful data, the last is 56 bits of useful + * data packed into 8 bytes, using the low 7 bits of each + * byte, filling the high bit with odd parity. + * + * Examine the XDMCP specification for the correct algorithm + */ + +#include "Wrap.h" + +void +XdmcpUnwrap (input, wrapper, output, bytes) + unsigned char *input, *output; + unsigned char *wrapper; + int bytes; +{ + int i, j, k; + unsigned char tmp[8]; + unsigned char blocks[2][8]; + unsigned char expand_wrapper[8]; + auth_wrapper_schedule schedule; + + _XdmcpWrapperToOddParity (wrapper, expand_wrapper); + _XdmcpAuthSetup (expand_wrapper, schedule); + + k = 0; + for (j = 0; j < bytes; j += 8) + { + if (bytes - j < 8) + return; /* bad input length */ + for (i = 0; i < 8; i++) + blocks[k][i] = input[j + i]; + _XdmcpAuthDoIt ((unsigned char *) (input + j), (unsigned char *) tmp, schedule, 0); + /* block chaining */ + k = (k == 0) ? 1 : 0; + for (i = 0; i < 8; i++) + { + if (j == 0) + output[j + i] = tmp[i]; + else + output[j + i] = tmp[i] ^ blocks[k][i]; + } + } +} + +#endif /* HASXDMAUTH */ @@ -0,0 +1,48 @@ +/* + * $Xorg: WA16.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +int +XdmcpWriteARRAY16 (buffer, array) + XdmcpBufferPtr buffer; + ARRAY16Ptr array; +{ + int i; + + if (!XdmcpWriteCARD8 (buffer, array->length)) + return FALSE; + for (i = 0; i < (int)array->length; i++) + if (!XdmcpWriteCARD16 (buffer, array->data[i])) + return FALSE; + return TRUE; +} @@ -0,0 +1,48 @@ +/* + * $Xorg: WA32.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +int +XdmcpWriteARRAY32 (buffer, array) + XdmcpBufferPtr buffer; + ARRAY32Ptr array; +{ + int i; + + if (!XdmcpWriteCARD8 (buffer, array->length)) + return FALSE; + for (i = 0; i < (int)array->length; i++) + if (!XdmcpWriteCARD32 (buffer, array->data[i])) + return FALSE; + return TRUE; +} @@ -0,0 +1,48 @@ +/* + * $Xorg: WA8.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +int +XdmcpWriteARRAY8 (buffer, array) + XdmcpBufferPtr buffer; + ARRAY8Ptr array; +{ + int i; + + if (!XdmcpWriteCARD16 (buffer, array->length)) + return FALSE; + for (i = 0; i < (int)array->length; i++) + if (!XdmcpWriteCARD8 (buffer, array->data[i])) + return FALSE; + return TRUE; +} diff --git a/WAofA8.c b/WAofA8.c new file mode 100644 index 0000000..84ba454 --- /dev/null +++ b/WAofA8.c @@ -0,0 +1,48 @@ +/* + * $Xorg: WAofA8.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +int +XdmcpWriteARRAYofARRAY8 (buffer, array) + XdmcpBufferPtr buffer; + ARRAYofARRAY8Ptr array; +{ + int i; + + if (!XdmcpWriteCARD8 (buffer, array->length)) + return FALSE; + for (i = 0; i < (int)array->length; i++) + if (!XdmcpWriteARRAY8 (buffer, &array->data[i])) + return FALSE; + return TRUE; +} @@ -0,0 +1,45 @@ +/* + * $Xorg: WC16.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +int +XdmcpWriteCARD16 (buffer, value) + XdmcpBufferPtr buffer; + CARD16 value; +{ + if (!XdmcpWriteCARD8 (buffer, value >> 8)) + return FALSE; + if (!XdmcpWriteCARD8 (buffer, value & 0xff)) + return FALSE; + return TRUE; +} @@ -0,0 +1,49 @@ +/* + * $Xorg: WC32.c,v 1.4 2001/02/09 02:03:49 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +int +XdmcpWriteCARD32 (buffer, value) + XdmcpBufferPtr buffer; + CARD32 value; +{ + if (!XdmcpWriteCARD8 (buffer, value >> 24)) + return FALSE; + if (!XdmcpWriteCARD8 (buffer, (value >> 16) & 0xff)) + return FALSE; + if (!XdmcpWriteCARD8 (buffer, (value >> 8) & 0xff)) + return FALSE; + if (!XdmcpWriteCARD8 (buffer, value & 0xff)) + return FALSE; + return TRUE; +} @@ -0,0 +1,44 @@ +/* + * $Xorg: WC8.c,v 1.4 2001/02/09 02:03:49 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +int +XdmcpWriteCARD8 (buffer, value) + XdmcpBufferPtr buffer; + CARD8 value; +{ + if (buffer->pointer >= buffer->size) + return FALSE; + buffer->data[buffer->pointer++] = (BYTE) value; + return TRUE; +} @@ -0,0 +1,59 @@ +/* + * $Xorg: Whead.c,v 1.4 2001/02/09 02:03:49 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +int +XdmcpWriteHeader (buffer, header) + XdmcpBufferPtr buffer; + XdmcpHeaderPtr header; +{ + BYTE *newData; + + if ((int)buffer->size < 6 + (int)header->length) + { + newData = (BYTE *) Xalloc (XDM_MAX_MSGLEN * sizeof (BYTE)); + if (!newData) + return FALSE; + Xfree (buffer->data); + buffer->data = newData; + buffer->size = XDM_MAX_MSGLEN; + } + buffer->pointer = 0; + if (!XdmcpWriteCARD16 (buffer, header->version)) + return FALSE; + if (!XdmcpWriteCARD16 (buffer, header->opcode)) + return FALSE; + if (!XdmcpWriteCARD16 (buffer, header->length)) + return FALSE; + return TRUE; +} @@ -0,0 +1,127 @@ +/* + * $Xorg: Wrap.c,v 1.4 2001/02/09 02:03:49 xorgcvs Exp $ + * + * +Copyright 1989, 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. + * * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xdmcp.h> + +#ifdef HASXDMAUTH + +/* + * The following function exists only to demonstrate the + * desired functional interface for this routine. You will + * need to add the appropriate algorithm if you wish to + * use XDM-AUTHENTICATION-1/XDM-AUTHORIZATION-1. + * + * Examine the XDMCP specification for the correct algorithm + */ + +#include "Wrap.h" + +void +XdmcpWrap (input, wrapper, output, bytes) + unsigned char *input, *output; + unsigned char *wrapper; + int bytes; +{ + int i, j; + int len; + unsigned char tmp[8]; + unsigned char expand_wrapper[8]; + auth_wrapper_schedule schedule; + + _XdmcpWrapperToOddParity (wrapper, expand_wrapper); + _XdmcpAuthSetup (expand_wrapper, schedule); + for (j = 0; j < bytes; j += 8) + { + len = 8; + if (bytes - j < len) + len = bytes - j; + /* block chaining */ + for (i = 0; i < len; i++) + { + if (j == 0) + tmp[i] = input[i]; + else + tmp[i] = input[j + i] ^ output[j - 8 + i]; + } + for (; i < 8; i++) + { + if (j == 0) + tmp[i] = 0; + else + tmp[i] = 0 ^ output[j - 8 + i]; + } + _XdmcpAuthDoIt (tmp, (output + j), schedule, 1); + } +} + +/* + * Given a 56 bit wrapper in XDMCP format, create a 56 + * bit wrapper in 7-bits + odd parity format + */ + +static int +OddParity (c) + unsigned char c; +{ + c = c ^ (c >> 4); + c = c ^ (c >> 2); + c = c ^ (c >> 1); + return ~c & 0x1; +} + +/* + * Spread the 56 bit wrapper among 8 bytes, using the upper 7 bits + * of each byte, and storing an odd parity bit in the low bit + */ + +void +_XdmcpWrapperToOddParity (in, out) + unsigned char *in, *out; +{ + int ashift, bshift; + int i; + unsigned char c; + + ashift = 7; + bshift = 1; + for (i = 0; i < 7; i++) + { + c = ((in[i] << ashift) | (in[i+1] >> bshift)) & 0x7f; + out[i] = (c << 1) | OddParity (c); + ashift--; + bshift++; + } + c = in[i]; + out[i] = (c << 1) | OddParity(c); +} + +#endif @@ -0,0 +1,10 @@ +/* $Xorg: Wrap.h,v 1.3 2000/08/17 19:45:50 cpqbld Exp $ */ +/* + * header file for compatibility with something useful + */ + +typedef unsigned char auth_cblock[8]; /* block size */ + +typedef struct auth_ks_struct { auth_cblock _; } auth_wrapper_schedule[16]; + +extern void _XdmcpWrapperToOddParity(); diff --git a/include/X11/Xdmcp.h b/include/X11/Xdmcp.h new file mode 100644 index 0000000..b37ba28 --- /dev/null +++ b/include/X11/Xdmcp.h @@ -0,0 +1,141 @@ +/* $Xorg: Xdmcp.h,v 1.6 2000/08/17 19:45:50 cpqbld Exp $ */ +/* + * Copyright 1989 Network Computing Devices, Inc., Mountain View, California. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of N.C.D. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. N.C.D. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + */ +#include <X11/Xmd.h> + +#ifndef _XDMCP_H_ +#define _XDMCP_H_ +#define XDM_PROTOCOL_VERSION 1 +#define XDM_UDP_PORT 177 +#define XDM_MAX_MSGLEN 8192 +#define XDM_MIN_RTX 2 +#define XDM_MAX_RTX 32 +#define XDM_RTX_LIMIT 7 +#define XDM_KA_RTX_LIMIT 4 +#define XDM_DEF_DORMANCY (3 * 60) /* 3 minutes */ +#define XDM_MAX_DORMANCY (24 * 60 * 60) /* 24 hours */ + +typedef enum { + BROADCAST_QUERY = 1, QUERY, INDIRECT_QUERY, FORWARD_QUERY, + WILLING, UNWILLING, REQUEST, ACCEPT, DECLINE, MANAGE, REFUSE, + FAILED, KEEPALIVE, ALIVE +} xdmOpCode; + +typedef enum { + XDM_QUERY, XDM_BROADCAST, XDM_INDIRECT, XDM_COLLECT_QUERY, + XDM_COLLECT_BROADCAST_QUERY, XDM_COLLECT_INDIRECT_QUERY, + XDM_START_CONNECTION, XDM_AWAIT_REQUEST_RESPONSE, + XDM_AWAIT_MANAGE_RESPONSE, XDM_MANAGE, XDM_RUN_SESSION, XDM_OFF, + XDM_AWAIT_USER_INPUT, XDM_KEEPALIVE, XDM_AWAIT_ALIVE_RESPONSE +} xdmcp_states; + +#ifdef NOTDEF +/* table of hosts */ + +#define XDM_MAX_STR_LEN 21 +#define XDM_MAX_HOSTS 20 +struct xdm_host_table { + struct sockaddr_in sockaddr; + char name[XDM_MAX_STR_LEN]; + char status[XDM_MAX_STR_LEN]; +}; +#endif /* NOTDEF */ + +typedef CARD8 *CARD8Ptr; +typedef CARD16 *CARD16Ptr; +typedef CARD32 *CARD32Ptr; + +typedef struct _ARRAY8 { + CARD16 length; + CARD8Ptr data; +} ARRAY8, *ARRAY8Ptr; + +typedef struct _ARRAY16 { + CARD8 length; + CARD16Ptr data; +} ARRAY16, *ARRAY16Ptr; + +typedef struct _ARRAY32 { + CARD8 length; + CARD32Ptr data; +} ARRAY32, *ARRAY32Ptr; + +typedef struct _ARRAYofARRAY8 { + CARD8 length; + ARRAY8Ptr data; +} ARRAYofARRAY8, *ARRAYofARRAY8Ptr; + +typedef struct _XdmcpHeader { + CARD16 version, opcode, length; +} XdmcpHeader, *XdmcpHeaderPtr; + +typedef struct _XdmcpBuffer { + BYTE *data; + int size; /* size of buffer pointed by to data */ + int pointer; /* current index into data */ + int count; /* bytes read from network into data */ +} XdmcpBuffer, *XdmcpBufferPtr; + +typedef struct _XdmAuthKey { + BYTE data[8]; +} XdmAuthKeyRec, *XdmAuthKeyPtr; + + +/* implementation-independent network address structure. + Equiv to sockaddr* for sockets and netbuf* for STREAMS. */ + +typedef char *XdmcpNetaddr; + + +extern int XdmcpWriteCARD8(), XdmcpWriteCARD16(); +extern int XdmcpWriteCARD32(); +extern int XdmcpWriteARRAY8(), XdmcpWriteARRAY16(); +extern int XdmcpWriteARRAY32(), XdmcpWriteARRAYofARRAY8(); +extern int XdmcpWriteHeader(), XdmcpFlush(); + +extern int XdmcpReadCARD8(), XdmcpReadCARD16(); +extern int XdmcpReadCARD32(); +extern int XdmcpReadARRAY8(), XdmcpReadARRAY16(); +extern int XdmcpReadARRAY32(), XdmcpReadARRAYofARRAY8(); +extern int XdmcpReadHeader(), XdmcpFill(); + +extern int XdmcpReadRemaining(); + +extern void XdmcpDisposeARRAY8(), XdmcpDisposeARRAY16(); +extern void XdmcpDisposeARRAY32(), XdmcpDisposeARRAYofARRAY8(); + +extern int XdmcpCopyARRAY8(); + +extern int XdmcpARRAY8Equal(); + +#ifdef HASXDMAUTH +extern void XdmcpGenerateKey(); +extern void XdmcpIncrementKey(); +extern void XdmcpDecrementKey(); +extern void XdmcpWrap(); +extern void XdmcpUnwrap(); +#endif + +#ifndef TRUE +#define TRUE 1 +#define FALSE 0 +#endif + +#if !defined(Xalloc) && !defined(xalloc) && !defined(Xrealloc) +extern long *Xalloc (), *Xrealloc (); +extern void Xfree(); +#endif + +#endif /* _XDMCP_H_ */ |