From 49e2d0f05b865ed4aec92a03b8782356913e5eec Mon Sep 17 00:00:00 2001 From: Jinkun Jang Date: Wed, 13 Mar 2013 01:54:09 +0900 Subject: [PATCH] Tizen 2.1 base --- AUTHORS | 3 + AuDispose.c | 47 +++ AuFileName.c | 72 +++++ AuGetAddr.c | 109 +++++++ AuGetBest.c | 170 +++++++++++ AuLock.c | 117 ++++++++ AuRead.c | 107 +++++++ AuUnlock.c | 59 ++++ AuWrite.c | 68 +++++ Autest.c | 74 +++++ COPYING | 21 ++ ChangeLog | 687 +++++++++++++++++++++++++++++++++++++++++++ INSTALL | 291 ++++++++++++++++++ Makefile.am | 64 ++++ README | 182 ++++++++++++ autogen.sh | 12 + configure.ac | 82 ++++++ include/X11/Xauth.h | 137 +++++++++ man/Makefile.am | 47 +++ man/Xau.man | 129 ++++++++ man/XauDisposeAuth.man | 1 + man/XauFileName.man | 1 + man/XauGetAuthByAddr.man | 1 + man/XauGetBestAuthByAddr.man | 1 + man/XauLockAuth.man | 1 + man/XauReadAuth.man | 1 + man/XauUnlockAuth.man | 1 + man/XauWriteAuth.man | 1 + packaging/libXau.spec | 73 +++++ xau.pc.in | 11 + 30 files changed, 2570 insertions(+) create mode 100644 AUTHORS create mode 100644 AuDispose.c create mode 100644 AuFileName.c create mode 100644 AuGetAddr.c create mode 100644 AuGetBest.c create mode 100644 AuLock.c create mode 100644 AuRead.c create mode 100644 AuUnlock.c create mode 100644 AuWrite.c create mode 100644 Autest.c create mode 100644 COPYING create mode 100644 ChangeLog create mode 100644 INSTALL create mode 100644 Makefile.am create mode 100644 README create mode 100755 autogen.sh create mode 100644 configure.ac create mode 100644 include/X11/Xauth.h create mode 100644 man/Makefile.am create mode 100644 man/Xau.man create mode 100644 man/XauDisposeAuth.man create mode 100644 man/XauFileName.man create mode 100644 man/XauGetAuthByAddr.man create mode 100644 man/XauGetBestAuthByAddr.man create mode 100644 man/XauLockAuth.man create mode 100644 man/XauReadAuth.man create mode 100644 man/XauUnlockAuth.man create mode 100644 man/XauWriteAuth.man create mode 100644 packaging/libXau.spec create mode 100644 xau.pc.in diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..a491975 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,3 @@ +Keith Packard, X Consortium + +Some bug fixes, but not clear from where. diff --git a/AuDispose.c b/AuDispose.c new file mode 100644 index 0000000..2a9b2f1 --- /dev/null +++ b/AuDispose.c @@ -0,0 +1,47 @@ +/* + +Copyright 1988, 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. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include + +void +XauDisposeAuth (Xauth *auth) +{ + if (auth) { + if (auth->address) (void) free (auth->address); + if (auth->number) (void) free (auth->number); + if (auth->name) (void) free (auth->name); + if (auth->data) { + (void) bzero (auth->data, auth->data_length); + (void) free (auth->data); + } + free ((char *) auth); + } + return; +} diff --git a/AuFileName.c b/AuFileName.c new file mode 100644 index 0000000..f384f75 --- /dev/null +++ b/AuFileName.c @@ -0,0 +1,72 @@ +/* + +Copyright 1988, 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. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include + +char * +XauFileName (void) +{ + const char *slashDotXauthority = "/.Xauthority"; + char *name; + static char *buf; + static int bsize; +#ifdef WIN32 + char dir[128]; +#endif + int size; + + if ((name = getenv ("XAUTHORITY"))) + return name; + name = getenv ("HOME"); + if (!name) { +#ifdef WIN32 + (void) strcpy (dir, "/users/"); + if ((name = getenv("USERNAME"))) { + (void) strcat (dir, name); + name = dir; + } + if (!name) +#endif + return NULL; + } + size = strlen (name) + strlen(&slashDotXauthority[1]) + 2; + if (size > bsize) { + if (buf) + free (buf); + buf = malloc ((unsigned) size); + if (!buf) + return NULL; + bsize = size; + } + strcpy (buf, name); + strcat (buf, slashDotXauthority + (name[1] == '\0' ? 1 : 0)); + return buf; +} diff --git a/AuGetAddr.c b/AuGetAddr.c new file mode 100644 index 0000000..897d8b5 --- /dev/null +++ b/AuGetAddr.c @@ -0,0 +1,109 @@ +/* + +Copyright 1988, 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. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include + +static int +binaryEqual (_Xconst char *a, _Xconst char *b, int len) +{ + while (len--) + if (*a++ != *b++) + return 0; + return 1; +} + +Xauth * +XauGetAuthByAddr ( +#if NeedWidePrototypes +unsigned int family, +unsigned int address_length, +#else +unsigned short family, +unsigned short address_length, +#endif +_Xconst char* address, +#if NeedWidePrototypes +unsigned int number_length, +#else +unsigned short number_length, +#endif +_Xconst char* number, +#if NeedWidePrototypes +unsigned int name_length, +#else +unsigned short name_length, +#endif +_Xconst char* name) +{ + FILE *auth_file; + char *auth_name; + Xauth *entry; + + auth_name = XauFileName (); + if (!auth_name) + return NULL; + if (access (auth_name, R_OK) != 0) /* checks REAL id */ + return NULL; + auth_file = fopen (auth_name, "rb"); + if (!auth_file) + return NULL; + for (;;) { + entry = XauReadAuth (auth_file); + if (!entry) + break; + /* + * Match when: + * either family or entry->family are FamilyWild or + * family and entry->family are the same and + * address and entry->address are the same + * and + * either number or entry->number are empty or + * number and entry->number are the same + * and + * either name or entry->name are empty or + * name and entry->name are the same + */ + + if ((family == FamilyWild || entry->family == FamilyWild || + (entry->family == family && + address_length == entry->address_length && + binaryEqual (entry->address, address, (int)address_length))) && + (number_length == 0 || entry->number_length == 0 || + (number_length == entry->number_length && + binaryEqual (entry->number, number, (int)number_length))) && + (name_length == 0 || entry->name_length == 0 || + (entry->name_length == name_length && + binaryEqual (entry->name, name, (int)name_length)))) + break; + XauDisposeAuth (entry); + } + (void) fclose (auth_file); + return entry; +} diff --git a/AuGetBest.c b/AuGetBest.c new file mode 100644 index 0000000..673ee40 --- /dev/null +++ b/AuGetBest.c @@ -0,0 +1,170 @@ +/* + +Copyright 1988, 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. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#ifdef XTHREADS +#include +#endif +#ifdef hpux +#define X_INCLUDE_NETDB_H +#define XOS_USE_NO_LOCKING +#include +#endif + +static int +binaryEqual (_Xconst char *a, _Xconst char *b, int len) +{ + while (len--) + if (*a++ != *b++) + return 0; + return 1; +} + +Xauth * +XauGetBestAuthByAddr ( +#if NeedWidePrototypes + unsigned int family, + unsigned int address_length, +#else + unsigned short family, + unsigned short address_length, +#endif + _Xconst char* address, +#if NeedWidePrototypes + unsigned int number_length, +#else + unsigned short number_length, +#endif + _Xconst char* number, + int types_length, + char** types, + _Xconst int* type_lengths) +{ + FILE *auth_file; + char *auth_name; + Xauth *entry; + Xauth *best; + int best_type; + int type; +#ifdef hpux + char *fully_qual_address; + unsigned short fully_qual_address_length; +#endif + + auth_name = XauFileName (); + if (!auth_name) + return NULL; + if (access (auth_name, R_OK) != 0) /* checks REAL id */ + return NULL; + auth_file = fopen (auth_name, "rb"); + if (!auth_file) + return NULL; + +#ifdef hpux + if (family == FamilyLocal) { +#ifdef XTHREADS_NEEDS_BYNAMEPARAMS + _Xgethostbynameparams hparams; +#endif + struct hostent *hostp; + + /* make sure we try fully-qualified hostname */ + if ((hostp = _XGethostbyname(address,hparams)) != NULL) { + fully_qual_address = hostp->h_name; + fully_qual_address_length = strlen(fully_qual_address); + } + else + { + fully_qual_address = NULL; + fully_qual_address_length = 0; + } + } +#endif /* hpux */ + + best = NULL; + best_type = types_length; + for (;;) { + entry = XauReadAuth (auth_file); + if (!entry) + break; + /* + * Match when: + * either family or entry->family are FamilyWild or + * family and entry->family are the same and + * address and entry->address are the same + * and + * either number or entry->number are empty or + * number and entry->number are the same + * and + * either name or entry->name are empty or + * name and entry->name are the same + */ + + if ((family == FamilyWild || entry->family == FamilyWild || + (entry->family == family && + ((address_length == entry->address_length && + binaryEqual (entry->address, address, (int)address_length)) +#ifdef hpux + || (family == FamilyLocal && + fully_qual_address_length == entry->address_length && + binaryEqual (entry->address, fully_qual_address, + (int) fully_qual_address_length)) +#endif + ))) && + (number_length == 0 || entry->number_length == 0 || + (number_length == entry->number_length && + binaryEqual (entry->number, number, (int)number_length)))) + { + if (best_type == 0) + { + best = entry; + break; + } + for (type = 0; type < best_type; type++) + if (type_lengths[type] == entry->name_length && + !(strncmp (types[type], entry->name, entry->name_length))) + { + break; + } + if (type < best_type) + { + if (best) + XauDisposeAuth (best); + best = entry; + best_type = type; + if (type == 0) + break; + continue; + } + } + XauDisposeAuth (entry); + } + (void) fclose (auth_file); + return best; +} diff --git a/AuLock.c b/AuLock.c new file mode 100644 index 0000000..a816b24 --- /dev/null +++ b/AuLock.c @@ -0,0 +1,117 @@ +/* + +Copyright 1988, 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. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include +#include +#define Time_t time_t +#ifndef X_NOT_POSIX +#include +#else +#ifndef WIN32 +extern unsigned sleep (); +#else +#include +#define link rename +#endif +#endif +#ifdef __UNIXOS2__ +#define link rename +#endif + +int +XauLockAuth ( +_Xconst char *file_name, +int retries, +int timeout, +long dead) +{ + char creat_name[1025], link_name[1025]; + struct stat statb; + Time_t now; + int creat_fd = -1; + + if (strlen (file_name) > 1022) + return LOCK_ERROR; + (void) strcpy (creat_name, file_name); + (void) strcat (creat_name, "-c"); + (void) strcpy (link_name, file_name); + (void) strcat (link_name, "-l"); + if (stat (creat_name, &statb) != -1) { + now = time ((Time_t *) 0); + /* + * NFS may cause ctime to be before now, special + * case a 0 deadtime to force lock removal + */ + if (dead == 0 || now - statb.st_ctime > dead) { + (void) unlink (creat_name); + (void) unlink (link_name); + } + } + + while (retries > 0) { + if (creat_fd == -1) { + creat_fd = open (creat_name, O_WRONLY | O_CREAT | O_EXCL, 0600); + if (creat_fd == -1) { + if (errno != EACCES && errno != EEXIST) + return LOCK_ERROR; + } else + (void) close (creat_fd); + } + if (creat_fd != -1) { +#ifndef X_NOT_POSIX + /* The file system may not support hard links, and pathconf should tell us that. */ + if (1 == pathconf(creat_name, _PC_LINK_MAX)) { + if (-1 == rename(creat_name, link_name)) { + /* Is this good enough? Perhaps we should retry. TEST */ + return LOCK_ERROR; + } else { + return LOCK_SUCCESS; + } + } else { +#endif + if (link (creat_name, link_name) != -1) + return LOCK_SUCCESS; + if (errno == ENOENT) { + creat_fd = -1; /* force re-creat next time around */ + continue; + } + if (errno != EEXIST) + return LOCK_ERROR; +#ifndef X_NOT_POSIX + } +#endif + } + (void) sleep ((unsigned) timeout); + --retries; + } + return LOCK_TIMEOUT; +} diff --git a/AuRead.c b/AuRead.c new file mode 100644 index 0000000..3c59632 --- /dev/null +++ b/AuRead.c @@ -0,0 +1,107 @@ +/* + +Copyright 1988, 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. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include + +static int +read_short (unsigned short *shortp, FILE *file) +{ + unsigned char file_short[2]; + + if (fread ((char *) file_short, (int) sizeof (file_short), 1, file) != 1) + return 0; + *shortp = file_short[0] * 256 + file_short[1]; + return 1; +} + +static int +read_counted_string (unsigned short *countp, char **stringp, FILE *file) +{ + unsigned short len; + char *data; + + if (read_short (&len, file) == 0) + return 0; + if (len == 0) { + data = NULL; + } else { + data = malloc ((unsigned) len); + if (!data) + return 0; + if (fread (data, (int) sizeof (char), (int) len, file) != len) { + bzero (data, len); + free (data); + return 0; + } + } + *stringp = data; + *countp = len; + return 1; +} + +Xauth * +XauReadAuth (FILE *auth_file) +{ + Xauth local; + Xauth *ret; + + if (read_short (&local.family, auth_file) == 0) + return NULL; + if (read_counted_string (&local.address_length, &local.address, auth_file) == 0) + return NULL; + if (read_counted_string (&local.number_length, &local.number, auth_file) == 0) { + if (local.address) free (local.address); + return NULL; + } + if (read_counted_string (&local.name_length, &local.name, auth_file) == 0) { + if (local.address) free (local.address); + if (local.number) free (local.number); + return NULL; + } + if (read_counted_string (&local.data_length, &local.data, auth_file) == 0) { + if (local.address) free (local.address); + if (local.number) free (local.number); + if (local.name) free (local.name); + return NULL; + } + ret = (Xauth *) malloc (sizeof (Xauth)); + if (!ret) { + if (local.address) free (local.address); + if (local.number) free (local.number); + if (local.name) free (local.name); + if (local.data) { + bzero (local.data, local.data_length); + free (local.data); + } + return NULL; + } + *ret = local; + return ret; +} diff --git a/AuUnlock.c b/AuUnlock.c new file mode 100644 index 0000000..ddbe7db --- /dev/null +++ b/AuUnlock.c @@ -0,0 +1,59 @@ +/* + +Copyright 1988, 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. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include + +int +XauUnlockAuth ( +_Xconst char *file_name) +{ +#ifndef WIN32 + char creat_name[1025]; +#endif + char link_name[1025]; + + if (strlen (file_name) > 1022) + return 0; +#ifndef WIN32 + (void) strcpy (creat_name, file_name); + (void) strcat (creat_name, "-c"); +#endif + (void) strcpy (link_name, file_name); + (void) strcat (link_name, "-l"); + /* + * I think this is the correct order + */ +#ifndef WIN32 + (void) unlink (creat_name); +#endif + (void) unlink (link_name); + + return 1; +} diff --git a/AuWrite.c b/AuWrite.c new file mode 100644 index 0000000..0924f8d --- /dev/null +++ b/AuWrite.c @@ -0,0 +1,68 @@ +/* + +Copyright 1988, 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. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include + +static int +write_short (unsigned short s, FILE *file) +{ + unsigned char file_short[2]; + + file_short[0] = (s & (unsigned)0xff00) >> 8; + file_short[1] = s & 0xff; + if (fwrite ((char *) file_short, (int) sizeof (file_short), 1, file) != 1) + return 0; + return 1; +} + +static int +write_counted_string (unsigned short count, char *string, FILE *file) +{ + if (write_short (count, file) == 0) + return 0; + if (fwrite (string, (int) sizeof (char), (int) count, file) != count) + return 0; + return 1; +} + +int +XauWriteAuth (FILE *auth_file, Xauth *auth) +{ + if (write_short (auth->family, auth_file) == 0) + return 0; + if (write_counted_string (auth->address_length, auth->address, auth_file) == 0) + return 0; + if (write_counted_string (auth->number_length, auth->number, auth_file) == 0) + return 0; + if (write_counted_string (auth->name_length, auth->name, auth_file) == 0) + return 0; + if (write_counted_string (auth->data_length, auth->data, auth_file) == 0) + return 0; + return 1; +} diff --git a/Autest.c b/Autest.c new file mode 100644 index 0000000..efb3da8 --- /dev/null +++ b/Autest.c @@ -0,0 +1,74 @@ +/* + +Copyright 1988, 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. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include + +int +main (int argc, char **argv) +{ + Xauth test_data; + char *name = "XAU-TEST-1"; + char *data = "Do not begin the test until instructed to do so."; + char *file = NULL; + int state = 0; + FILE *output; + + while (*++argv) { + if (!strcmp (*argv, "-file")) + file = *++argv; + else if (state == 0) { + name = *argv; + ++state; + } else if (state == 1) { + data = *argv; + ++state; + } + } + test_data.family = 0; + test_data.address_length = 0; + test_data.address = ""; + test_data.number_length = 0; + test_data.number = ""; + test_data.name_length = strlen (name); + test_data.name = name; + test_data.data_length = strlen (data); + test_data.data = data; + if (!file) { + output = tmpfile(); + } else { + output = fopen (file, "w"); + } + if (output) { + state = XauWriteAuth (output, &test_data); + fclose (output); + } + return (state = 1) ? 0 : 1; +} diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..64492ad --- /dev/null +++ b/COPYING @@ -0,0 +1,21 @@ +Copyright 1988, 1993, 1994, 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. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..2d3c243 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,687 @@ +commit 0e3061495f5da8a323db02e612c4f09688b7ade0 +Author: Alan Coopersmith +Date: Tue Mar 6 22:16:57 2012 -0800 + + libXau 1.0.7 + + Signed-off-by: Alan Coopersmith + +commit 5c01ef69eee7dfe925c97558153fcd5e116252c6 +Author: Matthew D. Fuller +Date: Mon Sep 5 10:31:14 2011 -0500 + + Improve the handling of "normal" locking collisions. + + EEXIST is a perfectly normal and expected errno for open(O_CREAT | + O_EXCL), and is a signal to loop around and retry, not return with an + error. + + Signed-off-by: Matthew D. Fuller + Reviewed-by: Alan Coopersmith + Signed-off-by: Alan Coopersmith + +commit 8fd15eb0149cec75d69a27b1f8ec3ce092465b80 +Author: Alan Coopersmith +Date: Fri Sep 16 22:04:41 2011 -0700 + + Strip trailing whitespace + + Performed with: find * -type f | xargs perl -i -p -e 's{[ \t]+$}{}' + git diff -w & git diff -b show no diffs from this change + + Signed-off-by: Alan Coopersmith + +commit 063bfa679adc2c00a6b55e5c9ee97f2aa0638788 +Author: Gaetan Nadon +Date: Wed Feb 2 11:43:40 2011 -0500 + + config: comment, minor upgrade, quote and layout configure.ac + + Group statements per section as per Autoconf standard layout + Quote statements where appropriate. + Autoconf recommends not using dnl instead of # for comments + + Use AC_CONFIG_FILES to replace the deprecated AC_OUTPUT with parameters. + Use AC_PROG_LIBTOOL to replace the deprecated AM_PROG_LIBTOOL + Add AC_CONFIG_SRCDIR([Makefile.am]) where missing + No functional configuration changes + + This helps automated maintenance and release activities. + Details can be found in http://wiki.x.org/wiki/NewModuleGuidelines + + Signed-off-by: Gaetan Nadon + +commit c492cf2f90db79e75bf3fa8a8215f8139237c5c5 +Author: Gaetan Nadon +Date: Fri Jan 28 19:41:37 2011 -0500 + + config: replace deprecated AM_CONFIG_HEADER with AC_CONFIG_HEADERS + + Signed-off-by: Gaetan Nadon + +commit 7de07642d62440a90942a8a071624ac09f48a2b3 +Author: Gaetan Nadon +Date: Fri Jan 28 16:07:07 2011 -0500 + + config: replace deprecated AC_HELP_STRING with AS_HELP_STRING + + This silences an Automake warning. + + Signed-off-by: Gaetan Nadon + +commit 98f08b9c8414e7d759d08af4711b9519ca8fd37f +Author: Gaetan Nadon +Date: Fri Jan 28 11:56:13 2011 -0500 + + config: remove already included statements + + AC_PROG_INSTALL and AC_PROG_SED are included in XORG_DEFAULT_OPTIONS. + AC_PROG_MAKE_SET is included by AM_INIT_AUTOMAKE + + Signed-off-by: Gaetan Nadon + +commit b910d657d7b857fcd2564304205c853fa8148667 +Author: Gaetan Nadon +Date: Thu Jan 27 18:50:14 2011 -0500 + + config: remove AC_PROG_CC as it overrides AC_PROG_C_C99 + + XORG_STRICT_OPTION from XORG_DEFAULT_OPTIONS calls + AC_PROG_C_C99. This sets gcc with -std=gnu99. + If AC_PROG_CC macro is called afterwards, it resets CC to gcc. + + Signed-off-by: Gaetan Nadon + +commit 2085fbfa8347620890ed844057a42c9a4dba606b +Author: Jesse Adkins +Date: Tue Sep 28 13:30:02 2010 -0700 + + Purge cvs tags. + + Signed-off-by: Jesse Adkins + Signed-off-by: Alan Coopersmith + +commit 240d2475aa627774dad9e4f02594c5ce8c8048a4 +Author: Gaetan Nadon +Date: Wed Aug 11 09:41:00 2010 -0400 + + Xau.man: replace hard-coded 3 with __libmansuffix__ + + Signed-off-by: Gaetan Nadon + +commit afcd0ff9109b3478a473772c9d4e14d57951aab8 +Author: Gaetan Nadon +Date: Wed Aug 11 09:31:50 2010 -0400 + + Xau.man: remove whitespace as reported by git diff check + + Signed-off-by: Gaetan Nadon + +commit f666268d1f328f76cbbef367560eb9ea4da30808 +Author: Gaetan Nadon +Date: Wed Aug 11 09:11:55 2010 -0400 + + config: simplify building of shadow man pages + + Store the shadow files in git as any other man page. + Move man pages to man dir and use the common makefile + + Local fix in CVS for bug 5628 + is not required as the problem has been fixed in + util-macros d9062e4077ebfd0985baf8418f3d0f111b9ddbba + + Signed-off-by: Gaetan Nadon + +commit a01b74fad039e68cf296bd5e83c6f538181e529a +Author: Julien Cristau +Date: Mon Jul 19 17:17:54 2010 +0100 + + Bump to 1.0.6 + +commit ad12e7a68f69fdc960170c0248f07df68f0fc476 +Author: Julien Cristau +Date: Mon Jul 19 17:18:34 2010 +0100 + + Require xorg-macros 1.4 for XORG_INSTALL + +commit f8f0ec4955e51a2a420724f9bc2287d5a725cb39 +Author: Julien Cristau +Date: Mon Jul 19 17:16:13 2010 +0100 + + Kill cvs keyword + +commit 7d42fad5cec59cb0696087bed9745ffd5a999f68 +Author: Brice Goglin +Date: Sat May 29 21:11:14 2010 +0200 + + Xau.man: Add missing const attributes + + Reported by Tom Fogal in + http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=583599 + +commit f93ffa718135d9d85f04935325016b8766f05ea3 +Author: Brice Goglin +Date: Sat May 29 21:04:24 2010 +0200 + + Xau.man: Fix XauGetAuthByAddr() prototype + + Add missing name_length and name parameters. + + Reported by Tom Fogal in + http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=583599 + +commit c0bc3fb7ac4f719b96257e29eaa60c2d5ed11705 +Author: Alan Coopersmith +Date: Wed May 26 21:59:15 2010 -0700 + + Use AC_PROG_SED to find sed to use for man pages + + Signed-off-by: Alan Coopersmith + +commit ff907e90a2fe95bb234049a7a11e8e3b10d54533 +Author: Alan Coopersmith +Date: Wed May 26 21:57:12 2010 -0700 + + Use $(AM_V_GEN) to silence man page generation + + Signed-off-by: Alan Coopersmith + +commit 58aef8ebf89cc8d6d4d67dc7572752db0c44b6c3 +Author: Gaetan Nadon +Date: Tue Mar 30 09:05:41 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 + +commit 8db2a151b92fe3a408d847c868d7823a0217b73d +Author: Gaetan Nadon +Date: Tue Mar 30 09:05:05 2010 -0400 + + config: remove the pkgconfig pc.in file from EXTRA_DIST + + Automake always includes it in the tarball. + + Signed-off-by: Gaetan Nadon + +commit 4039c624286061122e3350f9194dba27118ab904 +Author: Gaetan Nadon +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 + +commit 243b553ace945da0263bb32464dfdc45e0c70c88 +Author: Gaetan Nadon +Date: Fri Nov 27 20:56:03 2009 -0500 + + Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES + + Now that the INSTALL file is generated. + Allows running make maintainer-clean. + +commit eed5cf87f68c665503d0dae90baf8549bb61358e +Author: Gaetan Nadon +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 31fe929d3ea43cd8fbe2853157682677704883ad +Author: Gaetan Nadon +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 f6ae36d4bf43cd601c3c1339100684169bbaeeb3 +Author: Gaetan Nadon +Date: Mon Oct 26 22:08:42 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 6e702152714be9538e1ae1b3533843f972ceb1e9 +Author: Gaetan Nadon +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 550725b423ec0364f0a32ed6935140617e366cf8 +Author: Jeremy Huddleston +Date: Wed Oct 21 12:47:23 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 + +commit 825435514bd91d0d903247c46249a87d6fe8ae09 +Author: Peter Hutterer +Date: Fri Aug 28 14:34:32 2009 +1000 + + libXau 1.0.5 + + Signed-off-by: Peter Hutterer + +commit fc54a4f03b926dfdb590b112c7128516ffc25539 +Author: Jeremy Huddleston +Date: Sun Feb 22 11:14:04 2009 -0800 + + Make file locking more robust for network shares like AFP + +commit 742ff03dcad4d16ca8901ed47be91b303523a385 +Author: Alan Coopersmith +Date: Fri Feb 6 11:35:40 2009 -0800 + + Restore FamilyKrb5Principal definition + + Even if Kerberos5 support is currently unimplemented in the X server & + libXau, the Family id for the X11 protocol is still defined and reserved + for Kerberos5, and should be recorded here for interoperability with + other implementations and to avoid reuse if someone adds a new + authentication family in the future. + + Signed-off-by: Alan Coopersmith + +commit c147fb417582e7384b5464bb53cfd492f9d7c69d +Author: Paulo Cesar Pereira de Andrade +Date: Mon Feb 2 16:54:20 2009 -0200 + + Remove old api kerberos. + + LibXau uses a 1993 kerberos api, but the X Server side support has + been already removed for quite some time. + This corrects bug report + https://bugs.freedesktop.org/show_bug.cgi?id=14684 + +commit 11fbe620625520668f5e88e4f5a8fe149a7cfa3f +Author: Paulo Cesar Pereira de Andrade +Date: Thu Jan 29 15:08:23 2009 -0200 + + Janitor: Correct make distcheck and remove extra .gitignore file. + +commit 7f6275300243fd15ce974d1b5e478b47f7758485 +Author: Alan Coopersmith +Date: Tue Aug 26 14:19:19 2008 -0700 + + Version bump: 1.0.4 + +commit 753bf38ceca4a0c8d6c6c1845b4387e4b3c9e4f0 +Author: Damien Th?bault +Date: Tue Aug 26 14:16:44 2008 -0700 + + Bug 17314: libXau's Makefile.am should have proper man creation rules + + X.Org Bugzilla #17314 + Patch #18528 + Signed-off-by: Alan Coopersmith + +commit a0b2aac596ea2cbe4d0ec1ef8c406ad98f0c499d +Author: Alan Coopersmith +Date: Tue Jul 8 15:08:35 2008 -0700 + + SVR4 (including Solaris) puts gethostbyname_r in libnsl instead of libc + +commit 1bc9f04963a8a236cc190e75e32282774b556932 +Author: Daniel Drake +Date: Tue May 29 14:06:00 2007 -0800 + + Bug #11097: libXau COPYING fix (add missing copyright dates) + + X.Org Bugzilla #11097 + +commit 45d137fdbb9b21513aff68e945e19cdfdcbc28b1 +Author: Daniel Stone +Date: Sat Dec 16 01:18:20 2006 +0200 + + bump to 1.0.3 + +commit fefdba6ed5ef56abf0da9caaca64af5a5e7895b0 +Author: Daniel Stone +Date: Wed Dec 6 18:53:29 2006 +0200 + + Makefile.am: make ChangeLog hook safer + Make ChangeLog hook as safe as possible. + +commit 90e34a4aa471b6e446345ba8095990e360a41570 +Author: Alan Coopersmith +Date: Fri Jul 28 13:47:44 2006 -0700 + + Version bump -> 1.0.2 + +commit fab8b091936874b4a8077f490ec80abf7b092049 +Author: Alan Coopersmith +Date: Mon Jul 24 13:14:04 2006 -0700 + + Require xorg-macros 1.1.0 or later for XORG_WITH_LINT & XORG_LINT_LIBRARY macros + +commit 3399e7bed20680520b39ade782d7a33966d477ae +Author: Alan Coopersmith +Date: Mon Jul 24 13:12:57 2006 -0700 + + Add lint library to CLEANFILES + +commit aa4f35661022f3f1c1b94284b34a531381d3a7f1 +Author: Matthieu Herrb +Date: Sun Jul 16 10:57:36 2006 +0200 + + set GIT_DIR=${srcdir}/.git for git-log + +commit 881115413a7c157c9aab8fba39c8929692baaacc +Author: Alan Coopersmith +Date: Thu Jul 13 17:01:49 2006 -0700 + + Generate lint library for checking programs that call functions in libXau + + (Disabled by default, enable with --enable-lint-library) + +commit f25155b03b9fa866d522714ad64e92bf7f2b95fa +Author: Alan Coopersmith +Date: Thu Jul 13 15:16:11 2006 -0700 + + renamed: include/.cvsignore -> include/.gitignore + +commit 9062a6da402d416f21d4365d3c3a29ceea707e77 +Author: Alan Coopersmith +Date: Wed Jul 12 23:53:14 2006 -0700 + + Replace static ChangeLog with dist-hook to generate from git-log + +commit 9b5a14e6de65658fdb712e737b292568a69dc3ee +Author: Alan Coopersmith +Date: Wed Jul 12 19:27:52 2006 -0700 + + Rename XORG_ENABLE_LINT to XORG_WITH_LINT + +commit d3f7a679fce893782774e97c0718393295d0773e +Author: Alan Coopersmith +Date: Wed Jul 12 19:26:53 2006 -0700 + + Move --with-lint handling to XORG_ENABLE_LINT() in xorg-macros.m4 + +commit 1abf440a6a54fb0624915f9ac975f3074252c422 +Author: Alan Coopersmith +Date: Wed Jul 12 19:25:38 2006 -0700 + + Add *~ to .gitignore to ignore emacs droppings + +commit 43b8275be56151bf0e29ce22795afbef24de0f9c +Author: Alan Coopersmith +Date: Wed Jul 12 17:00:16 2006 -0700 + + renamed: .cvsignore -> .gitignore + +commit 385d7fa4f151425539d613c9665b5e862f3ef614 +Author: Alan Coopersmith +Date: Wed Jun 28 22:53:36 2006 +0000 + + Add "--with-lint" configure flag and "make lint" Makefile target to check + source code with lint, sparse or similar tools. + +commit 21ea069c9078edd386e96e038e1a71e041e32cf5 +Author: Alan Coopersmith +Date: Wed Jun 28 22:49:36 2006 +0000 + + Changelog for last commit: + Remove prototype for XauGetAuthByName to clear lint warning: name declared + but never used or defined + Fix sparse warnings: + -warning: Using plain integer as NULL pointer + -warning: non-ANSI definition of function + +commit 8274b8e4b121c3dc3bfd5d0fa4f85bc23f5c09a0 +Author: Alan Coopersmith +Date: Wed Jun 28 22:26:50 2006 +0000 + + Remove prototype for XauGetAuthByName to clear lint warning: name declared + but never used or defined + Fix sparse warnings: + -warning: Using plain integer as NULL pointer + -warning: non-ANSI definition of function + +commit 7f6f90cfce51806340f25b80a87b147d8a743b27 +Author: Alan Coopersmith +Date: Sat Jun 10 01:27:06 2006 +0000 + + Clean up existing Autest test program and use to provide simple (and very + incomplete) "make check" test case. + +commit e214cc19e1d599f16a69e86b1d8b247ad40a9ed7 +Author: Adam Jackson +Date: Fri May 12 16:05:48 2006 +0000 + + Bump to 1.0.1 + +commit b92b597d7d597dd223371fe0ff60d1b2dad38fda +Author: Kevin E Martin +Date: Mon May 8 19:47:10 2006 +0000 + + Bug #5628 Shadow pages + not created correctly when MANDIR & MANSUFFIX don't match. + +commit 253a3e1c94642ccee9a3ed694eecb5382aa22b1e +Author: Kevin E Martin +Date: Thu Dec 15 00:24:28 2005 +0000 + + Update package version number for final X11R7 release candidate. + +commit c7648c97a5da8824d2871f528da89dedc98e2598 +Author: Kevin E Martin +Date: Tue Dec 6 22:48:42 2005 +0000 + + Change *man_SOURCES ==> *man_PRE to fix autotools warnings. + +commit c0fbe656693cab8fdf8776fb4d0fa85d0efc4e20 +Author: Kevin E Martin +Date: Sat Dec 3 05:49:42 2005 +0000 + + Update package version number for X11R7 RC3 release. + +commit d6d0baef6dd91cc1c3d3d701ad83ec095f02630c +Author: Alan Coopersmith +Date: Mon Nov 28 22:03:05 2005 +0000 + + Change *mandir targets to use new *_MAN_DIR variables set by xorg-macros.m4 + update to fix bug #5167 (Linux prefers *.1x man pages in man1 subdir) + +commit 1272a96ff8c6ee8c1ff5fc23c421b79ea4c15f92 +Author: Eric Anholt +Date: Sun Nov 20 23:17:40 2005 +0000 + + Add/improve libs .cvsignores. + +commit 08bef4712fc1e9194db9c8910f461873b7065063 +Author: Kevin E Martin +Date: Sat Nov 19 07:15:40 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 307ff4cf91c1331c29470a9654d9d18293b45389 +Author: Kevin E Martin +Date: Wed Oct 19 02:48:09 2005 +0000 + + Update package version number for RC1 release. + +commit 913ed232278b0673a763eb46e97aea0f78348b5a +Author: Alan Coopersmith +Date: Tue Oct 18 00:00:08 2005 +0000 + + Use @LIB_MAN_SUFFIX@ instead of $(LIB_MAN_SUFFIX) in macro substitutions to + work better with BSD make + +commit ce3af1f6d302e3b7adaba7e166f6f594aa13c310 +Author: Alan Coopersmith +Date: Mon Oct 17 21:13:15 2005 +0000 + + Rename .shadows.DONE to shadows.DONE to avoid some make's thinking it's a + suffix rule (reported by Matthieu Herrb) + +commit 86f92c112c22604824d2044b566b8cbee81cb397 +Author: Alan Coopersmith +Date: Wed Oct 12 00:39:36 2005 +0000 + + Use sed to put version number in man page Add shadow man pages for man + pages that document multiple functions. + +commit bd48f668b3c8d5de53e42b73ef4e4136d384672d +Author: Alan Coopersmith +Date: Thu Sep 22 01:40:07 2005 +0000 + + Set needed flags for MT-safe API's called from libXau + +commit 82affd3fdeafe063406d80e439c16b5d7ee66020 +Author: Kevin E Martin +Date: Fri Jul 29 21:22:50 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 2edd5e132ac2d1ca1a5631fb1e54970012b33f85 +Author: Keith Packard +Date: Sat Jul 9 06:06:57 2005 +0000 + + Add .cvsignore files + +commit 2527a93c7ba785499c52de48da9b60d02eb4722d +Author: Adam Jackson +Date: Thu May 19 00:22:32 2005 +0000 + + revert last change, didn't do right thing at all, sorry for the noise + +commit fe846da148f3dd15e13e34216853d700cd2c51fd +Author: Adam Jackson +Date: Thu May 19 00:10:07 2005 +0000 + + Require automake 1.7 in AM_INIT_AUTOMAKE + +commit 9607573553c23bcdfb1c3eaec3571aa52fdeb5ee +Author: Josh Triplett +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 . + +commit 56a655e717c5de6d91c890fdc6f9b0469ad1dd1a +Author: Søren Sandmann Pedersen +Date: Wed May 11 22:44:53 2005 +0000 + + lib/Xau: + - Update AUTHORS, COPYING from Keith's tree + - Don't use gcc specific "-include config.h" + - Add autogen.sh + lib/xtrans: + - Add AUTHORS, COPYING, ChangeLog, Makefile.am, NEWS, README, autogen.sh, + configure.ac, xtrans.pc.in + xc/lib/Xau: + - Add conditionalized #include + util/modular/symlink.sh + - Add functions symlink_lib_xau() and symlink_lib_xtrans() + util/modular/addconfig.h + - New script that adds #include to files + +commit 60177d823918d9ef7575da27870796c1285a2032 +Author: Søren Sandmann Pedersen +Date: Mon May 9 22:04:21 2005 +0000 + + Add Xau library to lib/ and symlink.sh + +commit 62b6efa4e0012fc499d2c70bff7b99b468a0458f +Author: Alexander Gottwald +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 05ed20614e85180684d5b8e663dcc2fe57851447 +Author: Egbert Eich +Date: Fri Apr 23 18:43:36 2004 +0000 + + Merging XORG-CURRENT into trunk + +commit 0b934581a8612148d70ecf84df72f6a69ca6c5c2 +Author: Egbert Eich +Date: Sun Mar 14 08:32:01 2004 +0000 + + Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004 + +commit 1a9fc5ef22e3bdd719fc0f991512b6a1d88faaad +Author: Egbert Eich +Date: Wed Mar 3 12:11:20 2004 +0000 + + Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004 + +commit 494e0315dcd701302bb81f2b68f759917ad401dd +Author: Egbert Eich +Date: Thu Feb 26 13:35:30 2004 +0000 + + readding XFree86's cvs IDs + +commit 690d8700431f1afcb585897e7cc49b4fd7c9cf46 +Author: Egbert Eich +Date: Thu Feb 26 09:22:39 2004 +0000 + + Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004 + +commit bca26a7b7c4c4f58d65462ffd3f1b0eaef2d5d4c +Author: Kaleb Keithley +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 1be3101aeab9b6136c32a91c23799724a7fe7797 +Author: Kaleb Keithley +Date: Fri Nov 14 16:48:47 2003 +0000 + + XFree86 4.3.0.1 + +commit dcc3fc52f917603df94ef4207f1dec9238dce23b +Author: Kaleb Keithley +Date: Fri Nov 14 15:54:38 2003 +0000 + + R6.6 is the Xorg base-line diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..8b82ade --- /dev/null +++ b/INSTALL @@ -0,0 +1,291 @@ +Installation Instructions +************************* + +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, +2006, 2007, 2008 Free Software Foundation, Inc. + + This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +Basic Installation +================== + + Briefly, the shell commands `./configure; make; make install' should +configure, build, and install this package. The following +more-detailed instructions are generic; see the `README' file for +instructions specific to this package. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. Caching is +disabled by default to prevent problems with accidental use of stale +cache files. + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You need `configure.ac' if +you want to change it or regenerate `configure' using a newer version +of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. + + Running `configure' might take a while. While running, it prints + some messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + + 6. Often, you can also type `make uninstall' to remove the installed + files again. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c99 CFLAGS=-g LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you can use GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + With a non-GNU `make', it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use `make distclean' before +reconfiguring for another architecture. + + On MacOS X 10.5 and later systems, you can create libraries and +executables that work on multiple system types--known as "fat" or +"universal" binaries--by specifying multiple `-arch' options to the +compiler but only a single `-arch' option to the preprocessor. Like +this: + + ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CPP="gcc -E" CXXCPP="g++ -E" + + This is not guaranteed to produce working output in all cases, you +may have to build one architecture at a time and combine the results +using the `lipo' tool if you have problems. + +Installation Names +================== + + By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Particular systems +================== + + On HP-UX, the default C compiler is not ANSI C compatible. If GNU +CC is not installed, it is recommended to use the following options in +order to use an ANSI C compiler: + + ./configure CC="cc -Ae" + +and if that doesn't work, install pre-built binaries of GCC for HP-UX. + + On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot +parse its `' header file. The option `-nodtk' can be used as +a workaround. If GNU CC is not installed, it is therefore recommended +to try + + ./configure CC="cc" + +and if that doesn't work, try + + ./configure CC="cc -nodtk" + +Specifying the System Type +========================== + + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). + +Unfortunately, this technique does not work for `CONFIG_SHELL' due to +an Autoconf bug. Until the bug is fixed you can use this workaround: + + CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash + +`configure' Invocation +====================== + + `configure' recognizes the following options to control how it +operates. + +`--help' +`-h' + Print a summary of all of the options to `configure', and exit. + +`--help=short' +`--help=recursive' + Print a summary of the options unique to this package's + `configure', and exit. The `short' variant lists options used + only in the top level, while the `recursive' variant lists options + also present in any nested packages. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--prefix=DIR' + Use DIR as the installation prefix. *Note Installation Names:: + for more details, including other options available for fine-tuning + the installation locations. + +`--no-create' +`-n' + Run the configure checks, but stop before creating any output + files. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..9e8d95b --- /dev/null +++ b/Makefile.am @@ -0,0 +1,64 @@ +SUBDIRS=man + +lib_LTLIBRARIES = libXau.la + +AM_CFLAGS = $(XAU_CFLAGS) $(CWARNFLAGS) + +INCLUDES = -I${top_srcdir}/include + +libXau_la_LDFLAGS = -version-number 6:0:0 -no-undefined + +libXau_la_LIBADD = $(XAU_LIBS) + +libXau_la_SOURCES = \ + AuDispose.c \ + AuFileName.c \ + AuGetAddr.c \ + AuGetBest.c \ + AuLock.c \ + AuRead.c \ + AuUnlock.c \ + AuWrite.c + +xauincludedir=$(includedir)/X11 + +xauinclude_HEADERS = include/X11/Xauth.h + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = xau.pc + +check_PROGRAMS=Autest +TESTS=Autest + +Autest_SOURCES=Autest.c +Autest_LDADD=libXau.la + +if LINT +ALL_LINT_FLAGS=$(LINT_FLAGS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) + +lint: + $(LINT) $(ALL_LINT_FLAGS) $(libXau_la_SOURCES) +endif LINT + +if MAKE_LINT_LIB +lintlibdir = $(libdir) + +lintlib_DATA = $(LINTLIB) + +$(LINTLIB): $(libXau_la_SOURCES) + $(LINT) -y -oXau -x $(ALL_LINT_FLAGS) $(libXau_la_SOURCES) +endif MAKE_LINT_LIB + +CLEANFILES = $(lintlib_DATA) +MAINTAINERCLEANFILES = ChangeLog INSTALL + +.PHONY: ChangeLog INSTALL + +INSTALL: + $(INSTALL_CMD) + +ChangeLog: + $(CHANGELOG_CMD) + +dist-hook: ChangeLog INSTALL diff --git a/README b/README new file mode 100644 index 0000000..249a1a7 --- /dev/null +++ b/README @@ -0,0 +1,182 @@ + + + A Sample Authorization Protocol for X + + +Overview + +The following note describes a very simple mechanism for providing individual +access to an X Window System display. It uses existing core protocol and +library hooks for specifying authorization data in the connection setup block +to restrict use of the display to only those clients that show that they +know a server-specific key called a "magic cookie". This mechanism is *not* +being proposed as an addition to the Xlib standard; among other reasons, a +protocol extension is needed to support more flexible mechanisms. We have +implemented this mechanism already; if you have comments, please send them +to us. + +This scheme involves changes to the following parts of the sample release: + + o xdm + - generate random magic cookie and store in protected file + - pass name of magic cookie file to server + - when user logs in, add magic cookie to user's auth file + - when user logs out, generate a new cookie for server + + o server + - a new command line option to specify cookie file + - check client authorization data against magic cookie + - read in cookie whenever the server resets + - do not add local machine to host list if magic cookie given + + o Xlib + - read in authorization data from file + - find data for appropriate server + - send authorization data if found + + o xauth [new program to manage user auth file] + - add entries to user's auth file + - remove entries from user's auth file + +This mechanism assumes that the superuser and the transport layer between +the client and the server is secure. + + +Description + +The sample implementation will use the xdm Display Manager to set up and +control the server's authorization file. Sites that do not run xdm will +need to build their own mechanisms. + +Xdm uses a random key (seeded by the system time and check sum of /dev/kmem) +to generate a unique sequence of characters at 16 bytes long. This sequence +will be written to a file which is made readable only by the server. The +server will then be started with a command line option instructing it to use +the contents of the file as the magic cookie for connections that include +authorization data. This will also disable the server from adding the local +machine's address to the initial host list. Note that the actual cookie must +not be stored on the command line or in an environment variable, to prevent +it from being publicly obtainable by the "ps" command. + +If a client presents an authorization name of "MIT-MAGIC-COOKIE-1" and +authorization data that matches the magic cookie, that client is allowed +access. If the name or data does not match and the host list is empty, +that client will be denied access. Otherwise, the existing host-based access +control will be used. Since any client that is making a connection from a +machine on the host list will be granted access even if their authorization +data is incorrect, sites are strongly urged not to set up any default hosts +using the /etc/X*.hosts files. Granting access to other machines should be +done by the user's session manager instead. + +Assuming the server is configured with an empty host list, the existence of the +cookie is sufficient to ensure there will be no unauthorized access to the +display. However, xdm will (continue to) work to minimize the chances of +spoofing on servers that do not support this authorization mechanism. This +will be done by grabbing the server and the keyboard after opening the display. +This action will be surrounded by a timer which will kill the server if the +grabs cannot be done within several seconds. [This level of security is now +implemented in patches already sent out.] + +After the user logs in, xdm will add authorization entries for each of the +server machine's network addresses to the user's authorization file (the format +of which is described below). This file will usually be named .Xauthority in +the users's home directory; will be owned by the user (as specified by the +pw_uid and pw_gid fields in the user's password entry), and will be accessible +only to the user (no group access). This file will contain authorization data +for all of the displays opened by the user. + +When the session terminates, xdm will generate and store a new magic cookie +for the server. Then, xdm will shutdown its own connection and send a +SIGHUP to the server process, which should cause the server to reset. The +server will then read in the new magic cookie. + +To support accesses (both read and write) from multiple machines (for use in +environments that use distributed file systems), file locking is done using +hard links. This is done by creat'ing (sic) a lock file and then linking it +to another name in the same directory. If the link-target already exists, +the link will fail, indicating failure to obtain the lock. Linking is used +instead of just creating the file read-only since link will fail even for +the superuser. + +Problems and Solutions + +There are a few problems with .Xauthority as described. If no home directory +exists, or if xdm cannot create a file there (disk full), xdm stores the +cookie in a file in a resource-specified back-up directory, and sets an +environment variable in the user's session (called XAUTHORITY) naming this +file. There is also the problem that the locking attempts will need to be +timed out, due to a leftover lock. Xdm, again, creates a file and set an +environment variable. Finally, the back-up directory might be full. Xdm, +as a last resort, provides a function key binding that allows a user to log +in without having the authorization data stored, and with host-based access +control disabled. + +Xlib + +XOpenDisplay in Xlib was enhanced to allow specification of authorization +information. As implied above, Xlib looks for the data in the +.Xauthority file of the home directory, or in the file pointed at by the +XAUTHORITY environment variable instead if that is defined. This required +no programmatic interface change to Xlib. In addition, a new Xlib routine +is provided to explicitly specify authorization. + + XSetAuthorization(name, namelen, data, datalen) + int namelen, datalen; + char *name, *data; + +There are three types of input: + + name NULL, data don't care - use default authorization mechanism. + name non-NULL, data NULL - use the named authorization; get + data from that mechanism's default. + name non-NULL, data non-NULL - use the given authorization and data. + +This interface is used by xdm and might also be used by any other +applications that wish to explicitly set the authorization information. + +Authorization File + +The .Xauthority file is a binary file consisting of a sequence of entries +in the following format: + + 2 bytes Family value (second byte is as in protocol HOST) + 2 bytes address length (always MSB first) + A bytes host address (as in protocol HOST) + 2 bytes display "number" length (always MSB first) + S bytes display "number" string + 2 bytes name length (always MSB first) + N bytes authorization name string + 2 bytes data length (always MSB first) + D bytes authorization data string + +The format is binary for easy processing, since authorization information +usually consists of arbitrary data. Host addresses are used instead of +names to eliminate potentially time-consuming name resolutions in +XOpenDisplay. Programs, such as xdm, that initialize the user's +authorization file will have to do the same work as the server in finding +addresses for all network interfaces. If more than one entry matches the +desired address, the entry that is chosen is implementation-dependent. In +our implementation, it is always the first in the file. + +The Family is specified in two bytes to allow out-of-band values +(i.e. values not in the Protocol) to be used. In particular, +two new values "FamilyLocal" and "FamilyWild" are defined. FamilyLocal +refers to any connections using a non-network method of connetion from the +local machine (Unix domain sockets, shared memory, loopback serial line). +In this case the host address is specified by the data returned from +gethostname() and better be unique in a collection of machines +which share NFS directories. FamilyWild is currently used only +by xdm to communicate authorization data to the server. It matches +any family/host address pair. + +For FamilyInternet, the host address is the 4 byte internet address, for +FamilyDecnet, the host address is the byte decnet address, for FamilyChaos +the address is also two bytes. + +The Display Number is the ascii representation of the display number +portion of the display name. It is in ascii to allow future expansion +to PseudoRoots or anything else that might happen. + +A utility called "xauth" will be provided for editing and viewing the +contents of authorization files. Note that the user's authorization file is +not the same as the server's magic cookie file. diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..904cd67 --- /dev/null +++ b/autogen.sh @@ -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 100644 index 0000000..92ad113 --- /dev/null +++ b/configure.ac @@ -0,0 +1,82 @@ +# +# Copyright © 2003 Keith Packard, Noah Levitt +# +# 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, and that the name of Keith Packard not be used in +# advertising or publicity pertaining to distribution of the software without +# specific, written prior permission. Keith Packard makes no +# representations about the suitability of this software for any purpose. It +# is provided "as is" without express or implied warranty. +# +# KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +# EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR +# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +# DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. +# + +# Initialize Autoconf +AC_PREREQ([2.60]) +AC_INIT([libXau], [1.0.7], + [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXau]) +AC_CONFIG_SRCDIR([Makefile.am]) +AC_CONFIG_HEADERS([config.h]) + +# Initialize Automake +AM_INIT_AUTOMAKE([foreign dist-bzip2]) +AM_MAINTAINER_MODE + +# Initialize libtool +AC_LIBTOOL_WIN32_DLL +AC_PROG_LIBTOOL + +# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS +m4_ifndef([XORG_MACROS_VERSION], + [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) +XORG_MACROS_VERSION(1.8) +XORG_DEFAULT_OPTIONS + +# Checks for programs. +AC_PROG_LN_S + +# Obtain compiler/linker options for depedencies +PKG_CHECK_MODULES(XAU, xproto) + +AC_ARG_ENABLE(xthreads, + AS_HELP_STRING([--disable-xthreads], + [Disable libXau support for Multithreading]), + [xthreads=$enableval],[xthreads=yes]) + +if test "x$xthreads" = "xyes" ; then + AC_DEFINE(XTHREADS,1,[Whether libXau is compiled with thread support]) + AC_CHECK_LIB(c, gethostbyname_r, [mtsafe=yes]) + if test "x$mtsafe" = "x" ; then + AC_CHECK_LIB(nsl, gethostbyname_r, [mtsafe=yes]) + fi + if test "x$mtsafe" = "xyes" ; then + AC_DEFINE(XUSE_MTSAFE_API, 1, + [Whether libXau needs to use MT safe API's]) + fi + +# XXX incomplete, please fill this in + case $host_os in + solaris*) + XTHREAD_CFLAGS="-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS" ;; + esac + XAU_CFLAGS="$XAU_CFLAGS $XTHREAD_CFLAGS" +fi + +# Allow checking code with lint, sparse, etc. +XORG_WITH_LINT +XORG_LINT_LIBRARY([Xau]) +LINT_FLAGS="${LINT_FLAGS} ${XAU_CFLAGS}" + +AC_CONFIG_FILES([Makefile + man/Makefile + xau.pc]) +AC_OUTPUT diff --git a/include/X11/Xauth.h b/include/X11/Xauth.h new file mode 100644 index 0000000..f57a1b3 --- /dev/null +++ b/include/X11/Xauth.h @@ -0,0 +1,137 @@ +/* + +Copyright 1988, 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. + +*/ + +#ifndef _Xauth_h +#define _Xauth_h + +typedef struct xauth { + unsigned short family; + unsigned short address_length; + char *address; + unsigned short number_length; + char *number; + unsigned short name_length; + char *name; + unsigned short data_length; + char *data; +} Xauth; + +#ifndef _XAUTH_STRUCT_ONLY + +# include +# include + +# include + +# define FamilyLocal (256) /* not part of X standard (i.e. X.h) */ +# define FamilyWild (65535) +# define FamilyNetname (254) /* not part of X standard */ +# define FamilyKrb5Principal (253) /* Kerberos 5 principal name */ +# define FamilyLocalHost (252) /* for local non-net authentication */ + + +_XFUNCPROTOBEGIN + +char *XauFileName(void); + +Xauth *XauReadAuth( +FILE* /* auth_file */ +); + +int XauLockAuth( +_Xconst char* /* file_name */, +int /* retries */, +int /* timeout */, +long /* dead */ +); + +int XauUnlockAuth( +_Xconst char* /* file_name */ +); + +int XauWriteAuth( +FILE* /* auth_file */, +Xauth* /* auth */ +); + +Xauth *XauGetAuthByAddr( +#if NeedWidePrototypes +unsigned int /* family */, +unsigned int /* address_length */, +#else +unsigned short /* family */, +unsigned short /* address_length */, +#endif +_Xconst char* /* address */, +#if NeedWidePrototypes +unsigned int /* number_length */, +#else +unsigned short /* number_length */, +#endif +_Xconst char* /* number */, +#if NeedWidePrototypes +unsigned int /* name_length */, +#else +unsigned short /* name_length */, +#endif +_Xconst char* /* name */ +); + +Xauth *XauGetBestAuthByAddr( +#if NeedWidePrototypes +unsigned int /* family */, +unsigned int /* address_length */, +#else +unsigned short /* family */, +unsigned short /* address_length */, +#endif +_Xconst char* /* address */, +#if NeedWidePrototypes +unsigned int /* number_length */, +#else +unsigned short /* number_length */, +#endif +_Xconst char* /* number */, +int /* types_length */, +char** /* type_names */, +_Xconst int* /* type_lengths */ +); + +void XauDisposeAuth( +Xauth* /* auth */ +); + +_XFUNCPROTOEND + +/* Return values from XauLockAuth */ + +# define LOCK_SUCCESS 0 /* lock succeeded */ +# define LOCK_ERROR 1 /* lock unexpectely failed, check errno */ +# define LOCK_TIMEOUT 2 /* lock failed, timeouts expired */ + +#endif /* _XAUTH_STRUCT_ONLY */ + +#endif /* _Xauth_h */ diff --git a/man/Makefile.am b/man/Makefile.am new file mode 100644 index 0000000..4becb8a --- /dev/null +++ b/man/Makefile.am @@ -0,0 +1,47 @@ +# +# 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. +# + +libmandir = $(LIB_MAN_DIR) + +libman_PRE = \ + Xau.man \ + XauDisposeAuth.man \ + XauFileName.man \ + XauGetAuthByAddr.man \ + XauGetBestAuthByAddr.man \ + XauLockAuth.man \ + XauReadAuth.man \ + XauUnlockAuth.man \ + XauWriteAuth.man + +libman_DATA = $(libman_PRE:man=$(LIB_MAN_SUFFIX)) + +EXTRA_DIST = $(libman_PRE) + +CLEANFILES = $(libman_DATA) + +# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure +SUFFIXES = .$(LIB_MAN_SUFFIX) .man + +.man.$(LIB_MAN_SUFFIX): + $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ diff --git a/man/Xau.man b/man/Xau.man new file mode 100644 index 0000000..46d4a19 --- /dev/null +++ b/man/Xau.man @@ -0,0 +1,129 @@ +.\" Copyright (c) 1994 X Consortium +.\" +.\" 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 furnished to do so, subject to the following conditions: +.\" +.\" The above copyright notice and this permission notice shall be included in +.\" all copies or substantial portions of the Software. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +.\" THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +.\" SOFTWARE. +.\" +.\" Except as contained in this notice, the name of the X Consortium shall not +.\" be used in advertising or otherwise to promote the sale, use or other +.\" dealing in this Software without prior written authorization from the +.\" X Consortium. +.\" +.TH Xau __libmansuffix__ __xorgversion__ +.SH NAME +Xau library: XauFileName, XauReadAuth, XauLockAuth, XauUnlockAuth, +XauWriteAuth, XauDisposeAuth, +XauGetAuthByAddr, XauGetBestAuthByAddr \- X authority database routines +.SH SYNOPSIS +.B "#include " +.PP +.nf +.ta .5i 2i +typedef struct xauth { + unsigned short family; + unsigned short address_length; + char *address; + unsigned short number_length; + char *number; + unsigned short name_length; + char *name; + unsigned short data_length; + char *data; +} Xauth; + +.HP +char *XauFileName (void); +.HP +Xauth *XauReadAuth (FILE *\fIauth_file\fP\^); +.HP +int XauWriteAuth (FILE *\fIauth_file\fP, Xauth *\fIauth\fP\^); +.HP +Xauth *XauGetAuthByAddr (unsigned short \fIfamily\fP\^, unsigned short +\fIaddress_length\fP\^, const char *\fIaddress\fP\^, unsigned short +\fInumber_length\fP\^, const char *\fInumber\fP\^, unsigned short +\fIname_length\fP\^, const char *\fIname\fP\^); +.HP +Xauth *XauGetBestAuthByAddr (unsigned short \fIfamily\fP\^, unsigned short +\fIaddress_length\fP\^, const char *\fIaddress\fP\^, unsigned short +\fInumber_length\fP\^, const char *\fInumber\fP\^, int \fItypes_length\fP\^, +char **\fItypes\fR\^, const int *\fItype_lengths\fR\^); +.HP +int XauLockAuth (const char *\fIfile_name\fP\^, int \fIretries\fP\^, int +\fItimeout\fP\^, long \fIdead\fP\^); +.HP +int XauUnlockAuth (const char *\fIfile_name\fP\^); +.HP +int XauDisposeAuth (Xauth *\fIauth\fP\^); +.ft R +.SH DESCRIPTION +.PP +\fBXauFileName\fP generates the default authorization file name by first +checking the XAUTHORITY environment variable if set, else it returns +$HOME/.Xauthority. This name is statically allocated and should +not be freed. +.PP +\fBXauReadAuth\fP reads the next entry from \fIauth_file\fP. The entry is +\fBnot\fP statically allocated and should be freed by calling +\fIXauDisposeAuth\fP. +.PP +\fBXauWriteAuth\fP writes an authorization entry to \fIauth_file\fP. It +returns 1 on success, 0 on failure. +.PP +\fBXauGetAuthByAddr\fP searches for an entry which matches the given network +address/display number pair. The entry is \fBnot\fP statically allocated +and should be freed by calling \fIXauDisposeAuth\fP. +.PP +\fBXauGetBestAuthByAddr\fP is similar to \fBXauGetAuthByAddr\fP, except +that a list of acceptable authentication methods is specified. Xau will +choose the file entry which matches the earliest entry in this list (e.g., the +most secure authentication method). The \fItypes\fP argument is an array of +strings, one string for each authentication method. \fItypes_length\fP +specifies how many elements are in the \fItypes\fP array. +\fItypes_lengths\fP is an array of integers representing the length +of each string. +.PP +\fBXauLockAuth\fP does the work necessary to synchronously update an +authorization file. First it makes two file names, one with ``-c'' appended +to \fIfile_name\fP, the other with ``-l'' appended. If the ``-c'' file +already exists and is more than \fIdead\fP seconds old, \fIXauLockAuth\fP +removes it and the associated ``-l'' file. To prevent possible +synchronization troubles with NFS, a \fIdead\fP value of zero forces the +files to be removed. \fIXauLockAuth\fP makes \fIretries\fP attempts to +create and link the file names, pausing \fItimeout\fP seconds between each +attempt. \fIXauLockAuth\fP returns a collection of values depending on the +results: +.nf +.ta .5i 2i + + LOCK_ERROR A system error occurred, either a file_name + which is too long, or an unexpected failure from + a system call. errno may prove useful. + + LOCK_TIMEOUT \fIretries\fP attempts failed + + LOCK_SUCCESS The lock succeeded. + +.fi +.PP +\fBXauUnlockAuth\fP undoes the work of \fIXauLockAuth\fP by unlinking both +the ``-c'' and ``-l'' file names. +.PP +\fBXauDisposeAuth\fP frees storage allocated to hold an authorization entry. +.SH "SEE ALSO" +xauth(1), xdm(1) +.SH AUTHOR +Keith Packard, MIT X Consortium diff --git a/man/XauDisposeAuth.man b/man/XauDisposeAuth.man new file mode 100644 index 0000000..df111d6 --- /dev/null +++ b/man/XauDisposeAuth.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xau.__libmansuffix__ diff --git a/man/XauFileName.man b/man/XauFileName.man new file mode 100644 index 0000000..df111d6 --- /dev/null +++ b/man/XauFileName.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xau.__libmansuffix__ diff --git a/man/XauGetAuthByAddr.man b/man/XauGetAuthByAddr.man new file mode 100644 index 0000000..df111d6 --- /dev/null +++ b/man/XauGetAuthByAddr.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xau.__libmansuffix__ diff --git a/man/XauGetBestAuthByAddr.man b/man/XauGetBestAuthByAddr.man new file mode 100644 index 0000000..df111d6 --- /dev/null +++ b/man/XauGetBestAuthByAddr.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xau.__libmansuffix__ diff --git a/man/XauLockAuth.man b/man/XauLockAuth.man new file mode 100644 index 0000000..df111d6 --- /dev/null +++ b/man/XauLockAuth.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xau.__libmansuffix__ diff --git a/man/XauReadAuth.man b/man/XauReadAuth.man new file mode 100644 index 0000000..df111d6 --- /dev/null +++ b/man/XauReadAuth.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xau.__libmansuffix__ diff --git a/man/XauUnlockAuth.man b/man/XauUnlockAuth.man new file mode 100644 index 0000000..df111d6 --- /dev/null +++ b/man/XauUnlockAuth.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xau.__libmansuffix__ diff --git a/man/XauWriteAuth.man b/man/XauWriteAuth.man new file mode 100644 index 0000000..df111d6 --- /dev/null +++ b/man/XauWriteAuth.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xau.__libmansuffix__ diff --git a/packaging/libXau.spec b/packaging/libXau.spec new file mode 100644 index 0000000..1a78721 --- /dev/null +++ b/packaging/libXau.spec @@ -0,0 +1,73 @@ +Name: libXau +Summary: X.Org X11 libXau runtime library +Version: 1.0.7 +Release: 1 +Group: System/Libraries +License: MIT +URL: http://www.x.org/ +Source0: http://xorg.freedesktop.org/releases/individual/lib/%{name}-%{version}.tar.gz + +BuildRequires: pkgconfig(xproto) +BuildRequires: pkgconfig(xorg-macros) + +Requires(post): /sbin/ldconfig +Requires(postun): /sbin/ldconfig + +BuildRoot: %{_tmppath}/%{name}-%{version}-build + +%description +Description: %{summary} +This is a very simple mechanism for providing individual access to an X Window +System display.It uses existing core protocol and library hooks for specifying +authorization data in the connection setup block to restrict use of the display +to only those clients that show that they know a server-specific key +called a "magic cookie". + +%package devel +Summary: Development components for the libXau library +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} +Provides: libxau-devel + +%description devel +Description: %{summary} + +%prep +%setup -q + +%build + +./autogen.sh +%reconfigure --disable-static + +# Call make instruction with smp support +make %{?jobs:-j%jobs} + +%install +rm -rf %{buildroot} +mkdir -p %{buildroot}/usr/share/license +cp -af COPYING %{buildroot}/usr/share/license/%{name} +%make_install + +# remove *.la files +rm -f %{buildroot}%{_libdir}/*.la + +%remove_docs + +%clean +rm -rf %{buildroot} + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%files +%defattr(-,root,root,-) +/usr/share/license/%{name} +%{_libdir}/*.so.* + +%files devel +%defattr(-,root,root,-) +%dir %{_includedir}/X11 +%{_includedir}/X11/*.h +%{_libdir}/*.so +%{_libdir}/pkgconfig/*.pc diff --git a/xau.pc.in b/xau.pc.in new file mode 100644 index 0000000..cda113a --- /dev/null +++ b/xau.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: Xau +Description: X authorization file management libary +Version: @PACKAGE_VERSION@ +Requires: xproto +Cflags: -I${includedir} +Libs: -L${libdir} -lXau -- 2.7.4