1/*
2 * Copyright (c) 1997 - 2000 Kungliga Tekniska H�gskolan
3 * (Royal Institute of Technology, Stockholm, Sweden).
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright
11 *    notice, this list of conditions and the following disclaimer.
12 *
13 * 2. Redistributions in binary form must reproduce the above copyright
14 *    notice, this list of conditions and the following disclaimer in the
15 *    documentation and/or other materials provided with the distribution.
16 *
17 * 3. Neither the name of the Institute nor the names of its contributors
18 *    may be used to endorse or promote products derived from this software
19 *    without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#include "mit-gssapi.h"
35
36#define rk_UNCONST(x) x
37#define GSSAPI_LIB_VARIABLE
38
39
40/*
41 * The implementation must reserve static storage for a
42 * gss_OID_desc object containing the value
43 * {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
44 *              "\x01\x02\x01\x01"},
45 * corresponding to an object-identifier value of
46 * {iso(1) member-body(2) United States(840) mit(113554)
47 *  infosys(1) gssapi(2) generic(1) user_name(1)}.  The constant
48 * GSS_C_NT_USER_NAME should be initialized to point
49 * to that gss_OID_desc.
50 */
51
52static gss_OID_desc gss_c_nt_user_name_oid_desc =
53    {10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12" "\x01\x02\x01\x01")};
54
55gss_OID GSSAPI_LIB_VARIABLE GSS_C_NT_USER_NAME =
56    &gss_c_nt_user_name_oid_desc;
57
58
59/*
60 * The implementation must reserve static storage for a
61 * gss_OID_desc object containing the value
62 * {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
63 *              "\x01\x02\x01\x02"},
64 * corresponding to an object-identifier value of
65 * {iso(1) member-body(2) United States(840) mit(113554)
66 *  infosys(1) gssapi(2) generic(1) machine_uid_name(2)}.
67 * The constant GSS_C_NT_MACHINE_UID_NAME should be
68 * initialized to point to that gss_OID_desc.
69 */
70
71static gss_OID_desc gss_c_nt_machine_uid_name_oid_desc =
72    {10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12" "\x01\x02\x01\x02")};
73
74gss_OID GSSAPI_LIB_VARIABLE GSS_C_NT_MACHINE_UID_NAME =
75    &gss_c_nt_machine_uid_name_oid_desc;
76
77/*
78 * The implementation must reserve static storage for a
79 * gss_OID_desc object containing the value
80 * {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
81 *              "\x01\x02\x01\x03"},
82 * corresponding to an object-identifier value of
83 * {iso(1) member-body(2) United States(840) mit(113554)
84 *  infosys(1) gssapi(2) generic(1) string_uid_name(3)}.
85 * The constant GSS_C_NT_STRING_UID_NAME should be
86 * initialized to point to that gss_OID_desc.
87 */
88
89static gss_OID_desc gss_c_nt_string_uid_name_oid_desc =
90    {10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12" "\x01\x02\x01\x03")};
91
92gss_OID GSSAPI_LIB_VARIABLE GSS_C_NT_STRING_UID_NAME =
93    &gss_c_nt_string_uid_name_oid_desc;
94
95/*
96 * The implementation must reserve static storage for a
97 * gss_OID_desc object containing the value
98 * {6, (void *)"\x2b\x06\x01\x05\x06\x02"},
99 * corresponding to an object-identifier value of
100 * {iso(1) org(3) dod(6) internet(1) security(5)
101 * nametypes(6) gss-host-based-services(2)).  The constant
102 * GSS_C_NT_HOSTBASED_SERVICE_X should be initialized to point
103 * to that gss_OID_desc.  This is a deprecated OID value, and
104 * implementations wishing to support hostbased-service names
105 * should instead use the GSS_C_NT_HOSTBASED_SERVICE OID,
106 * defined below, to identify such names;
107 * GSS_C_NT_HOSTBASED_SERVICE_X should be accepted a synonym
108 * for GSS_C_NT_HOSTBASED_SERVICE when presented as an input
109 * parameter, but should not be emitted by GSS-API
110 * implementations
111 */
112
113static gss_OID_desc gss_c_nt_hostbased_service_x_oid_desc =
114    {6, rk_UNCONST("\x2b\x06\x01\x05\x06\x02")};
115
116gss_OID GSSAPI_LIB_VARIABLE GSS_C_NT_HOSTBASED_SERVICE_X =
117    &gss_c_nt_hostbased_service_x_oid_desc;
118
119/*
120 * The implementation must reserve static storage for a
121 * gss_OID_desc object containing the value
122 * {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
123 *              "\x01\x02\x01\x04"}, corresponding to an
124 * object-identifier value of {iso(1) member-body(2)
125 * Unites States(840) mit(113554) infosys(1) gssapi(2)
126 * generic(1) service_name(4)}.  The constant
127 * GSS_C_NT_HOSTBASED_SERVICE should be initialized
128 * to point to that gss_OID_desc.
129 */
130static gss_OID_desc gss_c_nt_hostbased_service_oid_desc =
131    {10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12" "\x01\x02\x01\x04")};
132
133gss_OID GSSAPI_LIB_VARIABLE GSS_C_NT_HOSTBASED_SERVICE =
134    &gss_c_nt_hostbased_service_oid_desc;
135
136gss_OID GSSAPI_LIB_VARIABLE gss_nt_service_name =
137    &gss_c_nt_hostbased_service_oid_desc;
138
139gss_OID GSSAPI_LIB_VARIABLE gss_nt_service_name_v2 =
140    &gss_c_nt_hostbased_service_oid_desc;
141
142/*
143 * The implementation must reserve static storage for a
144 * gss_OID_desc object containing the value
145 * {6, (void *)"\x2b\x06\01\x05\x06\x03"},
146 * corresponding to an object identifier value of
147 * {1(iso), 3(org), 6(dod), 1(internet), 5(security),
148 * 6(nametypes), 3(gss-anonymous-name)}.  The constant
149 * and GSS_C_NT_ANONYMOUS should be initialized to point
150 * to that gss_OID_desc.
151 */
152
153static gss_OID_desc gss_c_nt_anonymous_oid_desc =
154    {6, rk_UNCONST("\x2b\x06\01\x05\x06\x03")};
155
156gss_OID GSSAPI_LIB_VARIABLE GSS_C_NT_ANONYMOUS =
157    &gss_c_nt_anonymous_oid_desc;
158
159/*
160 * The implementation must reserve static storage for a
161 * gss_OID_desc object containing the value
162 * {6, (void *)"\x2b\x06\x01\x05\x06\x04"},
163 * corresponding to an object-identifier value of
164 * {1(iso), 3(org), 6(dod), 1(internet), 5(security),
165 * 6(nametypes), 4(gss-api-exported-name)}.  The constant
166 * GSS_C_NT_EXPORT_NAME should be initialized to point
167 * to that gss_OID_desc.
168 */
169
170static gss_OID_desc gss_c_nt_export_name_oid_desc =
171    {6, rk_UNCONST("\x2b\x06\x01\x05\x06\x04") };
172
173gss_OID GSSAPI_LIB_VARIABLE GSS_C_NT_EXPORT_NAME =
174    &gss_c_nt_export_name_oid_desc;
175
176gss_OID GSSAPI_LIB_VARIABLE gss_nt_exported_name =
177    &gss_c_nt_export_name_oid_desc;
178
179/*
180 *   This name form shall be represented by the Object Identifier {iso(1)
181 *   member-body(2) United States(840) mit(113554) infosys(1) gssapi(2)
182 *   krb5(2) krb5_name(1)}.  The recommended symbolic name for this type
183 *   is "GSS_KRB5_NT_PRINCIPAL_NAME".
184 */
185
186static gss_OID_desc gss_krb5_nt_principal_name_oid_desc =
187    {10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12\x01\x02\x02\x01") };
188
189gss_OID GSSAPI_LIB_VARIABLE GSS_KRB5_NT_PRINCIPAL_NAME =
190    &gss_krb5_nt_principal_name_oid_desc;
191
192gss_OID GSSAPI_LIB_VARIABLE gss_nt_krb5_name =
193    &gss_krb5_nt_principal_name_oid_desc;
194
195
196/* do not use */
197
198static gss_OID_desc gss_krb5_nt_principal_oid_desc =
199    {10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12\x01\x02\x02\x02") };
200
201gss_OID GSSAPI_LIB_VARIABLE gss_nt_krb5_principal =
202    &gss_krb5_nt_principal_oid_desc;
203
204
205/*
206 *   This name form shall be represented by the Object Identifier {iso(1)
207 *   member-body(2) United States(840) mit(113554) infosys(1) gssapi(2)
208 *   generic(1) user_name(1)}.  The recommended symbolic name for this
209 *   type is "GSS_KRB5_NT_USER_NAME".
210 */
211
212gss_OID GSSAPI_LIB_VARIABLE GSS_KRB5_NT_USER_NAME =
213    &gss_c_nt_user_name_oid_desc;
214
215gss_OID GSSAPI_LIB_VARIABLE gss_nt_user_name =
216    &gss_c_nt_user_name_oid_desc;
217
218/*
219 *   This name form shall be represented by the Object Identifier {iso(1)
220 *   member-body(2) United States(840) mit(113554) infosys(1) gssapi(2)
221 *   generic(1) machine_uid_name(2)}.  The recommended symbolic name for
222 *   this type is "GSS_KRB5_NT_MACHINE_UID_NAME".
223 */
224
225gss_OID GSSAPI_LIB_VARIABLE GSS_KRB5_NT_MACHINE_UID_NAME =
226    &gss_c_nt_machine_uid_name_oid_desc;
227
228gss_OID GSSAPI_LIB_VARIABLE gss_nt_machine_uid_name =
229    &gss_c_nt_machine_uid_name_oid_desc;
230
231/*
232 *   This name form shall be represented by the Object Identifier {iso(1)
233 *   member-body(2) United States(840) mit(113554) infosys(1) gssapi(2)
234 *   generic(1) string_uid_name(3)}.  The recommended symbolic name for
235 *   this type is "GSS_KRB5_NT_STRING_UID_NAME".
236 */
237
238gss_OID GSSAPI_LIB_VARIABLE GSS_KRB5_NT_STRING_UID_NAME =
239    &gss_c_nt_string_uid_name_oid_desc;
240
241gss_OID GSSAPI_LIB_VARIABLE gss_nt_string_uid_name =
242    &gss_c_nt_string_uid_name_oid_desc;
243
244/*
245 *   To support ongoing experimentation, testing, and evolution of the
246 *   specification, the Kerberos V5 GSS-API mechanism as defined in this
247 *   and any successor memos will be identified with the following Object
248 *   Identifier, as defined in RFC-1510, until the specification is
249 *   advanced to the level of Proposed Standard RFC:
250 *
251 *   {iso(1), org(3), dod(5), internet(1), security(5), kerberosv5(2)}
252 *
253 *   Upon advancement to the level of Proposed Standard RFC, the Kerberos
254 *   V5 GSS-API mechanism will be identified by an Object Identifier
255 *   having the value:
256 *
257 *   {iso(1) member-body(2) United States(840) mit(113554) infosys(1)
258 *   gssapi(2) krb5(2)}
259 */
260
261static gss_OID_desc gss_krb5_mechanism_oid_desc =
262    {9, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12\x01\x02\x02") };
263
264static gss_OID_desc gss_krb5_mechanism_old_oid_desc =
265    {5, rk_UNCONST("\053\005\001\005\002") };
266
267gss_OID GSSAPI_LIB_VARIABLE GSS_KRB5_MECHANISM =
268    &gss_krb5_mechanism_oid_desc;
269
270gss_OID GSSAPI_LIB_VARIABLE gss_mech_krb5 =
271    &gss_krb5_mechanism_oid_desc;
272
273gss_OID GSSAPI_LIB_VARIABLE gss_mech_krb5_old =
274    &gss_krb5_mechanism_old_oid_desc;
275
276/*
277 * Copyright 1993 by OpenVision Technologies, Inc.
278 *
279 * Permission to use, copy, modify, distribute, and sell this software
280 * and its documentation for any purpose is hereby granted without fee,
281 * provided that the above copyright notice appears in all copies and
282 * that both that copyright notice and this permission notice appear in
283 * supporting documentation, and that the name of OpenVision not be used
284 * in advertising or publicity pertaining to distribution of the software
285 * without specific, written prior permission. OpenVision makes no
286 * representations about the suitability of this software for any
287 * purpose.  It is provided "as is" without express or implied warranty.
288 *
289 * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
290 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
291 * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR
292 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
293 * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
294 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
295 * PERFORMANCE OF THIS SOFTWARE.
296 */
297
298/*
299 * Copyright (C) 1998 by the FundsXpress, INC.
300 *
301 * All rights reserved.
302 *
303 * Export of this software from the United States of America may require
304 * a specific license from the United States Government.  It is the
305 * responsibility of any person or organization contemplating export to
306 * obtain such a license before exporting.
307 *
308 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
309 * distribute this software and its documentation for any purpose and
310 * without fee is hereby granted, provided that the above copyright
311 * notice appear in all copies and that both that copyright notice and
312 * this permission notice appear in supporting documentation, and that
313 * the name of FundsXpress. not be used in advertising or publicity pertaining
314 * to distribution of the software without specific, written prior
315 * permission.  FundsXpress makes no representations about the suitability of
316 * this software for any purpose.  It is provided "as is" without express
317 * or implied warranty.
318 *
319 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
320 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
321 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
322 */
323
324const gss_OID_desc krb5_gss_oid_array[] = {
325    { 9, "\052\206\110\206\367\022\001\002\002" },
326    { 5, "\053\005\001\005\002" },
327    { 9, "\052\206\110\202\367\022\001\002\002" },
328    { 9, "\052\206\110\206\367\022\001\002\003" },
329    { 10, "\052\206\110\206\367\022\001\002\002\001" },
330    { 10, "\052\206\110\206\367\022\001\002\002\002" },
331    { 0, 0 }
332};
333
334static const gss_OID_set_desc oidsets[] = {
335    { 1, (gss_OID) krb5_gss_oid_array + 0 },
336    { 1, (gss_OID) krb5_gss_oid_array + 1 },
337    { 3, (gss_OID) krb5_gss_oid_array + 0 },
338    { 1, (gss_OID) krb5_gss_oid_array + 2 },
339    { 3, (gss_OID) krb5_gss_oid_array + 0 },
340};
341
342const gss_OID_set_desc * const gss_mech_set_krb5 = oidsets + 0;
343const gss_OID_set_desc * const gss_mech_set_krb5_old = oidsets + 1;
344const gss_OID_set_desc * const gss_mech_set_krb5_both = oidsets + 2;
345