1 /* $NetBSD: external.c,v 1.1.1.2 2014/04/24 12:45:29 pettai Exp $ */
4 * Copyright (c) 1997 - 2000 Kungliga Tekniska Högskolan
5 * (Royal Institute of Technology, Stockholm, Sweden).
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of the Institute nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 #include "gsskrb5_locl.h"
37 #include <gssapi_mech.h>
40 * The implementation must reserve static storage for a
41 * gss_OID_desc object containing the value
42 * {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
43 * "\x01\x02\x01\x01"},
44 * corresponding to an object-identifier value of
45 * {iso(1) member-body(2) United States(840) mit(113554)
46 * infosys(1) gssapi(2) generic(1) user_name(1)}. The constant
47 * GSS_C_NT_USER_NAME should be initialized to point
48 * to that gss_OID_desc.
51 gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_user_name_oid_desc
=
52 {10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12" "\x01\x02\x01\x01")};
55 * The implementation must reserve static storage for a
56 * gss_OID_desc object containing the value
57 * {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
58 * "\x01\x02\x01\x02"},
59 * corresponding to an object-identifier value of
60 * {iso(1) member-body(2) United States(840) mit(113554)
61 * infosys(1) gssapi(2) generic(1) machine_uid_name(2)}.
62 * The constant GSS_C_NT_MACHINE_UID_NAME should be
63 * initialized to point to that gss_OID_desc.
66 gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_machine_uid_name_oid_desc
=
67 {10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12" "\x01\x02\x01\x02")};
70 * The implementation must reserve static storage for a
71 * gss_OID_desc object containing the value
72 * {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
73 * "\x01\x02\x01\x03"},
74 * corresponding to an object-identifier value of
75 * {iso(1) member-body(2) United States(840) mit(113554)
76 * infosys(1) gssapi(2) generic(1) string_uid_name(3)}.
77 * The constant GSS_C_NT_STRING_UID_NAME should be
78 * initialized to point to that gss_OID_desc.
81 gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_string_uid_name_oid_desc
=
82 {10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12" "\x01\x02\x01\x03")};
85 * The implementation must reserve static storage for a
86 * gss_OID_desc object containing the value
87 * {6, (void *)"\x2b\x06\x01\x05\x06\x02"},
88 * corresponding to an object-identifier value of
89 * {iso(1) org(3) dod(6) internet(1) security(5)
90 * nametypes(6) gss-host-based-services(2)). The constant
91 * GSS_C_NT_HOSTBASED_SERVICE_X should be initialized to point
92 * to that gss_OID_desc. This is a deprecated OID value, and
93 * implementations wishing to support hostbased-service names
94 * should instead use the GSS_C_NT_HOSTBASED_SERVICE OID,
95 * defined below, to identify such names;
96 * GSS_C_NT_HOSTBASED_SERVICE_X should be accepted a synonym
97 * for GSS_C_NT_HOSTBASED_SERVICE when presented as an input
98 * parameter, but should not be emitted by GSS-API
102 gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_hostbased_service_x_oid_desc
=
103 {6, rk_UNCONST("\x2b\x06\x01\x05\x06\x02")};
106 * The implementation must reserve static storage for a
107 * gss_OID_desc object containing the value
108 * {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
109 * "\x01\x02\x01\x04"}, corresponding to an
110 * object-identifier value of {iso(1) member-body(2)
111 * Unites States(840) mit(113554) infosys(1) gssapi(2)
112 * generic(1) service_name(4)}. The constant
113 * GSS_C_NT_HOSTBASED_SERVICE should be initialized
114 * to point to that gss_OID_desc.
116 gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_hostbased_service_oid_desc
=
117 {10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12" "\x01\x02\x01\x04")};
120 * The implementation must reserve static storage for a
121 * gss_OID_desc object containing the value
122 * {6, (void *)"\x2b\x06\01\x05\x06\x03"},
123 * corresponding to an object identifier value of
124 * {1(iso), 3(org), 6(dod), 1(internet), 5(security),
125 * 6(nametypes), 3(gss-anonymous-name)}. The constant
126 * and GSS_C_NT_ANONYMOUS should be initialized to point
127 * to that gss_OID_desc.
130 gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_anonymous_oid_desc
=
131 {6, rk_UNCONST("\x2b\x06\01\x05\x06\x03")};
134 * The implementation must reserve static storage for a
135 * gss_OID_desc object containing the value
136 * {6, (void *)"\x2b\x06\x01\x05\x06\x04"},
137 * corresponding to an object-identifier value of
138 * {1(iso), 3(org), 6(dod), 1(internet), 5(security),
139 * 6(nametypes), 4(gss-api-exported-name)}. The constant
140 * GSS_C_NT_EXPORT_NAME should be initialized to point
141 * to that gss_OID_desc.
144 gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_export_name_oid_desc
=
145 {6, rk_UNCONST("\x2b\x06\x01\x05\x06\x04") };
148 * This name form shall be represented by the Object Identifier {iso(1)
149 * member-body(2) United States(840) mit(113554) infosys(1) gssapi(2)
150 * krb5(2) krb5_name(1)}. The recommended symbolic name for this type
151 * is "GSS_KRB5_NT_PRINCIPAL_NAME".
154 gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_nt_principal_name_oid_desc
=
155 {10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12\x01\x02\x02\x01") };
158 * draft-ietf-cat-iakerb-09, IAKERB:
159 * The mechanism ID for IAKERB proxy GSS-API Kerberos, in accordance
160 * with the mechanism proposed by SPNEGO [7] for negotiating protocol
161 * variations, is: {iso(1) org(3) dod(6) internet(1) security(5)
162 * mechanisms(5) iakerb(10) iakerbProxyProtocol(1)}. The proposed
163 * mechanism ID for IAKERB minimum messages GSS-API Kerberos, in
164 * accordance with the mechanism proposed by SPNEGO for negotiating
165 * protocol variations, is: {iso(1) org(3) dod(6) internet(1)
166 * security(5) mechanisms(5) iakerb(10)
167 * iakerbMinimumMessagesProtocol(2)}.
170 gss_OID_desc GSSAPI_LIB_VARIABLE __gss_iakerb_proxy_mechanism_oid_desc
=
171 {7, rk_UNCONST("\x2b\x06\x01\x05\x05\x0a\x01")};
173 gss_OID_desc GSSAPI_LIB_VARIABLE __gss_iakerb_min_msg_mechanism_oid_desc
=
174 {7, rk_UNCONST("\x2b\x06\x01\x05\x05\x0a\x02") };
177 * Context for krb5 calls.
180 static gss_mo_desc krb5_mo
[] = {
182 GSS_C_MA_SASL_MECH_NAME
,
185 rk_UNCONST("GS2-KRB5"),
186 _gss_mo_get_ctx_as_string
,
194 _gss_mo_get_ctx_as_string
,
198 GSS_C_MA_MECH_DESCRIPTION
,
200 "Mechanism description",
201 rk_UNCONST("Heimdal Kerberos 5 mech"),
202 _gss_mo_get_ctx_as_string
,
206 GSS_C_MA_MECH_CONCRETE
,
210 GSS_C_MA_ITOK_FRAMED
,
222 GSS_C_MA_AUTH_INIT_ANON
,
275 static gssapi_mech_interface_desc krb5_mech
= {
278 {9, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12\x01\x02\x02") },
280 _gsskrb5_acquire_cred
,
281 _gsskrb5_release_cred
,
282 _gsskrb5_init_sec_context
,
283 _gsskrb5_accept_sec_context
,
284 _gsskrb5_process_context_token
,
285 _gsskrb5_delete_sec_context
,
286 _gsskrb5_context_time
,
291 _gsskrb5_display_status
,
292 _gsskrb5_indicate_mechs
,
293 _gsskrb5_compare_name
,
294 _gsskrb5_display_name
,
295 _gsskrb5_import_name
,
296 _gsskrb5_export_name
,
297 _gsskrb5_release_name
,
298 _gsskrb5_inquire_cred
,
299 _gsskrb5_inquire_context
,
300 _gsskrb5_wrap_size_limit
,
302 _gsskrb5_inquire_cred_by_mech
,
303 _gsskrb5_export_sec_context
,
304 _gsskrb5_import_sec_context
,
305 _gsskrb5_inquire_names_for_mech
,
306 _gsskrb5_inquire_mechs_for_name
,
307 _gsskrb5_canonicalize_name
,
308 _gsskrb5_duplicate_name
,
309 _gsskrb5_inquire_sec_context_by_oid
,
310 _gsskrb5_inquire_cred_by_oid
,
311 _gsskrb5_set_sec_context_option
,
312 _gsskrb5_set_cred_option
,
313 _gsskrb5_pseudo_random
,
318 _gsskrb5_export_cred
,
319 _gsskrb5_import_cred
,
320 _gsskrb5_acquire_cred_ext
,
328 sizeof(krb5_mo
) / sizeof(krb5_mo
[0]),
329 _gsskrb5_pname_to_uid
,
330 _gsskrb5_authorize_localname
,
340 gssapi_mech_interface
341 __gss_krb5_initialize(void)