- Complete re-write of sasc.
[dragonfly.git] / crypto / heimdal / lib / gssapi / external.c
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 "gssapi_locl.h"
35
36 RCSID("$Id: external.c,v 1.5 2000/07/22 03:45:28 assar Exp $");
37
38 /*
39  * The implementation must reserve static storage for a
40  * gss_OID_desc object containing the value
41  * {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
42  *              "\x01\x02\x01\x01"},
43  * corresponding to an object-identifier value of
44  * {iso(1) member-body(2) United States(840) mit(113554)
45  *  infosys(1) gssapi(2) generic(1) user_name(1)}.  The constant
46  * GSS_C_NT_USER_NAME should be initialized to point
47  * to that gss_OID_desc.
48  */
49
50 static gss_OID_desc gss_c_nt_user_name_oid_desc =
51 {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
52  "\x01\x02\x01\x01"};
53
54 gss_OID GSS_C_NT_USER_NAME = &gss_c_nt_user_name_oid_desc;
55
56 /*
57  * The implementation must reserve static storage for a
58  * gss_OID_desc object containing the value
59  * {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
60  *              "\x01\x02\x01\x02"},
61  * corresponding to an object-identifier value of
62  * {iso(1) member-body(2) United States(840) mit(113554)
63  *  infosys(1) gssapi(2) generic(1) machine_uid_name(2)}.
64  * The constant GSS_C_NT_MACHINE_UID_NAME should be
65  * initialized to point to that gss_OID_desc.
66  */
67
68 static gss_OID_desc gss_c_nt_machine_uid_name_oid_desc =
69 {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
70  "\x01\x02\x01\x02"};
71
72 gss_OID GSS_C_NT_MACHINE_UID_NAME = &gss_c_nt_machine_uid_name_oid_desc;
73
74 /*
75  * The implementation must reserve static storage for a
76  * gss_OID_desc object containing the value
77  * {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
78  *              "\x01\x02\x01\x03"},
79  * corresponding to an object-identifier value of
80  * {iso(1) member-body(2) United States(840) mit(113554)
81  *  infosys(1) gssapi(2) generic(1) string_uid_name(3)}.
82  * The constant GSS_C_NT_STRING_UID_NAME should be
83  * initialized to point to that gss_OID_desc.
84  */
85
86 static gss_OID_desc gss_c_nt_string_uid_name_oid_desc =
87 {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
88  "\x01\x02\x01\x03"};
89
90 gss_OID GSS_C_NT_STRING_UID_NAME = &gss_c_nt_string_uid_name_oid_desc;
91
92 /*
93  * The implementation must reserve static storage for a
94  * gss_OID_desc object containing the value
95  * {6, (void *)"\x2b\x06\x01\x05\x06\x02"},
96  * corresponding to an object-identifier value of
97  * {iso(1) org(3) dod(6) internet(1) security(5)
98  * nametypes(6) gss-host-based-services(2)).  The constant
99  * GSS_C_NT_HOSTBASED_SERVICE_X should be initialized to point
100  * to that gss_OID_desc.  This is a deprecated OID value, and
101  * implementations wishing to support hostbased-service names
102  * should instead use the GSS_C_NT_HOSTBASED_SERVICE OID,
103  * defined below, to identify such names;
104  * GSS_C_NT_HOSTBASED_SERVICE_X should be accepted a synonym
105  * for GSS_C_NT_HOSTBASED_SERVICE when presented as an input
106  * parameter, but should not be emitted by GSS-API
107  * implementations
108  */
109
110 static gss_OID_desc gss_c_nt_hostbased_service_x_oid_desc =
111 {6, (void *)"\x2b\x06\x01\x05\x06\x02"};
112
113 gss_OID GSS_C_NT_HOSTBASED_SERVICE_X = &gss_c_nt_hostbased_service_x_oid_desc;
114
115 /*
116  * The implementation must reserve static storage for a
117  * gss_OID_desc object containing the value
118  * {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
119  *              "\x01\x02\x01\x04"}, corresponding to an
120  * object-identifier value of {iso(1) member-body(2)
121  * Unites States(840) mit(113554) infosys(1) gssapi(2)
122  * generic(1) service_name(4)}.  The constant
123  * GSS_C_NT_HOSTBASED_SERVICE should be initialized
124  * to point to that gss_OID_desc.
125  */
126 static gss_OID_desc gss_c_nt_hostbased_service_oid_desc =
127 {10, (void *)"\x2a\x86\x48\x86\xf7\x12" "\x01\x02\x01\x04"};
128
129 gss_OID GSS_C_NT_HOSTBASED_SERVICE = &gss_c_nt_hostbased_service_oid_desc;
130
131 /*
132  * The implementation must reserve static storage for a
133  * gss_OID_desc object containing the value
134  * {6, (void *)"\x2b\x06\01\x05\x06\x03"},
135  * corresponding to an object identifier value of
136  * {1(iso), 3(org), 6(dod), 1(internet), 5(security),
137  * 6(nametypes), 3(gss-anonymous-name)}.  The constant
138  * and GSS_C_NT_ANONYMOUS should be initialized to point
139  * to that gss_OID_desc.
140  */
141
142 static gss_OID_desc gss_c_nt_anonymous_oid_desc =
143 {6, (void *)"\x2b\x06\01\x05\x06\x03"};
144
145 gss_OID GSS_C_NT_ANONYMOUS = &gss_c_nt_anonymous_oid_desc;
146
147 /*
148  * The implementation must reserve static storage for a
149  * gss_OID_desc object containing the value
150  * {6, (void *)"\x2b\x06\x01\x05\x06\x04"},
151  * corresponding to an object-identifier value of
152  * {1(iso), 3(org), 6(dod), 1(internet), 5(security),
153  * 6(nametypes), 4(gss-api-exported-name)}.  The constant
154  * GSS_C_NT_EXPORT_NAME should be initialized to point
155  * to that gss_OID_desc.
156  */
157
158 static gss_OID_desc gss_c_nt_export_name_oid_desc =
159 {6, (void *)"\x2b\x06\x01\x05\x06\x04"};
160
161 gss_OID GSS_C_NT_EXPORT_NAME = &gss_c_nt_export_name_oid_desc;
162
163 /*
164  *   This name form shall be represented by the Object Identifier {iso(1)
165  *   member-body(2) United States(840) mit(113554) infosys(1) gssapi(2)
166  *   krb5(2) krb5_name(1)}.  The recommended symbolic name for this type
167  *   is "GSS_KRB5_NT_PRINCIPAL_NAME".
168  */
169
170 static gss_OID_desc gss_krb5_nt_principal_name_oid_desc =
171 {10, (void *)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x02\x01"};
172
173 gss_OID GSS_KRB5_NT_PRINCIPAL_NAME = &gss_krb5_nt_principal_name_oid_desc;
174
175 /*
176  *   This name form shall be represented by the Object Identifier {iso(1)
177  *   member-body(2) United States(840) mit(113554) infosys(1) gssapi(2)
178  *   generic(1) user_name(1)}.  The recommended symbolic name for this
179  *   type is "GSS_KRB5_NT_USER_NAME".
180  */
181
182 gss_OID GSS_KRB5_NT_USER_NAME = &gss_c_nt_user_name_oid_desc;
183
184 /*
185  *   This name form shall be represented by the Object Identifier {iso(1)
186  *   member-body(2) United States(840) mit(113554) infosys(1) gssapi(2)
187  *   generic(1) machine_uid_name(2)}.  The recommended symbolic name for
188  *   this type is "GSS_KRB5_NT_MACHINE_UID_NAME".
189  */
190
191 gss_OID GSS_KRB5_NT_MACHINE_UID_NAME = &gss_c_nt_machine_uid_name_oid_desc;
192
193 /*
194  *   This name form shall be represented by the Object Identifier {iso(1)
195  *   member-body(2) United States(840) mit(113554) infosys(1) gssapi(2)
196  *   generic(1) string_uid_name(3)}.  The recommended symbolic name for
197  *   this type is "GSS_KRB5_NT_STRING_UID_NAME".
198  */
199
200 gss_OID GSS_KRB5_NT_STRING_UID_NAME = &gss_c_nt_string_uid_name_oid_desc;
201
202 /*
203  *   To support ongoing experimentation, testing, and evolution of the
204  *   specification, the Kerberos V5 GSS-API mechanism as defined in this
205  *   and any successor memos will be identified with the following Object
206  *   Identifier, as defined in RFC-1510, until the specification is
207  *   advanced to the level of Proposed Standard RFC:
208  *
209  *   {iso(1), org(3), dod(5), internet(1), security(5), kerberosv5(2)}
210  *
211  *   Upon advancement to the level of Proposed Standard RFC, the Kerberos
212  *   V5 GSS-API mechanism will be identified by an Object Identifier
213  *   having the value:
214  *
215  *   {iso(1) member-body(2) United States(840) mit(113554) infosys(1)
216  *   gssapi(2) krb5(2)}
217  */
218
219 #if 0 /* This is the old OID */
220
221 static gss_OID_desc gss_krb5_mechanism_oid_desc =
222 {5, (void *)"\x2b\x05\x01\x05\x02"};
223
224 #endif
225
226 static gss_OID_desc gss_krb5_mechanism_oid_desc =
227 {9, (void *)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x02"};
228
229 gss_OID GSS_KRB5_MECHANISM = &gss_krb5_mechanism_oid_desc;
230
231 /*
232  * Context for krb5 calls.
233  */
234
235 krb5_context gssapi_krb5_context;