Git init
authorKibum Kim <kb0929.kim@samsung.com>
Fri, 6 Jan 2012 15:49:14 +0000 (00:49 +0900)
committerKibum Kim <kb0929.kim@samsung.com>
Fri, 6 Jan 2012 15:49:14 +0000 (00:49 +0900)
37 files changed:
AUTHORS [new file with mode: 0644]
Array.c [new file with mode: 0755]
COPYING [new file with mode: 0644]
ChangeLog [new file with mode: 0755]
Fill.c [new file with mode: 0755]
Flush.c [new file with mode: 0755]
Key.c [new file with mode: 0755]
Makefile.am [new file with mode: 0755]
NEWS [new file with mode: 0644]
README [new file with mode: 0644]
Read.c [new file with mode: 0755]
Unwrap.c [new file with mode: 0755]
Wrap.c [new file with mode: 0755]
Wrap.h [new file with mode: 0755]
Wraphelp.README.crypto [new file with mode: 0644]
Wraphelp.c [new file with mode: 0755]
Write.c [new file with mode: 0755]
autogen.sh [new file with mode: 0755]
configure.ac [new file with mode: 0755]
debian/README.source [new file with mode: 0644]
debian/changelog [new file with mode: 0755]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0755]
debian/copyright [new file with mode: 0644]
debian/libxdmcp-dev.install [new file with mode: 0755]
debian/libxdmcp6-udeb.install [new file with mode: 0644]
debian/libxdmcp6.install [new file with mode: 0644]
debian/rules [new file with mode: 0755]
debian/watch [new file with mode: 0644]
debian/xsfbs/repack.sh [new file with mode: 0644]
debian/xsfbs/xsfbs.mk [new file with mode: 0644]
debian/xsfbs/xsfbs.sh [new file with mode: 0644]
doc/Makefile.am [new file with mode: 0755]
doc/xdmcp.xml [new file with mode: 0755]
include/X11/Xdmcp.h [new file with mode: 0755]
packaging/libXdmcp.spec [new file with mode: 0644]
xdmcp.pc.in [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..0364123
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +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.
diff --git a/Array.c b/Array.c
new file mode 100755 (executable)
index 0000000..8862773
--- /dev/null
+++ b/Array.c
@@ -0,0 +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;
+}
diff --git a/COPYING b/COPYING
new file mode 100644 (file)
index 0000000..5532d14
--- /dev/null
+++ b/COPYING
@@ -0,0 +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
diff --git a/ChangeLog b/ChangeLog
new file mode 100755 (executable)
index 0000000..1ebdd04
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,677 @@
+commit 7db29ff43eb3cdcbfe77c35ecc78c7ca3ddba595
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Fri Oct 29 15:13:16 2010 -0700
+
+    libXdmcp 1.1.0
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit fef4451fa3c55dcf81e7eee7ca001c57e301a150
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Wed Oct 27 23:01:49 2010 -0700
+
+    Remove AC_PROG_CC & AC_PROG_INSTALL that XORG_DEFAULT_OPTIONS already call
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 21c9f93bb5200dda0bfdd05b928c19829f23d646
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Tue Aug 3 15:28:51 2010 -0400
+
+    config: require xorg-macros minimum of 1.10 for XORG_CHECK_SGML_DOCTOOLS
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit adaf75c9aac6ca77b26379cc5e451728d9f1a78b
+Author: Matt Dew <matt@osource.org>
+Date:   Sun Aug 1 14:23:18 2010 -0400
+
+    specs: replace troff source with docbook-xml source
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 39993ef6f48cb3f9ee0cb0cd4dcef0d643cda698
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Fri May 7 19:21:42 2010 -0700
+
+    Replace comments pointing to non-public X Consortium defect reports
+    
+    Restored the original comments suggested by Paul Shearer of Sequent in the
+    patches he submitted with these fixes in the original X Consortium defect
+    reports from 1995, since modern readers can't refer to the referenced
+    bug reports in that old/closed bug db.
+    
+    7328 Xdmcp: memory leak in XdmcpReadARRAYofARRAY8 when read fails
+    7329 Xdmcp: XdmcpReadARRAY and XdmcpDisposeARRAY routines may free twice
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit ea0e0d0e3d45eb5e71542af835194514a6f8801c
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Fri May 7 19:03:54 2010 -0700
+
+    Fix order of CPPFLAGS passed to lint/compile steps
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 996d92d2710f9dc740351f4d9cbe14af64569689
+Author: Mikhail Gusarov <dottedmag@dottedmag.net>
+Date:   Fri May 7 20:22:20 2010 +0000
+
+    Get rid of Xalloc/Xrealloc/Xfree from X server or Xlib
+    
+    alloc/realloc/free calls are encapsulated in libXdmcp, so
+    there is no need to wrap allocation functions even under Windows
+    
+    Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 2a51e57425e1b4062a459a19b1860c9c9721d9ea
+Author: Mikhail Gusarov <dottedmag@dottedmag.net>
+Date:   Fri May 7 20:06:52 2010 +0000
+
+    Nuke RCS tags
+    
+    Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
+    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 710d4a4298772cf06c22cce336622b33487b8b44
+Author: Mikhail Gusarov <dottedmag@dottedmag.net>
+Date:   Fri May 7 20:03:46 2010 +0000
+
+    Reshuffle functions to decrease amount of boilerplate
+    
+    It it a PitA to do anything with lot of nearly idenical code scattered
+    around in 30 files each containing 5-line function
+    
+    Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
+    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 1b22d07fc1268e7c5343cccd562ab69a101baf91
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Thu May 6 15:38:01 2010 -0700
+
+    Use stdint.h instead of limits.h for UINT*_MAX definitions
+    
+    While Solaris allows either one, C99 only requires them in stdint.h
+    and some platforms don't include them via limits.h
+    
+    Corrects tinderbox reported errors on Fedora 11 build machine:
+    
+    http://tinderbox.x.org/builds/2010-05-06-0019/logs/libXdmcp/#build
+    
+    AA32.c: In function 'XdmcpAllocARRAY32':
+    AA32.c:47: error: 'UINT8_MAX' undeclared (first use in this function)
+    
+    AA8.c: In function 'XdmcpAllocARRAY8':
+    AA8.c:47: error: 'UINT16_MAX' undeclared (first use in this function)
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+    
+    Compiles clean on GNU/Linux AMD64
+    Tested-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 30e388a8284ed100893983178acb6b4e3ff2b815
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Thu Apr 29 20:19:38 2010 -0700
+
+    Deal with lint warnings about implicit narrowing conversions
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+    Reviewed-by: Matt Turner <mattst88@gmail.com>
+
+commit 110078a137915f486a13e0445ee9ba5e1558c081
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Thu Apr 29 19:57:46 2010 -0700
+
+    unifdef Lynx
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+    Reviewed-by: Matt Turner <mattst88@gmail.com>
+
+commit 5ea80e308026357aeee8b56230e85cb4d2e87631
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Thu Apr 29 19:56:37 2010 -0700
+
+    XdmcpARRAY8Equal: Use memcmp instead of rolling our own
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+    Reviewed-by: Matt Turner <mattst88@gmail.com>
+
+commit 27b1aa82a3f0db7d20a303ba093d1ec52de39bff
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Thu Apr 29 19:51:25 2010 -0700
+
+    Constify function prototypes
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+    Reviewed-by: Matt Turner <mattst88@gmail.com>
+
+commit 482b19329fac5e311fe0423e58f3e8c573b66114
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Mon Mar 29 16:50:34 2010 -0400
+
+    config: update AC_PREREQ statement to 2.60
+    
+    Unrelated to the previous patches, the new value simply reflects
+    the reality that the minimum level for autoconf to configure
+    all x.org modules is 2.60 dated June 2006.
+    
+    ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 1c220fc14083ed8e1214329138d6ca548dad6dcc
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Mon Mar 29 14:53:48 2010 -0400
+
+    config: remove the pkgconfig pc.in file from EXTRA_DIST
+    
+    Automake always includes it in the tarball.
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 7367f2efae9561d87cabaa6e1740355b0aeda86f
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Sat Mar 20 11:22:59 2010 -0400
+
+    make: remove unrequired -I${top_builddir}/include
+    
+    The -I${top_srcdir}/include in AM_CFLAGS is the correct one.
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 2110b60cf122a624011ade8883af07b88bb2c2bb
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Tue Feb 16 10:37:21 2010 -0500
+
+    config: move CWARNFLAGS from configure.ac to Makefile.am
+    
+    Compiler warning flags should be explicitly set in the makefile
+    rather than being merged with other packages compiler flags.
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 7c1d4d862240a0b01eefbccf6b85e7a365e60ada
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Fri Nov 27 20:56:04 2009 -0500
+
+    Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES
+    
+    Now that the INSTALL file is generated.
+    Allows running make maintainer-clean.
+
+commit 3c0e64988dad80afe5633c62c29ab3d1c54d2d23
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Wed Oct 28 14:09:10 2009 -0400
+
+    INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206
+    
+    Add missing INSTALL file. Use standard GNU file on building tarball
+    README may have been updated
+    Remove AUTHORS file as it is empty and no content available yet.
+    Remove NEWS file as it is empty and no content available yet.
+
+commit a4a69387d7d0783326fbbd2b7b202498325d5f96
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Tue Oct 27 15:07:25 2009 -0400
+
+    Deploy the new XORG_DEFAULT_OPTIONS #24242
+    
+    This macro aggregate a number of existing macros that sets commmon
+    X.Org components configuration options. It shields the configuration file from
+    future changes.
+
+commit 748ea77263a40080e665adc742a7a9791b4293c0
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Mon Oct 26 22:08:43 2009 -0400
+
+    Makefile.am: ChangeLog not required: EXTRA_DIST or *CLEANFILES #24432
+    
+    ChangeLog filename is known to Automake and requires no further
+    coding in the makefile.
+
+commit 1ac333abaae4940467d2101d1080be9e46d90c78
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Thu Oct 22 12:34:19 2009 -0400
+
+    .gitignore: use common defaults with custom section # 24239
+    
+    Using common defaults will reduce errors and maintenance.
+    Only the very small or inexistent custom section need periodic maintenance
+    when the structure of the component changes. Do not edit defaults.
+
+commit c362c31e583215855458bc5cbb9ed1020157b1ad
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Sun Sep 27 16:28:37 2009 -0400
+
+    Makefile.am: do not include autogen.sh in distribution #24183
+    
+    This is a private build script that should not be distributed
+
+commit d0f3336872147e925666aaf73b6c0c11aedc63c3
+Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
+Date:   Wed Oct 21 12:47:24 2009 -0700
+
+    This is not a GNU project, so declare it foreign.
+    
+    On Wed, 2009-10-21 at 13:36 +1000, Peter Hutterer wrote:
+    > On Tue, Oct 20, 2009 at 08:23:55PM -0700, Jeremy Huddleston wrote:
+    > > I noticed an INSTALL file in xlsclients and libXvMC today, and it
+    > > was quite annoying to work around since 'autoreconf -fvi' replaces
+    > > it and git wants to commit it.  Should these files even be in git?
+    > > Can I nuke them for the betterment of humanity and since they get
+    > > created by autoreconf anyways?
+    >
+    > See https://bugs.freedesktop.org/show_bug.cgi?id=24206
+    
+    As an interim measure, replace AM_INIT_AUTOMAKE([dist-bzip2]) with
+    AM_INIT_AUTOMAKE([foreign dist-bzip2]). This will prevent the generation
+    of the INSTALL file. It is also part of the 24206 solution.
+    
+    Signed-off-by: Jeremy Huddleston <jeremyhu@freedesktop.org>
+
+commit 3a7e0bb1cec5975e9fcbddc6569e7ac1aea550e5
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Aug 28 15:32:31 2009 +1000
+
+    libXdmcp 1.0.3
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 8ba417e3f3915102f99e08b15e1543680120102d
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Sep 23 21:59:12 2009 +1000
+
+    Require macros 1.3 for XORG_DEFAULT_OPTIONS.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit d992d9dd3af95132ca76f0479d08d3479b899a95
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Mon Feb 2 20:34:33 2009 -0800
+
+    Add README with pointers to mailing list, bugzilla & git repos
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
+
+commit 49336f1b6fa5d8dc8a9ae3e8d286b061f0d2914c
+Author: Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>
+Date:   Fri Jan 9 16:34:13 2009 -0200
+
+    Ansification and compile warning fixes.
+    
+      Code that already have a header with the proper prototype is safe
+    to ansify.
+      This uses XORG_CHANGELOG macro to properly work with the "git-log"
+    to "git log" change (required to pass "make distcheck"), uses the
+    XORG_CWARNFLAGS macro, and doesn't generate any compile warnings from
+    gcc 4.3 and sparse.
+
+commit 498cce64f12de67271316417de821460e8eee066
+Author: Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>
+Date:   Wed Nov 26 23:45:09 2008 -0200
+
+    Mark Xalloc, Xrealloc, and Xfree as weak symbols.
+    
+    Maybe a _X_WEAK macro could be added to <X11/Xfuncproto.h>, but that
+    could actually encourage use of __attribute__((weak)), what is not
+    intended.
+    This change uses the same semantics used in libXfont to declare
+    weak symbols that are overridden by the ones defined in the X Server.
+
+commit f876004608f8a4737f66e1fc0e83ff7e7d6d150b
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Fri Aug 11 14:43:15 2006 -0700
+
+    Version bump -> 1.0.2
+
+commit 55f64a8a29094905b9f49be95ee576de4a2e1a46
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Fri Aug 11 14:41:42 2006 -0700
+
+    Require xorg-macros 1.1.0 or later for XORG_WITH_LINT & XORG_LINT_LIBRARY macros
+
+commit ae43ecfcb85ad238b2a513d3caf400028b951019
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Fri Aug 11 14:26:26 2006 -0700
+
+    Add lint library to CLEANFILES
+
+commit a106f489a69246f24535acd8bdac96e273df7334
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Fri Aug 11 14:22:42 2006 -0700
+
+    Replace static ChangeLog with dist-hook to generate from git-log
+
+commit 644ff9232d48a32dcc16a1eeba2b51c8686eb33e
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Thu Aug 10 15:58:18 2006 -0700
+
+    Use AC_CHECK_FUNCS instead of #ifdef SYSV to check for srand48 & lrand48
+
+commit 048d2bb6b48dce7b2afea39cd429f3253d8e77ca
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Thu Aug 10 15:43:31 2006 -0700
+
+    Add *~ to .gitignore to ignore emacs droppings
+
+commit 1f3fadd3a0f8226fb19f94d6a6344e144e031bba
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Thu Jul 13 18:01:01 2006 -0700
+
+    Add lint checking & library targets
+
+commit 0b7f0333fe6384598e78f6e0dc61dfbf3636c1c8
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Thu Jul 13 17:52:46 2006 -0700
+
+    Fix sparse warnings for using 0 instead of NULL
+    
+    RA8.c:50:17: warning: Using plain integer as NULL pointer
+    RA16.c:50:16: warning: Using plain integer as NULL pointer
+    RA32.c:50:16: warning: Using plain integer as NULL pointer
+    RAofA8.c:50:16: warning: Using plain integer as NULL pointer
+
+commit bfcde07215512ea5153700bc57ef8baa8d3e9ef2
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Thu Jul 13 14:58:52 2006 -0700
+
+    renamed: .cvsignore -> .gitignore
+
+commit f204a3d32500eb8c6ec7a694a21440fc330ab834
+Author: Adam Jackson <ajax@nwnk.net>
+Date:   Thu Apr 27 00:07:09 2006 +0000
+
+    Bump to 1.0.1
+
+commit b7de07f180407a1597ee74cc570311d7eb808637
+Author: Adam Jackson <ajax@nwnk.net>
+Date:   Mon Mar 20 19:51:32 2006 +0000
+
+    Bug #6243: Fix build on Cygwin, and when srcdir != objdir. (Yaakov
+        Selkowitz)
+
+commit aaee3f658482018c622d8cbb926bbfa14df64eea
+Author: Adam Jackson <ajax@nwnk.net>
+Date:   Thu Jan 12 23:36:41 2006 +0000
+
+    static -> static const
+
+commit 9f8e330eff571cc0c525fd42c4ef8a34cac2eb0d
+Author: Kevin E Martin <kem@kem.org>
+Date:   Thu Dec 15 00:24:29 2005 +0000
+
+    Update package version number for final X11R7 release candidate.
+
+commit 9cd3a3746077c2d6a8fcf2c2c125237d9207e2fb
+Author: Kevin E Martin <kem@kem.org>
+Date:   Sat Dec 3 05:49:43 2005 +0000
+
+    Update package version number for X11R7 RC3 release.
+
+commit da0e8c8bbdfe6cef0225960b204eb9878897cb9b
+Author: Kevin E Martin <kem@kem.org>
+Date:   Sat Nov 19 07:15:41 2005 +0000
+
+    Update pkgconfig files to separate library build-time dependencies from
+        application build-time dependencies, and update package deps to work
+        with separate build roots.
+
+commit cbd6a80c320d7d02ca3bb6d1ca036c0eff27d2c3
+Author: Kevin E Martin <kem@kem.org>
+Date:   Wed Oct 19 02:48:09 2005 +0000
+
+    Update package version number for RC1 release.
+
+commit 0609d6f55136698cb7120b62244d44423e6f0945
+Author: Kevin E Martin <kem@kem.org>
+Date:   Wed Oct 5 19:24:07 2005 +0000
+
+    Add missing files to EXTRA_DIST
+
+commit b0c00126bad965f526ef13fa041248e8379a4a53
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Sat Jul 30 07:44:09 2005 +0000
+
+    Add missing library dependencies: Xdmcp: -lsocket (if needed for recvfrom,
+        such as on Solaris) lbxutil: -lz xkbui: -lm
+
+commit 19ca07e4c538a6f8b46b3bbcdacd39afc1fdede0
+Author: Kevin E Martin <kem@kem.org>
+Date:   Fri Jul 29 21:22:51 2005 +0000
+
+    Various changes preparing packages for RC0:
+    - Verify and update package version numbers as needed
+    - Implement versioning scheme
+    - Change bug address to point to bugzilla bug entry form
+    - Disable loadable i18n in libX11 by default (use --enable-loadable-i18n to
+        reenable it)
+    - Fix makedepend to use pkgconfig and pass distcheck
+    - Update build script to build macros first
+    - Update modular Xorg version
+
+commit 7242946c1cac1ecb97ea0cc312a8ea08707ca945
+Author: Daniel Stone <daniel@fooishbar.org>
+Date:   Sat Jul 16 06:41:57 2005 +0000
+
+    Use -version-number instead of -version-info.
+
+commit ce57d6479026168ab4839dc8d93f8c13c7ee6356
+Author: Adam Jackson <ajax@nwnk.net>
+Date:   Thu Jul 14 15:12:44 2005 +0000
+
+    typo fixes (Matthieu Herrb)
+
+commit d5c88f476d6d263b9e80640c1acd3ec784c7184b
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sat Jul 9 06:15:32 2005 +0000
+
+    Add .cvsignore files Switch _la_CFLAGS for AM_CFLAGS to clean up directory
+
+commit 1df326ab00b3ca1faf44d81ce53f6b66076ad0cf
+Author: Daniel Stone <daniel@fooishbar.org>
+Date:   Sun Jul 3 07:00:56 2005 +0000
+
+    Add Xtrans definitions (FONT_t, TRANS_CLIENT) to clean up warnings.
+    Add XSERV_t, TRANS_SERVER, TRANS_REOPEN to quash warnings.
+    Add #include <dix-config.h> or <xorg-config.h>, as appropriate, to all
+        source files in the xserver/xorg tree, predicated on defines of
+        HAVE_{DIX,XORG}_CONFIG_H. Change all Xfont includes to
+        <X11/fonts/foo.h>.
+
+commit 77283d94174d18791e230b4800641242c1767e87
+Author: Adam Jackson <ajax@nwnk.net>
+Date:   Thu May 19 00:22:32 2005 +0000
+
+    revert last change, didn't do right thing at all, sorry for the noise
+
+commit daefb98f4437af90dcff3853ec23b8a1f0864018
+Author: Adam Jackson <ajax@nwnk.net>
+Date:   Thu May 19 00:10:07 2005 +0000
+
+    Require automake 1.7 in AM_INIT_AUTOMAKE
+
+commit 2f31285482451b8ed44b0b61969a7f324dbe905a
+Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk>
+Date:   Tue May 17 14:43:47 2005 +0000
+
+    Tue May 17 10:38:30 2005 Søren Sandmann <sandmann@redhat.com>
+    Remove Xdmcpconf.h and references to it, since it is not needed.
+    Delete entries from the xlibs tree since they are not relevant
+
+commit 83b3f8f9fcb08348d28dbdb19e07a2c41b9f8bf2
+Author: Josh Triplett <josh@speakeasy.net>
+Date:   Sat May 14 08:03:04 2005 +0000
+
+    Add Xdmcpconf.h.in from xlibs tree.
+
+commit ceec4744a2906539154007edf1ec3b865fef1991
+Author: Josh Triplett <josh@speakeasy.net>
+Date:   Sat May 14 07:58:43 2005 +0000
+
+    Add configure.ac for Xdmcp from xlibs tree.
+
+commit d5d1fb73e5c8c0b2a5b2704ec6b8394fc8a425b4
+Author: Josh Triplett <josh@speakeasy.net>
+Date:   Sat May 14 07:46:48 2005 +0000
+
+    Move includes in Xau and Xdmcp into include/X11 subdirectories so that the
+        source can reference them with <X11/...>.
+
+commit 0ea8a9fde966a2fbdc075e4cfc47235d3c899022
+Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk>
+Date:   Thu May 12 16:27:25 2005 +0000
+
+    Thu May 12 12:24:16 2005 Søren Sandmann <sandmann@redhat.com>
+    Conditionally include config.h
+    add Makefile.am
+
+commit 845dff36906d99a80ea920a8d0efb73bd0b88d56
+Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk>
+Date:   Thu May 12 16:12:34 2005 +0000
+
+    Make xtrans install in $(includedir)/X11/Xtrans. Remove all references to
+        Xtransdef.
+    Add Xdmcp build files
+    Add Wrap.h to lib/dmcp part of symlink script.
+
+commit 2e5c59efc9df61d84f81af0f9a100672d096bac6
+Author: Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>
+Date:   Mon Nov 15 15:06:55 2004 +0000
+
+    Bufzilla #1802, http://freedesktop.org/bugzilla/show_bug.cgi?id=1802 Added
+        mingw (Win32) port
+
+commit 5cd56c90f05d05c19c484f606b70d17873b507b5
+Author: Keith Packard <keithp@keithp.com>
+Date:   Tue Aug 24 18:33:32 2004 +0000
+
+    Replace 'uint32_t' with 'CARD32' and 'uint8_t' with 'CARD8'. Add #include
+        <X11/Xmd.h>
+    reviewed by: Stuart Kreitman <Stuart.Kreitman@Sun.COM>
+
+commit 874e5e8b17f111f07c2c4e9167b4940365cc1421
+Author: Stuart Kreitman <stuart.kreitman@sun.com>
+Date:   Mon Aug 23 17:06:37 2004 +0000
+
+    Modified Files: Wraphelp.c
+    Coding standard recommended by C99 standards body:
+    http://www.oreillynet.com/pub/a/network/2003/10/07/michael_barr.html
+
+commit 7acd9ecff911e900deb03767f283d59fc90f550c
+Author: Jim Gettys <jg@freedesktop.org>
+Date:   Sun Aug 22 01:02:25 2004 +0000
+
+    Matthieu Herrb <matthieu.herrb@laas.fr> points out:
+    Hmm, this version doesn't work on LP64 big endian machines (like
+    *BSD/sparc64). The problems were fixed in OpenBSD. May I suggest to switch
+        to this version (it's the same origin, with the LP64 problems fixed):
+        <http://www.openbsd.org/cgi-bin/cvsweb.cgi/XF4/xc/lib/Xdmcp/Wraphelp.c>
+
+commit faf433b79417ef801ed3c62fdf9bbc8edf1b6ba3
+Author: Jim Gettys <jg@freedesktop.org>
+Date:   Sat Aug 21 02:06:44 2004 +0000
+
+    Add Wraphelp.c to lib/Xdmcp, at long last, along with the U.S. government
+        required notifications. The website notification went up first.
+    Clean up Wraphelp.c so that it compiles cleanly.
+    I chose the version Australian version written for R5 written by Eric
+        Eay@psych.psy.uq.oz.au, as I don't know where the original one was, and
+        didn't want to touch XFree86.
+    Make HasXdmAuth YES for xorg.
+
+commit 4a01be711a72d99e054a83e9a00a27b2fc420601
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Sat Aug 7 19:22:01 2004 +0000
+
+    Check to see if array->data is NULL before we dereference it, instead of
+        after. (Prevents segfault when array->data is initialized to NULL, but
+        array->length is not set to 0.)
+    Always initialize both data & length in ARRAYs.
+
+commit 54c91c33da46e67a4efce0dd43def29c65677ed4
+Author: Egbert Eich <eich@suse.de>
+Date:   Tue Jul 6 14:37:47 2004 +0000
+
+    Separated Intel drivers from default DriDrivers to avoid building them on
+        IA64 (Egbert Eich).
+    Fixed wrong function prototype (Egbert Eich).
+    Don't test for generic VGA on IA64 (Egbert Eich).
+    Fixed a segfault when accessing a structure before verifying the pointer
+        exists (Egbert Eich).
+    Added a showcache option for debugging (Egbert Eich).
+    Increase default video RAM size to 16MB when DRI is enabled and more than
+        128MB are available (Egbert Eich). Fixed lockups during mode switch.
+        Problem was introduced when attempting to copy the behavior during
+        LeaveVT()/EnterVT() but but forgetting to call I810DRILeave() before
+        I810DRIEnter(). The entire DRILeave()/Enter() scenario has been
+        commented out as it didn't seem to be necessary (Egbert Eich).
+    Fix TweakMemorySize() (tested with i855/i865) (Egbert Eich).
+    increased MAX_DEVICES to 128 (Egbert Eich).
+    Use OS provided PCI config space access as default method (Egbert Eich).
+    Added support for Linux 2.6 proc file format.
+    Fixed unaligned accesses to pieces of the VBE info block. VESA did not
+        align elements to size (Egbert Eich).
+
+commit 11ce0b3adae5dac23d95fae62570d0a7e872055f
+Author: Egbert Eich <eich@suse.de>
+Date:   Fri Apr 23 18:43:41 2004 +0000
+
+    Merging XORG-CURRENT into trunk
+
+commit d1291a78bebace4d4ccef4b552bbfd145961ee44
+Author: Egbert Eich <eich@suse.de>
+Date:   Sun Mar 14 08:32:05 2004 +0000
+
+    Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004
+
+commit ca6d962126b1d876851293d9c0a407ff733b5558
+Author: Egbert Eich <eich@suse.de>
+Date:   Wed Mar 3 12:11:28 2004 +0000
+
+    Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004
+
+commit 3132e3a51c671fc95ee2b88802ae30abcb177320
+Author: Egbert Eich <eich@suse.de>
+Date:   Thu Feb 26 13:35:33 2004 +0000
+
+    readding XFree86's cvs IDs
+
+commit 47d1195510762af8efce38806dc75adc0bdc09cc
+Author: Egbert Eich <eich@suse.de>
+Date:   Thu Feb 26 09:22:42 2004 +0000
+
+    Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004
+
+commit 8ecf5d371806b603b64f257e4caa1d9cbc19556d
+Author: Kaleb Keithley <kaleb@freedesktop.org>
+Date:   Fri Dec 19 20:54:35 2003 +0000
+
+    XFree86 4.3.99.902 (RC 2)
+
+commit 9cfba0fa56ff1ebae9aaccf1e63049759dbd37f5
+Author: Kaleb Keithley <kaleb@freedesktop.org>
+Date:   Thu Dec 4 22:02:56 2003 +0000
+
+    XFree86 4.3.99.901 (RC 1)
+
+commit c95e0de1641abf24792dcafc5a98a95986183f53
+Author: Kaleb Keithley <kaleb@freedesktop.org>
+Date:   Tue Nov 25 19:28:09 2003 +0000
+
+    XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks
+
+commit 0200b5d9bb6a599aefbb05a2217e243ea0da387b
+Author: Kaleb Keithley <kaleb@freedesktop.org>
+Date:   Fri Nov 14 16:48:48 2003 +0000
+
+    XFree86 4.3.0.1
+
+commit d1eb0ee78fbb0c109f9fa8e1bc05907608fc4299
+Author: Kaleb Keithley <kaleb@freedesktop.org>
+Date:   Fri Nov 14 15:54:38 2003 +0000
+
+    R6.6 is the Xorg base-line
diff --git a/Fill.c b/Fill.c
new file mode 100755 (executable)
index 0000000..98c324f
--- /dev/null
+++ b/Fill.c
@@ -0,0 +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;
+}
diff --git a/Flush.c b/Flush.c
new file mode 100755 (executable)
index 0000000..cdcd1f0
--- /dev/null
+++ b/Flush.c
@@ -0,0 +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;
+}
diff --git a/Key.c b/Key.c
new file mode 100755 (executable)
index 0000000..aa4add6
--- /dev/null
+++ b/Key.c
@@ -0,0 +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;
+}
diff --git a/Makefile.am b/Makefile.am
new file mode 100755 (executable)
index 0000000..c3b85aa
--- /dev/null
@@ -0,0 +1,66 @@
+SUBDIRS=doc
+
+lib_LTLIBRARIES = libXdmcp.la
+
+AM_CPPFLAGS = -I${top_srcdir}/include
+AM_CFLAGS = \
+       $(XDMCP_CFLAGS) \
+       $(CWARNFLAGS)
+
+libXdmcp_la_LDFLAGS = -version-number 6:0:0 -no-undefined
+libXdmcp_la_LIBADD = $(XDMCP_LIBS)
+libXdmcp_la_SOURCES = \
+       Array.c \
+       Fill.c \
+       Flush.c \
+       Key.c \
+       Read.c \
+       Unwrap.c \
+       Wrap.c \
+       Wrap.h \
+       Write.c
+
+if HASXDMAUTH
+nodist_libXdmcp_la_SOURCES = Wraphelp.c
+endif HASXDMAUTH
+
+xdmcpincludedir=$(includedir)/X11
+
+xdmcpinclude_HEADERS = \
+       include/X11/Xdmcp.h
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = xdmcp.pc
+
+MAINTAINERCLEANFILES = ChangeLog INSTALL
+EXTRA_DIST = autogen.sh Wraphelp.c Wraphelp.README.crypto
+
+if LINT
+ALL_LINT_FLAGS=$(LINT_FLAGS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+               $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS)
+
+lint:
+       $(LINT) $(ALL_LINT_FLAGS) $(libXdmcp_la_SOURCES) $(nodist_libXdmcp_la_SOURCES) $(LIBS) $(XDMCP_LIBS)
+endif LINT
+
+if MAKE_LINT_LIB
+lintlibdir = $(libdir)
+
+lintlib_DATA = $(LINTLIB)
+
+$(LINTLIB): $(libXdmcp_la_SOURCES) $(nodist_libXdmcp_la_SOURCES)
+       $(LINT) -y -oXdmcp -x $(ALL_LINT_FLAGS) $(libXdmcp_la_SOURCES) $(nodist_libXdmcp_la_SOURCES)
+endif MAKE_LINT_LIB
+
+
+.PHONY: ChangeLog INSTALL
+
+INSTALL:
+       $(INSTALL_CMD)
+
+ChangeLog:
+       $(CHANGELOG_CMD)
+
+dist-hook: ChangeLog INSTALL
+
+CLEANFILES=$(lintlib_DATA)
diff --git a/NEWS b/NEWS
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..7ba85f0
--- /dev/null
+++ b/README
@@ -0,0 +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
+
diff --git a/Read.c b/Read.c
new file mode 100755 (executable)
index 0000000..7da6163
--- /dev/null
+++ b/Read.c
@@ -0,0 +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;
+}
diff --git a/Unwrap.c b/Unwrap.c
new file mode 100755 (executable)
index 0000000..82a10ee
--- /dev/null
+++ b/Unwrap.c
@@ -0,0 +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 */
diff --git a/Wrap.c b/Wrap.c
new file mode 100755 (executable)
index 0000000..f025caf
--- /dev/null
+++ b/Wrap.c
@@ -0,0 +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
diff --git a/Wrap.h b/Wrap.h
new file mode 100755 (executable)
index 0000000..479da5f
--- /dev/null
+++ b/Wrap.h
@@ -0,0 +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
diff --git a/Wraphelp.README.crypto b/Wraphelp.README.crypto
new file mode 100644 (file)
index 0000000..20c34c0
--- /dev/null
@@ -0,0 +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.
diff --git a/Wraphelp.c b/Wraphelp.c
new file mode 100755 (executable)
index 0000000..1b962e3
--- /dev/null
@@ -0,0 +1,495 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <sys/types.h>
+#include <X11/Xmd.h>
+#include "Wrap.h"
+
+/* des routines for non-usa - eay 10/9/1991 eay@psych.psy.uq.oz.au
+ * These routines were written for speed not size so they are bigger than
+ * needed.  I have removed some of the loop unrolling, this will reduce
+ * code size at the expense of some speed.
+ * 25/9/1991 eay - much faster _XdmcpAuthSetup (4 times faster).
+ * 19/9/1991 eay - cleaned up the IP and FP code.
+ * 10/9/1991 eay - first release.
+ * The des routines this file has been made from can be found in
+ * ftp.psy.uq.oz.au /pub/DES
+ * This particular version derived from OpenBSD Revsion 1.3.
+ */
+
+/*
+ *
+ * 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.
+ * 
+ * 
+ * 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.
+ */
+
+static const CARD32 skb[8][64] = {
+       /* for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 */
+       { 0x00000000,0x00000010,0x20000000,0x20000010,
+         0x00010000,0x00010010,0x20010000,0x20010010,
+         0x00000800,0x00000810,0x20000800,0x20000810,
+         0x00010800,0x00010810,0x20010800,0x20010810,
+         0x00000020,0x00000030,0x20000020,0x20000030,
+         0x00010020,0x00010030,0x20010020,0x20010030,
+         0x00000820,0x00000830,0x20000820,0x20000830,
+         0x00010820,0x00010830,0x20010820,0x20010830,
+         0x00080000,0x00080010,0x20080000,0x20080010,
+         0x00090000,0x00090010,0x20090000,0x20090010,
+         0x00080800,0x00080810,0x20080800,0x20080810,
+         0x00090800,0x00090810,0x20090800,0x20090810,
+         0x00080020,0x00080030,0x20080020,0x20080030,
+         0x00090020,0x00090030,0x20090020,0x20090030,
+         0x00080820,0x00080830,0x20080820,0x20080830,
+         0x00090820,0x00090830,0x20090820,0x20090830 },
+       /* for C bits (numbered as per FIPS 46) 7 8 10 11 12 13 */
+       { 0x00000000,0x02000000,0x00002000,0x02002000,
+         0x00200000,0x02200000,0x00202000,0x02202000,
+         0x00000004,0x02000004,0x00002004,0x02002004,
+         0x00200004,0x02200004,0x00202004,0x02202004,
+         0x00000400,0x02000400,0x00002400,0x02002400,
+         0x00200400,0x02200400,0x00202400,0x02202400,
+         0x00000404,0x02000404,0x00002404,0x02002404,
+         0x00200404,0x02200404,0x00202404,0x02202404,
+         0x10000000,0x12000000,0x10002000,0x12002000,
+         0x10200000,0x12200000,0x10202000,0x12202000,
+         0x10000004,0x12000004,0x10002004,0x12002004,
+         0x10200004,0x12200004,0x10202004,0x12202004,
+         0x10000400,0x12000400,0x10002400,0x12002400,
+         0x10200400,0x12200400,0x10202400,0x12202400,
+         0x10000404,0x12000404,0x10002404,0x12002404,
+         0x10200404,0x12200404,0x10202404,0x12202404 },
+       /* for C bits (numbered as per FIPS 46) 14 15 16 17 19 20 */
+       { 0x00000000,0x00000001,0x00040000,0x00040001,
+         0x01000000,0x01000001,0x01040000,0x01040001,
+         0x00000002,0x00000003,0x00040002,0x00040003,
+         0x01000002,0x01000003,0x01040002,0x01040003,
+         0x00000200,0x00000201,0x00040200,0x00040201,
+         0x01000200,0x01000201,0x01040200,0x01040201,
+         0x00000202,0x00000203,0x00040202,0x00040203,
+         0x01000202,0x01000203,0x01040202,0x01040203,
+         0x08000000,0x08000001,0x08040000,0x08040001,
+         0x09000000,0x09000001,0x09040000,0x09040001,
+         0x08000002,0x08000003,0x08040002,0x08040003,
+         0x09000002,0x09000003,0x09040002,0x09040003,
+         0x08000200,0x08000201,0x08040200,0x08040201,
+         0x09000200,0x09000201,0x09040200,0x09040201,
+         0x08000202,0x08000203,0x08040202,0x08040203,
+         0x09000202,0x09000203,0x09040202,0x09040203 },
+       /* for C bits (numbered as per FIPS 46) 21 23 24 26 27 28 */
+       { 0x00000000,0x00100000,0x00000100,0x00100100,
+         0x00000008,0x00100008,0x00000108,0x00100108,
+         0x00001000,0x00101000,0x00001100,0x00101100,
+         0x00001008,0x00101008,0x00001108,0x00101108,
+         0x04000000,0x04100000,0x04000100,0x04100100,
+         0x04000008,0x04100008,0x04000108,0x04100108,
+         0x04001000,0x04101000,0x04001100,0x04101100,
+         0x04001008,0x04101008,0x04001108,0x04101108,
+         0x00020000,0x00120000,0x00020100,0x00120100,
+         0x00020008,0x00120008,0x00020108,0x00120108,
+         0x00021000,0x00121000,0x00021100,0x00121100,
+         0x00021008,0x00121008,0x00021108,0x00121108,
+         0x04020000,0x04120000,0x04020100,0x04120100,
+         0x04020008,0x04120008,0x04020108,0x04120108,
+         0x04021000,0x04121000,0x04021100,0x04121100,
+         0x04021008,0x04121008,0x04021108,0x04121108 },
+       /* for D bits (numbered as per FIPS 46) 1 2 3 4 5 6 */
+       { 0x00000000,0x10000000,0x00010000,0x10010000,
+         0x00000004,0x10000004,0x00010004,0x10010004,
+         0x20000000,0x30000000,0x20010000,0x30010000,
+         0x20000004,0x30000004,0x20010004,0x30010004,
+         0x00100000,0x10100000,0x00110000,0x10110000,
+         0x00100004,0x10100004,0x00110004,0x10110004,
+         0x20100000,0x30100000,0x20110000,0x30110000,
+         0x20100004,0x30100004,0x20110004,0x30110004,
+         0x00001000,0x10001000,0x00011000,0x10011000,
+         0x00001004,0x10001004,0x00011004,0x10011004,
+         0x20001000,0x30001000,0x20011000,0x30011000,
+         0x20001004,0x30001004,0x20011004,0x30011004,
+         0x00101000,0x10101000,0x00111000,0x10111000,
+         0x00101004,0x10101004,0x00111004,0x10111004,
+         0x20101000,0x30101000,0x20111000,0x30111000,
+         0x20101004,0x30101004,0x20111004,0x30111004 },
+       /* for D bits (numbered as per FIPS 46) 8 9 11 12 13 14 */
+       { 0x00000000,0x08000000,0x00000008,0x08000008,
+         0x00000400,0x08000400,0x00000408,0x08000408,
+         0x00020000,0x08020000,0x00020008,0x08020008,
+         0x00020400,0x08020400,0x00020408,0x08020408,
+         0x00000001,0x08000001,0x00000009,0x08000009,
+         0x00000401,0x08000401,0x00000409,0x08000409,
+         0x00020001,0x08020001,0x00020009,0x08020009,
+         0x00020401,0x08020401,0x00020409,0x08020409,
+         0x02000000,0x0A000000,0x02000008,0x0A000008,
+         0x02000400,0x0A000400,0x02000408,0x0A000408,
+         0x02020000,0x0A020000,0x02020008,0x0A020008,
+         0x02020400,0x0A020400,0x02020408,0x0A020408,
+         0x02000001,0x0A000001,0x02000009,0x0A000009,
+         0x02000401,0x0A000401,0x02000409,0x0A000409,
+         0x02020001,0x0A020001,0x02020009,0x0A020009,
+         0x02020401,0x0A020401,0x02020409,0x0A020409 },
+       /* for D bits (numbered as per FIPS 46) 16 17 18 19 20 21 */
+       { 0x00000000,0x00000100,0x00080000,0x00080100,
+         0x01000000,0x01000100,0x01080000,0x01080100,
+         0x00000010,0x00000110,0x00080010,0x00080110,
+         0x01000010,0x01000110,0x01080010,0x01080110,
+         0x00200000,0x00200100,0x00280000,0x00280100,
+         0x01200000,0x01200100,0x01280000,0x01280100,
+         0x00200010,0x00200110,0x00280010,0x00280110,
+         0x01200010,0x01200110,0x01280010,0x01280110,
+         0x00000200,0x00000300,0x00080200,0x00080300,
+         0x01000200,0x01000300,0x01080200,0x01080300,
+         0x00000210,0x00000310,0x00080210,0x00080310,
+         0x01000210,0x01000310,0x01080210,0x01080310,
+         0x00200200,0x00200300,0x00280200,0x00280300,
+         0x01200200,0x01200300,0x01280200,0x01280300,
+         0x00200210,0x00200310,0x00280210,0x00280310,
+         0x01200210,0x01200310,0x01280210,0x01280310 },
+         /* for D bits (numbered as per FIPS 46) 22 23 24 25 27 28 */
+       { 0x00000000,0x04000000,0x00040000,0x04040000,
+         0x00000002,0x04000002,0x00040002,0x04040002,
+         0x00002000,0x04002000,0x00042000,0x04042000,
+         0x00002002,0x04002002,0x00042002,0x04042002,
+         0x00000020,0x04000020,0x00040020,0x04040020,
+         0x00000022,0x04000022,0x00040022,0x04040022,
+         0x00002020,0x04002020,0x00042020,0x04042020,
+         0x00002022,0x04002022,0x00042022,0x04042022,
+         0x00000800,0x04000800,0x00040800,0x04040800,
+         0x00000802,0x04000802,0x00040802,0x04040802,
+         0x00002800,0x04002800,0x00042800,0x04042800,
+         0x00002802,0x04002802,0x00042802,0x04042802,
+         0x00000820,0x04000820,0x00040820,0x04040820,
+         0x00000822,0x04000822,0x00040822,0x04040822,
+         0x00002820,0x04002820,0x00042820,0x04042820,
+         0x00002822,0x04002822,0x00042822,0x04042822 }
+};
+
+
+static const CARD32 SPtrans[8][64] = {
+       /* nibble 0 */
+       { 0x00410100, 0x00010000, 0x40400000, 0x40410100,
+         0x00400000, 0x40010100, 0x40010000, 0x40400000,
+         0x40010100, 0x00410100, 0x00410000, 0x40000100,
+         0x40400100, 0x00400000, 0x00000000, 0x40010000,
+         0x00010000, 0x40000000, 0x00400100, 0x00010100,
+         0x40410100, 0x00410000, 0x40000100, 0x00400100,
+         0x40000000, 0x00000100, 0x00010100, 0x40410000,
+         0x00000100, 0x40400100, 0x40410000, 0x00000000,
+         0x00000000, 0x40410100, 0x00400100, 0x40010000,
+         0x00410100, 0x00010000, 0x40000100, 0x00400100,
+         0x40410000, 0x00000100, 0x00010100, 0x40400000,
+         0x40010100, 0x40000000, 0x40400000, 0x00410000,
+         0x40410100, 0x00010100, 0x00410000, 0x40400100,
+         0x00400000, 0x40000100, 0x40010000, 0x00000000,
+         0x00010000, 0x00400000, 0x40400100, 0x00410100,
+         0x40000000, 0x40410000, 0x00000100, 0x40010100 },
+
+       /* nibble 1 */
+       { 0x08021002, 0x00000000, 0x00021000, 0x08020000,
+         0x08000002, 0x00001002, 0x08001000, 0x00021000,
+         0x00001000, 0x08020002, 0x00000002, 0x08001000,
+         0x00020002, 0x08021000, 0x08020000, 0x00000002,
+         0x00020000, 0x08001002, 0x08020002, 0x00001000,
+         0x00021002, 0x08000000, 0x00000000, 0x00020002,
+         0x08001002, 0x00021002, 0x08021000, 0x08000002,
+         0x08000000, 0x00020000, 0x00001002, 0x08021002,
+         0x00020002, 0x08021000, 0x08001000, 0x00021002,
+         0x08021002, 0x00020002, 0x08000002, 0x00000000,
+         0x08000000, 0x00001002, 0x00020000, 0x08020002,
+         0x00001000, 0x08000000, 0x00021002, 0x08001002,
+         0x08021000, 0x00001000, 0x00000000, 0x08000002,
+         0x00000002, 0x08021002, 0x00021000, 0x08020000,
+         0x08020002, 0x00020000, 0x00001002, 0x08001000,
+         0x08001002, 0x00000002, 0x08020000, 0x00021000 },
+
+       /* nibble 2 */
+       { 0x20800000, 0x00808020, 0x00000020, 0x20800020,
+         0x20008000, 0x00800000, 0x20800020, 0x00008020,
+         0x00800020, 0x00008000, 0x00808000, 0x20000000,
+         0x20808020, 0x20000020, 0x20000000, 0x20808000,
+         0x00000000, 0x20008000, 0x00808020, 0x00000020,
+         0x20000020, 0x20808020, 0x00008000, 0x20800000,
+         0x20808000, 0x00800020, 0x20008020, 0x00808000,
+         0x00008020, 0x00000000, 0x00800000, 0x20008020,
+         0x00808020, 0x00000020, 0x20000000, 0x00008000,
+         0x20000020, 0x20008000, 0x00808000, 0x20800020,
+         0x00000000, 0x00808020, 0x00008020, 0x20808000,
+         0x20008000, 0x00800000, 0x20808020, 0x20000000,
+         0x20008020, 0x20800000, 0x00800000, 0x20808020,
+         0x00008000, 0x00800020, 0x20800020, 0x00008020,
+         0x00800020, 0x00000000, 0x20808000, 0x20000020,
+         0x20800000, 0x20008020, 0x00000020, 0x00808000 },
+
+       /* nibble 3 */
+       { 0x00080201, 0x02000200, 0x00000001, 0x02080201,
+         0x00000000, 0x02080000, 0x02000201, 0x00080001,
+         0x02080200, 0x02000001, 0x02000000, 0x00000201,
+         0x02000001, 0x00080201, 0x00080000, 0x02000000,
+         0x02080001, 0x00080200, 0x00000200, 0x00000001,
+         0x00080200, 0x02000201, 0x02080000, 0x00000200,
+         0x00000201, 0x00000000, 0x00080001, 0x02080200,
+         0x02000200, 0x02080001, 0x02080201, 0x00080000,
+         0x02080001, 0x00000201, 0x00080000, 0x02000001,
+         0x00080200, 0x02000200, 0x00000001, 0x02080000,
+         0x02000201, 0x00000000, 0x00000200, 0x00080001,
+         0x00000000, 0x02080001, 0x02080200, 0x00000200,
+         0x02000000, 0x02080201, 0x00080201, 0x00080000,
+         0x02080201, 0x00000001, 0x02000200, 0x00080201,
+         0x00080001, 0x00080200, 0x02080000, 0x02000201,
+         0x00000201, 0x02000000, 0x02000001, 0x02080200 },
+
+       /* nibble 4 */
+       { 0x01000000, 0x00002000, 0x00000080, 0x01002084,
+         0x01002004, 0x01000080, 0x00002084, 0x01002000,
+         0x00002000, 0x00000004, 0x01000004, 0x00002080,
+         0x01000084, 0x01002004, 0x01002080, 0x00000000,
+         0x00002080, 0x01000000, 0x00002004, 0x00000084,
+         0x01000080, 0x00002084, 0x00000000, 0x01000004,
+         0x00000004, 0x01000084, 0x01002084, 0x00002004,
+         0x01002000, 0x00000080, 0x00000084, 0x01002080,
+         0x01002080, 0x01000084, 0x00002004, 0x01002000,
+         0x00002000, 0x00000004, 0x01000004, 0x01000080,
+         0x01000000, 0x00002080, 0x01002084, 0x00000000,
+         0x00002084, 0x01000000, 0x00000080, 0x00002004,
+         0x01000084, 0x00000080, 0x00000000, 0x01002084,
+         0x01002004, 0x01002080, 0x00000084, 0x00002000,
+         0x00002080, 0x01002004, 0x01000080, 0x00000084,
+         0x00000004, 0x00002084, 0x01002000, 0x01000004 },
+
+       /* nibble 5 */
+       { 0x10000008, 0x00040008, 0x00000000, 0x10040400,
+         0x00040008, 0x00000400, 0x10000408, 0x00040000,
+         0x00000408, 0x10040408, 0x00040400, 0x10000000,
+         0x10000400, 0x10000008, 0x10040000, 0x00040408,
+         0x00040000, 0x10000408, 0x10040008, 0x00000000,
+         0x00000400, 0x00000008, 0x10040400, 0x10040008,
+         0x10040408, 0x10040000, 0x10000000, 0x00000408,
+         0x00000008, 0x00040400, 0x00040408, 0x10000400,
+         0x00000408, 0x10000000, 0x10000400, 0x00040408,
+         0x10040400, 0x00040008, 0x00000000, 0x10000400,
+         0x10000000, 0x00000400, 0x10040008, 0x00040000,
+         0x00040008, 0x10040408, 0x00040400, 0x00000008,
+         0x10040408, 0x00040400, 0x00040000, 0x10000408,
+         0x10000008, 0x10040000, 0x00040408, 0x00000000,
+         0x00000400, 0x10000008, 0x10000408, 0x10040400,
+         0x10040000, 0x00000408, 0x00000008, 0x10040008 },
+
+       /* nibble 6 */
+       { 0x00000800, 0x00000040, 0x00200040, 0x80200000,
+         0x80200840, 0x80000800, 0x00000840, 0x00000000,
+         0x00200000, 0x80200040, 0x80000040, 0x00200800,
+         0x80000000, 0x00200840, 0x00200800, 0x80000040,
+         0x80200040, 0x00000800, 0x80000800, 0x80200840,
+         0x00000000, 0x00200040, 0x80200000, 0x00000840,
+         0x80200800, 0x80000840, 0x00200840, 0x80000000,
+         0x80000840, 0x80200800, 0x00000040, 0x00200000,
+         0x80000840, 0x00200800, 0x80200800, 0x80000040,
+         0x00000800, 0x00000040, 0x00200000, 0x80200800,
+         0x80200040, 0x80000840, 0x00000840, 0x00000000,
+         0x00000040, 0x80200000, 0x80000000, 0x00200040,
+         0x00000000, 0x80200040, 0x00200040, 0x00000840,
+         0x80000040, 0x00000800, 0x80200840, 0x00200000,
+         0x00200840, 0x80000000, 0x80000800, 0x80200840,
+         0x80200000, 0x00200840, 0x00200800, 0x80000800 },
+
+       /* nibble 7 */
+       { 0x04100010, 0x04104000, 0x00004010, 0x00000000,
+         0x04004000, 0x00100010, 0x04100000, 0x04104010,
+         0x00000010, 0x04000000, 0x00104000, 0x00004010,
+         0x00104010, 0x04004010, 0x04000010, 0x04100000,
+         0x00004000, 0x00104010, 0x00100010, 0x04004000,
+         0x04104010, 0x04000010, 0x00000000, 0x00104000,
+         0x04000000, 0x00100000, 0x04004010, 0x04100010,
+         0x00100000, 0x00004000, 0x04104000, 0x00000010,
+         0x00100000, 0x00004000, 0x04000010, 0x04104010,
+         0x00004010, 0x04000000, 0x00000000, 0x00104000,
+         0x04100010, 0x04004010, 0x04004000, 0x00100010,
+         0x04104000, 0x00000010, 0x00100010, 0x04004000,
+         0x04104010, 0x00100000, 0x04100000, 0x04000010,
+         0x00104000, 0x00004010, 0x04004010, 0x04100000,
+         0x00000010, 0x04104000, 0x00104010, 0x00000000,
+         0x04000000, 0x04100010, 0x00004000, 0x00104010}
+};
+
+#define ITERATIONS 16
+#define HALF_ITERATIONS 8
+
+#define c2l(c,l)       (l =((CARD32)(*((c)++)))    , \
+                        l|=((CARD32)(*((c)++)))<< 8, \
+                        l|=((CARD32)(*((c)++)))<<16, \
+                        l|=((CARD32)(*((c)++)))<<24)
+
+#define l2c(l,c)       (*((c)++)=(CARD8)(((l)    )&0xff), \
+                        *((c)++)=(CARD8)(((l)>> 8)&0xff), \
+                        *((c)++)=(CARD8)(((l)>>16)&0xff), \
+                        *((c)++)=(CARD8)(((l)>>24)&0xff))
+
+#define PERM_OP(a,b,t,n,m) ((t)=((((a)>>(n))^(b))&(m)),\
+       (b)^=(t),\
+       (a)^=((t)<<(n)))
+
+#define HPERM_OP(a,t,n,m) ((t)=((((a)<<(16-(n)))^(a))&(m)),\
+       (a)=(a)^(t)^(t>>(16-(n))))\
+
+static const char shifts2[16] = {0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0};
+
+void _XdmcpAuthSetup(auth_cblock key, auth_wrapper_schedule schedule)
+{
+       CARD32 c,d,t,s;
+       CARD8 *in;
+       CARD32 *k;
+       int i;
+
+       k=(CARD32 *)schedule;
+       in=(CARD8 *)key;
+
+       c2l(in,c);
+       c2l(in,d);
+
+       /* do PC1 in 60 simple operations */
+       PERM_OP(d,c,t,4,0x0f0f0f0f);
+       HPERM_OP(c,t,-2, 0xcccc0000);
+       HPERM_OP(c,t,-1, 0xaaaa0000);
+       HPERM_OP(c,t, 8, 0x00ff0000);
+       HPERM_OP(c,t,-1, 0xaaaa0000);
+       HPERM_OP(d,t,-8, 0xff000000);
+       HPERM_OP(d,t, 8, 0x00ff0000);
+       HPERM_OP(d,t, 2, 0x33330000);
+       d=((d&0x00aa00aa)<<7)|((d&0x55005500)>>7)|(d&0xaa55aa55);
+       d=(d>>8)|((c&0xf0000000)>>4);
+       c&=0x0fffffff;
+
+       for (i=0; i<ITERATIONS; i++) {
+               if (shifts2[i]) {
+                       c=((c>>2)|(c<<26)); d=((d>>2)|(d<<26));
+               } else {
+                       c=((c>>1)|(c<<27)); d=((d>>1)|(d<<27));
+               }
+               c&=0x0fffffff;
+               d&=0x0fffffff;
+               /* could be a few less shifts but I am to lazy at this
+                * point in time to investigate */
+               s=      skb[0][ (c    )&0x3f                ]|
+                       skb[1][((c>> 6)&0x03)|((c>> 7)&0x3c)]|
+                       skb[2][((c>>13)&0x0f)|((c>>14)&0x30)]|
+                       skb[3][((c>>20)&0x01)|((c>>21)&0x06) |
+                                             ((c>>22)&0x38)];
+               t=      skb[4][ (d    )&0x3f                ]|
+                       skb[5][((d>> 7)&0x03)|((d>> 8)&0x3c)]|
+                       skb[6][ (d>>15)&0x3f                ]|
+                       skb[7][((d>>21)&0x0f)|((d>>22)&0x30)];
+
+               /* table contained 0213 4657 */
+               *(k++)=((t<<16)|(s&0x0000ffff));
+               s=     ((s>>16)|(t&0xffff0000));
+
+               s=(s<<4)|(s>>28);
+               *(k++)=s;
+       }
+       return;
+}
+
+#define D_ENCRYPT(L,R,S)       \
+       t=(R<<1)|(R>>31); \
+       u=(t^s[S  ]); \
+       t=(t^s[S+1]); \
+       t=(t>>4)|(t<<28); \
+       L^=     SPtrans[1][(t    )&0x3f]| \
+               SPtrans[3][(t>> 8)&0x3f]| \
+               SPtrans[5][(t>>16)&0x3f]| \
+               SPtrans[7][(t>>24)&0x3f]| \
+               SPtrans[0][(u    )&0x3f]| \
+               SPtrans[2][(u>> 8)&0x3f]| \
+               SPtrans[4][(u>>16)&0x3f]| \
+               SPtrans[6][(u>>24)&0x3f];
+
+
+void _XdmcpAuthDoIt(auth_cblock input, auth_cblock output,
+    auth_wrapper_schedule ks, int encrypt)
+{
+       CARD32 l,r,t,u;
+       CARD32 *s;
+       CARD8 *in,*out;
+       int i;
+
+       in=(CARD8 *)input;
+       out=(CARD8 *)output;
+       c2l(in,l);
+       c2l(in,r);
+
+       /* do IP */
+       PERM_OP(r,l,t, 4,0x0f0f0f0f);
+       PERM_OP(l,r,t,16,0x0000ffff);
+       PERM_OP(r,l,t, 2,0x33333333);
+       PERM_OP(l,r,t, 8,0x00ff00ff);
+       PERM_OP(r,l,t, 1,0x55555555);
+       /* r and l are reversed - remember that :-) */
+       t=l;
+       l=r;
+       r=t;
+
+       s=(CARD32 *)ks;
+
+       if (encrypt) {
+               for (i=0; i<(ITERATIONS*2); i+=4) {
+                       D_ENCRYPT(l,r,  i); /*  1 */
+                       D_ENCRYPT(r,l,  i+2); /*  2 */
+               }
+       } else {
+               for (i=(ITERATIONS*2)-2; i >= 0; i-=4) {
+                       D_ENCRYPT(l,r,  i); /*  1 */
+                       D_ENCRYPT(r,l,  i-2); /*  2 */
+               }
+       }
+
+       /* swap l and r
+        * we will not do the swap so just remember they are
+        * reversed for the rest of the subroutine
+        * luckily by FP fixes this problem :-) */
+
+       PERM_OP(r,l,t, 1,0x55555555);
+       PERM_OP(l,r,t, 8,0x00ff00ff);
+       PERM_OP(r,l,t, 2,0x33333333);
+       PERM_OP(l,r,t,16,0x0000ffff);
+       PERM_OP(r,l,t, 4,0x0f0f0f0f);
+
+       l2c(l,out);
+       l2c(r,out);
+       return;
+}
diff --git a/Write.c b/Write.c
new file mode 100755 (executable)
index 0000000..8eb9c50
--- /dev/null
+++ b/Write.c
@@ -0,0 +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;
+}
diff --git a/autogen.sh b/autogen.sh
new file mode 100755 (executable)
index 0000000..904cd67
--- /dev/null
@@ -0,0 +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 "$@"
diff --git a/configure.ac b/configure.ac
new file mode 100755 (executable)
index 0000000..5de378a
--- /dev/null
@@ -0,0 +1,68 @@
+dnl 
+dnl  Copyright © 2003 Keith Packard, Noah Levitt
+dnl 
+dnl  Permission to use, copy, modify, distribute, and sell this software and its
+dnl  documentation for any purpose is hereby granted without fee, provided that
+dnl  the above copyright notice appear in all copies and that both that
+dnl  copyright notice and this permission notice appear in supporting
+dnl  documentation, and that the name of Keith Packard not be used in
+dnl  advertising or publicity pertaining to distribution of the software without
+dnl  specific, written prior permission.  Keith Packard makes no
+dnl  representations about the suitability of this software for any purpose.  It
+dnl  is provided "as is" without express or implied warranty.
+dnl 
+dnl  KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+dnl  INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+dnl  EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+dnl  CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+dnl  DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+dnl  TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+dnl  PERFORMANCE OF THIS SOFTWARE.
+dnl
+dnl Process this file with autoconf to create configure.
+
+AC_PREREQ([2.60])
+AC_INIT([libXdmcp], [1.1.0],
+        [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXdmcp])
+AM_INIT_AUTOMAKE([foreign dist-bzip2])
+AM_MAINTAINER_MODE
+
+AM_CONFIG_HEADER(config.h)
+
+# Require xorg-macros minimum of 1.10 for HAVE_STYLESHEETS in XORG_CHECK_SGML_DOCTOOLS
+m4_ifndef([XORG_MACROS_VERSION],
+         [m4_fatal([must install xorg-macros 1.10 or later before running autoconf/autogen])])
+XORG_MACROS_VERSION(1.10)
+XORG_DEFAULT_OPTIONS
+XORG_ENABLE_DOCS
+XORG_WITH_XMLTO(0.0.20)
+XORG_WITH_FOP
+XORG_CHECK_SGML_DOCTOOLS(1.5)
+
+AC_PROG_LN_S
+AC_LIBTOOL_WIN32_DLL
+AM_PROG_LIBTOOL
+AC_PROG_MAKE_SET
+
+AC_CHECK_FUNCS([srand48 lrand48])
+
+AC_SEARCH_LIBS([recvfrom],[socket])
+
+PKG_CHECK_MODULES(XDMCP, xproto)
+
+if test -f ${srcdir}/Wraphelp.c; then
+       AC_DEFINE(HASXDMAUTH,1,[Has Wraphelp.c needed for XDM AUTH protocols])
+       HASXDMAUTH=yes
+else
+       HASXDMAUTH=no
+fi
+
+AM_CONDITIONAL(HASXDMAUTH,test x$HASXDMAUTH = xyes)
+
+dnl Allow checking code with lint, sparse, etc.
+XORG_WITH_LINT
+XORG_LINT_LIBRARY([Xdmcp])
+
+AC_OUTPUT([Makefile
+          doc/Makefile
+           xdmcp.pc])
diff --git a/debian/README.source b/debian/README.source
new file mode 100644 (file)
index 0000000..34ab4bf
--- /dev/null
@@ -0,0 +1,73 @@
+------------------------------------------------------
+Quick Guide To Patching This Package For The Impatient
+------------------------------------------------------
+
+1. Make sure you have quilt installed
+2. Unpack the package as usual with "dpkg-source -x"
+3. Run the "patch" target in debian/rules
+4. Create a new patch with "quilt new" (see quilt(1))
+5. Edit all the files you want to include in the patch with "quilt edit" 
+   (see quilt(1)).
+6. Write the patch with "quilt refresh" (see quilt(1))
+7. Run the "clean" target in debian/rules
+
+Alternatively, instead of using quilt directly, you can drop the patch in to 
+debian/patches and add the name of the patch to debian/patches/series.
+
+------------------------------------
+Guide To The X Strike Force Packages
+------------------------------------
+
+The X Strike Force team maintains X packages in git repositories on
+git.debian.org in the pkg-xorg subdirectory. Most upstream packages
+are actually maintained in git repositories as well, so they often
+just need to be pulled into git.debian.org in a "upstream-*" branch.
+Otherwise, the upstream sources are manually installed in the Debian
+git repository.
+
+The .orig.tar.gz upstream source file could be generated this
+"upstream-*" branch in the Debian git repository but it is actually
+copied from upstream tarballs directly.
+
+Due to X.org being highly modular, packaging all X.org applications
+as their own independent packages would have created too many Debian
+packages. For this reason, some X.org applications have been grouped
+into larger packages: xutils, xutils-dev, x11-apps, x11-session-utils,
+x11-utils, x11-xfs-utils, x11-xkb-utils, x11-xserver-utils.
+Most packages, including the X.org server itself and all libraries
+and drivers are, however maintained independently.
+
+The Debian packaging is added by creating the "debian-*" git branch
+which contains the aforementioned "upstream-*" branch plus the debian/
+repository files.
+When a patch has to be applied to the Debian package, two solutions
+are involved:
+* If the patch is available in one of the upstream branches, it
+  may be git'cherry-picked into the Debian repository. In this
+  case, it appears directly in the .diff.gz.
+* Otherwise, the patch is added to debian/patches/ which is managed
+  with quilt as documented in /usr/share/doc/quilt/README.source.
+
+quilt is actually invoked by the Debian X packaging through a larger
+set of scripts called XSFBS. XSFBS brings some other X specific
+features such as managing dependencies and conflicts due to the video
+and input driver ABIs.
+XSFBS itself is maintained in a separate repository at
+  git://git.debian.org/pkg-xorg/xsfbs.git
+and it is pulled inside the other Debian X repositories when needed.
+
+The XSFBS patching system requires a build dependency on quilt. Also
+a dependency on $(STAMP_DIR)/patch has to be added to debian/rules
+so that the XSFBS patching occurs before the actual build. So the
+very first target of the build (likely the one running autoreconf)
+should depend on $(STAMP_DIR)/patch. It should also not depend on
+anything so that parallel builds are correctly supported (nothing
+should probably run while patching is being done). And finally, the
+clean target should depend on the xsfclean target so that patches
+are unapplied on clean.
+
+When the upstream sources contain some DFSG-nonfree files, they are
+listed in text files in debian/prune/ in the "debian-*" branch of
+the Debian repository. XSFBS' scripts then take care of removing
+these listed files during the build so as to generate a modified
+DFSG-free .orig.tar.gz tarball.
diff --git a/debian/changelog b/debian/changelog
new file mode 100755 (executable)
index 0000000..c7f2b7a
--- /dev/null
@@ -0,0 +1,135 @@
+libxdmcp (1:1.1.0-1slp2) unstable; urgency=low
+
+  * [X11R7.6] upgrade package
+  * Git: 165.213.180.234:slp/pkgs/xorg/lib/libxdmcp
+  * Tag: libxdmcp_1.1.0-1slp2
+
+ -- SooChan Lim <sc1.lim@samsung.com>  Tue, 04 Jan 2011 11:00:22 +0900
+
+libxdmcp (1:1.0.3-2) unstable; urgency=low
+
+  [ Julien Cristau ]
+  * Rename the build directory to not include DEB_BUILD_GNU_TYPE for no
+    good reason.  Thanks, Colin Watson!
+  * Remove myself from Uploaders
+
+  [ Cyril Brulebois ]
+  * Add udeb needed for the graphical installer: libxdmcp6-udeb.
+  * Add myself to Uploaders.
+  * Bump Standards-Version from 3.8.3 to 3.8.4 (no changes needed).
+
+ -- Cyril Brulebois <kibi@debian.org>  Tue, 09 Mar 2010 02:30:26 +0100
+
+libxdmcp (1:1.0.3-1) unstable; urgency=low
+
+  [ Brice Goglin ]
+  * Add a link to www.X.org and a reference to the upstream module
+    in the long description.
+  * Add upstream URL to debian/copyright.
+
+  [ Timo Aaltonen ]
+  * New upstream release (closes: #555996).
+  * Run autoreconf on build. Add build-deps on automake, libtool
+    and xutils-dev.
+  * Parse space-separated DEB_BUILD_OPTIONS, and handle parallel=N.
+  * Bump Standards-Version to 3.8.3.
+  * Move -dbg package to section debug.
+  * Drop pre-dependency on x11-common from libxdmcp-dev. This was needed
+    for upgrades from sarge.
+
+ -- Julien Cristau <jcristau@debian.org>  Wed, 25 Nov 2009 16:28:22 +0100
+
+libxdmcp (1:1.0.2-3) unstable; urgency=low
+
+  * Put libxdmcp-dev in libdevel where it belongs.
+  * Remove Fabio and Branden from Uploaders with their permission.
+  * Add myself to Uploaders.
+  * Bump Standards-Version to 3.7.3.
+  * Drop the XS- prefix from Vcs-* control fields.
+  * libxdmcp6{,-dbg} don't need to depend on x11-common.
+  * Use ${binary:Version} instead of the deprecated ${Source-Version}.
+
+ -- Julien Cristau <jcristau@debian.org>  Sun, 18 May 2008 14:42:59 +0200
+
+libxdmcp (1:1.0.2-2) unstable; urgency=low
+
+  * Add "Section" header to binary packages in debian/control, with the values
+    from the override.
+  * Upload to unstable.
+  * Add XS-Vcs-Browser to debian/control.
+
+ -- Julien Cristau <jcristau@debian.org>  Wed, 11 Apr 2007 12:36:41 +0200
+
+libxdmcp (1:1.0.2-1) experimental; urgency=low
+
+  * New upstream release.
+  * Drop obsolete CVS info from the descriptions, and add XS-Vcs-Git.
+  * Install the upstream changelog.
+
+ -- Julien Cristau <jcristau@debian.org>  Tue, 13 Feb 2007 10:19:24 +0100
+
+libxdmcp (1:1.0.1-2) unstable; urgency=low
+
+  [ Andres Salomon ]
+  * Test for obj-$(DEB_BUILD_GNU_TYPE) before creating it during build;
+    idempotency fix.
+
+  [ Drew Parsons ]
+  * dbg package has priority extra.
+
+ -- David Nusinow <dnusinow@debian.org>  Tue, 29 Aug 2006 20:12:48 +0000
+
+libxdmcp (1:1.0.1-1) experimental; urgency=low
+
+  * New upstream release
+  * Version all x11-common dependencies to 1:7.0.0 to match the rest of Debian
+    and shut Debian up
+  * Remove extra dep on x11-common in the -dev package
+  * Bump standards version to 3.7.2.0
+  * Reformat -dev description so that it's not too long on any one line
+  * Bump debhelper compat to 5
+  * Run dh_install with --list-missing
+  * Don't try and install manpages for the -dev package, there aren't any
+
+ -- David Nusinow <dnusinow@debian.org>  Sun,  2 Jul 2006 22:13:38 -0400
+
+libxdmcp (1:1.0.0-4) unstable; urgency=low
+
+  * Reorder makeshlib command in rules file so that ldconfig is run
+    properly. Thanks Drew Parsons and Steve Langasek.
+
+ -- David Nusinow <dnusinow@debian.org>  Tue, 18 Apr 2006 21:49:58 -0400
+
+libxdmcp (1:1.0.0-3) unstable; urgency=low
+
+  * Upload to unstable
+
+ -- David Nusinow <dnusinow@debian.org>  Thu, 23 Mar 2006 22:44:34 -0500
+
+libxdmcp (1:1.0.0-2) experimental; urgency=low
+
+  * Version x11-common dependencies. Thanks Kurt Roeckx. (closes: #351779)
+
+ -- David Nusinow <dnusinow@debian.org>  Sun, 19 Mar 2006 23:35:55 -0500
+
+libxdmcp (1:1.0.0-1) experimental; urgency=low
+
+  * First upload to Debian
+  * In debian/rules copy Wraphelp.c to the build directory to allow des code
+    to build. This is an ugly hack and we'll remove it when we can. Thanks
+    Eugene Konev.
+
+ -- David Nusinow <dnusinow@debian.org>  Fri,  6 Jan 2006 00:48:12 -0500
+
+libxdmcp (1:0.1.3-2) breezy; urgency=low
+
+  * Add build dependencies: pkg-config, x11proto-core-dev
+  * Change Build-Depends-Indep to Build-Depends.
+
+ -- Matthias Klose <doko@ubuntu.com>  Mon, 23 May 2005 20:02:59 +0000
+
+libxdmcp (1:0.1.3-1) breezy; urgency=low
+
+  * First libxdmcp release.
+
+ -- Daniel Stone <daniel.stone@ubuntu.com>  Mon, 16 May 2005 22:10:17 +1000
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..7ed6ff8
--- /dev/null
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100755 (executable)
index 0000000..3f0e5b9
--- /dev/null
@@ -0,0 +1,72 @@
+Source: libxdmcp
+Section: x11
+Priority: optional
+Maintainer: YoungHoon Jung <yhoon.jung@samsung.com>, SangJin Lee <lsj119@samsung.com>, Debian X Strike Force <debian-x@lists.debian.org>
+Uploaders: SooChan Lim <sc1.lim@samsung.com>, David Nusinow <dnusinow@debian.org>, Cyril Brulebois <kibi@debian.org>
+Build-Depends: debhelper (>= 5.0.0), pkg-config, x11proto-core-dev, automake, libtool, xutils-dev (>= 1:7.5~1)
+Standards-Version: 3.8.4
+Vcs-Git: git://git.debian.org/git/pkg-xorg/lib/libxdmcp
+Vcs-Browser: http://git.debian.org/?p=pkg-xorg/lib/libxdmcp.git
+
+Package: libxdmcp6
+Architecture: any
+Section: libs
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: X11 Display Manager Control Protocol library
+ This package provides the main interface to the X11 display manager control
+ protocol library, which allows for remote logins to display managers.
+ .
+ More information about X.Org can be found at:
+ <URL:http://www.X.org>
+ <URL:http://xorg.freedesktop.org>
+ <URL:http://lists.freedesktop.org/mailman/listinfo/xorg>
+ .
+ This module can be found at
+ git://anongit.freedesktop.org/git/xorg/lib/libXdmcp
+
+#Package: libxdmcp6-udeb
+#XC-Package-Type: udeb
+#Architecture: any
+#Section: debian-installer
+#Depends: ${shlibs:Depends}, ${misc:Depends}
+#Description: X11 Display Manager Control Protocol library
+# This is a udeb, or a microdeb, for the debian-installer.
+
+Package: libxdmcp6-dbg
+Architecture: any
+Section: debug
+Priority: extra
+Depends: ${shlibs:Depends}, ${misc:Depends}, libxdmcp6 (= ${binary:Version})
+Description: X11 authorisation library (debug package)
+ This package provides the main interface to the X11 display manager control
+ protocol library, which allows for remote logins to display managers.
+ .
+ This package contains the debug versions of the library found in libxdmcp6.
+ Non-developers likely have little use for this package.
+ .
+ More information about X.Org can be found at:
+ <URL:http://www.X.org>
+ <URL:http://xorg.freedesktop.org>
+ <URL:http://lists.freedesktop.org/mailman/listinfo/xorg>
+ .
+ This module can be found at
+ git://anongit.freedesktop.org/git/xorg/lib/libXdmcp
+
+Package: libxdmcp-dev
+Architecture: any
+Section: libdevel
+Depends: ${shlibs:Depends}, ${misc:Depends}, libxdmcp6 (= ${binary:Version}), x11proto-core-dev
+Description: X11 authorisation library (development headers)
+ This package provides the main interface to the X11 display manager control
+ protocol library, which allows for remote logins to display managers.
+ .
+ This package contains the development headers for the library found in 
+ libxdmcp6. Non-developers likely have little use for this package.
+ .
+ More information about X.Org can be found at:
+ <URL:http://www.X.org>
+ <URL:http://xorg.freedesktop.org>
+ <URL:http://lists.freedesktop.org/mailman/listinfo/xorg>
+ .
+ This module can be found at
+ git://anongit.freedesktop.org/git/xorg/lib/libXdmcp
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..f4cec19
--- /dev/null
@@ -0,0 +1,26 @@
+This package was downloaded from
+http://xorg.freedesktop.org/releases/individual/lib/
+
+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/debian/libxdmcp-dev.install b/debian/libxdmcp-dev.install
new file mode 100755 (executable)
index 0000000..5cceac5
--- /dev/null
@@ -0,0 +1,5 @@
+usr/include/X11/*
+usr/lib/libXdmcp.a
+usr/lib/libXdmcp.so
+usr/lib/libXdmcp.la
+usr/lib/pkgconfig/xdmcp.pc
diff --git a/debian/libxdmcp6-udeb.install b/debian/libxdmcp6-udeb.install
new file mode 100644 (file)
index 0000000..e9d049b
--- /dev/null
@@ -0,0 +1 @@
+usr/lib/libXdmcp.so.6*
diff --git a/debian/libxdmcp6.install b/debian/libxdmcp6.install
new file mode 100644 (file)
index 0000000..e9d049b
--- /dev/null
@@ -0,0 +1 @@
+usr/lib/libXdmcp.so.6*
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..4631b62
--- /dev/null
@@ -0,0 +1,102 @@
+#!/usr/bin/make -f
+# debian/rules for the Debian libxdmcp package.
+# Copyright © 2004 Scott James Remnant <scott@netsplit.com>
+# Copyright © 2005 Daniel Stone <daniel@fooishbar.org>
+# Copyright © 2005 David Nusinow <dnusinow@debian.org>
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# set this to the name of the main shlib's binary package
+PACKAGE = libxdmcp6
+
+include debian/xsfbs/xsfbs.mk
+
+CFLAGS = -Wall -g
+ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
+       CFLAGS += -O0
+else
+       CFLAGS += -O2
+endif
+ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+       NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+       MAKEFLAGS += -j$(NUMJOBS)
+endif
+
+DEB_HOST_ARCH      ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
+DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
+       confflags += --build=$(DEB_HOST_GNU_TYPE)
+else
+       confflags += --build=$(DEB_HOST_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
+#      confflags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
+endif
+
+
+build: build-stamp
+build-stamp:
+       dh_testdir
+       autoreconf -vfi
+       test -d obj-$(DEB_BUILD_GNU_TYPE) || mkdir obj-$(DEB_BUILD_GNU_TYPE)
+       cp Wraphelp.c obj-$(DEB_BUILD_GNU_TYPE) #Ick... to allow des building
+       cd obj-$(DEB_BUILD_GNU_TYPE) && \
+       ../configure --prefix=/usr --mandir=\$${prefix}/share/man \
+                    --infodir=\$${prefix}/share/info $(confflags) \
+                    CFLAGS="$(CFLAGS)" 
+       cd obj-$(DEB_BUILD_GNU_TYPE) && $(MAKE)
+
+       touch build-stamp
+
+clean:
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp
+
+       rm -f config.cache config.log config.status
+       rm -f */config.cache */config.log */config.status
+       rm -f conftest* */conftest*
+       rm -rf autom4te.cache */autom4te.cache
+       rm -rf obj-*
+       rm -f aclocal.m4 config.guess config.h.in config.sub configure
+       rm -f depcomp install-sh missing mkinstalldirs
+       rm -f ltmain.sh
+       find -name Makefile.in -exec rm -f {} \;
+       #find -name Makefile.in -delete
+
+       dh_clean
+
+install: build
+       dh_testdir
+       dh_testroot
+       dh_clean -k
+       dh_installdirs
+
+       cd obj-$(DEB_BUILD_GNU_TYPE) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
+
+# Build architecture-dependent files here.
+binary-arch: build install
+       dh_testdir
+       dh_testroot
+
+#      dh_installdocs
+       dh_install --sourcedir=debian/tmp --list-missing
+#      dh_installchangelogs ChangeLog
+       dh_link
+       dh_strip --dbg-package=$(PACKAGE)-dbg
+       dh_compress
+       dh_fixperms
+       dh_makeshlibs
+#      dh_makeshlibs --add-udeb=$(PACKAGE)-udeb
+       dh_shlibdeps
+       dh_installdeb
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+# Build architecture-independent files here.
+binary-indep: build install
+# Nothing to do
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
diff --git a/debian/watch b/debian/watch
new file mode 100644 (file)
index 0000000..bda9722
--- /dev/null
@@ -0,0 +1,2 @@
+version=3
+http://xorg.freedesktop.org/releases/individual/lib/ libXdmcp-(.*)\.tar\.gz
diff --git a/debian/xsfbs/repack.sh b/debian/xsfbs/repack.sh
new file mode 100644 (file)
index 0000000..5935cc9
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+set -e
+
+if ! [ -d debian/prune ]; then
+       exit 0
+fi
+
+if [ "x$1" != x--upstream-version ]; then
+       exit 1
+fi
+
+version="$2"
+filename="$3"
+
+if [ -z "$version" ] || ! [ -f "$filename" ]; then
+       exit 1
+fi
+
+dir="$(pwd)"
+tempdir="$(mktemp -d)"
+
+cd "$tempdir"
+tar xf "$dir/$filename"
+cat "$dir"/debian/prune/* | while read file; do rm -f */$file; done
+
+tar czf "$dir/$filename" *
+cd "$dir"
+rm -rf "$tempdir"
+echo "Done pruning upstream tarball"
+
+exit 0
diff --git a/debian/xsfbs/xsfbs.mk b/debian/xsfbs/xsfbs.mk
new file mode 100644 (file)
index 0000000..5e16b10
--- /dev/null
@@ -0,0 +1,276 @@
+#!/usr/bin/make -f
+
+# Debian X Strike Force Build System (XSFBS): Make portion
+
+# Copyright 1996 Stephen Early
+# Copyright 1997 Mark Eichin
+# Copyright 1998-2005, 2007 Branden Robinson
+# Copyright 2005 David Nusinow
+#
+# Licensed under the GNU General Public License, version 2.  See the file
+# /usr/share/common-licenses/GPL or <http://www.gnu.org/copyleft/gpl.txt>.
+
+# Originally by Stephen Early <sde1000@debian.org>
+# Modified by Mark W. Eichin <eichin@kitten.gen.ma.us>
+# Modified by Adam Heath <doogie@debian.org>
+# Modified by Branden Robinson <branden@debian.org>
+# Modified by Fabio Massimo Di Nitto <fabbione@fabbione.net>
+# Modified by David Nusinow <dnusinow@debian.org>
+# Acknowledgements to Manoj Srivastava.
+
+# Pass $(DH_OPTIONS) into the environment for debhelper's benefit.
+export DH_OPTIONS
+
+# force quilt to not use ~/.quiltrc and to use debian/patches
+QUILT = QUILT_PATCHES=debian/patches quilt --quiltrc /dev/null
+
+# Set up parameters for the upstream build environment.
+
+# Determine (source) package name from Debian changelog.
+SOURCE_NAME:=$(shell dpkg-parsechangelog -ldebian/changelog \
+                        | grep '^Source:' | awk '{print $$2}')
+
+# Determine package version from Debian changelog.
+SOURCE_VERSION:=$(shell dpkg-parsechangelog -ldebian/changelog \
+                        | grep '^Version:' | awk '{print $$2}')
+
+# Determine upstream version number.
+UPSTREAM_VERSION:=$(shell echo $(SOURCE_VERSION) | sed 's/-.*//')
+
+# Determine the source version without the epoch for make-orig-tar-gz
+NO_EPOCH_VER:=$(shell echo $(UPSTREAM_VERSION) | sed 's/^.://')
+
+# Figure out who's building this package.
+BUILDER:=$(shell echo $${DEBEMAIL:-$${EMAIL:-$$(echo $$LOGNAME@$$(cat /etc/mailname 2>/dev/null))}})
+
+# Find out if this is an official build; an official build has nothing but
+# digits, dots, and/or the codename of a release in the Debian part of the
+# version number.  Anything else indicates an unofficial build.
+OFFICIAL_BUILD:=$(shell VERSION=$(SOURCE_VERSION); if ! expr "$$(echo $${VERSION\#\#*-} | sed 's/\(woody\|sarge\|etch\|lenny\)//g')" : ".*[^0-9.].*" >/dev/null 2>&1; then echo yes; fi)
+
+# Set up parameters for the Debian build environment.
+
+# Determine our architecture.
+BUILD_ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
+# Work around some old-time dpkg braindamage.
+BUILD_ARCH:=$(subst i486,i386,$(BUILD_ARCH))
+# The DEB_HOST_ARCH variable may be set per the Debian cross-compilation policy.
+ifdef DEB_HOST_ARCH
+ ARCH:=$(DEB_HOST_ARCH)
+else
+ # dpkg-cross sets the ARCH environment variable; if set, use it.
+ ifdef ARCH
+  ARCH:=$(ARCH)
+ else
+  ARCH:=$(BUILD_ARCH)
+ endif
+endif
+
+# $(STAMP_DIR) houses stamp files for complex targets.
+STAMP_DIR:=stampdir
+
+# $(DEBTREEDIR) is where all install rules are told (via $(DESTDIR)) to place
+# their files.
+DEBTREEDIR:=$(CURDIR)/debian/tmp
+
+# All "important" targets have four lines:
+#   1) A target name that is invoked by a package-building tool or the user.
+#      This consists of a dependency on a "$(STAMP_DIR)/"-prefixed counterpart.
+#   2) A line delcaring 1) as a phony target (".PHONY:").
+#   3) A "$(STAMP_DIR)/"-prefixed target which does the actual work, and may
+#   depend on other targets.
+#   4) A line declaring 3) as a member of the $(stampdir_targets) variable; the
+#   "$(STAMP_DIR)/" prefix is omitted.
+#
+# This indirection is needed so that the "stamp" files that signify when a rule
+# is done can be located in a separate "stampdir".  Recall that make has no way
+# to know when a goal has been met for a phony target (like "build" or
+# "install").
+#
+# At the end of each "$(STAMP_DIR)/" target, be sure to run the command ">$@"
+# so that the target will not be run again.  Removing the file will make Make
+# run the target over.
+
+# All phony targets should be declared as dependencies of .PHONY, even if they
+# do not have "($STAMP_DIR)/"-prefixed counterparts.
+
+# Define a harmless default rule to keep things from going nuts by accident.
+.PHONY: default
+default:
+
+# Set up the $(STAMP_DIR) directory.
+.PHONY: stampdir
+stampdir_targets+=stampdir
+stampdir: $(STAMP_DIR)/stampdir
+$(STAMP_DIR)/stampdir:
+       mkdir $(STAMP_DIR)
+       >$@
+
+# Set up the package build directory as quilt expects to find it.
+.PHONY: prepare
+stampdir_targets+=prepare
+prepare: $(STAMP_DIR)/prepare
+$(STAMP_DIR)/prepare: $(STAMP_DIR)/log $(STAMP_DIR)/genscripts
+       >$@
+
+.PHONY: log
+stampdir_targets+=log
+log: $(STAMP_DIR)/log
+$(STAMP_DIR)/log: $(STAMP_DIR)/stampdir
+       mkdir -p $(STAMP_DIR)/log
+
+# Apply all patches to the upstream source.
+.PHONY: patch
+stampdir_targets+=patch
+patch: $(STAMP_DIR)/patch
+$(STAMP_DIR)/patch: $(STAMP_DIR)/prepare
+       if ! [ `which quilt` ]; then \
+               echo "Couldn't find quilt. Please install it or add it to the build-depends for this package."; \
+               exit 1; \
+       fi; \
+       if $(QUILT) next >/dev/null 2>&1; then \
+         echo -n "Applying patches..."; \
+         if $(QUILT) push -a -v >$(STAMP_DIR)/log/patch 2>&1; then \
+           cat $(STAMP_DIR)/log/patch; \
+           echo "successful."; \
+         else \
+           cat $(STAMP_DIR)/log/patch; \
+           echo "failed! (check $(STAMP_DIR)/log/patch for details)"; \
+           exit 1; \
+         fi; \
+       else \
+         echo "No patches to apply"; \
+       fi; \
+       >$@
+
+# Revert all patches to the upstream source.
+.PHONY: unpatch
+unpatch: $(STAMP_DIR)/log
+       rm -f $(STAMP_DIR)/patch
+       @echo -n "Unapplying patches..."; \
+       if $(QUILT) applied >/dev/null 2>/dev/null; then \
+         if $(QUILT) pop -a -v >$(STAMP_DIR)/log/unpatch 2>&1; then \
+           cat $(STAMP_DIR)/log/unpatch; \
+           echo "successful."; \
+         else \
+           cat $(STAMP_DIR)/log/unpatch; \
+           echo "failed! (check $(STAMP_DIR)/log/unpatch for details)"; \
+           exit 1; \
+         fi; \
+       else \
+         echo "nothing to do."; \
+       fi
+
+# Clean the generated maintainer scripts.
+.PHONY: cleanscripts
+cleanscripts:
+       rm -f $(STAMP_DIR)/genscripts
+       rm -f debian/*.config \
+             debian/*.postinst \
+             debian/*.postrm \
+             debian/*.preinst \
+             debian/*.prerm
+
+# Clean the package build tree.
+.PHONY: xsfclean
+xsfclean: cleanscripts unpatch
+       dh_testdir
+       rm -rf .pc
+       rm -rf $(STAMP_DIR)
+       dh_clean
+
+# Remove files from the upstream source tree that we don't need, or which have
+# licensing problems.  It must be run before creating the .orig.tar.gz.
+#
+# Note: This rule is for Debian package maintainers' convenience, and is not
+# needed for conventional build scenarios.
+.PHONY: prune-upstream-tree
+prune-upstream-tree:
+       # Ensure we're in the correct directory.
+       dh_testdir
+       grep -rvh '^#' debian/prune/ | xargs --no-run-if-empty rm -rf
+
+# Verify that there are no offsets or fuzz in the patches we apply.
+#
+# Note: This rule is for Debian package maintainers' convenience, and is not
+# needed for conventional build scenarios.
+.PHONY: patch-audit
+patch-audit: prepare unpatch
+       @echo -n "Auditing patches..."; \
+       >$(STAMP_DIR)/log/patch; \
+       FUZZY=; \
+       while [ -n "$$($(QUILT) next)" ]; do \
+         RESULT=$$($(QUILT) push -v | tee -a $(STAMP_DIR)/log/patch | grep ^Hunk | sed 's/^Hunk.*\(succeeded\|FAILED\).*/\1/');\
+         case "$$RESULT" in \
+           succeeded) \
+             echo "fuzzy patch: $$($(QUILT) top)" \
+               | tee -a $(STAMP_DIR)/log/$$($(QUILT) top); \
+             FUZZY=yes; \
+             ;; \
+           FAILED) \
+             echo "broken patch: $$($(QUILT) next)" \
+               | tee -a $(STAMP_DIR)/log/$$($(QUILT) next); \
+             exit 1; \
+             ;; \
+         esac; \
+       done; \
+       if [ -n "$$FUZZY" ]; then \
+         echo "there were fuzzy patches; please fix."; \
+         exit 1; \
+       else \
+         echo "done."; \
+       fi
+
+# Generate the maintainer scripts.
+.PHONY: genscripts
+stampdir_targets+=genscripts
+genscripts: $(STAMP_DIR)/genscripts
+$(STAMP_DIR)/genscripts: $(STAMP_DIR)/stampdir
+       for FILE in debian/*.config.in \
+                   debian/*.postinst.in \
+                   debian/*.postrm.in \
+                   debian/*.preinst.in \
+                   debian/*.prerm.in; do \
+         if [ -e "$$FILE" ]; then \
+           MAINTSCRIPT=$$(echo $$FILE | sed 's/.in$$//'); \
+           sed -n '1,/^#INCLUDE_SHELL_LIB#$$/p' <$$FILE \
+             | sed -e '/^#INCLUDE_SHELL_LIB#$$/d' >$$MAINTSCRIPT.tmp; \
+           cat debian/xsfbs/xsfbs.sh >>$$MAINTSCRIPT.tmp; \
+           sed -n '/^#INCLUDE_SHELL_LIB#$$/,$$p' <$$FILE \
+             | sed -e '/^#INCLUDE_SHELL_LIB#$$/d' >>$$MAINTSCRIPT.tmp; \
+           sed -e 's/@SOURCE_VERSION@/$(SOURCE_VERSION)/' \
+               -e 's/@OFFICIAL_BUILD@/$(OFFICIAL_BUILD)/' \
+             <$$MAINTSCRIPT.tmp >$$MAINTSCRIPT; \
+           rm $$MAINTSCRIPT.tmp; \
+         fi; \
+       done
+       # Validate syntax of generated shell scripts.
+       #sh debian/scripts/validate-posix-sh debian/*.config \
+       #                                    debian/*.postinst \
+       #                                    debian/*.postrm \
+       #                                    debian/*.preinst \
+       #                                    debian/*.prerm
+       >$@
+
+SERVERMINVERS = $(shell cat /usr/share/xserver-xorg/serverminver 2>/dev/null)
+VIDEOABI = $(shell cat /usr/share/xserver-xorg/videoabiver 2>/dev/null)
+INPUTABI = $(shell cat /usr/share/xserver-xorg/inputabiver 2>/dev/null)
+SERVER_DEPENDS = xserver-xorg-core (>= $(SERVERMINVERS))
+VIDDRIVER_PROVIDES = xserver-xorg-video-$(VIDEOABI)
+INPDRIVER_PROVIDES = xserver-xorg-input-$(INPUTABI)
+ifeq ($(PACKAGE),)
+PACKAGE=$(shell awk '/^Package:/ { print $$2; exit }' < debian/control)
+endif
+
+.PHONY: serverabi
+serverabi: install
+ifeq ($(SERVERMINVERS),)
+       @echo error: xserver-xorg-dev needs to be installed
+       @exit 1
+else
+       echo "xserver:Depends=$(SERVER_DEPENDS)" >> debian/$(PACKAGE).substvars
+       echo "xviddriver:Provides=$(VIDDRIVER_PROVIDES)" >> debian/$(PACKAGE).substvars
+       echo "xinpdriver:Provides=$(INPDRIVER_PROVIDES)" >> debian/$(PACKAGE).substvars
+endif
+
+# vim:set noet ai sts=8 sw=8 tw=0:
diff --git a/debian/xsfbs/xsfbs.sh b/debian/xsfbs/xsfbs.sh
new file mode 100644 (file)
index 0000000..813fd8d
--- /dev/null
@@ -0,0 +1,622 @@
+# This is the X Strike Force shell library for X Window System package
+# maintainer scripts.  It serves to define shell functions commonly used by
+# such packages, and performs some error checking necessary for proper operation
+# of those functions.  By itself, it does not "do" much; the maintainer scripts
+# invoke the functions defined here to accomplish package installation and
+# removal tasks.
+
+# If you are reading this within a Debian package maintainer script (e.g.,
+# /var/lib/dpkg/info/PACKAGE.{config,preinst,postinst,prerm,postrm}), you can
+# skip past this library by scanning forward in this file to the string
+# "GOBSTOPPER".
+
+SOURCE_VERSION=@SOURCE_VERSION@
+OFFICIAL_BUILD=@OFFICIAL_BUILD@
+
+# Use special abnormal exit codes so that problems with this library are more
+# easily tracked down.
+SHELL_LIB_INTERNAL_ERROR=86
+SHELL_LIB_THROWN_ERROR=74
+SHELL_LIB_USAGE_ERROR=99
+
+# old -> new variable names
+if [ -z "$DEBUG_XORG_PACKAGE" ] && [ -n "$DEBUG_XFREE86_PACKAGE" ]; then
+  DEBUG_XORG_PACKAGE="$DEBUG_XFREE86_PACKAGE"
+fi
+if [ -z "$DEBUG_XORG_DEBCONF" ] && [ -n "$DEBUG_XFREE86_DEBCONF" ]; then
+  DEBUG_XORG_DEBCONF="$DEBUG_XFREE86_DEBCONF"
+fi
+
+# initial sanity checks
+if [ -z "$THIS_PACKAGE" ]; then
+  cat >&2 <<EOF
+Error: package maintainer script attempted to use shell library without
+definining \$THIS_PACKAGE shell variable.  Please report the package name,
+version, and the text of this error message to the Debian Bug Tracking System.
+Visit <http://www.debian.org/Bugs/Reporting> on the World Wide Web for
+instructions, read the file /usr/share/doc/debian/bug-reporting.txt from the
+"doc-debian" package, or install the "reportbug" package and use the command of
+the same name to file a report against version $SOURCE_VERSION of this package.
+EOF
+  exit $SHELL_LIB_USAGE_ERROR
+fi
+
+if [ -z "$THIS_SCRIPT" ]; then
+  cat >&2 <<EOF
+Error: package maintainer script attempted to use shell library without
+definining \$THIS_SCRIPT shell variable.  Please report the package name,
+version, and the text of this error message to the Debian Bug Tracking System.
+Visit <http://www.debian.org/Bugs/Reporting> on the World Wide Web for
+instructions, read the file /usr/share/doc/debian/bug-reporting.txt from the
+"doc-debian" package, or install the "reportbug" package and use the command of
+the same name to file a report against version $SOURCE_VERSION of the
+"$THIS_PACKAGE" package.
+EOF
+  exit $SHELL_LIB_USAGE_ERROR
+fi
+
+if [ "$1" = "reconfigure" ] || [ -n "$DEBCONF_RECONFIGURE" ]; then
+  RECONFIGURE="true"
+else
+  RECONFIGURE=
+fi
+
+if ([ "$1" = "install" ] || [ "$1" = "configure" ]) && [ -z "$2" ]; then
+  FIRSTINST="yes"
+fi
+
+if [ -z "$RECONFIGURE" ] && [ -z "$FIRSTINST" ]; then
+  UPGRADE="yes"
+fi
+
+trap "message;\
+      message \"Received signal.  Aborting $THIS_PACKAGE package $THIS_SCRIPT script.\";\
+      message;\
+      exit 1" HUP INT QUIT TERM
+
+reject_nondigits () {
+  # syntax: reject_nondigits [ operand ... ]
+  #
+  # scan operands (typically shell variables whose values cannot be trusted) for
+  # characters other than decimal digits and barf if any are found
+  while [ -n "$1" ]; do
+    # does the operand contain anything but digits?
+    if ! expr "$1" : "[[:digit:]]\+$" > /dev/null 2>&1; then
+      # can't use die(), because it wraps message() which wraps this function
+      echo "$THIS_PACKAGE $THIS_SCRIPT error: reject_nondigits() encountered" \
+           "possibly malicious garbage \"$1\"" >&2
+      exit $SHELL_LIB_THROWN_ERROR
+    fi
+    shift
+  done
+}
+
+reject_unlikely_path_chars () {
+  # syntax: reject_unlikely_path_chars [ operand ... ]
+  #
+  # scan operands (typically shell variables whose values cannot be trusted) for
+  # characters unlikely to be seen in a path and which the shell might
+  # interpret and barf if any are found
+  while [ -n "$1" ]; do
+    # does the operand contain any funny characters?
+    if expr "$1" : '.*[!$&()*;<>?|].*' > /dev/null 2>&1; then
+      # can't use die(), because I want to avoid forward references
+      echo "$THIS_PACKAGE $THIS_SCRIPT error: reject_unlikely_path_chars()" \
+           "encountered possibly malicious garbage \"$1\"" >&2
+      exit $SHELL_LIB_THROWN_ERROR
+    fi
+    shift
+  done
+}
+
+# Query the terminal to establish a default number of columns to use for
+# displaying messages to the user.  This is used only as a fallback in the
+# event the COLUMNS variable is not set.  ($COLUMNS can react to SIGWINCH while
+# the script is running, and this cannot, only being calculated once.)
+DEFCOLUMNS=$(stty size 2> /dev/null | awk '{print $2}') || true
+if ! expr "$DEFCOLUMNS" : "[[:digit:]]\+$" > /dev/null 2>&1; then
+  DEFCOLUMNS=80
+fi
+
+message () {
+  # pretty-print messages of arbitrary length
+  reject_nondigits "$COLUMNS"
+  echo "$*" | fmt -t -w ${COLUMNS:-$DEFCOLUMNS} >&2
+}
+
+observe () {
+  # syntax: observe message ...
+  #
+  # issue observational message suitable for logging someday when support for
+  # it exists in dpkg
+  if [ -n "$DEBUG_XORG_PACKAGE" ]; then
+    message "$THIS_PACKAGE $THIS_SCRIPT note: $*"
+  fi
+}
+
+warn () {
+  # syntax: warn message ...
+  #
+  # issue warning message suitable for logging someday when support for
+  # it exists in dpkg; also send to standard error
+  message "$THIS_PACKAGE $THIS_SCRIPT warning: $*"
+}
+
+die () {
+  # syntax: die message ...
+  #
+  # exit script with error message
+  message "$THIS_PACKAGE $THIS_SCRIPT error: $*"
+  exit $SHELL_LIB_THROWN_ERROR
+}
+
+internal_error () {
+  # exit script with error; essentially a "THIS SHOULD NEVER HAPPEN" message
+  message "internal error: $*"
+  if [ -n "$OFFICIAL_BUILD" ]; then
+    message "Please report a bug in the $THIS_SCRIPT script of the" \
+            "$THIS_PACKAGE package, version $SOURCE_VERSION to the Debian Bug" \
+            "Tracking System.  Include all messages above that mention the" \
+            "$THIS_PACKAGE package.  Visit " \
+            "<http://www.debian.org/Bugs/Reporting> on the World Wide Web for" \
+            "instructions, read the file" \
+            "/usr/share/doc/debian/bug-reporting.txt from the doc-debian" \
+            "package, or install the reportbug package and use the command of" \
+            "the same name to file a report."
+  fi
+  exit $SHELL_LIB_INTERNAL_ERROR
+}
+
+usage_error () {
+  message "usage error: $*"
+  message "Please report a bug in the $THIS_SCRIPT script of the" \
+          "$THIS_PACKAGE package, version $SOURCE_VERSION to the Debian Bug" \
+          "Tracking System.  Include all messages above that mention the" \
+          "$THIS_PACKAGE package.  Visit " \
+          "<http://www.debian.org/Bugs/Reporting> on the World Wide Web for" \
+          "instructions, read the file" \
+          "/usr/share/doc/debian/bug-reporting.txt from the doc-debian" \
+          "package, or install the reportbug package and use the command of" \
+          "the same name to file a report."
+  exit $SHELL_LIB_USAGE_ERROR
+}
+
+font_update () {
+  # run $UPDATECMDS in $FONTDIRS
+
+  local dir cmd shortcmd x_font_dir_prefix
+
+  x_font_dir_prefix="/usr/share/fonts/X11"
+
+  if [ -z "$UPDATECMDS" ]; then
+    usage_error "font_update() called but \$UPDATECMDS not set"
+  fi
+  if [ -z "$FONTDIRS" ]; then
+    usage_error "font_update() called but \$FONTDIRS not set"
+  fi
+
+  reject_unlikely_path_chars "$UPDATECMDS"
+  reject_unlikely_path_chars "$FONTDIRS"
+
+  for dir in $FONTDIRS; do
+    if [ -d "$x_font_dir_prefix/$dir" ]; then
+      for cmd in $UPDATECMDS; do
+        if which "$cmd" > /dev/null 2>&1; then
+          shortcmd=${cmd##*/}
+          observe "running $shortcmd in $dir font directory"
+         cmd_opts=
+          if [ "$shortcmd" = "update-fonts-alias" ]; then
+            cmd_opts=--x11r7-layout
+          fi
+          if [ "$shortcmd" = "update-fonts-dir" ]; then
+            cmd_opts=--x11r7-layout
+          fi
+          if [ "$shortcmd" = "update-fonts-scale" ]; then
+            cmd_opts=--x11r7-layout
+          fi
+          $cmd $cmd_opts $dir || warn "$cmd $cmd_opts $dir" \
+                              "failed; font directory data may not" \
+                              "be up to date"
+        else
+          warn "$cmd not found; not updating corresponding $dir font" \
+               "directory data"
+        fi
+      done
+    else
+      warn "$dir is not a directory; not updating font directory data"
+    fi
+  done
+}
+
+remove_conffile_prepare () {
+  # syntax: remove_conffile_prepare filename official_md5sum ...
+  #
+  # Check a conffile "filename" against a list of canonical MD5 checksums.
+  # If the file's current MD5 checksum matches one of the "official_md5sum"
+  # operands provided, then prepare the conffile for removal from the system.
+  # We defer actual deletion until the package is configured so that we can
+  # roll this operation back if package installation fails.
+  #
+  # Call this function from a preinst script in the event $1 is "upgrade" or
+  # "install" and verify $2 to ensure the package is being upgraded from a
+  # version (or installed over a version removed-but-not-purged) prior to the
+  # one in which the conffile was obsoleted.
+
+  local conffile current_checksum
+
+  # validate arguments
+  if [ $# -lt 2 ]; then
+    usage_error "remove_conffile_prepare() called with wrong number of" \
+                "arguments; expected at least 2, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  conffile="$1"
+  shift
+
+  # does the conffile even exist?
+  if [ -e "$conffile" ]; then
+    # calculate its checksum
+    current_checksum=$(md5sum < "$conffile" | sed 's/[[:space:]].*//')
+    # compare it to each supplied checksum
+    while [ -n "$1" ]; do
+      if [ "$current_checksum" = "$1" ]; then
+        # we found a match; move the confffile and stop looking
+        observe "preparing obsolete conffile $conffile for removal"
+        mv "$conffile" "$conffile.$THIS_PACKAGE-tmp"
+        break
+      fi
+      shift
+    done
+  fi
+}
+
+remove_conffile_lookup () {
+  # syntax: remove_conffile_lookup package filename
+  #
+  # Lookup the md5sum of a conffile in dpkg's database, and prepare for removal
+  # if it matches the actual file's md5sum.
+  #
+  # Call this function when you would call remove_conffile_prepare but only
+  # want to check against dpkg's status database instead of known checksums.
+
+  local package conffile old_md5sum
+
+  # validate arguments
+  if [ $# -ne 2 ]; then
+    usage_error "remove_conffile_lookup() called with wrong number of" \
+                "arguments; expected 1, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  package="$1"
+  conffile="$2"
+
+  if ! [ -e "$conffile" ]; then
+    return
+  fi
+  old_md5sum="$(dpkg-query -W -f='${Conffiles}' "$package" | \
+    awk '{ if (match($0, "^ '"$conffile"' ")) print $2}')"
+  if [ -n "$old_md5sum" ]; then
+    remove_conffile_prepare "$conffile" "$old_md5sum"
+  fi
+}
+
+remove_conffile_commit () {
+  # syntax: remove_conffile_commit filename
+  #
+  # Complete the removal of a conffile "filename" that has become obsolete.
+  #
+  # Call this function from a postinst script after having used
+  # remove_conffile_prepare() in the preinst.
+
+  local conffile
+
+  # validate arguments
+  if [ $# -ne 1 ]; then
+    usage_error "remove_conffile_commit() called with wrong number of" \
+                "arguments; expected 1, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  conffile="$1"
+
+  # if the temporary file created by remove_conffile_prepare() exists, remove it
+  if [ -e "$conffile.$THIS_PACKAGE-tmp" ]; then
+    observe "committing removal of obsolete conffile $conffile"
+    rm "$conffile.$THIS_PACKAGE-tmp"
+  fi
+}
+
+remove_conffile_rollback () {
+  # syntax: remove_conffile_rollback filename
+  #
+  # Roll back the removal of a conffile "filename".
+  #
+  # Call this function from a postrm script in the event $1 is "abort-upgrade"
+  # or "abort-install" is  after having used remove_conffile_prepare() in the
+  # preinst.
+
+  local conffile
+
+  # validate arguments
+  if [ $# -ne 1 ]; then
+    usage_error "remove_conffile_rollback() called with wrong number of" \
+                "arguments; expected 1, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  conffile="$1"
+
+  # if the temporary file created by remove_conffile_prepare() exists, move it
+  # back
+  if [ -e "$conffile.$THIS_PACKAGE-tmp" ]; then
+    observe "rolling back removal of obsolete conffile $conffile"
+    mv "$conffile.$THIS_PACKAGE-tmp" "$conffile"
+  fi
+}
+
+replace_conffile_with_symlink_prepare () {
+  # syntax: replace_conffile_with_symlink_prepare oldfilename newfilename \
+  # official_md5sum ...
+  #
+  # Check a conffile "oldfilename" against a list of canonical MD5 checksums.
+  # If the file's current MD5 checksum matches one of the "official_md5sum"
+  # operands provided, then prepare the conffile for removal from the system.
+  # We defer actual deletion until the package is configured so that we can
+  # roll this operation back if package installation fails. Otherwise copy it
+  # to newfilename and let dpkg handle it through conffiles mechanism.
+  #
+  # Call this function from a preinst script in the event $1 is "upgrade" or
+  # "install" and verify $2 to ensure the package is being upgraded from a
+  # version (or installed over a version removed-but-not-purged) prior to the
+  # one in which the conffile was obsoleted.
+
+  local conffile current_checksum
+
+  # validate arguments
+  if [ $# -lt 3 ]; then
+    usage_error "replace_conffile_with_symlink_prepare() called with wrong" \
+                " number of arguments; expected at least 3, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  oldconffile="$1"
+  shift
+  newconffile="$1"
+  shift
+
+  remove_conffile_prepare "$_oldconffile" "$@"
+  # If $oldconffile still exists, then md5sums didn't match.
+  # Copy it to new one.
+  if [ -f "$oldconffile" ]; then
+    cp "$oldconffile" "$newconffile"
+  fi
+
+}
+
+replace_conffile_with_symlink_commit () {
+  # syntax: replace_conffile_with_symlink_commit oldfilename
+  #
+  # Complete the removal of a conffile "oldfilename" that has been
+  # replaced by a symlink.
+  #
+  # Call this function from a postinst script after having used
+  # replace_conffile_with_symlink_prepare() in the preinst.
+
+  local conffile
+
+  # validate arguments
+  if [ $# -ne 1 ]; then
+    usage_error "replace_conffile_with_symlink_commit() called with wrong" \
+                "number of arguments; expected 1, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  conffile="$1"
+
+  remove_conffile_commit "$conffile"
+}
+
+replace_conffile_with_symlink_rollback () {
+  # syntax: replace_conffile_with_symlink_rollback oldfilename newfilename
+  #
+  # Roll back the replacing of a conffile "oldfilename" with symlink to
+  # "newfilename".
+  #
+  # Call this function from a postrm script in the event $1 is "abort-upgrade"
+  # or "abort-install" and verify $2 to ensure the package failed to upgrade
+  # from a version (or install over a version removed-but-not-purged) prior
+  # to the one in which the conffile was obsoleted.
+  # You should have  used replace_conffile_with_symlink_prepare() in the
+  # preinst.
+
+  local conffile
+
+  # validate arguments
+  if [ $# -ne 2 ]; then
+    usage_error "replace_conffile_with_symlink_rollback() called with wrong" \
+                "number of arguments; expected 2, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  oldconffile="$1"
+  newconffile="$2"
+
+  remove_conffile_rollback "$_oldconffile"
+  if [ -f "$newconffile" ]; then
+    rm "$newconffile"
+  fi
+}
+
+run () {
+  # syntax: run command [ argument ... ]
+  #
+  # Run specified command with optional arguments and report its exit status.
+  # Useful for commands whose exit status may be nonzero, but still acceptable,
+  # or commands whose failure is not fatal to us.
+  #
+  # NOTE: Do *not* use this function with db_get or db_metaget commands; in
+  # those cases the return value of the debconf command *must* be checked
+  # before the string returned by debconf is used for anything.
+
+  local retval
+
+  # validate arguments
+  if [ $# -lt 1 ]; then
+    usage_error "run() called with wrong number of arguments; expected at" \
+                "least 1, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  "$@" || retval=$?
+
+  if [ ${retval:-0} -ne 0 ]; then
+    observe "command \"$*\" exited with status $retval"
+  fi
+}
+
+make_symlink_sane () {
+  # syntax: make_symlink_sane symlink target
+  #
+  # Ensure that the symbolic link symlink exists, and points to target.
+  #
+  # If symlink does not exist, create it and point it at target.
+  #
+  # If symlink exists but is not a symbolic link, back it up.
+  #
+  # If symlink exists, is a symbolic link, but points to the wrong location, fix
+  # it.
+  #
+  # If symlink exists, is a symbolic link, and already points to target, do
+  # nothing.
+  #
+  # This function wouldn't be needed if ln had an -I, --idempotent option.
+
+  # Validate arguments.
+  if [ $# -ne 2 ]; then
+    usage_error "make_symlink_sane() called with wrong number of arguments;" \
+      "expected 2, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  # We could just use the positional parameters as-is, but that makes things
+  # harder to follow.
+  local symlink target
+
+  symlink="$1"
+  target="$2"
+
+  if [ -L "$symlink" ] && [ "$(readlink "$symlink")" = "$target" ]; then
+      observe "link from $symlink to $target already exists"
+  else
+    observe "creating symbolic link from $symlink to $target"
+    mkdir -p "${target%/*}" "${symlink%/*}"
+    ln -s -b -S ".dpkg-old" "$target" "$symlink"
+  fi
+}
+
+migrate_dir_to_symlink () {
+  # syntax: migrate_dir_to_symlink old_location new_location
+  #
+  # Per Debian Policy section 6.5.4, "A directory will never be replaced by a
+  # symbolic link to a directory or vice versa; instead, the existing state
+  # (symlink or not) will be left alone and dpkg will follow the symlink if
+  # there is one."
+  #
+  # We have to do it ourselves.
+  #
+  # This function moves the contents of old_location, a directory, into
+  # new_location, a directory, then makes old_location a symbolic link to
+  # new_location.
+  #
+  # old_location need not exist, but if it does, it must be a directory (or a
+  # symlink to a directory).  If it is not, it is backed up.  If new_location
+  # exists already and is not a directory, it is backed up.
+  #
+  # This function should be called from a package's preinst so that other
+  # packages unpacked after this one --- but before this package's postinst runs
+  # --- are unpacked into new_location even if their payloads contain
+  # old_location filespecs.
+
+  # Validate arguments.
+  if [ $# -ne 2 ]; then
+    usage_error "migrate_dir_to_symlink() called with wrong number of"
+                "arguments; expected 2, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  # We could just use the positional parameters as-is, but that makes things
+  # harder to follow.
+  local new old
+
+  old="$1"
+  new="$2"
+
+  # Is old location a symlink?
+  if [ -L "$old" ]; then
+    # Does it already point to new location?
+    if [ "$(readlink "$old")" = "$new" ]; then
+      # Nothing to do; migration has already been done.
+      observe "migration of $old to $new already done"
+      return 0
+    else
+      # Back it up.
+      warn "backing up symbolic link $old as $old.dpkg-old"
+      mv -b "$old" "$old.dpkg-old"
+    fi
+  fi
+
+  # Does old location exist, but is not a directory?
+  if [ -e "$old" ] && ! [ -d "$old" ]; then
+      # Back it up.
+      warn "backing up non-directory $old as $old.dpkg-old"
+      mv -b "$old" "$old.dpkg-old"
+  fi
+
+  observe "migrating $old to $new"
+
+  # Is new location a symlink?
+  if [ -L "$new" ]; then
+    # Does it point the wrong way, i.e., back to where we're migrating from?
+    if [ "$(readlink "$new")" = "$old" ]; then
+      # Get rid of it.
+      observe "removing symbolic link $new which points to $old"
+      rm "$new"
+    else
+      # Back it up.
+      warn "backing up symbolic link $new as $new.dpkg-old"
+      mv -b "$new" "$new.dpkg-old"
+    fi
+  fi
+
+  # Does new location exist, but is not a directory?
+  if [ -e "$new" ] && ! [ -d "$new" ]; then
+    warn "backing up non-directory $new as $new.dpkg-old"
+    mv -b "$new" "$new.dpkg-old"
+  fi
+
+  # Create new directory if it does not yet exist.
+  if ! [ -e "$new" ]; then
+    observe "creating $new"
+    mkdir -p "$new"
+  fi
+
+  # Copy files in old location to new location.  Back up any filenames that
+  # already exist in the new location with the extension ".dpkg-old".
+  observe "copying files from $old to $new"
+  if ! (cd "$old" && cp -a -b -S ".dpkg-old" . "$new"); then
+    die "error(s) encountered while copying files from $old to $new"
+  fi
+
+  # Remove files at old location.
+  observe "removing $old"
+  rm -r "$old"
+
+  # Create symlink from old location to new location.
+  make_symlink_sane "$old" "$new"
+}
+
+# vim:set ai et sw=2 ts=2 tw=80:
+
+# GOBSTOPPER: The X Strike Force shell library ends here.
diff --git a/doc/Makefile.am b/doc/Makefile.am
new file mode 100755 (executable)
index 0000000..c2aa671
--- /dev/null
@@ -0,0 +1,64 @@
+#
+# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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.
+#
+
+if ENABLE_DOCS
+doc_sources = xdmcp.xml
+dist_doc_DATA = $(doc_sources)
+
+if HAVE_XMLTO
+doc_DATA = $(doc_sources:.xml=.html)
+
+if HAVE_FOP
+doc_DATA += $(doc_sources:.xml=.ps) $(doc_sources:.xml=.pdf)
+endif
+
+if HAVE_XMLTO_TEXT
+doc_DATA += $(doc_sources:.xml=.txt)
+endif
+
+if HAVE_STYLESHEETS
+XMLTO_FLAGS = -m $(XSL_STYLESHEET)
+
+doc_DATA += xorg.css
+xorg.css: $(STYLESHEET_SRCDIR)/xorg.css
+       $(AM_V_GEN)cp -pf $(STYLESHEET_SRCDIR)/xorg.css $@
+endif
+
+CLEANFILES = $(doc_DATA)
+
+SUFFIXES = .xml .ps .pdf .txt .html
+
+.xml.txt:
+       $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) txt $<
+
+.xml.html:
+       $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) xhtml-nochunks $<
+
+.xml.pdf:
+       $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) --with-fop pdf $<
+
+.xml.ps:
+       $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) --with-fop ps $<
+
+endif HAVE_XMLTO
+endif ENABLE_DOCS
diff --git a/doc/xdmcp.xml b/doc/xdmcp.xml
new file mode 100755 (executable)
index 0000000..22bccc6
--- /dev/null
@@ -0,0 +1,3895 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+                   "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
+
+<book id="xdmcp">
+
+<bookinfo>
+   <title>X Display Manager Control Protocol</title>
+   <subtitle>X.Org Standard</subtitle>
+   <releaseinfo>Version 1.1</releaseinfo>
+   <authorgroup>
+   <author>
+      <firstname>Keith</firstname><surname>Packard</surname>
+      <affiliation><orgname>
+X Consortium,
+Laboratory for Computer Science,
+Massachusetts Institute of Technology
+      </orgname></affiliation>
+   </author>
+   </authorgroup>
+
+   <copyright><year>1989</year><holder>The Open Group</holder></copyright>
+   <copyright><year>2004</year><holder>The Open Group</holder></copyright>
+   <productnumber>X Version 11, Release 6.8</productnumber>
+
+<legalnotice>
+
+
+
+<para>
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+</para>
+<para>
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+</para>
+<para>
+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.
+</para>
+<para>
+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.
+</para>
+
+<para>
+<emphasis remap='I'>X Window System</emphasis> is a trademark of The Open Group.
+</para>
+</legalnotice>
+</bookinfo>
+
+<chapter id="TITLE">
+<title>TITLE</title>
+<sect1 id="Purpose_and_Goals">
+<title>Purpose and Goals</title>
+<!-- .XS -->
+<!-- (SN Purpose and Goals -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+The purpose of the X Display Manager Control Protocol (XDMCP)
+is to provide a uniform mechanism for an autonomous
+display to request login service from a remote host.
+By autonomous, we mean
+the display consists of hardware and processes that are independent of any
+particular host where login service is desired.  (For example, the server
+cannot simply be started by a
+<function>fork/exec</function>
+sequence on the host.)
+An X terminal (screen, keyboard, mouse, processor, network interface)
+is a prime example of an autonomous display.
+</para>
+
+<para>
+From the point of view of the end user, it is very important to make
+autonomous displays as easy to use as traditional hardwired character
+terminals.  Specifically, you can typically just power on a hardwired
+terminal and be greeted with a login prompt.  The same should be possible
+with autonomous displays.  However, in a network environment with multiple
+hosts, the end user may want to choose which host(s) to connect to.  In an
+environment with many displays and many hosts, a site administrator may want
+to associate particular collections of hosts with particular displays.  We
+would like to support the following options:
+</para>
+
+<itemizedlist>
+  <listitem>
+    <para>
+The display has a single, fixed host to which it should connect.  It should be
+possible to power on the display and receive a login prompt, without user
+intervention.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Any one of several hosts on a network or subnetwork may be acceptable
+for accepting login from the display.
+(For example, the user's file systems can be mounted onto
+any such host, providing comparable environments.)  It should be possible
+for the display to broadcast to find such hosts and to have the display
+either automatically choose a host or present the possible hosts to the
+user for selection.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+The display has a fixed set of hosts that it can connect to.  It should be
+possible for the display to have that set stored in RAM, but it should also be
+possible for a site administrator to be able to maintain host sets for a
+large number of displays using a centralized facility, without having to
+interact (physically or electronically) with each individual display.
+Particular hosts should be allowed to refuse login service, based on
+whatever local criteria are desired.
+    </para>
+  </listitem>
+</itemizedlist>
+
+<para>
+The control protocol should be designed in such a way that it can be used over
+a reasonable variety of communication transport layers.  In fact, it is quite
+desirable if every major network protocol family that supports the standard X
+protocol is also capable of supporting XDMCP, because the end result of XDMCP
+negotiation will be standard X protocol connections to the display.
+However, because the number of displays per host may be large,
+a connection-based protocol appears less desirable
+than a connection-less protocol.  For this reason the protocol is designed
+to use datagram services with the display responsible for sequencing and
+retransmission.
+</para>
+<para>
+<!-- .LP -->
+To keep the burden on displays at a minimum (because display cost is not
+a factor that can be ignored), it is desirable that displays not be required
+to maintain permanent state (across power cycles) for the purposes
+of the control protocol,
+and it is desirable to keep required state at a minimum while the
+display is powered on.
+</para>
+<para>
+<!-- .LP -->
+Security is an important consideration and must be an integral part of the
+design.  The important security goals in the context of XDMCP are:
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+It should be possible for the display to verify that it is communicating
+with a legitimate host login service.  Because the user will present
+credentials (for example, password) to this service,
+it is important to avoid spoof attacks.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+It should be possible for the display and the login service to negotiate the
+authorization mechanism to be used for the standard X protocol.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+It should be possible to provide the same level of security in verifying the
+login service as is provided by the negotiated authorization mechanism.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Because there are no firm standards yet in the area of security,
+XDMCP must be flexible enough to accomodate a variety of security mechanisms.
+    </para>
+  </listitem>
+</itemizedlist>
+</sect1>
+
+<sect1 id="Overview_of_the_Protocol">
+<title>Overview of the Protocol</title>
+<!-- .XS -->
+<!-- (SN Overview of the Protocol -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+XDMCP is designed to provide authenticated access to display management
+services for remote displays.  A new network server, called a \fIDisplay
+Manager\fP, will use XDMCP to communicate with displays to negotiate the
+startup of X sessions.  The protocol allows the display to authenticate the
+manager.  It also allows most of the configuration information to be
+centralized with the manager and to ease the burden of system administration
+in a large network of displays.
+The essential goal is to provide plug-and-play
+services similar to those provided in the familiar mainframe/terminal world.
+</para>
+<para>
+<!-- .LP -->
+Displays may be turned off by the user at any time.  Any existing session
+running on a display that has been turned off must be identifiable.  This
+is made possible by requiring a three-way handshake to start a session.  If
+the handshake succeeds, any existing session is terminated immediately and a
+new session started.  There is the problem (at least with TCP) that
+connections may not be closed when the display is turned off.  In most
+environments, the manager should reduce this problem by periodically XSync'ing
+on its own connection, perhaps every five to ten minutes, and terminating the
+session if its own connection ever closes.
+</para>
+<para>
+<!-- .LP -->
+Displays should not be required to retain permanent state for purposes of
+the control protocol.  One solution to packets received out of sequence
+would be to use monotonically increasing message identifiers in each message
+to allow both sides to ignore messages that arrive out-of-sequence.  For
+this to work, displays would at a minimum have to increment a stable crash
+count each time they are powered on and use that number as part of a
+larger sequence number.  But if displays cannot retain permanent state this
+cannot work.  Instead, the manager assumes the responsibility for permanent
+state by generating unique numbers that identify a particular session and
+the protocol simply ignores packets that correspond to an invalid session.
+</para>
+<para>
+<!-- .LP -->
+The Manager must not be responsible for packet reception.  To prevent the
+Manager from becoming stuck because of a hostile display, no portion of the
+protocol requires the Manager to retransmit a packet.  Part of this means
+that any valid packet that the Manager does receive must be
+acknowledged in some way to prevent the display from continuously resending
+packets.  The display can keep the protocol running as it will always know
+when the Manager has received (at least one copy of) a packet.  On the
+Manager side, this means that any packet may be received more than once (if
+the response was lost) and duplicates must be ignored.
+</para>
+</sect1>
+
+<sect1 id="Data_Types">
+<title>Data Types</title>
+<!-- .XS -->
+<!-- (SN Data Types -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+XDMCP packets contain several types of data.  Integer values are always
+stored most significant byte first in the packet ("Big Endian" order).
+As XDMCP will not be used to transport large quantities of data, this
+restriction will not substantially hamper the efficiency of any
+implementation.  Also, no padding of any sort will occur within the packets.
+</para>
+
+<informaltable frame="none">
+  <tgroup cols='3' align='left'>
+  <colspec colname='c1' colsep="0"/>
+  <colspec colname='c2' colsep="0"/>
+  <colspec colname='c3' colsep="0"/>
+  <thead>
+    <row>
+      <entry>Type Name</entry>
+      <entry>Length (Bytes)</entry>
+      <entry>Description</entry>
+    </row>
+  </thead>
+  <tbody>
+    <row rowsep="0">
+      <entry>CARD8</entry>
+      <entry>1</entry>
+      <entry>A single byte unsigned integer</entry>
+    </row>
+    <row rowsep="0">
+      <entry>CARD16</entry>
+      <entry>2</entry>
+      <entry>Two byte unsigned integer</entry>
+    </row>
+    <row rowsep="0">
+      <entry>CARD32</entry>
+      <entry>4</entry>
+      <entry>Four byte unsigned integer</entry>
+    </row>
+    <row rowsep="0">
+      <entry>ARRAY8</entry>
+      <entry>n+2</entry>
+      <entry>
+This is actually a CARD16 followed by
+a collection of CARD8.  The value of the CARD16
+field (n) specifies the number of CARD8 values to follow
+      </entry>
+    </row>
+    <row rowsep="0">
+      <entry>ARRAY16</entry>
+      <entry>2*m+1</entry>
+      <entry>
+This is a CARD8 (m) which specifies the
+number of CARD16 values to follow
+      </entry>
+    </row>
+    <row rowsep="0">
+      <entry>ARRAY32</entry>
+      <entry>4*l+1</entry>
+      <entry>
+This is a CARD8 (l) which specifies the
+number of CARD32 values to follow
+      </entry>
+    </row>
+    <row rowsep="0">
+      <entry>ARRAYofARRAY8</entry>
+      <entry>?</entry>
+      <entry>
+This is a CARD8 which specifies the
+number of ARRAY8 values to follow.
+      </entry>
+    </row>
+  </tbody>
+  </tgroup>
+</informaltable>
+</sect1>
+
+<sect1 id="Packet_Format">
+<title>Packet Format</title>
+<!-- .XS -->
+<!-- (SN Packet Format -->
+<!-- .XE -->
+<para>
+All XDMCP packets have the following information:
+</para>
+
+<informaltable frame="none">
+  <tgroup cols='3' align='left'>
+  <colspec colname='c1' colsep="0"/>
+  <colspec colname='c2' colsep="0"/>
+  <colspec colname='c3' colsep="0"/>
+  <thead>
+    <row>
+      <entry>Length (Bytes)</entry>
+      <entry>Field Type</entry>
+      <entry>Description</entry>
+    </row>
+  </thead>
+  <tbody>
+    <row rowsep="0">
+      <entry>2</entry>
+      <entry>CARD16</entry>
+      <entry>version number</entry>
+    </row>
+    <row rowsep="0">
+      <entry>2</entry>
+      <entry>CARD16</entry>
+      <entry>opcode packet header</entry>
+    </row>
+    <row rowsep="0">
+      <entry>2</entry>
+      <entry>CARD16</entry>
+      <entry>n = length of remaining data in bytes</entry>
+    </row>
+    <row rowsep="0">
+      <entry>n</entry>
+      <entry>???</entry>
+      <entry>packet-specific data</entry>
+    </row>
+  </tbody>
+  </tgroup>
+</informaltable>
+
+<para>
+<!-- .LP -->
+The fields are as follows:
+</para>
+
+<variablelist>
+  <varlistentry>
+    <term>Version number</term>
+    <listitem>
+      <para>
+This specifies the version of XDMCP that generated this packet in
+case changes in this protocol are required.  Displays and
+managers may choose to support older versions for compatibility.
+This field will initially be one (1).
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>Opcode</term>
+    <listitem>
+      <para>
+This specifies what step of the protocol this packet represents and should
+contain one of the following values (encoding provided in section below):
+<emphasis role="bold">BroadcastQuery</emphasis>,
+<emphasis role="bold">Query</emphasis>,
+<emphasis role="bold">IndirectQuery</emphasis>,
+<emphasis role="bold">ForwardQuery</emphasis>,
+<emphasis role="bold">Willing</emphasis>,
+<emphasis role="bold">Unwilling</emphasis>,
+<emphasis role="bold">Request</emphasis>,
+<emphasis role="bold">Accept</emphasis>,
+<emphasis role="bold">Decline</emphasis>,
+<emphasis role="bold">Manage</emphasis>,
+<emphasis role="bold">Refuse</emphasis>,
+<emphasis role="bold">Failed</emphasis>,
+<emphasis role="bold">KeepAlive</emphasis>
+or
+<emphasis role="bold">Alive</emphasis>.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>Length of data in bytes</term>
+    <listitem>
+      <para>
+This specifies the length of the information following the first 6 bytes.
+Each packet-type has a different format and will need to be separately
+length-checked against this value.  Because every data item has either an
+explicit or implicit length, this can be easily accomplished.
+Packets that have too little or too much data should be ignored.
+      </para>
+    </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+Packets should be checked to make sure that they satisfy the following
+conditions:
+</para>
+
+<orderedlist>
+  <listitem>
+    <para>
+They must contain valid opcodes.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+The length of the remaining data should correspond to the sum of the
+lengths of the individual remaining data items.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+The opcode should be expected (a finite state diagram is given
+in a later section).
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+If the packet is of type
+<emphasis role="bold">Manage</emphasis> or
+<emphasis role="bold">Refuse</emphasis>,
+the Session ID should match the value sent in the preceding
+<emphasis role="bold">Accept</emphasis> packet.
+    </para>
+  </listitem>
+</orderedlist>
+</sect1>
+
+<sect1 id="Protocol">
+<title>Protocol</title>
+<!-- .XS -->
+<!-- (SN Protocol -->
+<!-- .XE -->
+<para>
+Each of the opcodes is described below.  Because a given packet type is only
+ever sent one way, each packet description below indicates the direction.
+Most of the packets have additional information included beyond the
+description above.  The additional information is appended to the packet
+header in the order described without padding, and the length field is
+computed accordingly.
+</para>
+
+<informaltable frame="none">
+  <tgroup cols='10' align='left'>
+  <colspec colname='col1' colsep="0" colwidth="1*"/>
+  <colspec colname='col2' colsep="0" colwidth="1*"/>
+  <colspec colname='col3' colsep="0" colwidth="1*"/>
+  <colspec colname='col4' colsep="0" colwidth="1*"/>
+  <colspec colname='col5' colsep="0" colwidth="1*"/>
+  <colspec colname='col6' colsep="0" colwidth="1*"/>
+  <colspec colname='col7' colsep="0" colwidth="1*"/>
+  <colspec colname='col8' colsep="0" colwidth="1*"/>
+  <colspec colname='col9' colsep="0" colwidth="1*"/>
+  <colspec colname='col10' colsep="0" colwidth="1*"/>
+  <spanspec namest="col1" nameend="col10" spanname="col1_on" align="left"/>
+  <spanspec namest="col2" nameend="col10" spanname="col2_on" align="left"/>
+  <spanspec namest="col3" nameend="col10" spanname="col3_on" align="left"/>
+  <spanspec namest="col4" nameend="col10" spanname="col4_on" align="left"/>
+  <spanspec namest="col5" nameend="col10" spanname="col5_on" align="left"/>
+  <tbody>
+    <row rowsep="0">
+      <entry spanname="col1_on"><emphasis role="bold">Query</emphasis></entry>
+    </row>
+    <row rowsep="0">
+      <entry spanname="col1_on"><emphasis role="bold">BroadcastQuery</emphasis></entry>
+    </row>
+    <row rowsep="0">
+      <entry spanname="col1_on"><emphasis role="bold">IndirectQuery</emphasis></entry>
+    </row>
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">Display -> Manager</entry>
+    </row>
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">Additional Fields:</entry>
+    </row>
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+<emphasis>Authentication Names</emphasis>: ARRAYofARRAY8
+      </entry>
+    </row>
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Specifies a list of authentication names that the display supports.  The
+manager will choose one of these and return it in the
+<emphasis role="bold">Willing</emphasis> packet.
+      </entry>
+    </row>
+<!-- AAAAAAAAAAAAA -->
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry>Semantics</entry>
+    </row>
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+<para>
+A <function>Query</function>
+packet is sent from the display to a specific host to ask if
+that host is willing to provide management services to this display.  The
+host should respond with
+<function>Willing</function>
+if it is willing to service the display or
+<function>Unwilling</function>
+if it is not.
+</para>
+
+<para>
+A
+<function>BroadcastQuery</function>
+packet is similar to the
+<function>Query</function>
+packet except that it is intended to be received by all hosts on the network
+(or subnetwork).  However, unlike
+<function>Query</function>
+requests, hosts that are not willing to service the display
+should simply ignore
+<function>BroadcastQuery</function>
+requests.
+</para>
+
+<para>
+An
+<function>IndirectQuery</function>
+packet is sent to a well known manager that forwards
+the request to a larger collection of secondary managers using
+<function>ForwardQuery</function>
+packets.
+In this way, the collection of managers that respond can be grouped
+on other than network boundaries; the use of a central manager reduces
+system administrative overhead.
+The primary manager may also send a
+<function>Willing</function>
+packet in response to this packet.
+</para>
+
+<para>
+Each packet type has slightly different semantics:
+</para>
+      </entry>
+    </row>
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col5_on">
+<para>
+The
+<function>Query</function>
+packet is destined only for a single host.
+If the display is instructed to
+<function>Query</function>
+multiple managers, it will send multiple
+<function>Query</function>
+packets.  The
+<function>Query</function>
+packet also demands a response from the manager, either
+<function>Willing</function>
+or
+<function>Unwilling</function>.
+    </para>
+    <para>
+The
+<function>BroadcastQuery</function>
+packet is sent to many hosts.
+Each manager that receives this packet will not respond with an
+<function>Unwilling</function>
+packet.
+    </para>
+    <para>
+The
+<function>IndirectQuery</function>
+packet is sent to only one manager with the request
+that the request be forwarded to a larger list of managers using
+<function>ForwardQuery</function>
+packets.  This list is expected to be maintained at one
+central site to reduce administrative overhead.
+The function of this packet type is similar to
+<function>BroadcastQuery except that</function>
+<function>BroadcastQuery</function>
+is not forwarded.
+    </para>
+      </entry>
+    </row>
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">Valid Responses:</entry>
+    </row>
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+<function>Willing</function>,
+<function>Unwilling</function>
+      </entry>
+    </row>
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">Problems/Solutions:</entry>
+    </row>
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">Problem:</entry>
+    </row>
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+<para>Not all managers receive the query packet.</para>
+<para>Indication:</para>
+      </entry>
+    </row>
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col5_on">
+None if
+<function>BroadcastQuery</function>
+or
+<function>IndirectQuery</function>
+was sent, else failure to receive
+<function>Willing</function>.
+      </entry>
+    </row>
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">Solution:</entry>
+    </row>
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col5_on">
+Repeatedly send the packet while waiting for user to choose a manager.
+      </entry>
+    </row>
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+Timeout/Retransmission policy:
+      </entry>
+    </row>
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+An exponential backoff algorithm should be used here to reduce network load
+for long-standing idle displays.  Start at 2 seconds, back off by factors of
+2 to 32 seconds, and discontinue retransmit after 126 seconds.  The display
+should reset the timeout when user-input is detected.  In this way, the
+display will wakeup when touched by the user.
+      </entry>
+    </row>
+    <row rowsep="0">
+      <entry spanname="col1_on">
+<function>ForwardQuery</function>
+      </entry>
+    </row>
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+<para>Primary Manager -&gt; Secondary Manager</para>
+<para>Additional Fields:</para>
+      </entry>
+    </row>
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+<emphasis remap='I'>Client Address</emphasis>: ARRAY8
+      </entry>
+    </row>
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Specifies the network address of the client display.
+      </entry>
+    </row>
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+<emphasis remap='I'>Client Port</emphasis>: ARRAY8
+      </entry>
+    </row>
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Specifies an identification of the client task on the client display.
+      </entry>
+    </row>
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+<emphasis remap='I'>Authentication Names</emphasis>: ARRAYofARRAY8
+      </entry>
+    </row>
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Is a duplicate of Authentication Names array that was received
+in the
+<function>IndirectQuery</function>
+packet.
+      </entry>
+    </row>
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Semantics:
+      </entry>
+    </row>
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+        <para>
+When primary manager receives a
+<function>IndirectQuery</function>
+packet, it is responsible for sending
+<function>ForwardQuery</function>
+packets to an appropriate list of
+managers that can provide service to the display using the same network
+type as the one the original
+<function>IndirectQuery</function>
+packet was received from.
+The Client Address and Client Port fields must contain an
+address that the secondary manager can use to reach the display also using
+this same network.  Each secondary manager sends a
+<function>Willing</function>
+packet to the display if it is willing to provide service.
+        </para>
+
+        <para>
+<function>ForwardQuery</function>
+packets are similar to
+<function>BroadcastQuery</function>
+packets in that managers that are not willing to service
+particular displays should not send a
+<function>Unwilling</function>
+packet.
+        </para>
+      </entry>
+    </row>
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Valid Responses:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+<function>Willing</function>
+      </entry>
+    </row>
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Problems/Solutions:
+      </entry>
+    </row>
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+Identical to
+<function>BroadcastQuery</function>
+      </entry>
+    </row>
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Timeout/Retransmission policy:
+      </entry>
+    </row>
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+Like all packets sent from a manager, this packet should never be
+retransmitted.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry spanname="col1_on">
+<function>Willing</function>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+        <para>
+Manager -&gt; Display
+        </para>
+        <para>
+Additional Fields:
+        </para>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+<emphasis remap='I'>Authentication Name</emphasis>: ARRAY8
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+<para>
+Specifies the authentication method, selected from the list offered in the
+<function>Query ,</function>
+<function>BroadcastQuery ,</function>
+or
+<function>IndirectQuery</function>
+packet that the manger expects the display to use in the subsequent
+<function>Request</function>
+packet.
+This choice should remain as constant as feasible so that displays that
+send multiple
+<function>Query</function>
+packets can use the Authentication Name from any
+<function>Willing</function>
+packet that arrives.
+</para>
+<para>
+The display is free to ignore managers that request an insufficient level
+of authentication.
+</para>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+<emphasis remap='I'>Hostname</emphasis>: ARRAY8
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Is a human readable string describing the host from which the packet was sent.
+The protocol specifies no interpretation of the data in this field.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+<emphasis remap='I'>Status</emphasis>: ARRAY8
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Is a human readable string describing the status of the host.  This could
+include load average/number of users connected or other information.  The
+protocol specifies no interpretation of the data in this field.
+      </entry>
+    </row>
+
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Semantics:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+A
+<function>Willing</function>
+packet is sent by managers that may service connections from
+this display.  It is sent in response to either a
+<function>Query ,</function>
+<function>BroadcastQuery ,</function>
+or
+<function>ForwardQuery</function>
+but does not imply a commitment to provide service
+(for example, it may later decide that it has accepted enough
+connections already).
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Problems/Solutions:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+Problem:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+<para>
+<function>Willing</function>
+not received by the display.
+</para>
+<para>
+Indication:
+</para>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col5_on">
+None if
+<function>BroadcastQuery</function>
+or
+<function>IndirectQuery</function>
+was sent, else failure to receive
+<function>Willing .</function>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Solution:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col5_on">
+The display should continue to send the query until a response is received.
+      </entry>
+    </row>
+
+
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Timeout/Retransmission policy:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+Like all packets sent from the manager to the display, this packet should
+never be retransmitted.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry spanname="col1_on">
+<function>Unwilling</function>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+        <para>
+Manager -&gt; Display
+        </para>
+        <para>
+Additional Fields:
+        </para>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+The Hostname and Status fields as in the
+<function>Willing</function>
+packet.
+The Status field should indicate to the user a reason
+for the refusal of service.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Semantics:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+An
+<function>Unwilling</function>
+packet is sent by managers in response to direct
+<function>Query</function>
+requests (as opposed to
+<function>BroadcastQuery</function>
+or
+<function>IndirectQuery</function>
+requests) if the manager will not accept requests for management.
+This is typically sent by managers that wish to only service
+particular displays or that handle a limited number of displays at once.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Problems/Solutions:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+Problem:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+<para>
+<function>Unwilling</function>
+not received by the display.
+</para>
+<para>
+Indication:
+</para>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col5_on">
+Display fails to receive
+<function>Unwilling .</function>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Solution:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col5_on">
+The display should continue to send
+<function>Query</function>
+messages until a response is received.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Timeout/Retransmission policy:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+Like all packets sent from the manager to the display, this packet should
+never be retransmitted.
+      </entry>
+    </row>
+    <row rowsep="0">
+      <entry spanname="col1_on">
+<function>Request</function>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+        <para>
+Display -&gt; Manager
+        </para>
+        <para>
+Additional Fields:
+        </para>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+<emphasis remap='I'>Display Number</emphasis>: CARD16
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Specifies the index of this particular server for the host
+on which the display is resident.
+This value will be zero for most autonomous displays.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+<emphasis remap='I'>Connection Types</emphasis>: ARRAY16
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Specifies an array indicating the stream services accepted by the display.
+If the high-order byte in a particular entry is zero, the low-order byte
+corresponds to an X-protocol host family type.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+<emphasis remap='I'>Connection Addresses</emphasis>: ARRAYofARRAY8
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+For each connection type in the previous array, the corresponding entry in
+this array indicates the network address of the display device.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+        <para>
+<emphasis remap='I'>Authentication Name</emphasis>: ARRAY8
+        </para>
+        <para>
+<emphasis remap='I'>Authentication Data</emphasis>: ARRAY8
+        </para>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Specifies the authentication protocol that the display expects
+the manager to validate itself with.  The Authentication Data is
+expected to contain data that the manager will interpret, modify
+and use to authenticate itself.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+<emphasis remap='I'>Authorization Names</emphasis>: ARRAYofARRAY8
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Specifies which types of authorization the display supports.  The
+manager may decide to reject displays with which it cannot perform
+authorization.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+<emphasis remap='I'>Manufacturer Display ID</emphasis>: ARRAY8
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Can be used by the manager to determine how to decrypt the
+Authentication Data field in this packet.  See the section below on
+Manufacturer Display ID Format.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Semantics:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+A
+<function>Request</function>
+packet is sent by a display to a specific host to request a
+session ID in preparation for a establishing a connection.  If the manager
+is willing to service a connection to this display, it should return an
+<function>Accept</function>
+packet with a valid session ID and should be ready for a subsequent
+<function>Manage</function>
+request.  Otherwise, it should return a
+<function>Decline</function>
+packet.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Valid Responses:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+<function>Accept ,</function>
+<function>Decline</function>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Problems/Solutions:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+Problem:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Request not received by manager.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Indication:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col5_on">
+Display timeout waiting for response.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Solution:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col5_on">
+Display resends
+<function>Request</function>
+message.
+      </entry>
+    </row>
+
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Problem:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col5_on">
+Message received out of order by manager.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Indication:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col5_on">
+None.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Solution:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col5_on">
+Each time a
+<function>Request</function>
+is sent, the manager sends the Session ID
+associated with the next session in the
+<function>Accept .</function>
+If that next session is not yet started,
+the manager will simply resend with the same Session ID.
+If the session is in progress, the manager will reply
+with a new Session ID; in which case, the
+<function>Accept</function>
+will be discarded by the display.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Timeout/Retransmission policy:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+Timeout after 2 seconds, exponential backoff to 32 seconds.
+After no more than 126 seconds, give up and report an error to the user.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry spanname="col1_on">
+<function>Accept</function>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+        <para>
+Manager -&gt; Display
+        </para>
+        <para>
+Additional Fields:
+        </para>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+<emphasis remap='I'>Session ID</emphasis>: CARD32
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Identifies the session that can be started by the manager.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+        <para>
+<emphasis remap='I'>Authentication Name</emphasis>: ARRAY8
+        </para>
+        <para>
+<emphasis remap='I'>Authentication Data</emphasis>: ARRAY8
+        </para>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Is the data sent back to the display to authenticate the manager.
+If the Authentication Data is not the value expected by the display, it
+should terminate the protocol at this point and display an error to the user.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+        <para>
+<emphasis remap='I'>Authorization Name</emphasis>: ARRAY8
+        </para>
+        <para>
+<emphasis remap='I'>Authorization Data</emphasis>: ARRAY8
+        </para>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Is the data sent to the display to indicate the type of authorization the
+manager will be using in the first call to
+<function>XOpenDisplay</function>
+after the
+<function>Manage</function>
+packet is received.
+      </entry>
+    </row>
+
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Semantics:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+<para>
+An
+<function>Accept</function>
+packet is sent by a manager in response to a
+<function>Request</function>
+packet if the manager is willing to establish a connection for the display.
+The Session ID is used to identify this connection from any preceding
+ones and will be used by the display in its subsequent
+<function>Manage</function>
+packet.
+The Session ID is a 32-bit number that is incremented each time an
+<function>Accept</function>
+packet is sent as it must be unique over a reasonably long period of time.
+</para>
+<para>
+If the authentication information is invalid, a
+<function>Decline</function>
+packet will be returned with an appropriate
+<function>Status</function>
+message.
+</para>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Problems/Solutions:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+Problem:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+<function>Accept</function>
+or
+<function>Decline</function>
+not received by display.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Indication:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col5_on">
+Display timeout waiting for response to
+<function>Request .</function>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Solution:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col5_on">
+Display resends
+<function>Request</function>
+message.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+Problem:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Message received out of order by display.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Indication:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col5_on">
+Display receives
+<function>Accept</function>
+after
+<function>Manage</function>
+has been sent.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Solution:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col5_on">
+Display discards
+<function>Accept</function>
+messages after it has sent a
+<function>Manage</function>
+message.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Timeout/Retransmission policy:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+Like all packets sent from the manager to the display, this packet should
+never be retransmitted.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry spanname="col1_on">
+<function>Decline</function>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+        <para>
+Manager -&gt; Display
+        </para>
+        <para>
+Additional Fields:
+        </para>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+<emphasis remap='I'>Status</emphasis>: ARRAY8
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Is a human readable string indicating the reason for refusal of
+service.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+        <para>
+<emphasis remap='I'>Authentication Name</emphasis>:
+ARRAY8
+        </para>
+        <para>
+<emphasis remap='I'>Authentication Data</emphasis>:
+ARRAY8
+        </para>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Is the data sent back to the display to authenticate the manager.  If the
+Authentication Data is not the value expected by the display, it
+should terminate the protocol at this point and display an error to the user.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Semantics:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+A
+<function>Decline</function>
+packet is sent by a manager in response to a
+<function>Request</function>
+packet if the manager is unwilling to establish a connection for the
+display.
+This is allowed even if the manager had responded
+<function>Willing</function>
+to a previous query.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Problems/Solutions:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+Same as for
+<function>Accept .</function>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Timeout/Retransmission policy:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+Like all packets sent from a manager to a display, this packet should never
+be retransmitted.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry spanname="col1_on">
+<function>Manage</function>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+        <para>
+Display -&gt; Manager
+        </para>
+        <para>
+Additional Fields:
+        </para>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+<emphasis remap='I'>Session ID</emphasis>: CARD32
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Should contain the nonzero session ID returned in the
+<function>Accept</function>
+packet.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+<emphasis remap='I'>Display Number</emphasis>: CARD16
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Must match the value sent in the previous
+<function>Request</function>
+packet.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+<emphasis remap='I'>Display Class</emphasis>: ARRAY8
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Specifies the class of the display.
+See the Display Class Format section,
+which discusses the format of this field.
+      </entry>
+    </row>
+
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Semantics:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+A
+<function>Manage</function>
+packet is sent by a display to ask the manager to begin a
+session on the display.  If the Session ID is correct the manager
+should open a connection; otherwise, it should respond with a
+<function>Refuse</function>
+or
+<function>Failed</function>
+packet, unless the Session ID matches a currently
+running session or a session that has not yet successfully opened the
+display but has not given up the attempt.  In this latter case, the
+<function>Manage</function>
+packet should be ignored.
+This will work as stream connections give positive success indication
+to both halves of the stream, and positive failure indication
+to the connection initiator (which will eventually generate a
+<function>Failed</function>
+packet).
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Valid Responses:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+X connection with correct auth info,
+<function>Refuse ,</function>
+<function>Failed .</function>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Problems/Solutions:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+Problem:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+<function>Manage</function>
+not received by manager.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Indication:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col5_on">
+Display timeout waiting for response.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Solution:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col5_on">
+Display resends
+<function>Manage</function>
+message.
+      </entry>
+    </row>
+
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+Problem:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+<function>Manage</function>
+received out of order by manager.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Indication:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col5_on">
+Session already in progress with matching Session ID.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Solution:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col5_on">
+<function>Manage</function>
+packet ignored.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Indication:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col5_on">
+Session ID does not match next Session ID.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Solution:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col5_on">
+<function>Refuse</function>
+message is sent.
+      </entry>
+    </row>
+
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+Problem:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Display cannot be opened on selected stream.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Indication:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col5_on">
+Display connection setup fails.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Solution:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col5_on">
+<function>Failed</function>
+message is sent including a human readable reason.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+Problem:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Display open does not succeed before a second manage packet is received
+because of a timeout occuring in the display.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Indication:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col5_on">
+<function>Manage</function>
+packet received with Session ID matching the session
+attempting to connect to the display.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Solution:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col5_on">
+<function>Manage</function>
+packet is ignored.  As the stream connection will either
+succeed, which will result in an active session, or the stream will
+eventually give up hope of connecting and send a
+<function>Failed</function>
+packet; no response to this
+<function>Manage</function>
+packet is necessary.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Timeout/Retransmission policy:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+Timeout after 2 seconds, exponential backoff to 32 seconds.  After no more
+than 126 seconds, give up and report an error to the user.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry spanname="col1_on">
+<function>Refuse</function>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+        <para>
+Manager -&gt; Display
+        </para>
+        <para>
+Additional Fields:
+        </para>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+<emphasis remap='I'>Session ID</emphasis>: CARD32
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Should be set to the Session ID received in the
+<function>Manage</function>
+packet.
+      </entry>
+    </row>
+
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Semantics:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+A
+<function>Refuse</function>
+packet is sent by a manager when the Session ID received in the
+<function>Manage</function>
+packet does not match the current Session ID.
+The display should assume that it received an old
+<function>Accept</function>
+packet and should resend its
+<function>Request</function>
+packet.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Problems/Solutions:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+Problem:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Error message is lost.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Indication:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col5_on">
+Display times out waiting for
+new connection,
+<function>Refuse</function>
+or
+<function>Failed .</function>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Solution:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col5_on">
+Display resends
+<function>Manage</function>
+message.
+      </entry>
+    </row>
+
+
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Timeout/Retransmission policy:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+Like all packets sent from a manager to a display, this packet should never be
+retransmitted.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry spanname="col1_on">
+<function>Failed</function>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+        <para>
+Manager -&gt; Display
+        </para>
+        <para>
+Additional Fields:
+        </para>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+<emphasis remap='I'>Session ID</emphasis>: CARD32
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Should be set to the Session ID received in the
+<function>Manage</function>
+packet.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+<emphasis remap='I'>Status</emphasis>: ARRAY8
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Is a human readable string indicating the reason for failure.
+      </entry>
+    </row>
+
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Semantics:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+A
+<function>Failed</function>
+packet is sent by a manager when it has problems establishing
+the initial X connection in response to the
+<function>Manage</function>
+packet.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Problems/Solutions
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+Same as for
+<function>Refuse .</function>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry spanname="col1_on">
+<function>KeepAlive</function>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+        <para>
+Display -&gt; Manager
+        </para>
+        <para>
+Additional Fields:
+        </para>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+<emphasis remap='I'>Display Number</emphasis>: CARD16
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Set to the display index for the display host.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+<emphasis remap='I'>Session ID</emphasis>: CARD32
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Should be set to the Session ID received in the
+<function>Manage</function>
+packet during the negotiation for the current session.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Sematics:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+        <para>
+A
+<function>KeepAlive</function>
+packet can be sent at any time during the session by a
+display to discover if the manager is running.
+The manager should respond with
+<function>Alive</function>
+whenever it receives this type of packet.
+        </para>
+        <para>
+This allows the display to discover when the manager host
+is no longer running.
+A display is not required to send
+<function>KeepAlive</function>
+packets and, upon lack of receipt of
+<function>Alive</function>
+packets, is not required to perform any specific action.
+        </para>
+        <para>
+The expected use of this packet is to terminate an active session when the
+manager host or network link fails.  The display should keep track of the
+time since any packet has been received from the manager host and use
+<function>KeepAlive</function>
+packets when a substantial time has elapsed since the
+most recent packet.
+        </para>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Valid Responses:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+<function>Alive</function>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Problems/Solutions:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+Problem:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Manager does not receive the packet or display does not receive the response.
+      </entry>
+    </row>
+
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Indication:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col5_on">
+No
+<function>Alive</function>
+packet is returned.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Solution:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col5_on">
+Retransmit the packet with an exponential backoff; start at 2 seconds and
+assume the host is not up after no less than 30 seconds.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry spanname="col1_on">
+<function>Alive</function>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+        <para>
+Manager -&gt; Display
+        </para>
+        <para>
+Additional Fields:
+        </para>
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+<emphasis remap='I'>Session Running</emphasis>: CARD8
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Indicates that the session identified by Session ID is
+currently active.  The value is zero if no session is active
+or one if a session
+is active.
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+<emphasis remap='I'>Session ID</emphasis>: CARD32
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col4_on">
+Specifies the ID of the currently running session; if any.
+When no session is active this field should be zero.
+      </entry>
+    </row>
+
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry spanname="col2_on">
+Semantics:
+      </entry>
+    </row>
+
+    <row rowsep="0">
+      <entry></entry>
+      <entry></entry>
+      <entry spanname="col3_on">
+An
+<function>Alive</function>
+packet is sent in response to a
+<function>KeepAlive</function>
+request.
+If a session is currently active on the display, the manager includes the
+Session ID in the packet.  The display can use this information to
+determine the status of the manager.
+      </entry>
+    </row>
+  </tbody>
+  </tgroup>
+</informaltable>
+
+</sect1>
+
+<sect1 id="Session_Termination">
+<title>Session Termination</title>
+<para>
+When the session is over, the initial connection with the display (the one
+that acknowledges the
+<function>Manage</function>
+packet) will be closed by the manager.
+If only a single session was active on the display,
+all other connections should be closed by the display
+and the display should be reset.  If multiple sessions
+are active simultaneously and the display can identify which connections
+belong to the terminated sesssion, those connections should be closed.
+Otherwise, all connections should be closed and the display reset only when
+all sessions have been terminated (that is, all initial connections closed).
+</para>
+
+<para>
+The session may also be terminated at any time by the display if the
+managing host no longer responds to
+<function>KeepAlive</function>
+packets.
+The exact time-outs for sending
+<function>KeepAlive</function>
+packets is not specified in this protocol as the trade off
+should not be fixed between loading an otherwise idle system with spurious
+<function>KeepAlive</function>
+packets and not noticing that the manager host is down for a long time.
+</para>
+</sect1>
+
+<sect1 id="State_Diagrams">
+<title>State Diagrams</title>
+<!-- .XS -->
+<!-- (SN State Diagrams -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+The following state diagrams are designed to cover all actions of both
+the display and the manager.  Any packet that is received out-of-sequence
+will be ignored.
+</para>
+<para>
+<!-- .LP -->
+Display:
+</para>
+
+<variablelist>
+  <varlistentry>
+    <term><emphasis remap='I'>start</emphasis>:</term>
+    <listitem>
+      <para>
+User-requested connect to one host -&gt; <emphasis remap='I'>query</emphasis>
+      </para>
+      <para>
+User-requested connect to some host -&gt; <emphasis remap='I'>broadcast</emphasis>
+      </para>
+      <para>
+User-requested connect to site host-list -&gt; <emphasis remap='I'>indirect</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>query</emphasis>:</term>
+    <listitem>
+      <para>
+Send <function>Query</function> packet
+-&gt; <emphasis remap='I'>collect-query</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>collect-query</emphasis>:</term>
+    <listitem>
+      <para>
+Receive <function>Willing</function> -&gt;
+<emphasis remap='I'>start-connection</emphasis>
+      </para>
+      <para>
+Receive <function>Unwilling</function> -&gt;
+<emphasis remap='I'>stop-connection</emphasis>
+      </para>
+      <para>
+Timeout -&gt; <emphasis remap='I'>query</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+
+  <varlistentry>
+    <term><emphasis remap='I'>broadcast</emphasis>:</term>
+    <listitem>
+      <para>
+Send <function>BroadcastQuery</function> packet
+      </para>
+      <para>
+-&gt; <emphasis remap='I'>collect-broadcast-query</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>collect-broadcast-query</emphasis>:</term>
+    <listitem>
+      <para>
+Receive <function>Willing</function> -&gt;
+<emphasis remap='I'>update-broadcast-willing</emphasis>
+      </para>
+      <para>
+User-requested connect to one host -&gt;
+<emphasis remap='I'>start-connection</emphasis>
+      </para>
+      <para>
+Timeout -&gt; <emphasis remap='I'>broadcast</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>update-broadcast-willing</emphasis>:</term>
+    <listitem>
+      <para>
+Add new host to the host list presented to the user
+      </para>
+      <para>
+-&gt; <emphasis remap='I'>collect-broadcast-query</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>indirect</emphasis>:</term>
+    <listitem>
+      <para>
+Send <function>IndirectQuery</function> packet
+      </para>
+      <para>
+-&gt; <emphasis remap='I'>collect-indirect-query</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>collect-indirect-query</emphasis>:</term>
+    <listitem>
+      <para>
+Receive <function>Willing</function> -&gt;
+<emphasis remap='I'>update-indirect-willing</emphasis>
+      </para>
+      <para>
+User-requested connect to one host -&gt;
+<emphasis remap='I'>start-connection</emphasis>
+      </para>
+      <para>
+Timeout -&gt; <emphasis remap='I'>indirect</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>update-indirect-willing</emphasis>:</term>
+    <listitem>
+      <para>
+Add new host to the host list presented to the user
+      </para>
+      <para>
+-&gt; <emphasis remap='I'>collect-indirect-query</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+
+  <varlistentry>
+    <term><emphasis remap='I'>start-connection</emphasis>:</term>
+    <listitem>
+      <para>
+Send <function>Request</function> packet
+      </para>
+      <para>
+-&gt; <emphasis remap='I'>await-request-response</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>await-request-response</emphasis>:</term>
+    <listitem>
+      <para>
+Receive <function>Accept</function> -&gt;
+<emphasis remap='I'>manage</emphasis>
+      </para>
+      <para>
+Receive <function>Decline</function> -&gt;
+<emphasis remap='I'>stop-connection</emphasis>
+      </para>
+      <para>
+Timeout -&gt; <emphasis remap='I'>start-connection</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>manage</emphasis>:</term>
+    <listitem>
+      <para>
+Save Session ID
+      </para>
+      <para>
+Send <function>Manage</function> packet with Session ID
+      </para>
+      <para>
+-&gt; <emphasis remap='I'>await-manage-response</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>await-manage-response</emphasis>:</term>
+    <listitem>
+      <para>
+Receive <function>XOpenDisplay :</function> -&gt;
+<emphasis remap='I'>run-session</emphasis>
+      </para>
+      <para>
+Receive <function>Refuse</function> with matching Session ID
+-&gt; <emphasis remap='I'>start-connection</emphasis>
+      </para>
+      <para>
+Receive <function>Failed</function> with matching Session ID
+-&gt; <emphasis remap='I'>stop-connection</emphasis>
+      </para>
+      <para>
+Timeout -&gt; <emphasis remap='I'>manage</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>stop-connection</emphasis>:</term>
+    <listitem>
+      <para>
+Display cause of termination to user
+      </para>
+      <para>
+-&gt; <emphasis remap='I'>start</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>run-session</emphasis>:</term>
+    <listitem>
+      <para>
+Decide to send <function>KeepAlive</function> packet -&gt;
+<emphasis remap='I'>keep-alive</emphasis>
+      </para>
+      <para>
+wait close of first display connection
+      </para>
+      <para>
+-&gt; <emphasis remap='I'>reset-display</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>keep-alive</emphasis>:</term>
+    <listitem>
+      <para>
+Send <function>KeepAlive</function> packet with current Session ID
+      </para>
+      <para>
+-&gt; <emphasis remap='I'>await-alive</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>await-alive</emphasis>:</term>
+    <listitem>
+      <para>
+Receive <function>Alive</function> with matching Session ID -&gt;
+<emphasis remap='I'>run-session</emphasis>
+      </para>
+      <para>
+Receive <function>Alive</function> with nonmatching Session ID
+or FALSE Session Running -&gt; <emphasis remap='I'>reset-display</emphasis>
+      </para>
+      <para>
+Final timeout without receiving <function>Alive</function>
+packet -&gt; <emphasis remap='I'>reset-display</emphasis>
+      </para>
+      <para>
+Timeout -&gt; <emphasis remap='I'>keep-alive</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>reset-display</emphasis>:</term>
+    <listitem>
+      <para>
+(if possible) -&gt; close all display connections associated with this session
+      </para>
+      <para>
+Last session -&gt; close all display connections
+      </para>
+      <para>
+-&gt; <emphasis remap='I'>start</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+</variablelist>
+
+
+<para>
+Manager:
+</para>
+
+<variablelist>
+  <varlistentry>
+    <term><emphasis remap='I'>idle</emphasis>:</term>
+    <listitem>
+      <para>
+Receive <function>Query</function> -&gt;
+<emphasis remap='I'>query-respond</emphasis>
+      </para>
+      <para>
+Receive
+<function>BroadcastQuery</function>
+-&gt; <emphasis remap='I'>broadcast-respond</emphasis>
+      </para>
+      <para>
+Receive
+<function>IndirectQuery</function>
+-&gt; <emphasis remap='I'>indirect-respond</emphasis>
+      </para>
+      <para>
+Receive
+<function>ForwardQuery</function>
+-&gt; <emphasis remap='I'>forward-respond</emphasis>
+Receive
+      </para>
+      <para>
+<function>Request</function>
+-&gt; <emphasis remap='I'>request-respond</emphasis>
+      </para>
+      <para>
+Receive
+<function>Manage</function>
+-&gt; <emphasis remap='I'>manage</emphasis>
+      </para>
+      <para>
+An active session terminates
+-&gt; <emphasis remap='I'>finish-session</emphasis>
+      </para>
+      <para>
+Receive <function>KeepAlive</function>
+-&gt; <emphasis remap='I'>send-alive</emphasis>
+      </para>
+      <para>
+-&gt; <emphasis remap='I'>idle</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>query-respond</emphasis>:</term>
+    <listitem>
+      <para>
+If willing to manage -&gt; <emphasis remap='I'>send-willing</emphasis>
+      </para>
+      <para>
+-&gt; <emphasis remap='I'>send-unwilling</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>broadcast-respond</emphasis>:</term>
+    <listitem>
+      <para>
+If willing to manage -&gt; <emphasis remap='I'>send-willing</emphasis>
+      </para>
+      <para>
+-&gt; <emphasis remap='I'>idle</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>indirect-respond</emphasis>:</term>
+    <listitem>
+      <para>
+Send <function>ForwardQuery</function>
+packets to all managers on redirect list
+      </para>
+      <para>
+If willing to manage -&gt; <emphasis remap='I'>send-willing</emphasis>
+      </para>
+      <para>
+-&gt; <emphasis remap='I'>idle</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>forward-respond</emphasis>:</term>
+    <listitem>
+      <para>
+Decode destination address, if willing to manage -&gt;
+<emphasis remap='I'>send-willing</emphasis>
+      </para>
+      <para>
+-&gt; <emphasis remap='I'>idle</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>send-willing</emphasis>:</term>
+    <listitem>
+      <para>
+Send <function>Willing</function> packet
+      </para>
+      <para>
+-&gt; <emphasis remap='I'>idle</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>send-unwilling</emphasis>:</term>
+    <listitem>
+      <para>
+Send <function>Unwilling</function> packet
+-&gt; <emphasis remap='I'>idle</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>request-respond</emphasis>:</term>
+    <listitem>
+      <para>
+If manager is willing to allow a session on display
+-&gt; <emphasis remap='I'>accept-session</emphasis>
+      </para>
+      <para>
+-&gt; <emphasis remap='I'>decline-session</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>accept-session</emphasis>:</term>
+    <listitem>
+      <para>
+Generate Session ID and save Session ID, display address, and
+display number somewhere
+      </para>
+      <para>
+Send <function>Accept</function> packet
+      </para>
+      <para>
+-&gt; <emphasis remap='I'>idle</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>decline-session</emphasis>:</term>
+    <listitem>
+      <para>
+Send <function>Decline</function> packet
+      </para>
+      <para>
+-&gt; <emphasis remap='I'>idle</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>manage</emphasis>:</term>
+    <listitem>
+      <para>
+If Session ID matches saved Session ID -&gt;
+<emphasis remap='I'>run-session</emphasis>
+      </para>
+      <para>
+If Session ID matches Session ID of session in process of
+starting up, or currently active session -&gt;
+<emphasis remap='I'>idle</emphasis>
+      </para>
+      <para>
+-&gt; <emphasis remap='I'>refuse</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>refuse</emphasis>:</term>
+    <listitem>
+      <para>
+Send <function>Refuse</function> packet
+      </para>
+      <para>
+-&gt; <emphasis remap='I'>idle</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>run-session</emphasis>:</term>
+    <listitem>
+      <para>
+Terminate any session in progress
+      </para>
+      <para>
+<function>XOpenDisplay</function>
+      </para>
+      <para>
+Open display succeeds -&gt;
+<emphasis remap='I'>start-session</emphasis>
+      </para>
+      <para>
+-&gt; <emphasis remap='I'>failed</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>failed</emphasis>:</term>
+    <listitem>
+      <para>
+Send <function>Failed</function> packet
+      </para>
+      <para>
+-&gt; <emphasis remap='I'>idle</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>start-session</emphasis>:</term>
+    <listitem>
+      <para>
+Start a new session
+      </para>
+      <para>
+-&gt; <emphasis remap='I'>idle</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>finish-session</emphasis>:</term>
+    <listitem>
+      <para>
+<function>XCloseDisplay</function>
+      </para>
+      <para>
+-&gt; <emphasis remap='I'>idle</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>send-alive</emphasis>:</term>
+    <listitem>
+      <para>
+Send <function>Alive</function> packet containing current status
+      </para>
+      <para>
+-&gt; <emphasis remap='I'>idle</emphasis>
+      </para>
+    </listitem>
+  </varlistentry>
+</variablelist>
+
+</sect1>
+
+<sect1 id="Protocol_Encoding">
+<title>Protocol Encoding</title>
+<para>
+When XDMCP is implemented on top of the Internet User Datagram Protocol (UDP),
+port number 177 is to be used. When using UDP over IPv4, Broadcast Query
+packets are sent via UDP broadcast.  When using UDP over IPv6, Broadcast Query
+packets are sent via multicast, either to an address in the IANA registered
+XDMCP multicast address range of
+FF0<emphasis remap='I'>X</emphasis>:0:0:0:0:0:0:12B
+(where the <emphasis remap='I'>X</emphasis> is replaced by a valid scope id)
+or to a locally assigned
+multicast address. The version number in all packets will be 1.
+Packet opcodes are 16-bit integers.
+</para>
+
+<informaltable frame="none">
+  <tgroup cols='2' align='left'>
+  <colspec colname='c1' colsep="0"/>
+  <colspec colname='c2' colsep="0"/>
+  <thead>
+    <row>
+      <entry>Packet Name</entry>
+      <entry>Encoding</entry>
+    </row>
+  </thead>
+  <tbody>
+    <row rowsep="0">
+      <entry>BroadcastQuery</entry>
+      <entry>1</entry>
+    </row>
+    <row rowsep="0">
+      <entry>Query</entry>
+      <entry>2</entry>
+    </row>
+    <row rowsep="0">
+      <entry>IndirectQuery</entry>
+      <entry>3</entry>
+    </row>
+    <row rowsep="0">
+      <entry>ForwardQuery</entry>
+      <entry>4</entry>
+    </row>
+    <row rowsep="0">
+      <entry>Willing</entry>
+      <entry>5</entry>
+    </row>
+    <row rowsep="0">
+      <entry>Unwilling</entry>
+      <entry>6</entry>
+    </row>
+    <row rowsep="0">
+      <entry>Request</entry>
+      <entry>7</entry>
+    </row>
+    <row rowsep="0">
+      <entry>Accept</entry>
+      <entry>8</entry>
+    </row>
+    <row rowsep="0">
+      <entry>Decline</entry>
+      <entry>9</entry>
+    </row>
+    <row rowsep="0">
+      <entry>Manage</entry>
+      <entry>10</entry>
+    </row>
+    <row rowsep="0">
+      <entry>Refuse</entry>
+      <entry>11</entry>
+    </row>
+    <row rowsep="0">
+      <entry>Failed</entry>
+      <entry>12</entry>
+    </row>
+    <row rowsep="0">
+      <entry>KeepAlive</entry>
+      <entry>13
+<footnote><para>
+A previous version of this document incorrectly reversed the opcodes of
+<emphasis role="bold">Alive</emphasis> and
+<emphasis role="bold">KeepAlive</emphasis>.
+</para></footnote>
+      </entry>
+    </row>
+    <row rowsep="0">
+      <entry>Alive</entry>
+      <entry>14
+<footnote><para>
+A previous version of this document incorrectly reversed the opcodes of
+<emphasis role="bold">Alive</emphasis> and
+<emphasis role="bold">KeepAlive</emphasis>.
+</para></footnote>
+      </entry>
+    </row>
+  </tbody>
+  </tgroup>
+</informaltable>
+
+<para>
+Per packet information follows:
+</para>
+
+<para>
+<function>Query</function>,
+<function>BroadcastQuery</function>,
+<function>IndirectQuery</function>
+</para>
+
+<literallayout class="monospaced">
+     2     CARD16     version number (always 1)
+     2     CARD16     opcode (always Query, BroadcastQuery or IndirectQuery)
+     2     CARD16     length
+     1     CARD8      number of Authentication Names sent (m)
+     2     CARD16     length of first Authentication Name (m<emphasis role="subscript">1</emphasis>)
+     m<emphasis role="subscript">1</emphasis>   CARD8     first Authentication Name
+     ...          Other Authentication Names
+</literallayout>
+
+<para>
+Note that these three packets are identical except for the opcode field.
+</para>
+
+<literallayout class="monospaced">
+<function>ForwardQuery</function>
+     2     CARD16     version number (always 1)
+     2     CARD16     opcode (always ForwardQuery)
+     2     CARD16     length
+     2     CARD16     length of Client Address (m)
+     m     CARD8     Client Address
+     2     CARD16     length of Client Port (n)
+     n     CARD8     Client Port
+     1     CARD8     number of Authentication Names sent (o)
+     2     CARD16     length of first Authentication Name (o<emphasis role="subscript">1</emphasis>)
+     o<emphasis role="subscript">1</emphasis>     CARD8     first Authentication Name
+     ...          Other Authentication Names
+</literallayout>
+
+<literallayout class="monospaced">
+<function>Willing</function>
+     2     CARD16     version number (always 1)
+     2     CARD16     opcode (always Willing)
+     2     CARD16     length (6 + m + n + o)
+     2     CARD16     Length of Authentication Name (m)
+     m     CARD8      Authentication Name
+     2     CARD16     Hostname length (n)
+     n     CARD8      Hostname
+     2     CARD16     Status length (o)
+     o     CARD8      Status
+</literallayout>
+
+<literallayout class="monospaced">
+<function>Unwilling</function>
+     2     CARD16     version number (always 1)
+     2     CARD16     opcode (always Unwilling)
+     2     CARD16     length (4 + m + n)
+     2     CARD16     Hostname length (m)
+     m     CARD8      Hostname
+     2     CARD16     Status length (n)
+     n     CARD8      Status
+</literallayout>
+
+<literallayout class="monospaced">
+<function>Request</function>
+     2     CARD16     version number (always 1)
+     2     CARD16     opcode (always Request)
+     2     CARD16     length
+     2     CARD16     Display Number
+     1     CARD8      Count of Connection Types (m)
+     2xm   CARD16     Connection Types
+     1     CARD8      Count of Connection Addresses (n)
+     2     CARD16     Length of first Connection Address (n<emphasis role="subscript">1</emphasis>)
+     n<emphasis role="subscript">1</emphasis>     CARD8      First Connection Address
+     ...              Other connection addresses
+     2     CARD16     Length of Authentication Name (o)
+     o     CARD8      Authentication Name
+     2     CARD16     Length of Authentication Data (p)
+     p     CARD8      Authentication Data
+     1     CARD8      Count of Authorization Names (q)
+     2     CARD16     Length of first Authorization Name (q<emphasis role="subscript">1</emphasis>)
+     q<emphasis role="subscript">1</emphasis>     CARD8      First Authorization Name
+     ...              Other authorization names
+     2     CARD16     Length of Manufacturer Display ID (r)
+     r     CARD8      Manufacturer Display ID
+</literallayout>
+
+<literallayout class="monospaced">
+<function>Accept</function>
+     2     CARD16     version number (always 1)
+     2     CARD16     opcode (always Accept)
+     2     CARD16     length (12 + n + m + o + p)
+     4     CARD32     Session ID
+     2     CARD16     Length of Authentication Name (n)
+     n     CARD8      Authentication Name
+     2     CARD16     Length of Authentication Data (m)
+     m     CARD8      Authentication Data
+     2     CARD16     Length of Authorization Name (o)
+     o     CARD8      Authorization Name
+     2     CARD16     Length of Authorization Data (p)
+     p     CARD8      Authorization Data
+</literallayout>
+
+<literallayout class="monospaced">
+<function>Decline</function>
+     2     CARD16     version number (always 1)
+     2     CARD16     opcode (always Decline)
+     2     CARD16     length (6 + m + n + o)
+     2     CARD16     Length of Status (m)
+     m     CARD8      Status
+     2     CARD16     Length of Authentication Name (n)
+     n     CARD8      Authentication Name
+     2     CARD16     Length of Authentication Data (o)
+     o     CARD8      Authentication Data
+</literallayout>
+
+<literallayout class="monospaced">
+<function>Manage</function>
+     2     CARD16     version number (always 1)
+     2     CARD16     opcode (always Manage)
+     2     CARD16     length (8 + m)
+     4     CARD32     Session ID
+     2     CARD16     Display Number
+     2     CARD16     Length of Display Class (m)
+     m     CARD8      Display Class
+</literallayout>
+
+<literallayout class="monospaced">
+<function>Refuse</function>
+     2     CARD16     version number (always 1)
+     2     CARD16     opcode (always Refuse)
+     2     CARD16     length (4)
+     4     CARD32     Session ID
+</literallayout>
+
+<literallayout class="monospaced">
+<function>Failed</function>
+     2     CARD16     version number (always 1)
+     2     CARD16     opcode (always Failed)
+     2     CARD16     length (6 + m)
+     4     CARD32     Session ID
+     2     CARD16     Length of Status (m)
+     m     CARD8      Status
+</literallayout>
+
+<literallayout class="monospaced">
+<function>KeepAlive</function>
+     2     CARD16     version number (always 1)
+     2     CARD16     opcode (always KeepAlive)
+     2     CARD16     length (6)
+     2     CARD16     Display Number
+     4     CARD32     Session ID
+</literallayout>
+
+<literallayout class="monospaced">
+<function>Alive</function>
+     2     CARD16     version number (always 1)
+     2     CARD16     opcode (always Alive)
+     2     CARD16     length (5)
+     1     CARD8      Session Running (0: not running 1: running)
+     4     CARD32     Session ID (0: not running)
+</literallayout>
+</sect1>
+
+<sect1 id="Display_Class_Format">
+<title>Display Class Format</title>
+<!-- .XS -->
+<!-- (SN Display Class Format -->
+<!-- .XE -->
+<para>
+The Display Class field of the
+<function>Manage</function>
+packet is used by the display manager to collect common sorts of
+displays into manageable groups.  This field is a string encoded of
+ISO-LATIN-1 characters in the following format:
+</para>
+
+<literallayout class="monospaced">
+<emphasis remap='I'>ManufacturerID</emphasis>-<emphasis remap='I'>ModelNumber</emphasis>
+</literallayout>
+
+<para>
+Both elements of this string must exclude characters of the set
+{ <function>-</function>,
+<function>.</function>,
+<function>:</function>,
+<function>*</function>,
+<function>?</function>,
+<emphasis remap='I'>&lt;space&gt;</emphasis> }.
+The ManufacturerID is a string that should be registered
+with the X Consortium.
+The ModelNumber is designed to identify characteristics of the display
+within the manufacturer's product line.
+This string should be documented in the users manual for the
+particular device and  should probably not be specifiable by the
+display user to avoid unexpected configuration errors.
+</para>
+</sect1>
+
+<sect1 id="Manufacturer_Display_ID_Format">
+<title>Manufacturer Display ID Format</title>
+<!-- .XS -->
+<!-- (SN Manufacturer Display ID Format -->
+<!-- .XE -->
+<para>
+To authenticate the manager, the display and manager will share a private
+key.
+The manager, then, must be able to discover which key to use for a
+particular device.
+The Manufacturer Display ID field of the
+<function>Request</function>
+packet is intended for this purpose.  Typically, the manager host will
+contain a map between this number and the key.  This field is intended to be
+unique per display, possibly the ethernet address of the display in the form:
+</para>
+
+<literallayout class="monospaced">
+-Ethernet-8:0:2b:a:f:d2
+</literallayout>
+
+<para>
+It can also be a string of the form:
+</para>
+
+<literallayout class="monospaced">
+<emphasis remap='I'>ManufacturerID</emphasis>-<emphasis remap='I'>ModelNumber</emphasis>-<emphasis remap='I'>SerialNumber</emphasis>
+</literallayout>
+
+<para>
+The ManufacturerID, ModelNumber and SerialNumber are encoded using
+ISO-LATIN-1 characters, excluding {
+<function>-</function>,
+<function>.</function>,
+<function>*</function>,
+<function>?</function>,
+<emphasis remap='I'>&lt;space&gt;</emphasis> }
+</para>
+
+<para>
+When the display is shipped to a customer, it should include both the
+Manufacturer Display ID and the private key in the documentation set.
+This information should not be modifiable by the display user.
+</para>
+
+</sect1>
+
+<sect1 id="Authentication">
+<title>Authentication</title>
+<!-- .XS -->
+<!-- (SN Authentication -->
+<!-- .XE -->
+<para>
+In an environment where authentication is not needed, XDMCP can disable
+authentication by having the display send empty Authentication Name
+and Authentication Data fields in the
+<function>Request</function>
+packet.
+In this case, the manager will not attempt to authenticate itself.
+Other authentication protocols may be developed, depending on local needs.
+</para>
+
+<para>
+In an unsecure environment, the display must be able to verify that the
+source of the various packets is a trusted manager.  These packets will
+contain authentication information.  As an example of such a system, the
+following discussion describes the "XDM-AUTHENTICATION-1" authentication
+system.  This system uses a 56-bit shared private key, and 64 bits of
+authentication data.  An associated example X authorization protocol
+"XDM-AUTHORIZATION-1" will also be discussed.  The 56-bit key is represented
+as a 64-bit number in network order (big endian).  This means that the first
+octet in the representation will be zero.  When incrementing a 64-bit value,
+the 8 octets of data will be interpreted in network order (big endian).
+That is, the last octet will be incremented, subsequent carries propogate
+towards the first octet.
+</para>
+
+<para>
+Assumptions:
+</para>
+
+<orderedlist>
+  <listitem>
+    <para>
+The display and manager share a private key.  This key could be programmed
+into the display by the manufacturer and shipped with the unit.  It must not
+be available from the display itself, but should allow the value to be
+modified in some way.  The system administrator would be responsible for
+managing a database of terminal keys.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+The display can generate random authentication numbers.
+    </para>
+  </listitem>
+</orderedlist>
+
+<para>
+Some definitions first:
+</para>
+
+<!-- FIXME: -->
+<!-- double chk math symbols, use mathml to display them? -->
+<itemizedlist>
+  <listitem>
+    <para>
+{D}= encryption of plain text D by key κ
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+{&#x394;}*&#x3BA; = decryption of crypto text &#x394; with key &#x3BA;
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+&tau; = private key shared by display and manager
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+&rho; = 64 bit random number generated by display
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+&alpha; = authentication data in XDMCP packets
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+&sigma; = per-session private key, generated by manager
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+&beta; = authorization data
+    </para>
+  </listitem>
+</itemizedlist>
+
+<para>
+Encryption will use the Data Encryption Standard (DES, FIPS 46-3); blocks
+shorter than 64 bits will be zero-filled
+on the right to 64 bits.  Blocks longer than 64 bits will use block chaining:
+</para>
+<para>
+{D}&#x3BA; = {D1 }&#x3BA; {D2 xor {D1 }&#x3BA; }&#x3BA;
+</para>
+
+<para>
+The display generates the first authentication data in the
+<function>Request</function>
+packet:
+</para>
+
+<para>
+&#945;Request = {&#961;}τ
+
+</para>
+
+<para>
+For the <function>Accept</function>
+packet, the manager decrypts the initial message and returns
+αAccept:
+
+</para>
+
+<para>
+&rho; = {&alpha; Request } *&tau;
+</para>
+
+<para>
+&alpha; Accept = { &rho; + 1}&tau;
+</para>
+
+<para>
+The <function>Accept</function>
+packet also contains the authorization intended for use by
+the X server.  A description of authorization type "XDM-AUTHORIZATION-1"
+follows.
+</para>
+
+<para>
+The <function>Accept</function>
+packet contains the authorization name
+"XDM-AUTHORIZATION-1".  The authorization data is the string:
+</para>
+<para>
+β Accept = {σ}τ
+</para>
+
+<para>
+To create authorization information for connection setup with the X server
+using the XDM-AUTHORIZATION-1 authorization protocol, the client computes the
+following:
+</para>
+<para>
+N mark = "X client identifier"
+</para>
+<para>
+T lineup = "Current time in seconds on client host (32 bits)"
+</para>
+<para>
+β = {ρNT}σ
+</para>
+
+<para>
+For TCP connections @N@ is 48 bits long and contains the 32-bit IPv4 address of
+the client host followed by the 16-bit port number of the client socket.
+Formats for other connections must be registered.
+The resulting value, β, is 192 bits of authorization data that is sent
+in the connection setup to the server.  The server receives the packet,
+decrypts the contents.  To accept the connection, the following must hold:
+</para>
+
+<itemizedlist>
+  <listitem>
+    <para>
+ρ must match the value generated for the most recent XDMCP negotiation.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+T must be within 1200 seconds of the internally stored time.  If no time
+been received before, the current time is set to @T@.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+No packet containing the same pair (N, T) can have been received
+in the last 1200 seconds (20 minutes).
+    </para>
+  </listitem>
+</itemizedlist>
+</sect1>
+</chapter>
+</book>
diff --git a/include/X11/Xdmcp.h b/include/X11/Xdmcp.h
new file mode 100755 (executable)
index 0000000..74ae4b3
--- /dev/null
@@ -0,0 +1,181 @@
+/*
+ * 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.
+ *
+ */
+
+#ifndef _XDMCP_H_
+#define _XDMCP_H_
+
+#include <X11/Xmd.h>
+
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+#define XDM_PROTOCOL_VERSION   1
+#define XDM_UDP_PORT           177
+
+/* IANA has assigned FF0X:0:0:0:0:0:0:12B as the permanently assigned 
+ * multicast addresses for XDMCP, where X in the prefix may be replaced
+ * by any valid scope identifier, such as 1 for Node-Local, 2 for Link-Local,
+ * 5 for Site-Local, and so on.  We set the default here to the Link-Local
+ * version to most closely match the old IPv4 subnet broadcast behavior.
+ * Both xdm and X -query allow specifying a different address if a different
+ * scope is defined.
+ */
+#define XDM_DEFAULT_MCAST_ADDR6        "ff02:0:0:0:0:0:0:12b"
+
+#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,
+#if defined(IPv6) && defined(AF_INET6)
+    XDM_MULTICAST, XDM_COLLECT_MULTICAST_QUERY,
+#endif
+    XDM_KEEP_ME_LAST
+} 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 XdmcpWriteARRAY16(XdmcpBufferPtr buffer, const ARRAY16Ptr array);
+extern int XdmcpWriteARRAY32(XdmcpBufferPtr buffer, const ARRAY32Ptr array);
+extern int XdmcpWriteARRAY8(XdmcpBufferPtr buffer, const ARRAY8Ptr array);
+extern int XdmcpWriteARRAYofARRAY8(XdmcpBufferPtr buffer, const ARRAYofARRAY8Ptr array);
+extern int XdmcpWriteCARD16(XdmcpBufferPtr buffer, unsigned value);
+extern int XdmcpWriteCARD32(XdmcpBufferPtr buffer, unsigned value);
+extern int XdmcpWriteCARD8(XdmcpBufferPtr buffer, unsigned value);
+extern int XdmcpWriteHeader(XdmcpBufferPtr  buffer, const XdmcpHeaderPtr  header);
+
+extern int XdmcpFlush(int fd, XdmcpBufferPtr buffer, XdmcpNetaddr to, int tolen);
+
+extern int XdmcpReadARRAY16(XdmcpBufferPtr buffer, ARRAY16Ptr array);
+extern int XdmcpReadARRAY32(XdmcpBufferPtr buffer, ARRAY32Ptr array);
+extern int XdmcpReadARRAY8(XdmcpBufferPtr buffer, ARRAY8Ptr array);
+extern int XdmcpReadARRAYofARRAY8(XdmcpBufferPtr buffer, ARRAYofARRAY8Ptr array);
+extern int XdmcpReadCARD16(XdmcpBufferPtr buffer, CARD16Ptr valuep);
+extern int XdmcpReadCARD32(XdmcpBufferPtr buffer, CARD32Ptr valuep);
+extern int XdmcpReadCARD8(XdmcpBufferPtr buffer, CARD8Ptr valuep);
+extern int XdmcpReadHeader(XdmcpBufferPtr buffer, XdmcpHeaderPtr header);
+
+extern int XdmcpFill(int fd, XdmcpBufferPtr buffer, XdmcpNetaddr from, int *fromlen);
+
+extern int XdmcpReadRemaining(const XdmcpBufferPtr buffer);
+
+extern void XdmcpDisposeARRAY8(ARRAY8Ptr array);
+extern void XdmcpDisposeARRAY16(ARRAY16Ptr array);
+extern void XdmcpDisposeARRAY32(ARRAY32Ptr array);
+extern void XdmcpDisposeARRAYofARRAY8(ARRAYofARRAY8Ptr array);
+
+extern int XdmcpCopyARRAY8(const ARRAY8Ptr src, ARRAY8Ptr dst);
+
+extern int XdmcpARRAY8Equal(const ARRAY8Ptr array1, const ARRAY8Ptr array2);
+
+extern void XdmcpGenerateKey (XdmAuthKeyPtr key);
+extern void XdmcpIncrementKey (XdmAuthKeyPtr key);
+extern void XdmcpDecrementKey (XdmAuthKeyPtr key);
+#ifdef HASXDMAUTH
+extern void XdmcpWrap(unsigned char *input, unsigned char *wrapper, unsigned char *output, int bytes);
+extern void XdmcpUnwrap(unsigned char *input, unsigned char *wrapper, unsigned char *output, int bytes);
+#endif
+
+#ifndef TRUE
+#define TRUE   1
+#define FALSE  0
+#endif
+
+extern int XdmcpCompareKeys (const XdmAuthKeyPtr a, const XdmAuthKeyPtr b);
+
+extern int XdmcpAllocARRAY16 (ARRAY16Ptr array, int length);
+extern int XdmcpAllocARRAY32 (ARRAY32Ptr array, int length);
+extern int XdmcpAllocARRAY8 (ARRAY8Ptr array, int length);
+extern int XdmcpAllocARRAYofARRAY8 (ARRAYofARRAY8Ptr array, int length);
+
+extern int XdmcpReallocARRAY16 (ARRAY16Ptr array, int length);
+extern int XdmcpReallocARRAY32 (ARRAY32Ptr array, int length);
+extern int XdmcpReallocARRAY8 (ARRAY8Ptr array, int length);
+extern int XdmcpReallocARRAYofARRAY8 (ARRAYofARRAY8Ptr array, int length);
+
+_XFUNCPROTOEND
+
+#endif /* _XDMCP_H_ */
diff --git a/packaging/libXdmcp.spec b/packaging/libXdmcp.spec
new file mode 100644 (file)
index 0000000..355e5f4
--- /dev/null
@@ -0,0 +1,68 @@
+
+Name:       libXdmcp
+Summary:    X.Org X11 libXdmcp runtime library
+Version:    1.1.0
+Release:    1
+Group:      System/Libraries
+License:    MIT
+URL:        http://www.x.org/
+Source0:    http://xorg.freedesktop.org/releases/individual/lib/%{name}-%{version}.tar.gz
+Requires(post):  /sbin/ldconfig
+Requires(postun):  /sbin/ldconfig
+BuildRequires:  pkgconfig(xproto)
+BuildRequires:  pkgconfig(xorg-macros)
+
+%description
+Description: %{summary}
+
+
+%package devel
+Summary:    Development components for the libXdmcp library
+Group:      Development/Libraries
+Requires:   %{name} = %{version}-%{release}
+
+%description devel
+Description: %{summary}
+
+
+%prep
+%setup -q -n %{name}-%{version}
+
+
+%build
+
+%reconfigure
+# Call make instruction with smp support
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+
+%clean
+rm -rf %{buildroot}
+
+
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+
+
+%files
+%defattr(-,root,root,-)
+%doc AUTHORS COPYING README ChangeLog
+%{_libdir}/libXdmcp.so.6
+%{_libdir}/libXdmcp.so.6.0.0
+
+
+%files devel
+%defattr(-,root,root,-)
+%dir %{_includedir}/X11/
+%{_includedir}/X11/Xdmcp.h
+%{_libdir}/libXdmcp.so
+%{_libdir}/pkgconfig/xdmcp.pc
+%{_docdir}/%{name}
+
diff --git a/xdmcp.pc.in b/xdmcp.pc.in
new file mode 100644 (file)
index 0000000..095d172
--- /dev/null
@@ -0,0 +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