Line data Source code
1 : /*
2 : * Copyright (c) 2004, PADL Software Pty Ltd.
3 : * Copyright (c) 2018 Kungliga Tekniska Högskolan
4 : * (Royal Institute of Technology, Stockholm, Sweden).
5 : * All rights reserved.
6 : *
7 : * Redistribution and use in source and binary forms, with or without
8 : * modification, are permitted provided that the following conditions
9 : * are met:
10 : *
11 : * 1. Redistributions of source code must retain the above copyright
12 : * notice, this list of conditions and the following disclaimer.
13 : *
14 : * 2. Redistributions in binary form must reproduce the above copyright
15 : * notice, this list of conditions and the following disclaimer in the
16 : * documentation and/or other materials provided with the distribution.
17 : *
18 : * 3. Neither the name of PADL Software nor the names of its contributors
19 : * may be used to endorse or promote products derived from this software
20 : * without specific prior written permission.
21 : *
22 : * THIS SOFTWARE IS PROVIDED BY PADL SOFTWARE AND CONTRIBUTORS ``AS IS'' AND
23 : * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 : * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 : * ARE DISCLAIMED. IN NO EVENT SHALL PADL SOFTWARE OR CONTRIBUTORS BE LIABLE
26 : * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 : * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 : * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 : * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 : * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 : * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 : * SUCH DAMAGE.
33 : */
34 :
35 : #include "spnego_locl.h"
36 : #include <gssapi_mech.h>
37 :
38 : /*
39 : * RFC2478, SPNEGO:
40 : * The security mechanism of the initial
41 : * negotiation token is identified by the Object Identifier
42 : * iso.org.dod.internet.security.mechanism.snego (1.3.6.1.5.5.2).
43 : */
44 : static gss_mo_desc spnego_mo[] = {
45 : {
46 : GSS_C_MA_SASL_MECH_NAME,
47 : GSS_MO_MA,
48 : "SASL mech name",
49 : rk_UNCONST("SPNEGO"),
50 : _gss_mo_get_ctx_as_string,
51 : NULL
52 : },
53 : {
54 : GSS_C_MA_MECH_NAME,
55 : GSS_MO_MA,
56 : "Mechanism name",
57 : rk_UNCONST("SPNEGO"),
58 : _gss_mo_get_ctx_as_string,
59 : NULL
60 : },
61 : {
62 : GSS_C_MA_MECH_DESCRIPTION,
63 : GSS_MO_MA,
64 : "Mechanism description",
65 : rk_UNCONST("Heimdal SPNEGO Mechanism"),
66 : _gss_mo_get_ctx_as_string,
67 : NULL
68 : },
69 : {
70 : GSS_C_MA_MECH_NEGO,
71 : GSS_MO_MA,
72 : NULL,
73 : NULL,
74 : NULL,
75 : NULL
76 : },
77 : {
78 : GSS_C_MA_MECH_PSEUDO,
79 : GSS_MO_MA,
80 : NULL,
81 : NULL,
82 : NULL,
83 : NULL
84 : }
85 : };
86 :
87 : static gssapi_mech_interface_desc spnego_mech = {
88 : GMI_VERSION,
89 : "spnego",
90 : {6, rk_UNCONST("\x2b\x06\x01\x05\x05\x02") },
91 : GM_USE_MG_CRED | GM_USE_MG_NAME,
92 : NULL, /* gm_acquire_cred */
93 : NULL, /* gm_release_cred */
94 : _gss_spnego_init_sec_context,
95 : _gss_spnego_accept_sec_context,
96 : _gss_spnego_process_context_token,
97 : _gss_spnego_delete_sec_context,
98 : _gss_spnego_context_time,
99 : _gss_spnego_get_mic,
100 : _gss_spnego_verify_mic,
101 : _gss_spnego_wrap,
102 : _gss_spnego_unwrap,
103 : NULL, /* gm_display_status */
104 : NULL, /* gm_indicate_mechs */
105 : NULL, /* gm_compare_name */
106 : NULL, /* gm_display_name */
107 : NULL, /* gm_import_name */
108 : NULL, /* gm_export_name */
109 : NULL, /* gm_release_name */
110 : NULL, /* gm_inquire_cred */
111 : _gss_spnego_inquire_context,
112 : _gss_spnego_wrap_size_limit,
113 : NULL, /* gm_add_cred */
114 : NULL, /* gm_inquire_cred_by_mech */
115 : _gss_spnego_export_sec_context,
116 : _gss_spnego_import_sec_context,
117 : NULL, /* gm_spnego_inquire_names_for_mech */
118 : NULL, /* gm_spnego_inquire_mechs_for_name */
119 : NULL, /* gm_spnego_canonicalize_name */
120 : NULL, /* gm_spnego_duplicate_name */
121 : _gss_spnego_inquire_sec_context_by_oid,
122 : NULL, /* gm_inquire_cred_by_oid */
123 : _gss_spnego_set_sec_context_option,
124 : NULL, /* gm_set_cred_option */
125 : _gss_spnego_pseudo_random,
126 : _gss_spnego_wrap_iov,
127 : _gss_spnego_unwrap_iov,
128 : _gss_spnego_wrap_iov_length,
129 : NULL,
130 : NULL, /* gm_export_cred */
131 : NULL, /* gm_import_cred */
132 : NULL, /* gm_acquire_cred_from */
133 : NULL, /* gm_acquire_cred_impersonate_name */
134 : NULL,
135 : NULL,
136 : NULL,
137 : NULL,
138 : NULL,
139 : NULL,
140 : spnego_mo,
141 : sizeof(spnego_mo) / sizeof(spnego_mo[0]),
142 : NULL, /* gm_localname */
143 : NULL, /* gm_authorize_localname */
144 : NULL, /* gm_display_name_ext */
145 : NULL, /* gm_inquire_name */
146 : NULL, /* gm_get_name_attribute */
147 : NULL, /* gm_set_name_attribute */
148 : NULL, /* gm_delete_name_attribute */
149 : NULL, /* gm_export_name_composite */
150 : NULL, /* gm_duplicate_cred */
151 : NULL, /* gm_add_cred_from */
152 : NULL, /* gm_store_cred_into */
153 : NULL, /* gm_query_mechanism_info */
154 : NULL, /* gm_query_meta_data */
155 : NULL, /* gm_exchange_meta_data */
156 : NULL, /* gm_store_cred_into2 */
157 : NULL /* gm_compat */
158 : };
159 :
160 : gssapi_mech_interface
161 22586 : __gss_spnego_initialize(void)
162 : {
163 22586 : return &spnego_mech;
164 : }
165 :
|