2 * linux/include/sunrpc/gss_err.h
4 * Adapted from MIT Kerberos 5-1.2.1 include/gssapi/gssapi.h
6 * Copyright (c) 2002 The Regents of the University of Michigan.
9 * Andy Adamson <andros@umich.edu>
13 * Copyright 1993 by OpenVision Technologies, Inc.
15 * Permission to use, copy, modify, distribute, and sell this software
16 * and its documentation for any purpose is hereby granted without fee,
17 * provided that the above copyright notice appears in all copies and
18 * that both that copyright notice and this permission notice appear in
19 * supporting documentation, and that the name of OpenVision not be used
20 * in advertising or publicity pertaining to distribution of the software
21 * without specific, written prior permission. OpenVision makes no
22 * representations about the suitability of this software for any
23 * purpose. It is provided "as is" without express or implied warranty.
25 * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
26 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
27 * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR
28 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
29 * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
30 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
31 * PERFORMANCE OF THIS SOFTWARE.
34 #ifndef _LINUX_SUNRPC_GSS_ERR_H
35 #define _LINUX_SUNRPC_GSS_ERR_H
39 typedef unsigned int OM_uint32;
42 * Flag bits for context-level services.
44 #define GSS_C_DELEG_FLAG 1
45 #define GSS_C_MUTUAL_FLAG 2
46 #define GSS_C_REPLAY_FLAG 4
47 #define GSS_C_SEQUENCE_FLAG 8
48 #define GSS_C_CONF_FLAG 16
49 #define GSS_C_INTEG_FLAG 32
50 #define GSS_C_ANON_FLAG 64
51 #define GSS_C_PROT_READY_FLAG 128
52 #define GSS_C_TRANS_FLAG 256
55 * Credential usage options
58 #define GSS_C_INITIATE 1
59 #define GSS_C_ACCEPT 2
62 * Status code types for gss_display_status
64 #define GSS_C_GSS_CODE 1
65 #define GSS_C_MECH_CODE 2
69 * Define the default Quality of Protection for per-message services. Note
70 * that an implementation that offers multiple levels of QOP may either reserve
71 * a value (for example zero, as assumed here) to mean "default protection", or
72 * alternatively may simply equate GSS_C_QOP_DEFAULT to a specific explicit
73 * QOP value. However a value of 0 should always be interpreted by a GSSAPI
74 * implementation as a request for the default protection level.
76 #define GSS_C_QOP_DEFAULT 0
79 * Expiration time of 2^32-1 seconds means infinite lifetime for a
80 * credential or security context
82 #define GSS_C_INDEFINITE ((OM_uint32) 0xfffffffful)
85 /* Major status codes */
87 #define GSS_S_COMPLETE 0
90 * Some "helper" definitions to make the status code macros obvious.
92 #define GSS_C_CALLING_ERROR_OFFSET 24
93 #define GSS_C_ROUTINE_ERROR_OFFSET 16
94 #define GSS_C_SUPPLEMENTARY_OFFSET 0
95 #define GSS_C_CALLING_ERROR_MASK ((OM_uint32) 0377ul)
96 #define GSS_C_ROUTINE_ERROR_MASK ((OM_uint32) 0377ul)
97 #define GSS_C_SUPPLEMENTARY_MASK ((OM_uint32) 0177777ul)
100 * The macros that test status codes for error conditions. Note that the
101 * GSS_ERROR() macro has changed slightly from the V1 GSSAPI so that it now
102 * evaluates its argument only once.
104 #define GSS_CALLING_ERROR(x) \
105 ((x) & (GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET))
106 #define GSS_ROUTINE_ERROR(x) \
107 ((x) & (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET))
108 #define GSS_SUPPLEMENTARY_INFO(x) \
109 ((x) & (GSS_C_SUPPLEMENTARY_MASK << GSS_C_SUPPLEMENTARY_OFFSET))
110 #define GSS_ERROR(x) \
111 ((x) & ((GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET) | \
112 (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET)))
115 * Now the actual status code definitions
121 #define GSS_S_CALL_INACCESSIBLE_READ \
122 (((OM_uint32) 1ul) << GSS_C_CALLING_ERROR_OFFSET)
123 #define GSS_S_CALL_INACCESSIBLE_WRITE \
124 (((OM_uint32) 2ul) << GSS_C_CALLING_ERROR_OFFSET)
125 #define GSS_S_CALL_BAD_STRUCTURE \
126 (((OM_uint32) 3ul) << GSS_C_CALLING_ERROR_OFFSET)
131 #define GSS_S_BAD_MECH (((OM_uint32) 1ul) << GSS_C_ROUTINE_ERROR_OFFSET)
132 #define GSS_S_BAD_NAME (((OM_uint32) 2ul) << GSS_C_ROUTINE_ERROR_OFFSET)
133 #define GSS_S_BAD_NAMETYPE (((OM_uint32) 3ul) << GSS_C_ROUTINE_ERROR_OFFSET)
134 #define GSS_S_BAD_BINDINGS (((OM_uint32) 4ul) << GSS_C_ROUTINE_ERROR_OFFSET)
135 #define GSS_S_BAD_STATUS (((OM_uint32) 5ul) << GSS_C_ROUTINE_ERROR_OFFSET)
136 #define GSS_S_BAD_SIG (((OM_uint32) 6ul) << GSS_C_ROUTINE_ERROR_OFFSET)
137 #define GSS_S_NO_CRED (((OM_uint32) 7ul) << GSS_C_ROUTINE_ERROR_OFFSET)
138 #define GSS_S_NO_CONTEXT (((OM_uint32) 8ul) << GSS_C_ROUTINE_ERROR_OFFSET)
139 #define GSS_S_DEFECTIVE_TOKEN (((OM_uint32) 9ul) << GSS_C_ROUTINE_ERROR_OFFSET)
140 #define GSS_S_DEFECTIVE_CREDENTIAL \
141 (((OM_uint32) 10ul) << GSS_C_ROUTINE_ERROR_OFFSET)
142 #define GSS_S_CREDENTIALS_EXPIRED \
143 (((OM_uint32) 11ul) << GSS_C_ROUTINE_ERROR_OFFSET)
144 #define GSS_S_CONTEXT_EXPIRED \
145 (((OM_uint32) 12ul) << GSS_C_ROUTINE_ERROR_OFFSET)
146 #define GSS_S_FAILURE (((OM_uint32) 13ul) << GSS_C_ROUTINE_ERROR_OFFSET)
147 #define GSS_S_BAD_QOP (((OM_uint32) 14ul) << GSS_C_ROUTINE_ERROR_OFFSET)
148 #define GSS_S_UNAUTHORIZED (((OM_uint32) 15ul) << GSS_C_ROUTINE_ERROR_OFFSET)
149 #define GSS_S_UNAVAILABLE (((OM_uint32) 16ul) << GSS_C_ROUTINE_ERROR_OFFSET)
150 #define GSS_S_DUPLICATE_ELEMENT \
151 (((OM_uint32) 17ul) << GSS_C_ROUTINE_ERROR_OFFSET)
152 #define GSS_S_NAME_NOT_MN \
153 (((OM_uint32) 18ul) << GSS_C_ROUTINE_ERROR_OFFSET)
156 * Supplementary info bits:
158 #define GSS_S_CONTINUE_NEEDED (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 0))
159 #define GSS_S_DUPLICATE_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 1))
160 #define GSS_S_OLD_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 2))
161 #define GSS_S_UNSEQ_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 3))
162 #define GSS_S_GAP_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 4))
164 /* XXXX these are not part of the GSSAPI C bindings! (but should be) */
166 #define GSS_CALLING_ERROR_FIELD(x) \
167 (((x) >> GSS_C_CALLING_ERROR_OFFSET) & GSS_C_CALLING_ERROR_MASK)
168 #define GSS_ROUTINE_ERROR_FIELD(x) \
169 (((x) >> GSS_C_ROUTINE_ERROR_OFFSET) & GSS_C_ROUTINE_ERROR_MASK)
170 #define GSS_SUPPLEMENTARY_INFO_FIELD(x) \
171 (((x) >> GSS_C_SUPPLEMENTARY_OFFSET) & GSS_C_SUPPLEMENTARY_MASK)
173 /* XXXX This is a necessary evil until the spec is fixed */
174 #define GSS_S_CRED_UNAVAIL GSS_S_FAILURE
176 #endif /* __KERNEL__ */
177 #endif /* __LINUX_SUNRPC_GSS_ERR_H */