Debian Codegraph @

lib/gssapi/spnego/external.c

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