upload tizen1.0 source
[framework/uifw/xorg/lib/libxau.git] / man / Xau.man
1 .\" Copyright (c) 1994  X Consortium
2 .\"
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:
9 .\"
10 .\" The above copyright notice and this permission notice shall be included in
11 .\" all copies or substantial portions of the Software.
12 .\"
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
19 .\" SOFTWARE.
20 .\"
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
24 .\" X Consortium.
25 .\"
26 .TH Xau __libmansuffix__ __xorgversion__
27 .SH NAME
28 Xau library: XauFileName, XauReadAuth, XauLockAuth, XauUnlockAuth,
29 XauWriteAuth, XauDisposeAuth,
30 XauGetAuthByAddr, XauGetBestAuthByAddr \- X authority database routines
31 .SH SYNOPSIS
32 .B "#include <X11/Xauth.h>"
33 .PP
34 .nf
35 .ta .5i 2i
36 typedef struct xauth {
37         unsigned short  family;
38         unsigned short  address_length;
39         char    *address;
40         unsigned short  number_length;
41         char    *number;
42         unsigned short  name_length;
43         char    *name;
44         unsigned short  data_length;
45         char    *data;
46 } Xauth;
47
48 .HP
49 char *XauFileName (void);
50 .HP
51 Xauth *XauReadAuth (FILE *\fIauth_file\fP\^);
52 .HP
53 int XauWriteAuth (FILE *\fIauth_file\fP, Xauth *\fIauth\fP\^);
54 .HP
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\^);
59 .HP
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\^);
64 .HP
65 int XauLockAuth (const char *\fIfile_name\fP\^, int \fIretries\fP\^, int
66 \fItimeout\fP\^, long \fIdead\fP\^);
67 .HP
68 int XauUnlockAuth (const char *\fIfile_name\fP\^);
69 .HP
70 int XauDisposeAuth (Xauth *\fIauth\fP\^);
71 .ft R
72 .SH DESCRIPTION
73 .PP
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
77 not be freed.
78 .PP
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
81 \fIXauDisposeAuth\fP.
82 .PP
83 \fBXauWriteAuth\fP writes an authorization entry to \fIauth_file\fP.  It
84 returns 1 on success, 0 on failure.
85 .PP
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.
89 .PP
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
97 of each string.
98 .PP
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
108 results:
109 .nf
110 .ta .5i 2i
111
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.
115
116         LOCK_TIMEOUT    \fIretries\fP attempts failed
117
118         LOCK_SUCCESS    The lock succeeded.
119
120 .fi
121 .PP
122 \fBXauUnlockAuth\fP undoes the work of \fIXauLockAuth\fP by unlinking both
123 the ``-c'' and ``-l'' file names.
124 .PP
125 \fBXauDisposeAuth\fP frees storage allocated to hold an authorization entry.
126 .SH "SEE ALSO"
127 xauth(1), xdm(1)
128 .SH AUTHOR
129 Keith Packard, MIT X Consortium