aboutsummaryrefslogtreecommitdiff
path: root/libXdmcp
diff options
context:
space:
mode:
Diffstat (limited to 'libXdmcp')
-rw-r--r--libXdmcp/.gitignore156
-rw-r--r--libXdmcp/AUTHORS16
-rw-r--r--libXdmcp/Array.c494
-rw-r--r--libXdmcp/COPYING46
-rw-r--r--libXdmcp/Fill.c180
-rw-r--r--libXdmcp/Flush.c140
-rw-r--r--libXdmcp/Key.c204
-rw-r--r--libXdmcp/README50
-rw-r--r--libXdmcp/Read.c488
-rw-r--r--libXdmcp/Unwrap.c180
-rw-r--r--libXdmcp/Wrap.c256
-rw-r--r--libXdmcp/Wrap.h30
-rw-r--r--libXdmcp/Wraphelp.README.crypto128
-rw-r--r--libXdmcp/Write.c302
-rw-r--r--libXdmcp/autogen.sh24
-rw-r--r--libXdmcp/xdmcp.pc.in22
16 files changed, 1358 insertions, 1358 deletions
diff --git a/libXdmcp/.gitignore b/libXdmcp/.gitignore
index ba66f132b..07ac69ef1 100644
--- a/libXdmcp/.gitignore
+++ b/libXdmcp/.gitignore
@@ -1,78 +1,78 @@
-#
-# X.Org module default exclusion patterns
-# The next section if for module specific patterns
-#
-# Do not edit the following section
-# GNU Build System (Autotools)
-aclocal.m4
-autom4te.cache/
-autoscan.log
-ChangeLog
-compile
-config.guess
-config.h
-config.h.in
-config.log
-config-ml.in
-config.py
-config.status
-config.status.lineno
-config.sub
-configure
-configure.scan
-depcomp
-.deps/
-INSTALL
-install-sh
-.libs/
-libtool
-libtool.m4
-ltmain.sh
-lt~obsolete.m4
-ltoptions.m4
-ltsugar.m4
-ltversion.m4
-Makefile
-Makefile.in
-mdate-sh
-missing
-mkinstalldirs
-*.pc
-py-compile
-stamp-h?
-symlink-tree
-texinfo.tex
-ylwrap
-
-# Do not edit the following section
-# Edit Compile Debug Document Distribute
-*~
-*.[0-9]
-*.[0-9]x
-*.bak
-*.bin
-core
-*.dll
-*.exe
-*-ISO*.bdf
-*-JIS*.bdf
-*-KOI8*.bdf
-*.kld
-*.ko
-*.ko.cmd
-*.lai
-*.l[oa]
-*.[oa]
-*.obj
-*.patch
-*.so
-*.pcf.gz
-*.pdb
-*.tar.bz2
-*.tar.gz
-#
-# Add & Override patterns for libXdmcp
-#
-# Edit the following section as needed
-# For example, !report.pc overrides *.pc. See 'man gitignore'
-#
+#
+# X.Org module default exclusion patterns
+# The next section if for module specific patterns
+#
+# Do not edit the following section
+# GNU Build System (Autotools)
+aclocal.m4
+autom4te.cache/
+autoscan.log
+ChangeLog
+compile
+config.guess
+config.h
+config.h.in
+config.log
+config-ml.in
+config.py
+config.status
+config.status.lineno
+config.sub
+configure
+configure.scan
+depcomp
+.deps/
+INSTALL
+install-sh
+.libs/
+libtool
+libtool.m4
+ltmain.sh
+lt~obsolete.m4
+ltoptions.m4
+ltsugar.m4
+ltversion.m4
+Makefile
+Makefile.in
+mdate-sh
+missing
+mkinstalldirs
+*.pc
+py-compile
+stamp-h?
+symlink-tree
+texinfo.tex
+ylwrap
+
+# Do not edit the following section
+# Edit Compile Debug Document Distribute
+*~
+*.[0-9]
+*.[0-9]x
+*.bak
+*.bin
+core
+*.dll
+*.exe
+*-ISO*.bdf
+*-JIS*.bdf
+*-KOI8*.bdf
+*.kld
+*.ko
+*.ko.cmd
+*.lai
+*.l[oa]
+*.[oa]
+*.obj
+*.patch
+*.so
+*.pcf.gz
+*.pdb
+*.tar.bz2
+*.tar.gz
+#
+# Add & Override patterns for libXdmcp
+#
+# Edit the following section as needed
+# For example, !report.pc overrides *.pc. See 'man gitignore'
+#
diff --git a/libXdmcp/AUTHORS b/libXdmcp/AUTHORS
index cf90d230d..0364123c6 100644
--- a/libXdmcp/AUTHORS
+++ b/libXdmcp/AUTHORS
@@ -1,8 +1,8 @@
-Keith Packard, MIT X Consortium
-
-Significant contributions by David Rosenthal of Sun who examined the protocol
-for security issues.
-
-GNU/Hurd support, Marcus Brinkmann
-
-Our apologies if we have inadvertantly overlooked anyone.
+Keith Packard, MIT X Consortium
+
+Significant contributions by David Rosenthal of Sun who examined the protocol
+for security issues.
+
+GNU/Hurd support, Marcus Brinkmann
+
+Our apologies if we have inadvertantly overlooked anyone.
diff --git a/libXdmcp/Array.c b/libXdmcp/Array.c
index a9069b09a..8862773b9 100644
--- a/libXdmcp/Array.c
+++ b/libXdmcp/Array.c
@@ -1,247 +1,247 @@
-/*
-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 HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <X11/Xos.h>
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xdmcp.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-/*
- * This variant of malloc does not return NULL if zero size is passed into.
- */
-static void *
-xmalloc(size_t size)
-{
- return malloc(size ? size : 1);
-}
-
-/*
- * This variant of realloc does not return NULL if zero size is passed into
- */
-static void *
-xrealloc(void *ptr, size_t size)
-{
- return realloc(ptr, size ? size : 1);
-}
-
-int
-XdmcpAllocARRAY8 (ARRAY8Ptr array, int length)
-{
- CARD8Ptr newData;
-
- /* length defined in ARRAY8 struct is a CARD16 (not CARD8 like the rest) */
- if (length > UINT16_MAX)
- return FALSE;
-
- newData = (CARD8Ptr) xmalloc(length * sizeof (CARD8));
- if (!newData)
- return FALSE;
- array->length = (CARD16) length;
- array->data = newData;
- return TRUE;
-}
-
-int
-XdmcpAllocARRAY16 (ARRAY16Ptr array, int length)
-{
- CARD16Ptr newData;
-
- /* length defined in ARRAY16 struct is a CARD8 */
- if (length > UINT8_MAX)
- return FALSE;
-
- newData = (CARD16Ptr) xmalloc(length * sizeof (CARD16));
- if (!newData)
- return FALSE;
- array->length = (CARD8) length;
- array->data = newData;
- return TRUE;
-}
-
-int
-XdmcpAllocARRAY32 (ARRAY32Ptr array, int length)
-{
- CARD32Ptr newData;
-
- /* length defined in ARRAY32 struct is a CARD8 */
- if (length > UINT8_MAX)
- return FALSE;
-
- newData = (CARD32Ptr) xmalloc(length * sizeof (CARD32));
- if (!newData)
- return FALSE;
- array->length = (CARD8) length;
- array->data = newData;
- return TRUE;
-}
-
-int
-XdmcpAllocARRAYofARRAY8 (ARRAYofARRAY8Ptr array, int length)
-{
- ARRAY8Ptr newData;
-
- /* length defined in ARRAYofARRAY8 struct is a CARD8 */
- if (length > UINT8_MAX)
- return FALSE;
-
- newData = (ARRAY8Ptr) xmalloc(length * sizeof (ARRAY8));
- if (!newData)
- return FALSE;
- array->length = (CARD8) length;
- array->data = newData;
- return TRUE;
-}
-
-int
-XdmcpARRAY8Equal (const ARRAY8Ptr array1, const ARRAY8Ptr array2)
-{
- if (array1->length != array2->length)
- return FALSE;
- if (memcmp(array1->data, array2->data, array1->length) != 0)
- return FALSE;
- return TRUE;
-}
-
-int
-XdmcpCopyARRAY8 (const ARRAY8Ptr src, ARRAY8Ptr dst)
-{
- dst->length = src->length;
- dst->data = (CARD8 *) xmalloc(dst->length * sizeof (CARD8));
- if (!dst->data)
- return FALSE;
- memmove (dst->data, src->data, src->length * sizeof (CARD8));
- return TRUE;
-}
-
-int
-XdmcpReallocARRAY8 (ARRAY8Ptr array, int length)
-{
- CARD8Ptr newData;
-
- /* length defined in ARRAY8 struct is a CARD16 (not CARD8 like the rest) */
- if (length > UINT16_MAX)
- return FALSE;
-
- newData = (CARD8Ptr) xrealloc(array->data, length * sizeof (CARD8));
- if (!newData)
- return FALSE;
- array->length = (CARD16) length;
- array->data = newData;
- return TRUE;
-}
-
-int
-XdmcpReallocARRAYofARRAY8 (ARRAYofARRAY8Ptr array, int length)
-{
- ARRAY8Ptr newData;
-
- /* length defined in ARRAYofARRAY8 struct is a CARD8 */
- if (length > UINT8_MAX)
- return FALSE;
-
- newData = (ARRAY8Ptr) xrealloc(array->data, length * sizeof (ARRAY8));
- if (!newData)
- return FALSE;
- array->length = (CARD8) length;
- array->data = newData;
- return TRUE;
-}
-
-int
-XdmcpReallocARRAY16 (ARRAY16Ptr array, int length)
-{
- CARD16Ptr newData;
-
- /* length defined in ARRAY16 struct is a CARD8 */
- if (length > UINT8_MAX)
- return FALSE;
- newData = (CARD16Ptr) xrealloc(array->data, length * sizeof (CARD16));
- if (!newData)
- return FALSE;
- array->length = (CARD8) length;
- array->data = newData;
- return TRUE;
-}
-
-int
-XdmcpReallocARRAY32 (ARRAY32Ptr array, int length)
-{
- CARD32Ptr newData;
-
- /* length defined in ARRAY32 struct is a CARD8 */
- if (length > UINT8_MAX)
- return FALSE;
-
- newData = (CARD32Ptr) xrealloc(array->data, length * sizeof (CARD32));
- if (!newData)
- return FALSE;
- array->length = (CARD8) length;
- array->data = newData;
- return TRUE;
-}
-
-void
-XdmcpDisposeARRAY8 (ARRAY8Ptr array)
-{
- free(array->data);
- array->length = 0;
- array->data = NULL;
-}
-
-void
-XdmcpDisposeARRAY16 (ARRAY16Ptr array)
-{
- free(array->data);
- array->length = 0;
- array->data = NULL;
-}
-
-void
-XdmcpDisposeARRAY32 (ARRAY32Ptr array)
-{
- free(array->data);
- array->length = 0;
- array->data = NULL;
-}
-
-void
-XdmcpDisposeARRAYofARRAY8 (ARRAYofARRAY8Ptr array)
-{
- int i;
-
- if (array->data != NULL) {
- for (i = 0; i < (int)array->length; i++)
- XdmcpDisposeARRAY8 (&array->data[i]);
- free(array->data);
- }
- array->length = 0;
- array->data = NULL;
-}
+/*
+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 HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+/*
+ * This variant of malloc does not return NULL if zero size is passed into.
+ */
+static void *
+xmalloc(size_t size)
+{
+ return malloc(size ? size : 1);
+}
+
+/*
+ * This variant of realloc does not return NULL if zero size is passed into
+ */
+static void *
+xrealloc(void *ptr, size_t size)
+{
+ return realloc(ptr, size ? size : 1);
+}
+
+int
+XdmcpAllocARRAY8 (ARRAY8Ptr array, int length)
+{
+ CARD8Ptr newData;
+
+ /* length defined in ARRAY8 struct is a CARD16 (not CARD8 like the rest) */
+ if (length > UINT16_MAX)
+ return FALSE;
+
+ newData = (CARD8Ptr) xmalloc(length * sizeof (CARD8));
+ if (!newData)
+ return FALSE;
+ array->length = (CARD16) length;
+ array->data = newData;
+ return TRUE;
+}
+
+int
+XdmcpAllocARRAY16 (ARRAY16Ptr array, int length)
+{
+ CARD16Ptr newData;
+
+ /* length defined in ARRAY16 struct is a CARD8 */
+ if (length > UINT8_MAX)
+ return FALSE;
+
+ newData = (CARD16Ptr) xmalloc(length * sizeof (CARD16));
+ if (!newData)
+ return FALSE;
+ array->length = (CARD8) length;
+ array->data = newData;
+ return TRUE;
+}
+
+int
+XdmcpAllocARRAY32 (ARRAY32Ptr array, int length)
+{
+ CARD32Ptr newData;
+
+ /* length defined in ARRAY32 struct is a CARD8 */
+ if (length > UINT8_MAX)
+ return FALSE;
+
+ newData = (CARD32Ptr) xmalloc(length * sizeof (CARD32));
+ if (!newData)
+ return FALSE;
+ array->length = (CARD8) length;
+ array->data = newData;
+ return TRUE;
+}
+
+int
+XdmcpAllocARRAYofARRAY8 (ARRAYofARRAY8Ptr array, int length)
+{
+ ARRAY8Ptr newData;
+
+ /* length defined in ARRAYofARRAY8 struct is a CARD8 */
+ if (length > UINT8_MAX)
+ return FALSE;
+
+ newData = (ARRAY8Ptr) xmalloc(length * sizeof (ARRAY8));
+ if (!newData)
+ return FALSE;
+ array->length = (CARD8) length;
+ array->data = newData;
+ return TRUE;
+}
+
+int
+XdmcpARRAY8Equal (const ARRAY8Ptr array1, const ARRAY8Ptr array2)
+{
+ if (array1->length != array2->length)
+ return FALSE;
+ if (memcmp(array1->data, array2->data, array1->length) != 0)
+ return FALSE;
+ return TRUE;
+}
+
+int
+XdmcpCopyARRAY8 (const ARRAY8Ptr src, ARRAY8Ptr dst)
+{
+ dst->length = src->length;
+ dst->data = (CARD8 *) xmalloc(dst->length * sizeof (CARD8));
+ if (!dst->data)
+ return FALSE;
+ memmove (dst->data, src->data, src->length * sizeof (CARD8));
+ return TRUE;
+}
+
+int
+XdmcpReallocARRAY8 (ARRAY8Ptr array, int length)
+{
+ CARD8Ptr newData;
+
+ /* length defined in ARRAY8 struct is a CARD16 (not CARD8 like the rest) */
+ if (length > UINT16_MAX)
+ return FALSE;
+
+ newData = (CARD8Ptr) xrealloc(array->data, length * sizeof (CARD8));
+ if (!newData)
+ return FALSE;
+ array->length = (CARD16) length;
+ array->data = newData;
+ return TRUE;
+}
+
+int
+XdmcpReallocARRAYofARRAY8 (ARRAYofARRAY8Ptr array, int length)
+{
+ ARRAY8Ptr newData;
+
+ /* length defined in ARRAYofARRAY8 struct is a CARD8 */
+ if (length > UINT8_MAX)
+ return FALSE;
+
+ newData = (ARRAY8Ptr) xrealloc(array->data, length * sizeof (ARRAY8));
+ if (!newData)
+ return FALSE;
+ array->length = (CARD8) length;
+ array->data = newData;
+ return TRUE;
+}
+
+int
+XdmcpReallocARRAY16 (ARRAY16Ptr array, int length)
+{
+ CARD16Ptr newData;
+
+ /* length defined in ARRAY16 struct is a CARD8 */
+ if (length > UINT8_MAX)
+ return FALSE;
+ newData = (CARD16Ptr) xrealloc(array->data, length * sizeof (CARD16));
+ if (!newData)
+ return FALSE;
+ array->length = (CARD8) length;
+ array->data = newData;
+ return TRUE;
+}
+
+int
+XdmcpReallocARRAY32 (ARRAY32Ptr array, int length)
+{
+ CARD32Ptr newData;
+
+ /* length defined in ARRAY32 struct is a CARD8 */
+ if (length > UINT8_MAX)
+ return FALSE;
+
+ newData = (CARD32Ptr) xrealloc(array->data, length * sizeof (CARD32));
+ if (!newData)
+ return FALSE;
+ array->length = (CARD8) length;
+ array->data = newData;
+ return TRUE;
+}
+
+void
+XdmcpDisposeARRAY8 (ARRAY8Ptr array)
+{
+ free(array->data);
+ array->length = 0;
+ array->data = NULL;
+}
+
+void
+XdmcpDisposeARRAY16 (ARRAY16Ptr array)
+{
+ free(array->data);
+ array->length = 0;
+ array->data = NULL;
+}
+
+void
+XdmcpDisposeARRAY32 (ARRAY32Ptr array)
+{
+ free(array->data);
+ array->length = 0;
+ array->data = NULL;
+}
+
+void
+XdmcpDisposeARRAYofARRAY8 (ARRAYofARRAY8Ptr array)
+{
+ int i;
+
+ if (array->data != NULL) {
+ for (i = 0; i < (int)array->length; i++)
+ XdmcpDisposeARRAY8 (&array->data[i]);
+ free(array->data);
+ }
+ array->length = 0;
+ array->data = NULL;
+}
diff --git a/libXdmcp/COPYING b/libXdmcp/COPYING
index 8fbc421a4..5532d143c 100644
--- a/libXdmcp/COPYING
+++ b/libXdmcp/COPYING
@@ -1,23 +1,23 @@
-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
+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
diff --git a/libXdmcp/Fill.c b/libXdmcp/Fill.c
index 2ff3cbbcc..98c324f45 100644
--- a/libXdmcp/Fill.c
+++ b/libXdmcp/Fill.c
@@ -1,90 +1,90 @@
-/*
-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
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <X11/Xos.h>
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xdmcp.h>
-#include <stdlib.h>
-
-#ifdef STREAMSCONN
-#include <tiuser.h>
-#else
-#ifdef WIN32
-#include <X11/Xwinsock.h>
-#else
-#include <sys/socket.h>
-#endif
-#endif
-
-int
-XdmcpFill (int fd, XdmcpBufferPtr buffer, XdmcpNetaddr from, int *fromlen)
-{
- BYTE *newBuf;
-#ifdef STREAMSCONN
- struct t_unitdata dataunit;
- int gotallflag, result;
-#endif
-
- if (buffer->size < XDM_MAX_MSGLEN)
- {
- newBuf = (BYTE *) malloc(XDM_MAX_MSGLEN);
- if (newBuf)
- {
- free(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, (void *)fromlen);
-#endif
- if (buffer->count < 6) {
- buffer->count = 0;
- return FALSE;
- }
- return TRUE;
-}
+/*
+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
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+#include <stdlib.h>
+
+#ifdef STREAMSCONN
+#include <tiuser.h>
+#else
+#ifdef WIN32
+#include <X11/Xwinsock.h>
+#else
+#include <sys/socket.h>
+#endif
+#endif
+
+int
+XdmcpFill (int fd, XdmcpBufferPtr buffer, XdmcpNetaddr from, int *fromlen)
+{
+ BYTE *newBuf;
+#ifdef STREAMSCONN
+ struct t_unitdata dataunit;
+ int gotallflag, result;
+#endif
+
+ if (buffer->size < XDM_MAX_MSGLEN)
+ {
+ newBuf = (BYTE *) malloc(XDM_MAX_MSGLEN);
+ if (newBuf)
+ {
+ free(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, (void *)fromlen);
+#endif
+ if (buffer->count < 6) {
+ buffer->count = 0;
+ return FALSE;
+ }
+ return TRUE;
+}
diff --git a/libXdmcp/Flush.c b/libXdmcp/Flush.c
index 1763657ba..cdcd1f096 100644
--- a/libXdmcp/Flush.c
+++ b/libXdmcp/Flush.c
@@ -1,70 +1,70 @@
-/*
-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
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#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 (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;
-}
+/*
+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
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#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 (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/libXdmcp/Key.c b/libXdmcp/Key.c
index ab1cb33c6..aa4add653 100644
--- a/libXdmcp/Key.c
+++ b/libXdmcp/Key.c
@@ -1,102 +1,102 @@
-/*
-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 HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <X11/Xos.h>
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xdmcp.h>
-
-static void
-getbits (long data, unsigned char *dst)
-{
- dst[0] = (data ) & 0xff;
- dst[1] = (data >> 8) & 0xff;
- dst[2] = (data >> 16) & 0xff;
- dst[3] = (data >> 24) & 0xff;
-}
-
-#define Time_t time_t
-
-#include <stdlib.h>
-
-#if defined(HAVE_LRAND48) && defined(HAVE_SRAND48)
-#define srandom srand48
-#define random lrand48
-#endif
-#ifdef WIN32
-#include <process.h>
-#define srandom srand
-#define random rand
-#define getpid(x) _getpid(x)
-#endif
-
-void
-XdmcpGenerateKey (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);
-}
-
-int
-XdmcpCompareKeys (const XdmAuthKeyPtr a, const XdmAuthKeyPtr b)
-{
- int i;
-
- for (i = 0; i < 8; i++)
- if (a->data[i] != b->data[i])
- return FALSE;
- return TRUE;
-}
-
-void
-XdmcpIncrementKey (XdmAuthKeyPtr key)
-{
- int i;
-
- i = 7;
- while (++key->data[i] == 0)
- if (--i < 0)
- break;
-}
-
-void
-XdmcpDecrementKey (XdmAuthKeyPtr key)
-{
- int i;
-
- i = 7;
- while (key->data[i]-- == 0)
- if (--i < 0)
- break;
-}
+/*
+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 HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+static void
+getbits (long data, unsigned char *dst)
+{
+ dst[0] = (data ) & 0xff;
+ dst[1] = (data >> 8) & 0xff;
+ dst[2] = (data >> 16) & 0xff;
+ dst[3] = (data >> 24) & 0xff;
+}
+
+#define Time_t time_t
+
+#include <stdlib.h>
+
+#if defined(HAVE_LRAND48) && defined(HAVE_SRAND48)
+#define srandom srand48
+#define random lrand48
+#endif
+#ifdef WIN32
+#include <process.h>
+#define srandom srand
+#define random rand
+#define getpid(x) _getpid(x)
+#endif
+
+void
+XdmcpGenerateKey (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);
+}
+
+int
+XdmcpCompareKeys (const XdmAuthKeyPtr a, const XdmAuthKeyPtr b)
+{
+ int i;
+
+ for (i = 0; i < 8; i++)
+ if (a->data[i] != b->data[i])
+ return FALSE;
+ return TRUE;
+}
+
+void
+XdmcpIncrementKey (XdmAuthKeyPtr key)
+{
+ int i;
+
+ i = 7;
+ while (++key->data[i] == 0)
+ if (--i < 0)
+ break;
+}
+
+void
+XdmcpDecrementKey (XdmAuthKeyPtr key)
+{
+ int i;
+
+ i = 7;
+ while (key->data[i]-- == 0)
+ if (--i < 0)
+ break;
+}
diff --git a/libXdmcp/README b/libXdmcp/README
index 441a11428..7ba85f043 100644
--- a/libXdmcp/README
+++ b/libXdmcp/README
@@ -1,25 +1,25 @@
-libXdmcp - X Display Manager Control Protocol library
-
-All questions regarding this software should be directed at the
-Xorg mailing list:
-
- http://lists.freedesktop.org/mailman/listinfo/xorg
-
-Please submit bug reports to the Xorg bugzilla:
-
- https://bugs.freedesktop.org/enter_bug.cgi?product=xorg
-
-The master development code repository can be found at:
-
- git://anongit.freedesktop.org/git/xorg/lib/libXdmcp
-
- http://cgit.freedesktop.org/xorg/lib/libXdmcp
-
-For patch submission instructions, see:
-
- http://www.x.org/wiki/Development/Documentation/SubmittingPatches
-
-For more information on the git code manager, see:
-
- http://wiki.x.org/wiki/GitPage
-
+libXdmcp - X Display Manager Control Protocol library
+
+All questions regarding this software should be directed at the
+Xorg mailing list:
+
+ http://lists.freedesktop.org/mailman/listinfo/xorg
+
+Please submit bug reports to the Xorg bugzilla:
+
+ https://bugs.freedesktop.org/enter_bug.cgi?product=xorg
+
+The master development code repository can be found at:
+
+ git://anongit.freedesktop.org/git/xorg/lib/libXdmcp
+
+ http://cgit.freedesktop.org/xorg/lib/libXdmcp
+
+For patch submission instructions, see:
+
+ http://www.x.org/wiki/Development/Documentation/SubmittingPatches
+
+For more information on the git code manager, see:
+
+ http://wiki.x.org/wiki/GitPage
+
diff --git a/libXdmcp/Read.c b/libXdmcp/Read.c
index 946a611e9..7da6163e4 100644
--- a/libXdmcp/Read.c
+++ b/libXdmcp/Read.c
@@ -1,244 +1,244 @@
-/*
-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 HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <X11/Xos.h>
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xdmcp.h>
-#include <stdlib.h>
-
-int
-XdmcpReadHeader (XdmcpBufferPtr buffer, XdmcpHeaderPtr header)
-{
- if (XdmcpReadCARD16 (buffer, &header->version) &&
- XdmcpReadCARD16 (buffer, &header->opcode) &&
- XdmcpReadCARD16 (buffer, &header->length))
- return TRUE;
- return FALSE;
-}
-
-int
-XdmcpReadRemaining (const XdmcpBufferPtr buffer)
-{
- return buffer->count - buffer->pointer;
-}
-
-int
-XdmcpReadARRAY8 (XdmcpBufferPtr buffer, ARRAY8Ptr array)
-{
- int i;
-
- /*
- * When returning FALSE, guarantee that array->data = 0.
- * This allows the user to safely call XdmcpDisposeARRAY8(array)
- * regardless of the return value below.
- * Note that XdmcpDisposeARRAY*(array) will call free(array->data),
- * so we must guarantee that array->data is NULL or a malloced pointer.
- */
- if (!XdmcpReadCARD16 (buffer, &array->length)) {
- array->data = NULL;
- return FALSE;
- }
- if (!array->length)
- {
- array->data = NULL;
- return TRUE;
- }
- array->data = (CARD8 *) malloc(array->length * sizeof (CARD8));
- if (!array->data)
- return FALSE;
- for (i = 0; i < (int)array->length; i++)
- {
- if (!XdmcpReadCARD8 (buffer, &array->data[i]))
- {
- free(array->data);
- array->data = NULL;
- array->length = 0;
- return FALSE;
- }
- }
- return TRUE;
-}
-
-int
-XdmcpReadARRAY16 (XdmcpBufferPtr buffer, ARRAY16Ptr array)
-{
- int i;
-
- /*
- * When returning FALSE, guarantee that array->data = 0.
- * This allows the user to safely call XdmcpDisposeARRAY16(array)
- * regardless of the return value below.
- * Note that XdmcpDisposeARRAY*(array) will call free(array->data),
- * so we must guarantee that array->data is NULL or a malloced pointer.
- */
- if (!XdmcpReadCARD8 (buffer, &array->length)) {
- array->data = NULL;
- return FALSE;
- }
- if (!array->length)
- {
- array->data = NULL;
- return TRUE;
- }
- array->data = (CARD16 *) malloc(array->length * sizeof (CARD16));
- if (!array->data)
- return FALSE;
- for (i = 0; i < (int)array->length; i++)
- {
- if (!XdmcpReadCARD16 (buffer, &array->data[i]))
- {
- free(array->data);
- array->data = NULL;
- array->length = 0;
- return FALSE;
- }
- }
- return TRUE;
-}
-
-int
-XdmcpReadARRAY32 (XdmcpBufferPtr buffer, ARRAY32Ptr array)
-{
- int i;
-
- /*
- * When returning FALSE, guarantee that array->data = 0.
- * This allows the user to safely call XdmcpDisposeARRAY32(array)
- * regardless of the return value below.
- * Note that XdmcpDisposeARRAY*(array) will call free(array->data),
- * so we must guarantee that array->data is NULL or a malloced pointer.
- */
- if (!XdmcpReadCARD8 (buffer, &array->length)) {
- array->data = NULL;
- return FALSE;
- }
- if (!array->length)
- {
- array->data = NULL;
- return TRUE;
- }
- array->data = (CARD32 *) malloc(array->length * sizeof (CARD32));
- if (!array->data)
- return FALSE;
- for (i = 0; i < (int)array->length; i++)
- {
- if (!XdmcpReadCARD32 (buffer, &array->data[i]))
- {
- free(array->data);
- array->data = NULL;
- array->length = 0;
- return FALSE;
- }
- }
- return TRUE;
-}
-
-int
-XdmcpReadARRAYofARRAY8 (XdmcpBufferPtr buffer, ARRAYofARRAY8Ptr array)
-{
- CARD8 i;
-
- /*
- * When returning FALSE, guarantee that array->data = 0.
- * This allows the user to safely call XdmcpDisposeARRAYofARRAY8(array)
- * regardless of the return value below.
- * Note that XdmcpDisposeARRAY*(array) will call free(array->data),
- * so we must guarantee that array->data is NULL or a malloced pointer.
- */
- if (!XdmcpReadCARD8 (buffer, &array->length)) {
- array->data = NULL;
- return FALSE;
- }
- if (!array->length)
- {
- array->data = NULL;
- return TRUE;
- }
- array->data = (ARRAY8 *) malloc(array->length * sizeof (ARRAY8));
- if (!array->data)
- return FALSE;
- for (i = 0; i < array->length; i++)
- {
- if (!XdmcpReadARRAY8 (buffer, &array->data[i]))
- {
- /*
- * We must free all of the arrays allocated thus far in the loop
- * and free array->data and finally set array->data = 0;
- * The easiest way to do this is to reset the length and call
- * XdmcpDisposeARRAYofARRAY8(array).
- */
- array->length = i;
- XdmcpDisposeARRAYofARRAY8(array);
- return FALSE;
- }
- }
- return TRUE;
-}
-
-int
-XdmcpReadCARD8 (XdmcpBufferPtr buffer, CARD8Ptr valuep)
-{
- if (buffer->pointer >= buffer->count)
- return FALSE;
- *valuep = (CARD8) buffer->data[buffer->pointer++];
- return TRUE;
-}
-
-int
-XdmcpReadCARD16 (XdmcpBufferPtr buffer, CARD16Ptr valuep)
-{
- CARD8 high, low;
-
- if (XdmcpReadCARD8 (buffer, &high) &&
- XdmcpReadCARD8 (buffer, &low))
- {
- *valuep = (((CARD16) high) << 8) | ((CARD16) low);
- return TRUE;
- }
- return FALSE;
-}
-
-int
-XdmcpReadCARD32 (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;
-}
+/*
+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 HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+#include <stdlib.h>
+
+int
+XdmcpReadHeader (XdmcpBufferPtr buffer, XdmcpHeaderPtr header)
+{
+ if (XdmcpReadCARD16 (buffer, &header->version) &&
+ XdmcpReadCARD16 (buffer, &header->opcode) &&
+ XdmcpReadCARD16 (buffer, &header->length))
+ return TRUE;
+ return FALSE;
+}
+
+int
+XdmcpReadRemaining (const XdmcpBufferPtr buffer)
+{
+ return buffer->count - buffer->pointer;
+}
+
+int
+XdmcpReadARRAY8 (XdmcpBufferPtr buffer, ARRAY8Ptr array)
+{
+ int i;
+
+ /*
+ * When returning FALSE, guarantee that array->data = 0.
+ * This allows the user to safely call XdmcpDisposeARRAY8(array)
+ * regardless of the return value below.
+ * Note that XdmcpDisposeARRAY*(array) will call free(array->data),
+ * so we must guarantee that array->data is NULL or a malloced pointer.
+ */
+ if (!XdmcpReadCARD16 (buffer, &array->length)) {
+ array->data = NULL;
+ return FALSE;
+ }
+ if (!array->length)
+ {
+ array->data = NULL;
+ return TRUE;
+ }
+ array->data = (CARD8 *) malloc(array->length * sizeof (CARD8));
+ if (!array->data)
+ return FALSE;
+ for (i = 0; i < (int)array->length; i++)
+ {
+ if (!XdmcpReadCARD8 (buffer, &array->data[i]))
+ {
+ free(array->data);
+ array->data = NULL;
+ array->length = 0;
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+int
+XdmcpReadARRAY16 (XdmcpBufferPtr buffer, ARRAY16Ptr array)
+{
+ int i;
+
+ /*
+ * When returning FALSE, guarantee that array->data = 0.
+ * This allows the user to safely call XdmcpDisposeARRAY16(array)
+ * regardless of the return value below.
+ * Note that XdmcpDisposeARRAY*(array) will call free(array->data),
+ * so we must guarantee that array->data is NULL or a malloced pointer.
+ */
+ if (!XdmcpReadCARD8 (buffer, &array->length)) {
+ array->data = NULL;
+ return FALSE;
+ }
+ if (!array->length)
+ {
+ array->data = NULL;
+ return TRUE;
+ }
+ array->data = (CARD16 *) malloc(array->length * sizeof (CARD16));
+ if (!array->data)
+ return FALSE;
+ for (i = 0; i < (int)array->length; i++)
+ {
+ if (!XdmcpReadCARD16 (buffer, &array->data[i]))
+ {
+ free(array->data);
+ array->data = NULL;
+ array->length = 0;
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+int
+XdmcpReadARRAY32 (XdmcpBufferPtr buffer, ARRAY32Ptr array)
+{
+ int i;
+
+ /*
+ * When returning FALSE, guarantee that array->data = 0.
+ * This allows the user to safely call XdmcpDisposeARRAY32(array)
+ * regardless of the return value below.
+ * Note that XdmcpDisposeARRAY*(array) will call free(array->data),
+ * so we must guarantee that array->data is NULL or a malloced pointer.
+ */
+ if (!XdmcpReadCARD8 (buffer, &array->length)) {
+ array->data = NULL;
+ return FALSE;
+ }
+ if (!array->length)
+ {
+ array->data = NULL;
+ return TRUE;
+ }
+ array->data = (CARD32 *) malloc(array->length * sizeof (CARD32));
+ if (!array->data)
+ return FALSE;
+ for (i = 0; i < (int)array->length; i++)
+ {
+ if (!XdmcpReadCARD32 (buffer, &array->data[i]))
+ {
+ free(array->data);
+ array->data = NULL;
+ array->length = 0;
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+int
+XdmcpReadARRAYofARRAY8 (XdmcpBufferPtr buffer, ARRAYofARRAY8Ptr array)
+{
+ CARD8 i;
+
+ /*
+ * When returning FALSE, guarantee that array->data = 0.
+ * This allows the user to safely call XdmcpDisposeARRAYofARRAY8(array)
+ * regardless of the return value below.
+ * Note that XdmcpDisposeARRAY*(array) will call free(array->data),
+ * so we must guarantee that array->data is NULL or a malloced pointer.
+ */
+ if (!XdmcpReadCARD8 (buffer, &array->length)) {
+ array->data = NULL;
+ return FALSE;
+ }
+ if (!array->length)
+ {
+ array->data = NULL;
+ return TRUE;
+ }
+ array->data = (ARRAY8 *) malloc(array->length * sizeof (ARRAY8));
+ if (!array->data)
+ return FALSE;
+ for (i = 0; i < array->length; i++)
+ {
+ if (!XdmcpReadARRAY8 (buffer, &array->data[i]))
+ {
+ /*
+ * We must free all of the arrays allocated thus far in the loop
+ * and free array->data and finally set array->data = 0;
+ * The easiest way to do this is to reset the length and call
+ * XdmcpDisposeARRAYofARRAY8(array).
+ */
+ array->length = i;
+ XdmcpDisposeARRAYofARRAY8(array);
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+int
+XdmcpReadCARD8 (XdmcpBufferPtr buffer, CARD8Ptr valuep)
+{
+ if (buffer->pointer >= buffer->count)
+ return FALSE;
+ *valuep = (CARD8) buffer->data[buffer->pointer++];
+ return TRUE;
+}
+
+int
+XdmcpReadCARD16 (XdmcpBufferPtr buffer, CARD16Ptr valuep)
+{
+ CARD8 high, low;
+
+ if (XdmcpReadCARD8 (buffer, &high) &&
+ XdmcpReadCARD8 (buffer, &low))
+ {
+ *valuep = (((CARD16) high) << 8) | ((CARD16) low);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+int
+XdmcpReadCARD32 (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;
+}
diff --git a/libXdmcp/Unwrap.c b/libXdmcp/Unwrap.c
index feebf98a7..82a10ee03 100644
--- a/libXdmcp/Unwrap.c
+++ b/libXdmcp/Unwrap.c
@@ -1,90 +1,90 @@
-/*
-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 HAVE_CONFIG_H
-#include <config.h>
-#endif
-#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 (
- unsigned char *input,
- unsigned char *wrapper,
- unsigned char *output,
- 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 */
+/*
+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 HAVE_CONFIG_H
+#include <config.h>
+#endif
+#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 (
+ unsigned char *input,
+ unsigned char *wrapper,
+ unsigned char *output,
+ 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 */
diff --git a/libXdmcp/Wrap.c b/libXdmcp/Wrap.c
index 0ee7a175b..f025caff0 100644
--- a/libXdmcp/Wrap.c
+++ b/libXdmcp/Wrap.c
@@ -1,128 +1,128 @@
-/*
-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 HAVE_CONFIG_H
-#include <config.h>
-#endif
-#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 (
- unsigned char *input,
- unsigned char *wrapper,
- unsigned char *output,
- 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 (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 (
- unsigned char *in,
- unsigned char *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
+/*
+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 HAVE_CONFIG_H
+#include <config.h>
+#endif
+#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 (
+ unsigned char *input,
+ unsigned char *wrapper,
+ unsigned char *output,
+ 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 (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 (
+ unsigned char *in,
+ unsigned char *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
diff --git a/libXdmcp/Wrap.h b/libXdmcp/Wrap.h
index 2837caa09..479da5f32 100644
--- a/libXdmcp/Wrap.h
+++ b/libXdmcp/Wrap.h
@@ -1,15 +1,15 @@
-/*
- * 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 (unsigned char *in, unsigned char *out);
-
-#ifdef HASXDMAUTH
-extern void _XdmcpAuthSetup (auth_cblock key, auth_wrapper_schedule schedule);
-extern void _XdmcpAuthDoIt (auth_cblock input, auth_cblock output,
- auth_wrapper_schedule schedule, int edflag);
-#endif
+/*
+ * 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 (unsigned char *in, unsigned char *out);
+
+#ifdef HASXDMAUTH
+extern void _XdmcpAuthSetup (auth_cblock key, auth_wrapper_schedule schedule);
+extern void _XdmcpAuthDoIt (auth_cblock input, auth_cblock output,
+ auth_wrapper_schedule schedule, int edflag);
+#endif
diff --git a/libXdmcp/Wraphelp.README.crypto b/libXdmcp/Wraphelp.README.crypto
index 0fa654fd4..20c34c071 100644
--- a/libXdmcp/Wraphelp.README.crypto
+++ b/libXdmcp/Wraphelp.README.crypto
@@ -1,64 +1,64 @@
-Export Requirements.
-
-You may not export or re-export this software or any copy or
-adaptation in violation of any applicable laws or regulations.
-
-Without limiting the generality of the foregoing, hardware, software,
-technology or services provided under this license agreement may not
-be exported, reexported, transferred or downloaded to or within (or to
-a national resident of) countries under U.S. economic embargo
-including the following countries:
-
-Cuba, Iran, Libya, North Korea, Sudan and Syria. This list is subject
-to change.
-
-Hardware, software, technology or services may not be exported,
-reexported, transferred or downloaded to persons or entities listed on
-the U.S. Department of Commerce Denied Persons List, Entity List of
-proliferation concern or on any U.S. Treasury Department Designated
-Nationals exclusion list, or to parties directly or indirectly
-involved in the development or production of nuclear, chemical,
-biological weapons or in missile technology programs as specified in
-the U.S. Export Administration Regulations (15 CFR 744).
-
-By accepting this license agreement you confirm that you are not
-located in (or a national resident of) any country under U.S. economic
-embargo, not identified on any U.S. Department of Commerce Denied
-Persons List, Entity List or Treasury Department Designated Nationals
-exclusion list, and not directly or indirectly involved in the
-development or production of nuclear, chemical, biological weapons or
-in missile technology programs as specified in the U.S. Export
-Administration Regulations.
-
-Software available on this web site contains cryptography and is
-therefore subject to US government export control under the
-U.S. Export Administration Regulations ("EAR"). EAR Part 740.13(e)
-allows the export and reexport of publicly available encryption source
-code that is not subject to payment of license fee or royalty
-payment. Object code resulting from the compiling of such source code
-may also be exported and reexported under this provision if publicly
-available and not subject to a fee or payment other than reasonable
-and customary fees for reproduction and distribution. This kind of
-encryption source code and the corresponding object code may be
-exported or reexported without prior U.S. government export license
-authorization provided that the U.S. government is notified about the
-Internet location of the software.
-
-The open source software available on this web site is publicly
-available without license fee or royalty payment, and all binary
-software is compiled from the source code. The U.S. government has
-been notified about this site and the location site for the source
-code. Therefore, the source code and compiled object code may be
-downloaded and exported under U.S. export license exception (without a
-U.S. export license) in accordance with the further restrictions
-outlined above regarding embargoed countries, restricted persons and
-restricted end uses.
-
-Local Country Import Requirements. The software you are about to
-download contains cryptography technology. Some countries regulate the
-import, use and/or export of certain products with cryptography. The
-X.org Foundation makes no claims as to the applicability of local
-country import, use and/or export regulations in relation to the
-download of this product. If you are located outside the U.S. and
-Canada you are advised to consult your local country regulations to
-insure compliance.
+Export Requirements.
+
+You may not export or re-export this software or any copy or
+adaptation in violation of any applicable laws or regulations.
+
+Without limiting the generality of the foregoing, hardware, software,
+technology or services provided under this license agreement may not
+be exported, reexported, transferred or downloaded to or within (or to
+a national resident of) countries under U.S. economic embargo
+including the following countries:
+
+Cuba, Iran, Libya, North Korea, Sudan and Syria. This list is subject
+to change.
+
+Hardware, software, technology or services may not be exported,
+reexported, transferred or downloaded to persons or entities listed on
+the U.S. Department of Commerce Denied Persons List, Entity List of
+proliferation concern or on any U.S. Treasury Department Designated
+Nationals exclusion list, or to parties directly or indirectly
+involved in the development or production of nuclear, chemical,
+biological weapons or in missile technology programs as specified in
+the U.S. Export Administration Regulations (15 CFR 744).
+
+By accepting this license agreement you confirm that you are not
+located in (or a national resident of) any country under U.S. economic
+embargo, not identified on any U.S. Department of Commerce Denied
+Persons List, Entity List or Treasury Department Designated Nationals
+exclusion list, and not directly or indirectly involved in the
+development or production of nuclear, chemical, biological weapons or
+in missile technology programs as specified in the U.S. Export
+Administration Regulations.
+
+Software available on this web site contains cryptography and is
+therefore subject to US government export control under the
+U.S. Export Administration Regulations ("EAR"). EAR Part 740.13(e)
+allows the export and reexport of publicly available encryption source
+code that is not subject to payment of license fee or royalty
+payment. Object code resulting from the compiling of such source code
+may also be exported and reexported under this provision if publicly
+available and not subject to a fee or payment other than reasonable
+and customary fees for reproduction and distribution. This kind of
+encryption source code and the corresponding object code may be
+exported or reexported without prior U.S. government export license
+authorization provided that the U.S. government is notified about the
+Internet location of the software.
+
+The open source software available on this web site is publicly
+available without license fee or royalty payment, and all binary
+software is compiled from the source code. The U.S. government has
+been notified about this site and the location site for the source
+code. Therefore, the source code and compiled object code may be
+downloaded and exported under U.S. export license exception (without a
+U.S. export license) in accordance with the further restrictions
+outlined above regarding embargoed countries, restricted persons and
+restricted end uses.
+
+Local Country Import Requirements. The software you are about to
+download contains cryptography technology. Some countries regulate the
+import, use and/or export of certain products with cryptography. The
+X.org Foundation makes no claims as to the applicability of local
+country import, use and/or export regulations in relation to the
+download of this product. If you are located outside the U.S. and
+Canada you are advised to consult your local country regulations to
+insure compliance.
diff --git a/libXdmcp/Write.c b/libXdmcp/Write.c
index a0faed31d..8eb9c5043 100644
--- a/libXdmcp/Write.c
+++ b/libXdmcp/Write.c
@@ -1,151 +1,151 @@
-/*
-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 HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <X11/Xos.h>
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xdmcp.h>
-#include <stdlib.h>
-
-int
-XdmcpWriteHeader (
- XdmcpBufferPtr buffer,
- const XdmcpHeaderPtr header)
-{
- BYTE *newData;
-
- if ((int)buffer->size < 6 + (int)header->length)
- {
- newData = (BYTE *) malloc(XDM_MAX_MSGLEN * sizeof (BYTE));
- if (!newData)
- return FALSE;
- free((unsigned long *)(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;
-}
-
-int
-XdmcpWriteARRAY8 (XdmcpBufferPtr buffer, const 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;
-}
-
-int
-XdmcpWriteARRAY16 (XdmcpBufferPtr buffer, const 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;
-}
-
-int
-XdmcpWriteARRAY32 (XdmcpBufferPtr buffer, const 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;
-}
-
-int
-XdmcpWriteARRAYofARRAY8 (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;
-}
-
-int
-XdmcpWriteCARD8 (
- XdmcpBufferPtr buffer,
- unsigned value)
-{
- if (buffer->pointer >= buffer->size)
- return FALSE;
- buffer->data[buffer->pointer++] = (BYTE) value;
- return TRUE;
-}
-
-int
-XdmcpWriteCARD16 (
- XdmcpBufferPtr buffer,
- unsigned value)
-{
- if (!XdmcpWriteCARD8 (buffer, value >> 8))
- return FALSE;
- if (!XdmcpWriteCARD8 (buffer, value & 0xff))
- return FALSE;
- return TRUE;
-}
-
-int
-XdmcpWriteCARD32 (
- XdmcpBufferPtr buffer,
- unsigned 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;
-}
+/*
+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 HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+#include <stdlib.h>
+
+int
+XdmcpWriteHeader (
+ XdmcpBufferPtr buffer,
+ const XdmcpHeaderPtr header)
+{
+ BYTE *newData;
+
+ if ((int)buffer->size < 6 + (int)header->length)
+ {
+ newData = (BYTE *) malloc(XDM_MAX_MSGLEN * sizeof (BYTE));
+ if (!newData)
+ return FALSE;
+ free((unsigned long *)(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;
+}
+
+int
+XdmcpWriteARRAY8 (XdmcpBufferPtr buffer, const 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;
+}
+
+int
+XdmcpWriteARRAY16 (XdmcpBufferPtr buffer, const 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;
+}
+
+int
+XdmcpWriteARRAY32 (XdmcpBufferPtr buffer, const 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;
+}
+
+int
+XdmcpWriteARRAYofARRAY8 (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;
+}
+
+int
+XdmcpWriteCARD8 (
+ XdmcpBufferPtr buffer,
+ unsigned value)
+{
+ if (buffer->pointer >= buffer->size)
+ return FALSE;
+ buffer->data[buffer->pointer++] = (BYTE) value;
+ return TRUE;
+}
+
+int
+XdmcpWriteCARD16 (
+ XdmcpBufferPtr buffer,
+ unsigned value)
+{
+ if (!XdmcpWriteCARD8 (buffer, value >> 8))
+ return FALSE;
+ if (!XdmcpWriteCARD8 (buffer, value & 0xff))
+ return FALSE;
+ return TRUE;
+}
+
+int
+XdmcpWriteCARD32 (
+ XdmcpBufferPtr buffer,
+ unsigned 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;
+}
diff --git a/libXdmcp/autogen.sh b/libXdmcp/autogen.sh
index 6fcae015c..904cd6746 100644
--- a/libXdmcp/autogen.sh
+++ b/libXdmcp/autogen.sh
@@ -1,12 +1,12 @@
-#! /bin/sh
-
-srcdir=`dirname $0`
-test -z "$srcdir" && srcdir=.
-
-ORIGDIR=`pwd`
-cd $srcdir
-
-autoreconf -v --install || exit 1
-cd $ORIGDIR || exit $?
-
-$srcdir/configure --enable-maintainer-mode "$@"
+#! /bin/sh
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+ORIGDIR=`pwd`
+cd $srcdir
+
+autoreconf -v --install || exit 1
+cd $ORIGDIR || exit $?
+
+$srcdir/configure --enable-maintainer-mode "$@"
diff --git a/libXdmcp/xdmcp.pc.in b/libXdmcp/xdmcp.pc.in
index c414e9165..095d17207 100644
--- a/libXdmcp/xdmcp.pc.in
+++ b/libXdmcp/xdmcp.pc.in
@@ -1,11 +1,11 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: Xdmcp
-Description: X Display Manager Control Protocol library
-Version: @PACKAGE_VERSION@
-Requires: xproto
-Cflags: -I${includedir}
-Libs: -L${libdir} -lXdmcp
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: Xdmcp
+Description: X Display Manager Control Protocol library
+Version: @PACKAGE_VERSION@
+Requires: xproto
+Cflags: -I${includedir}
+Libs: -L${libdir} -lXdmcp