1Xau(3) Library Functions Manual Xau(3)
2
3
4
6 Xau library: XauFileName, XauReadAuth, XauLockAuth, XauUnlockAuth,
7 XauWriteAuth, XauDisposeAuth, XauGetAuthByAddr, XauGetBestAuthByAddr -
8 X authority database routines
9
11 #include <X11/Xauth.h>
12
13 typedef struct xauth {
14 unsigned short family;
15 unsigned short address_length;
16 char *address;
17 unsigned short number_length;
18 char *number;
19 unsigned short name_length;
20 char *name;
21 unsigned short data_length;
22 char *data;
23 } Xauth;
24
25
26 char *XauFileName (void);
27
28 Xauth *XauReadAuth (FILE *auth_file);
29
30 int XauWriteAuth (FILE *auth_file, Xauth *auth);
31
32 Xauth *XauGetAuthByAddr (unsigned short family, unsigned short
33 address_length, char *address, unsigned short
34 number_length, char *number);
35
36 Xauth *XauGetBestAuthByAddr (unsigned short family, unsigned short
37 address_length, char *address, unsigned short
38 number_length, char *number, int types_length, char
39 **types, int *type_lengths);
40
41 int XauLockAuth (char *file_name, int retries, int
42 timeout, long dead);
43
44 int XauUnlockAuth (char *file_name);
45
46 int XauDisposeAuth (Xauth *auth);
47
49 XauFileName generates the default authorization file name by first
50 checking the XAUTHORITY environment variable if set, else it returns
51 $HOME/.Xauthority. This name is statically allocated and should not be
52 freed.
53
54 XauReadAuth reads the next entry from auth_file. The entry is not
55 statically allocated and should be freed by calling XauDisposeAuth.
56
57 XauWriteAuth writes an authorization entry to auth_file. It returns 1
58 on success, 0 on failure.
59
60 XauGetAuthByAddr searches for an entry which matches the given network
61 address/display number pair. The entry is not statically allocated and
62 should be freed by calling XauDisposeAuth.
63
64 XauGetBestAuthByAddr is similar to XauGetAuthByAddr, except that a list
65 of acceptable authentication methods is specified. Xau will choose the
66 file entry which matches the earliest entry in this list (e.g., the
67 most secure authentication method). The types argument is an array of
68 strings, one string for each authentication method. types_length spec‐
69 ifies how many elements are in the types array. types_lengths is an
70 array of integers representing the length of each string.
71
72 XauLockAuth does the work necessary to synchronously update an autho‐
73 rization file. First it makes two file names, one with ``-c'' appended
74 to file_name, the other with ``-l'' appended. If the ``-c'' file
75 already exists and is more than dead seconds old, XauLockAuth removes
76 it and the associated ``-l'' file. To prevent possible synchronization
77 troubles with NFS, a dead value of zero forces the files to be removed.
78 XauLockAuth makes retries attempts to create and link the file names,
79 pausing timeout seconds between each attempt. XauLockAuth returns a
80 collection of values depending on the results:
81
82 LOCK_ERROR A system error occurred, either a file_name
83 which is too long, or an unexpected failure from
84 a system call. errno may prove useful.
85
86 LOCK_TIMEOUT retries attempts failed
87
88 LOCK_SUCCESS The lock succeeded.
89
90
91 XauUnlockAuth undoes the work of XauLockAuth by unlinking both the
92 ``-c'' and ``-l'' file names.
93
94 XauDisposeAuth frees storage allocated to hold an authorization entry.
95
97 xauth(1), xdm(1)
98
100 Keith Packard, MIT X Consortium
101
102
103
104X Version 11 libXau 1.0.3 Xau(3)