Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37845866
en ru br
ALT Linux repositórios
S:1.0.11-alt1
5.0: 1.0.4-alt2
4.1: 1.0.3-alt1
4.0: 1.0.3-alt1

Group :: Sistema/Bibliotecas
RPM: libXau

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

pax_global_header00006660000000000000000000000064121477617200014521gustar00rootroot0000000000000052 comment=899790011304c4029e15abf410e49ce7cec17e0a
libXau-1.0.8/000075500000000000000000000000001214776172000127515ustar00rootroot00000000000000libXau-1.0.8/.gitignore000064400000000000000000000017471214776172000147520ustar00rootroot00000000000000#
# X.Org module default exclusion patterns
# The next section if for module specific patterns
#
# Do not edit the following section
# GNU Build System (Autotools)
aclocal.m4
autom4te.cache/
autoscan.log
ChangeLog
compile
config.guess
config.h
config.h.in
config.log
config-ml.in
config.py
config.status
config.status.lineno
config.sub
configure
configure.scan
depcomp
.deps/
INSTALL
install-sh
.libs/
libtool
libtool.m4
ltmain.sh
lt~obsolete.m4
ltoptions.m4
ltsugar.m4
ltversion.m4
Makefile
Makefile.in
mdate-sh
missing
mkinstalldirs
*.pc
py-compile
stamp-h?
symlink-tree
texinfo.tex
ylwrap

# Do not edit the following section
# Edit Compile Debug Document Distribute
*~
*.[0-9]
*.[0-9]x
*.bak
*.bin
core
*.dll
*.exe
*-ISO*.bdf
*-JIS*.bdf
*-KOI8*.bdf
*.kld
*.ko
*.ko.cmd
*.lai
*.l[oa]
*.[oa]
*.obj
*.patch
*.so
*.pcf.gz
*.pdb
*.tar.bz2
*.tar.gz
#
# Add & Override patterns for libXau
#
# Edit the following section as needed
# For example, !report.pc overrides *.pc. See 'man gitignore'
#
libXau-1.0.8/AUTHORS000064400000000000000000000001071214776172000140170ustar00rootroot00000000000000Keith Packard, X Consortium

