jpayne@69
|
1 /*
|
jpayne@69
|
2
|
jpayne@69
|
3 Copyright 1988, 1998 The Open Group
|
jpayne@69
|
4
|
jpayne@69
|
5 Permission to use, copy, modify, distribute, and sell this software and its
|
jpayne@69
|
6 documentation for any purpose is hereby granted without fee, provided that
|
jpayne@69
|
7 the above copyright notice appear in all copies and that both that
|
jpayne@69
|
8 copyright notice and this permission notice appear in supporting
|
jpayne@69
|
9 documentation.
|
jpayne@69
|
10
|
jpayne@69
|
11 The above copyright notice and this permission notice shall be included in
|
jpayne@69
|
12 all copies or substantial portions of the Software.
|
jpayne@69
|
13
|
jpayne@69
|
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
jpayne@69
|
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
jpayne@69
|
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
jpayne@69
|
17 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
jpayne@69
|
18 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
jpayne@69
|
19 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
jpayne@69
|
20
|
jpayne@69
|
21 Except as contained in this notice, the name of The Open Group shall not be
|
jpayne@69
|
22 used in advertising or otherwise to promote the sale, use or other dealings
|
jpayne@69
|
23 in this Software without prior written authorization from The Open Group.
|
jpayne@69
|
24
|
jpayne@69
|
25 */
|
jpayne@69
|
26
|
jpayne@69
|
27 #ifndef _Xauth_h
|
jpayne@69
|
28 #define _Xauth_h
|
jpayne@69
|
29
|
jpayne@69
|
30 /* struct xauth is full of implicit padding to properly align the pointers
|
jpayne@69
|
31 after the length fields. We can't clean that up without breaking ABI,
|
jpayne@69
|
32 so tell clang not to bother complaining about it. */
|
jpayne@69
|
33 #ifdef __clang__
|
jpayne@69
|
34 #pragma clang diagnostic push
|
jpayne@69
|
35 #pragma clang diagnostic ignored "-Wpadded"
|
jpayne@69
|
36 #endif
|
jpayne@69
|
37
|
jpayne@69
|
38 typedef struct xauth {
|
jpayne@69
|
39 unsigned short family;
|
jpayne@69
|
40 unsigned short address_length;
|
jpayne@69
|
41 char *address;
|
jpayne@69
|
42 unsigned short number_length;
|
jpayne@69
|
43 char *number;
|
jpayne@69
|
44 unsigned short name_length;
|
jpayne@69
|
45 char *name;
|
jpayne@69
|
46 unsigned short data_length;
|
jpayne@69
|
47 char *data;
|
jpayne@69
|
48 } Xauth;
|
jpayne@69
|
49
|
jpayne@69
|
50 #ifdef __clang__
|
jpayne@69
|
51 #pragma clang diagnostic pop
|
jpayne@69
|
52 #endif
|
jpayne@69
|
53
|
jpayne@69
|
54 #ifndef _XAUTH_STRUCT_ONLY
|
jpayne@69
|
55
|
jpayne@69
|
56 # include <X11/Xfuncproto.h>
|
jpayne@69
|
57 # include <X11/Xfuncs.h>
|
jpayne@69
|
58
|
jpayne@69
|
59 # include <stdio.h>
|
jpayne@69
|
60
|
jpayne@69
|
61 # define FamilyLocal (256) /* not part of X standard (i.e. X.h) */
|
jpayne@69
|
62 # define FamilyWild (65535)
|
jpayne@69
|
63 # define FamilyNetname (254) /* not part of X standard */
|
jpayne@69
|
64 # define FamilyKrb5Principal (253) /* Kerberos 5 principal name */
|
jpayne@69
|
65 # define FamilyLocalHost (252) /* for local non-net authentication */
|
jpayne@69
|
66
|
jpayne@69
|
67
|
jpayne@69
|
68 _XFUNCPROTOBEGIN
|
jpayne@69
|
69
|
jpayne@69
|
70 #ifndef __has_attribute
|
jpayne@69
|
71 # define __has_attribute(x) 0 /* Compatibility with older compilers */
|
jpayne@69
|
72 #endif
|
jpayne@69
|
73
|
jpayne@69
|
74 #if __has_attribute(access)
|
jpayne@69
|
75 # define XAU_ACCESS_ATTRIBUTE(X) __attribute__((access X))
|
jpayne@69
|
76 #else
|
jpayne@69
|
77 # define XAU_ACCESS_ATTRIBUTE(X)
|
jpayne@69
|
78 #endif
|
jpayne@69
|
79
|
jpayne@69
|
80 #if __has_attribute(malloc)
|
jpayne@69
|
81 # if defined(__clang__) || (defined(__GNUC__) && __GNUC__ < 11)
|
jpayne@69
|
82 /* Clang or gcc do not support the optional deallocator argument */
|
jpayne@69
|
83 # define XAU_MALLOC_ATTRIBUTE(X) __attribute__((malloc))
|
jpayne@69
|
84 # else
|
jpayne@69
|
85 # define XAU_MALLOC_ATTRIBUTE(X) __attribute__((malloc X))
|
jpayne@69
|
86 # endif
|
jpayne@69
|
87 #else
|
jpayne@69
|
88 # define XAU_MALLOC_ATTRIBUTE(X)
|
jpayne@69
|
89 #endif
|
jpayne@69
|
90
|
jpayne@69
|
91 char *XauFileName(void);
|
jpayne@69
|
92
|
jpayne@69
|
93 void XauDisposeAuth(
|
jpayne@69
|
94 Xauth* /* auth */
|
jpayne@69
|
95 );
|
jpayne@69
|
96
|
jpayne@69
|
97 XAU_MALLOC_ATTRIBUTE((XauDisposeAuth, 1))
|
jpayne@69
|
98 Xauth *XauReadAuth(
|
jpayne@69
|
99 FILE* /* auth_file */
|
jpayne@69
|
100 );
|
jpayne@69
|
101
|
jpayne@69
|
102 XAU_ACCESS_ATTRIBUTE((read_only, 1)) /* file_name */
|
jpayne@69
|
103 int XauLockAuth(
|
jpayne@69
|
104 _Xconst char* /* file_name */,
|
jpayne@69
|
105 int /* retries */,
|
jpayne@69
|
106 int /* timeout */,
|
jpayne@69
|
107 long /* dead */
|
jpayne@69
|
108 );
|
jpayne@69
|
109
|
jpayne@69
|
110 XAU_ACCESS_ATTRIBUTE((read_only, 1)) /* file_name */
|
jpayne@69
|
111 int XauUnlockAuth(
|
jpayne@69
|
112 _Xconst char* /* file_name */
|
jpayne@69
|
113 );
|
jpayne@69
|
114
|
jpayne@69
|
115 XAU_ACCESS_ATTRIBUTE((read_only, 2)) /* auth */
|
jpayne@69
|
116 int XauWriteAuth(
|
jpayne@69
|
117 FILE* /* auth_file */,
|
jpayne@69
|
118 Xauth* /* auth */
|
jpayne@69
|
119 );
|
jpayne@69
|
120
|
jpayne@69
|
121 XAU_ACCESS_ATTRIBUTE((read_only, 3, 2)) /* address */
|
jpayne@69
|
122 XAU_ACCESS_ATTRIBUTE((read_only, 5, 4)) /* number */
|
jpayne@69
|
123 XAU_ACCESS_ATTRIBUTE((read_only, 7, 6)) /* name */
|
jpayne@69
|
124 Xauth *XauGetAuthByAddr(
|
jpayne@69
|
125 #if NeedWidePrototypes
|
jpayne@69
|
126 unsigned int /* family */,
|
jpayne@69
|
127 unsigned int /* address_length */,
|
jpayne@69
|
128 #else
|
jpayne@69
|
129 unsigned short /* family */,
|
jpayne@69
|
130 unsigned short /* address_length */,
|
jpayne@69
|
131 #endif
|
jpayne@69
|
132 _Xconst char* /* address */,
|
jpayne@69
|
133 #if NeedWidePrototypes
|
jpayne@69
|
134 unsigned int /* number_length */,
|
jpayne@69
|
135 #else
|
jpayne@69
|
136 unsigned short /* number_length */,
|
jpayne@69
|
137 #endif
|
jpayne@69
|
138 _Xconst char* /* number */,
|
jpayne@69
|
139 #if NeedWidePrototypes
|
jpayne@69
|
140 unsigned int /* name_length */,
|
jpayne@69
|
141 #else
|
jpayne@69
|
142 unsigned short /* name_length */,
|
jpayne@69
|
143 #endif
|
jpayne@69
|
144 _Xconst char* /* name */
|
jpayne@69
|
145 );
|
jpayne@69
|
146
|
jpayne@69
|
147 XAU_ACCESS_ATTRIBUTE((read_only, 3, 2)) /* address */
|
jpayne@69
|
148 XAU_ACCESS_ATTRIBUTE((read_only, 5, 4)) /* number */
|
jpayne@69
|
149 XAU_ACCESS_ATTRIBUTE((read_only, 7, 6)) /* type_names */
|
jpayne@69
|
150 XAU_ACCESS_ATTRIBUTE((read_only, 8, 6)) /* type_lengths */
|
jpayne@69
|
151 Xauth *XauGetBestAuthByAddr(
|
jpayne@69
|
152 #if NeedWidePrototypes
|
jpayne@69
|
153 unsigned int /* family */,
|
jpayne@69
|
154 unsigned int /* address_length */,
|
jpayne@69
|
155 #else
|
jpayne@69
|
156 unsigned short /* family */,
|
jpayne@69
|
157 unsigned short /* address_length */,
|
jpayne@69
|
158 #endif
|
jpayne@69
|
159 _Xconst char* /* address */,
|
jpayne@69
|
160 #if NeedWidePrototypes
|
jpayne@69
|
161 unsigned int /* number_length */,
|
jpayne@69
|
162 #else
|
jpayne@69
|
163 unsigned short /* number_length */,
|
jpayne@69
|
164 #endif
|
jpayne@69
|
165 _Xconst char* /* number */,
|
jpayne@69
|
166 int /* types_length */,
|
jpayne@69
|
167 char** /* type_names */,
|
jpayne@69
|
168 _Xconst int* /* type_lengths */
|
jpayne@69
|
169 );
|
jpayne@69
|
170
|
jpayne@69
|
171 _XFUNCPROTOEND
|
jpayne@69
|
172
|
jpayne@69
|
173 /* Return values from XauLockAuth */
|
jpayne@69
|
174
|
jpayne@69
|
175 # define LOCK_SUCCESS 0 /* lock succeeded */
|
jpayne@69
|
176 # define LOCK_ERROR 1 /* lock unexpectedly failed, check errno */
|
jpayne@69
|
177 # define LOCK_TIMEOUT 2 /* lock failed, timeouts expired */
|
jpayne@69
|
178
|
jpayne@69
|
179 #endif /* _XAUTH_STRUCT_ONLY */
|
jpayne@69
|
180
|
jpayne@69
|
181 #endif /* _Xauth_h */
|