1 .\" $Xorg: Xau.man,v 1.3 2000/08/17 19:41:54 cpqbld Exp $
4 .\" Copyright (c) 1994 X Consortium
6 .\" Permission is hereby granted, free of charge, to any person obtaining a
7 .\" copy of this software and associated documentation files (the "Software"),
8 .\" to deal in the Software without restriction, including without limitation
9 .\" the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 .\" and/or sell copies of the Software, and to permit persons to whom the
11 .\" Software furnished to do so, subject to the following conditions:
13 .\" The above copyright notice and this permission notice shall be included in
14 .\" all copies or substantial portions of the Software.
16 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 .\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 .\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 .\" THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20 .\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
21 .\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 .\" Except as contained in this notice, the name of the X Consortium shall not
25 .\" be used in advertising or otherwise to promote the sale, use or other
26 .\" dealing in this Software without prior written authorization from the
29 .\" $XFree86: xc/doc/man/Xau/Xau.man,v 1.2 2001/01/27 18:20:19 dawes Exp $
31 .TH Xau 3 __xorgversion__
33 Xau library: XauFileName, XauReadAuth, XauLockAuth, XauUnlockAuth,
34 XauWriteAuth, XauDisposeAuth,
35 XauGetAuthByAddr, XauGetBestAuthByAddr \- X authority database routines
37 .B "#include <X11/Xauth.h>"
41 typedef struct xauth {
42 unsigned short family;
43 unsigned short address_length;
45 unsigned short number_length;
47 unsigned short name_length;
49 unsigned short data_length;
54 char *XauFileName (void);
56 Xauth *XauReadAuth (FILE *\fIauth_file\fP\^);
58 int XauWriteAuth (FILE *\fIauth_file\fP, Xauth *\fIauth\fP\^);
60 Xauth *XauGetAuthByAddr (unsigned short \fIfamily\fP\^, unsigned short
61 \fIaddress_length\fP\^, const char *\fIaddress\fP\^, unsigned short
62 \fInumber_length\fP\^, const char *\fInumber\fP\^, unsigned short
63 \fIname_length\fP\^, const char *\fIname\fP\^);
65 Xauth *XauGetBestAuthByAddr (unsigned short \fIfamily\fP\^, unsigned short
66 \fIaddress_length\fP\^, const char *\fIaddress\fP\^, unsigned short
67 \fInumber_length\fP\^, const char *\fInumber\fP\^, int \fItypes_length\fP\^,
68 char **\fItypes\fR\^, const int *\fItype_lengths\fR\^);
70 int XauLockAuth (const char *\fIfile_name\fP\^, int \fIretries\fP\^, int
71 \fItimeout\fP\^, long \fIdead\fP\^);
73 int XauUnlockAuth (const char *\fIfile_name\fP\^);
75 int XauDisposeAuth (Xauth *\fIauth\fP\^);
79 \fBXauFileName\fP generates the default authorization file name by first
80 checking the XAUTHORITY environment variable if set, else it returns
81 $HOME/.Xauthority. This name is statically allocated and should
84 \fBXauReadAuth\fP reads the next entry from \fIauth_file\fP. The entry is
85 \fBnot\fP statically allocated and should be freed by calling
88 \fBXauWriteAuth\fP writes an authorization entry to \fIauth_file\fP. It
89 returns 1 on success, 0 on failure.
91 \fBXauGetAuthByAddr\fP searches for an entry which matches the given network
92 address/display number pair. The entry is \fBnot\fP statically allocated
93 and should be freed by calling \fIXauDisposeAuth\fP.
95 \fBXauGetBestAuthByAddr\fP is similar to \fBXauGetAuthByAddr\fP, except
96 that a list of acceptable authentication methods is specified. Xau will
97 choose the file entry which matches the earliest entry in this list (e.g., the
98 most secure authentication method). The \fItypes\fP argument is an array of
99 strings, one string for each authentication method. \fItypes_length\fP
100 specifies how many elements are in the \fItypes\fP array.
101 \fItypes_lengths\fP is an array of integers representing the length
104 \fBXauLockAuth\fP does the work necessary to synchronously update an
105 authorization file. First it makes two file names, one with ``-c'' appended
106 to \fIfile_name\fP, the other with ``-l'' appended. If the ``-c'' file
107 already exists and is more than \fIdead\fP seconds old, \fIXauLockAuth\fP
108 removes it and the associated ``-l'' file. To prevent possible
109 synchronization troubles with NFS, a \fIdead\fP value of zero forces the
110 files to be removed. \fIXauLockAuth\fP makes \fIretries\fP attempts to
111 create and link the file names, pausing \fItimeout\fP seconds between each
112 attempt. \fIXauLockAuth\fP returns a collection of values depending on the
117 LOCK_ERROR A system error occurred, either a file_name
118 which is too long, or an unexpected failure from
119 a system call. errno may prove useful.
121 LOCK_TIMEOUT \fIretries\fP attempts failed
123 LOCK_SUCCESS The lock succeeded.
127 \fBXauUnlockAuth\fP undoes the work of \fIXauLockAuth\fP by unlinking both
128 the ``-c'' and ``-l'' file names.
130 \fBXauDisposeAuth\fP frees storage allocated to hold an authorization entry.
134 Keith Packard, MIT X Consortium