Some bug fixes, but not clear from where.
libXau-1.0.8/AuDispose.c000064400000000000000000000030471214776172000150150ustar00rootroot00000000000000/*

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 <config.h>
#endif
#include <X11/Xauth.h>
#include <stdlib.h>

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;
}
libXau-1.0.8/AuFileName.c000064400000000000000000000043401214776172000150640ustar00rootroot00000000000000/*

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 <config.h>
#endif
#include <X11/Xauth.h>
#include <X11/Xos.h>
#include <stdlib.h>

static char *buf = NULL;

static void
free_filename_buffer(void)
{
free(buf);
buf = NULL;
}

char *
XauFileName (void)
{
const char *slashDotXauthority = "/.Xauthority";
char *name;
static size_t bsize;
static int atexit_registered = 0;
#ifdef WIN32
char dir[128];
#endif
size_t size;

if ((name = getenv ("XAUTHORITY")))
return name;
name = getenv ("HOME");
if (!name) {
#ifdef WIN32
if ((name = getenv("USERNAME"))) {
snprintf(dir, sizeof(dir), "/users/%s", name);
name = dir;
}
if (!name)
#endif
return NULL;
}
size = strlen (name) + strlen(&slashDotXauthority[1]) + 2;
if (size > bsize) {
if (buf)
free (buf);
buf = malloc (size);
if (!buf)
return NULL;

if (!atexit_registered) {
atexit(free_filename_buffer);
atexit_registered = 1;
}

bsize = size;
}
snprintf (buf, bsize, "%s%s", name,
slashDotXauthority + (name[1] == '\0' ? 1 : 0));
return buf;
}
libXau-1.0.8/AuGetAddr.c000064400000000000000000000060031214776172000147140ustar00rootroot00000000000000/*

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 <config.h>
#endif
#include <X11/Xauth.h>
#include <X11/Xos.h>

#define binaryEqual(a, b, len) (memcmp(a, b, len) == 0)

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, address_length))) &&
(number_length == 0 || entry->number_length == 0 ||
(number_length == entry->number_length &&
binaryEqual (entry->number, number, number_length))) &&
(name_length == 0 || entry->name_length == 0 ||
(entry->name_length == name_length &&
binaryEqual (entry->name, name, name_length))))
break;
XauDisposeAuth (entry);
}
(void) fclose (auth_file);
return entry;
}
libXau-1.0.8/AuGetBest.c000064400000000000000000000103631214776172000147430ustar00rootroot00000000000000/*

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 <config.h>
#endif
#include <X11/Xauth.h>
#include <X11/Xos.h>
#ifdef XTHREADS
#include <X11/Xthreads.h>
#endif
#ifdef hpux
#define X_INCLUDE_NETDB_H
#define XOS_USE_NO_LOCKING
#include <X11/Xos_r.h>
#endif

#define binaryEqual(a, b, len) (memcmp(a, b, len) == 0)

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, address_length))
#ifdef hpux
|| (family == FamilyLocal &&
fully_qual_address_length == entry->address_length &&
binaryEqual (entry->address, fully_qual_address,
fully_qual_address_length))
#endif
))) &&
(number_length == 0 || entry->number_length == 0 ||
(number_length == entry->number_length &&
binaryEqual (entry->number, number, 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;
}
libXau-1.0.8/AuLock.c000064400000000000000000000060031214776172000142720ustar00rootroot00000000000000/*

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 <config.h>
#endif
#include <X11/Xauth.h>
#include <X11/Xos.h>
#include <sys/stat.h>
#include <errno.h>
#include <time.h>
#define Time_t time_t
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef WIN32
# include <X11/Xwindows.h>
# 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;
snprintf (creat_name, sizeof(creat_name), "%s-c", file_name);
snprintf (link_name, sizeof(link_name), "%s-l", file_name);
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) remove (creat_name);
(void) remove (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) {
#ifdef HAVE_PATHCONF
/* 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;
}
}
(void) sleep ((unsigned) timeout);
--retries;
}
return LOCK_TIMEOUT;
}
libXau-1.0.8/AuRead.c000064400000000000000000000060071214776172000142610ustar00rootroot00000000000000/*

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 <config.h>
#endif
#include <X11/Xauth.h>
#include <stdlib.h>

static int
read_short (unsigned short *shortp, FILE *file)
{
unsigned char file_short[2];

if (fread ((char *) file_short, 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, sizeof (char), 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;
}
libXau-1.0.8/AuUnlock.c000064400000000000000000000032621214776172000146410ustar00rootroot00000000000000/*

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 <config.h>
#endif
#include <X11/Xauth.h>
#include <X11/Xos.h>

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
snprintf (creat_name, sizeof(creat_name), "%s-c", file_name);
#endif
snprintf (link_name, sizeof(link_name), "%s-l", file_name);
/*
* I think this is the correct order
*/
#ifndef WIN32
(void) remove (creat_name);
#endif
(void) remove (link_name);

