cc82bc7d56782bbc4ff2927c97b0a0b52d48cf03
[framework/uifw/xorg/lib/libxau.git] / Xau.man
1 .\" $Xorg: Xau.man,v 1.3 2000/08/17 19:41:54 cpqbld Exp $
2 .\" $XdotOrg$
3 .\"
4 .\" Copyright (c) 1994  X Consortium
5 .\" 
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:
12 .\" 
13 .\" The above copyright notice and this permission notice shall be included in
14 .\" all copies or substantial portions of the Software.
15 .\" 
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 
22 .\" SOFTWARE.
23 .\" 
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 
27 .\" X Consortium.
28 .\"
29 .\" $XFree86: xc/doc/man/Xau/Xau.man,v 1.2 2001/01/27 18:20:19 dawes Exp $
30 .\"
31 .TH Xau 3 __xorgversion__
32 .SH NAME
33 Xau library: XauFileName, XauReadAuth, XauLockAuth, XauUnlockAuth,
34 XauWriteAuth, XauDisposeAuth,
35 XauGetAuthByAddr, XauGetBestAuthByAddr \- X authority database routines
36 .SH SYNOPSIS
37 .B "#include <X11/Xauth.h>"
38 .PP
39 .nf
40 .ta .5i 2i
41 typedef struct xauth {
42         unsigned short  family;
43         unsigned short  address_length;
44         char    *address;
45         unsigned short  number_length;
46         char    *number;
47         unsigned short  name_length;
48         char    *name;
49         unsigned short  data_length;
50         char    *data;
51 } Xauth;
52
53 .HP
54 char *XauFileName (void); 
55 .HP
56 Xauth *XauReadAuth (FILE *\fIauth_file\fP\^); 
57 .HP
58 int XauWriteAuth (FILE *\fIauth_file\fP, Xauth *\fIauth\fP\^); 
59 .HP
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\^);
64 .HP
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\^); 
69 .HP
70 int XauLockAuth (const char *\fIfile_name\fP\^, int \fIretries\fP\^, int
71 \fItimeout\fP\^, long \fIdead\fP\^); 
72 .HP
73 int XauUnlockAuth (const char *\fIfile_name\fP\^); 
74 .HP
75 int XauDisposeAuth (Xauth *\fIauth\fP\^); 
76 .ft R
77 .SH DESCRIPTION
78 .PP
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
82 not be freed.
83 .PP
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
86 \fIXauDisposeAuth\fP.
87 .PP
88 \fBXauWriteAuth\fP writes an authorization entry to \fIauth_file\fP.  It
89 returns 1 on success, 0 on failure.
90 .PP
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.
94 .PP
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
102 of each string.
103 .PP
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
113 results:
114 .nf
115 .ta .5i 2i
116
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.
120
121         LOCK_TIMEOUT    \fIretries\fP attempts failed
122
123         LOCK_SUCCESS    The lock succeeded.
124
125 .fi
126 .PP
127 \fBXauUnlockAuth\fP undoes the work of \fIXauLockAuth\fP by unlinking both 
128 the ``-c'' and ``-l'' file names.
129 .PP
130 \fBXauDisposeAuth\fP frees storage allocated to hold an authorization entry.
131 .SH "SEE ALSO"
132 xauth(1), xdm(1)
133 .SH AUTHOR
134 Keith Packard, MIT X Consortium