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