return 1;
}
libXau-1.0.8/AuWrite.c000064400000000000000000000042401214776172000144750ustar00rootroot00000000000000/*

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 <config.h>
#endif
#include <X11/Xauth.h>

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, 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, sizeof (char), 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;
}
libXau-1.0.8/Autest.c000064400000000000000000000042101214776172000143570ustar00rootroot00000000000000/*

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 <config.h>
#endif
#include <X11/Xauth.h>
#include <stdio.h>
#include <stdlib.h>

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;
}
libXau-1.0.8/COPYING000064400000000000000000000021741214776172000140100ustar00rootroot00000000000000Copyright 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.
libXau-1.0.8/Makefile.am000064400000000000000000000021161214776172000150050ustar00rootroot00000000000000SUBDIRS=man

lib_LTLIBRARIES = libXau.la

AM_CFLAGS = $(XAU_CFLAGS) $(CWARNFLAGS)
AM_CPPFLAGS = -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
libXau-1.0.8/README000064400000000000000000000212161214776172000136330ustar00rootroot00000000000000

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.
libXau-1.0.8/autogen.sh000075500000000000000000000003211214776172000147460ustar00rootroot00000000000000#! /bin/sh

srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.

ORIGDIR=`pwd`
cd $srcdir

autoreconf -v --install || exit 1
cd $ORIGDIR || exit $?

if test -z "$NOCONFIGURE"; then
$srcdir/configure "$@"
fi
libXau-1.0.8/configure.ac000064400000000000000000000055271214776172000152500ustar00rootroot00000000000000#
# 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.8],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXau])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([config.h])
AC_USE_SYSTEM_EXTENSIONS

# Initialize Automake
AM_INIT_AUTOMAKE([foreign dist-bzip2])

# 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

# Checks for library functions.
AC_CHECK_FUNCS([pathconf])

# 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
libXau-1.0.8/include/000075500000000000000000000000001214776172000143745ustar00rootroot00000000000000libXau-1.0.8/include/X11/000075500000000000000000000000001214776172000147455ustar00rootroot00000000000000libXau-1.0.8/include/X11/Xauth.h000064400000000000000000000073511214776172000162150ustar00rootroot00000000000000/*

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

/* struct xauth is full of implicit padding to properly align the pointers
after the length fields. We can't clean that up without breaking ABI,
so tell clang not to bother complaining about it. */
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpadded"
#endif

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;

#ifdef __clang__
#pragma clang diagnostic pop
#endif

#ifndef _XAUTH_STRUCT_ONLY

# include <X11/Xfuncproto.h>
# include <X11/Xfuncs.h>

# include <stdio.h>

# 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 */
libXau-1.0.8/man/000075500000000000000000000000001214776172000135245ustar00rootroot00000000000000libXau-1.0.8/man/Makefile.am000064400000000000000000000032431214776172000155620ustar00rootroot00000000000000#
# 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) < $< > $@
libXau-1.0.8/man/Xau.man000064400000000000000000000122171214776172000147610ustar00rootroot00000000000000.\" 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
.ft CW
.nf
#include <X11/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;
.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\^);
.fi
.ft
.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:
.TP
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.
.TP
LOCK_TIMEOUT
\fIretries\fP attempts failed
.TP
LOCK_SUCCESS
The lock succeeded.
.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
libXau-1.0.8/man/XauDisposeAuth.man000064400000000000000000000000551214776172000171270ustar00rootroot00000000000000.so man__libmansuffix__/Xau.__libmansuffix__
libXau-1.0.8/man/XauFileName.man000064400000000000000000000000551214776172000163570ustar00rootroot00000000000000.so man__libmansuffix__/Xau.__libmansuffix__
libXau-1.0.8/man/XauGetAuthByAddr.man000064400000000000000000000000551214776172000173260ustar00rootroot00000000000000.so man__libmansuffix__/Xau.__libmansuffix__
libXau-1.0.8/man/XauGetBestAuthByAddr.man000064400000000000000000000000551214776172000201440ustar00rootroot00000000000000.so man__libmansuffix__/Xau.__libmansuffix__
libXau-1.0.8/man/XauLockAuth.man000064400000000000000000000000551214776172000164110ustar00rootroot00000000000000.so man__libmansuffix__/Xau.__libmansuffix__
libXau-1.0.8/man/XauReadAuth.man000064400000000000000000000000551214776172000163740ustar00rootroot00000000000000.so man__libmansuffix__/Xau.__libmansuffix__
libXau-1.0.8/man/XauUnlockAuth.man000064400000000000000000000000551214776172000167540ustar00rootroot00000000000000.so man__libmansuffix__/Xau.__libmansuffix__
libXau-1.0.8/man/XauWriteAuth.man000064400000000000000000000000551214776172000166130ustar00rootroot00000000000000.so man__libmansuffix__/Xau.__libmansuffix__
libXau-1.0.8/xau.pc.in000064400000000000000000000003551214776172000145020ustar00rootroot00000000000000prefix=@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
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009