| 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 "gsskrb5_locl.h" |
| 35 |
#include <gssapi_mech.h> |
| 36 |
|
| 37 |
/* |
| 38 |
* The implementation must reserve static storage for a |
| 39 |
* gss_OID_desc object containing the value |
| 40 |
* {10, (void *)"\x2a\x86\x48\x86\xf7\x12" |
| 41 |
* "\x01\x02\x01\x01"}, |
| 42 |
* corresponding to an object-identifier value of |
| 43 |
* {iso(1) member-body(2) United States(840) mit(113554) |
| 44 |
* infosys(1) gssapi(2) generic(1) user_name(1)}. The constant |
| 45 |
* GSS_C_NT_USER_NAME should be initialized to point |
| 46 |
* to that gss_OID_desc. |
| 47 |
*/ |
| 48 |
|
| 49 |
gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_user_name_oid_desc = |
| 50 |
{10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12" "\x01\x02\x01\x01")}; |
| 51 |
|
| 52 |
/* |
| 53 |
* The implementation must reserve static storage for a |
| 54 |
* gss_OID_desc object containing the value |
| 55 |
* {10, (void *)"\x2a\x86\x48\x86\xf7\x12" |
| 56 |
* "\x01\x02\x01\x02"}, |
| 57 |
* corresponding to an object-identifier value of |
| 58 |
* {iso(1) member-body(2) United States(840) mit(113554) |
| 59 |
* infosys(1) gssapi(2) generic(1) machine_uid_name(2)}. |
| 60 |
* The constant GSS_C_NT_MACHINE_UID_NAME should be |
| 61 |
* initialized to point to that gss_OID_desc. |
| 62 |
*/ |
| 63 |
|
| 64 |
gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_machine_uid_name_oid_desc = |
| 65 |
{10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12" "\x01\x02\x01\x02")}; |
| 66 |
|
| 67 |
/* |
| 68 |
* The implementation must reserve static storage for a |
| 69 |
* gss_OID_desc object containing the value |
| 70 |
* {10, (void *)"\x2a\x86\x48\x86\xf7\x12" |
| 71 |
* "\x01\x02\x01\x03"}, |
| 72 |
* corresponding to an object-identifier value of |
| 73 |
* {iso(1) member-body(2) United States(840) mit(113554) |
| 74 |
* infosys(1) gssapi(2) generic(1) string_uid_name(3)}. |
| 75 |
* The constant GSS_C_NT_STRING_UID_NAME should be |
| 76 |
* initialized to point to that gss_OID_desc. |
| 77 |
*/ |
| 78 |
|
| 79 |
gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_string_uid_name_oid_desc = |
| 80 |
{10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12" "\x01\x02\x01\x03")}; |
| 81 |
|
| 82 |
/* |
| 83 |
* The implementation must reserve static storage for a |
| 84 |
* gss_OID_desc object containing the value |
| 85 |
* {6, (void *)"\x2b\x06\x01\x05\x06\x02"}, |
| 86 |
* corresponding to an object-identifier value of |
| 87 |
* {iso(1) org(3) dod(6) internet(1) security(5) |
| 88 |
* nametypes(6) gss-host-based-services(2)). The constant |
| 89 |
* GSS_C_NT_HOSTBASED_SERVICE_X should be initialized to point |
| 90 |
* to that gss_OID_desc. This is a deprecated OID value, and |
| 91 |
* implementations wishing to support hostbased-service names |
| 92 |
* should instead use the GSS_C_NT_HOSTBASED_SERVICE OID, |
| 93 |
* defined below, to identify such names; |
| 94 |
* GSS_C_NT_HOSTBASED_SERVICE_X should be accepted a synonym |
| 95 |
* for GSS_C_NT_HOSTBASED_SERVICE when presented as an input |
| 96 |
* parameter, but should not be emitted by GSS-API |
| 97 |
* implementations |
| 98 |
*/ |
| 99 |
|
| 100 |
gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_hostbased_service_x_oid_desc = |
| 101 |
{6, rk_UNCONST("\x2b\x06\x01\x05\x06\x02")}; |
| 102 |
|
| 103 |
/* |
| 104 |
* The implementation must reserve static storage for a |
| 105 |
* gss_OID_desc object containing the value |
| 106 |
* {10, (void *)"\x2a\x86\x48\x86\xf7\x12" |
| 107 |
* "\x01\x02\x01\x04"}, corresponding to an |
| 108 |
* object-identifier value of {iso(1) member-body(2) |
| 109 |
* Unites States(840) mit(113554) infosys(1) gssapi(2) |
| 110 |
* generic(1) service_name(4)}. The constant |
| 111 |
* GSS_C_NT_HOSTBASED_SERVICE should be initialized |
| 112 |
* to point to that gss_OID_desc. |
| 113 |
*/ |
| 114 |
gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_hostbased_service_oid_desc = |
| 115 |
{10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12" "\x01\x02\x01\x04")}; |
| 116 |
|
| 117 |
/* |
| 118 |
* The implementation must reserve static storage for a |
| 119 |
* gss_OID_desc object containing the value |
| 120 |
* {6, (void *)"\x2b\x06\01\x05\x06\x03"}, |
| 121 |
* corresponding to an object identifier value of |
| 122 |
* {1(iso), 3(org), 6(dod), 1(internet), 5(security), |
| 123 |
* 6(nametypes), 3(gss-anonymous-name)}. The constant |
| 124 |
* and GSS_C_NT_ANONYMOUS should be initialized to point |
| 125 |
* to that gss_OID_desc. |
| 126 |
*/ |
| 127 |
|
| 128 |
gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_anonymous_oid_desc = |
| 129 |
{6, rk_UNCONST("\x2b\x06\01\x05\x06\x03")}; |
| 130 |
|
| 131 |
/* |
| 132 |
* The implementation must reserve static storage for a |
| 133 |
* gss_OID_desc object containing the value |
| 134 |
* {6, (void *)"\x2b\x06\x01\x05\x06\x04"}, |
| 135 |
* corresponding to an object-identifier value of |
| 136 |
* {1(iso), 3(org), 6(dod), 1(internet), 5(security), |
| 137 |
* 6(nametypes), 4(gss-api-exported-name)}. The constant |
| 138 |
* GSS_C_NT_EXPORT_NAME should be initialized to point |
| 139 |
* to that gss_OID_desc. |
| 140 |
*/ |
| 141 |
|
| 142 |
gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_export_name_oid_desc = |
| 143 |
{6, rk_UNCONST("\x2b\x06\x01\x05\x06\x04") }; |
| 144 |
|
| 145 |
/* |
| 146 |
* This name form shall be represented by the Object Identifier {iso(1) |
| 147 |
* member-body(2) United States(840) mit(113554) infosys(1) gssapi(2) |
| 148 |
* krb5(2) krb5_name(1)}. The recommended symbolic name for this type |
| 149 |
* is "GSS_KRB5_NT_PRINCIPAL_NAME". |
| 150 |
*/ |
| 151 |
|
| 152 |
gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_nt_principal_name_oid_desc = |
| 153 |
{10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12\x01\x02\x02\x01") }; |
| 154 |
|
| 155 |
/* |
| 156 |
* draft-ietf-cat-iakerb-09, IAKERB: |
| 157 |
* The mechanism ID for IAKERB proxy GSS-API Kerberos, in accordance |
| 158 |
* with the mechanism proposed by SPNEGO [7] for negotiating protocol |
| 159 |
* variations, is: {iso(1) org(3) dod(6) internet(1) security(5) |
| 160 |
* mechanisms(5) iakerb(10) iakerbProxyProtocol(1)}. The proposed |
| 161 |
* mechanism ID for IAKERB minimum messages GSS-API Kerberos, in |
| 162 |
* accordance with the mechanism proposed by SPNEGO for negotiating |
| 163 |
* protocol variations, is: {iso(1) org(3) dod(6) internet(1) |
| 164 |
* security(5) mechanisms(5) iakerb(10) |
| 165 |
* iakerbMinimumMessagesProtocol(2)}. |
| 166 |
*/ |
| 167 |
|
| 168 |
gss_OID_desc GSSAPI_LIB_VARIABLE __gss_iakerb_proxy_mechanism_oid_desc = |
| 169 |
{7, rk_UNCONST("\x2b\x06\x01\x05\x05\x0a\x01")}; |
| 170 |
|
| 171 |
gss_OID_desc GSSAPI_LIB_VARIABLE __gss_iakerb_min_msg_mechanism_oid_desc = |
| 172 |
{7, rk_UNCONST("\x2b\x06\x01\x05\x05\x0a\x02") }; |
| 173 |
|
| 174 |
/* |
| 175 |
* Context for krb5 calls. |
| 176 |
*/ |
| 177 |
|
| 178 |
static gss_mo_desc krb5_mo[] = { |
| 179 |
{ |
| 180 |
GSS_C_MA_SASL_MECH_NAME, |
| 181 |
GSS_MO_MA, |
| 182 |
"SASL mech name", |
| 183 |
rk_UNCONST("GS2-KRB5"), |
| 184 |
_gss_mo_get_ctx_as_string, |
| 185 |
NULL |
| 186 |
}, |
| 187 |
{ |
| 188 |
GSS_C_MA_MECH_NAME, |
| 189 |
GSS_MO_MA, |
| 190 |
"Mechanism name", |
| 191 |
rk_UNCONST("KRB5"), |
| 192 |
_gss_mo_get_ctx_as_string, |
| 193 |
NULL |
| 194 |
}, |
| 195 |
{ |
| 196 |
GSS_C_MA_MECH_DESCRIPTION, |
| 197 |
GSS_MO_MA, |
| 198 |
"Mechanism description", |
| 199 |
rk_UNCONST("Heimdal Kerberos 5 mech"), |
| 200 |
_gss_mo_get_ctx_as_string, |
| 201 |
NULL |
| 202 |
}, |
| 203 |
{ |
| 204 |
GSS_C_MA_MECH_CONCRETE, |
| 205 |
GSS_MO_MA, |
| 206 |
NULL, |
| 207 |
NULL, |
| 208 |
NULL, |
| 209 |
NULL |
| 210 |
}, |
| 211 |
{ |
| 212 |
GSS_C_MA_ITOK_FRAMED, |
| 213 |
GSS_MO_MA, |
| 214 |
NULL, |
| 215 |
NULL, |
| 216 |
NULL, |
| 217 |
NULL |
| 218 |
}, |
| 219 |
{ |
| 220 |
GSS_C_MA_AUTH_INIT, |
| 221 |
GSS_MO_MA, |
| 222 |
NULL, |
| 223 |
NULL, |
| 224 |
NULL, |
| 225 |
NULL |
| 226 |
}, |
| 227 |
{ |
| 228 |
GSS_C_MA_AUTH_TARG, |
| 229 |
GSS_MO_MA, |
| 230 |
NULL, |
| 231 |
NULL, |
| 232 |
NULL, |
| 233 |
NULL |
| 234 |
}, |
| 235 |
{ |
| 236 |
GSS_C_MA_AUTH_INIT_ANON, |
| 237 |
GSS_MO_MA, |
| 238 |
NULL, |
| 239 |
NULL, |
| 240 |
NULL, |
| 241 |
NULL |
| 242 |
}, |
| 243 |
{ |
| 244 |
GSS_C_MA_DELEG_CRED, |
| 245 |
GSS_MO_MA, |
| 246 |
NULL, |
| 247 |
NULL, |
| 248 |
NULL, |
| 249 |
NULL |
| 250 |
}, |
| 251 |
{ |
| 252 |
GSS_C_MA_INTEG_PROT, |
| 253 |
GSS_MO_MA, |
| 254 |
NULL, |
| 255 |
NULL, |
| 256 |
NULL, |
| 257 |
NULL |
| 258 |
}, |
| 259 |
{ |
| 260 |
GSS_C_MA_CONF_PROT, |
| 261 |
GSS_MO_MA, |
| 262 |
NULL, |
| 263 |
NULL, |
| 264 |
NULL, |
| 265 |
NULL |
| 266 |
}, |
| 267 |
{ |
| 268 |
GSS_C_MA_MIC, |
| 269 |
GSS_MO_MA, |
| 270 |
NULL, |
| 271 |
NULL, |
| 272 |
NULL, |
| 273 |
NULL |
| 274 |
}, |
| 275 |
{ |
| 276 |
GSS_C_MA_WRAP, |
| 277 |
GSS_MO_MA, |
| 278 |
NULL, |
| 279 |
NULL, |
| 280 |
NULL, |
| 281 |
NULL |
| 282 |
}, |
| 283 |
{ |
| 284 |
GSS_C_MA_PROT_READY, |
| 285 |
GSS_MO_MA, |
| 286 |
NULL, |
| 287 |
NULL, |
| 288 |
NULL, |
| 289 |
NULL |
| 290 |
}, |
| 291 |
{ |
| 292 |
GSS_C_MA_REPLAY_DET, |
| 293 |
GSS_MO_MA, |
| 294 |
NULL, |
| 295 |
NULL, |
| 296 |
NULL, |
| 297 |
NULL |
| 298 |
}, |
| 299 |
{ |
| 300 |
GSS_C_MA_OOS_DET, |
| 301 |
GSS_MO_MA, |
| 302 |
NULL, |
| 303 |
NULL, |
| 304 |
NULL, |
| 305 |
NULL |
| 306 |
}, |
| 307 |
{ |
| 308 |
GSS_C_MA_CBINDINGS, |
| 309 |
GSS_MO_MA, |
| 310 |
NULL, |
| 311 |
NULL, |
| 312 |
NULL, |
| 313 |
NULL |
| 314 |
}, |
| 315 |
{ |
| 316 |
GSS_C_MA_PFS, |
| 317 |
GSS_MO_MA, |
| 318 |
NULL, |
| 319 |
NULL, |
| 320 |
NULL, |
| 321 |
NULL |
| 322 |
}, |
| 323 |
{ |
| 324 |
GSS_C_MA_CTX_TRANS, |
| 325 |
GSS_MO_MA, |
| 326 |
NULL, |
| 327 |
NULL, |
| 328 |
NULL, |
| 329 |
NULL |
| 330 |
} |
| 331 |
}; |
| 332 |
|
| 333 |
/* |
| 334 |
* |
| 335 |
*/ |
| 336 |
|
| 337 |
static gssapi_mech_interface_desc krb5_mech = { |
| 338 |
GMI_VERSION, |
| 339 |
"kerberos 5", |
| 340 |
{9, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12\x01\x02\x02") }, |
| 341 |
0, |
| 342 |
_gsskrb5_acquire_cred, |
| 343 |
_gsskrb5_release_cred, |
| 344 |
_gsskrb5_init_sec_context, |
| 345 |
_gsskrb5_accept_sec_context, |
| 346 |
_gsskrb5_process_context_token, |
| 347 |
_gsskrb5_delete_sec_context, |
| 348 |
_gsskrb5_context_time, |
| 349 |
_gsskrb5_get_mic, |
| 350 |
_gsskrb5_verify_mic, |
| 351 |
_gsskrb5_wrap, |
| 352 |
_gsskrb5_unwrap, |
| 353 |
_gsskrb5_display_status, |
| 354 |
_gsskrb5_indicate_mechs, |
| 355 |
_gsskrb5_compare_name, |
| 356 |
_gsskrb5_display_name, |
| 357 |
_gsskrb5_import_name, |
| 358 |
_gsskrb5_export_name, |
| 359 |
_gsskrb5_release_name, |
| 360 |
_gsskrb5_inquire_cred, |
| 361 |
_gsskrb5_inquire_context, |
| 362 |
_gsskrb5_wrap_size_limit, |
| 363 |
_gsskrb5_add_cred, |
| 364 |
_gsskrb5_inquire_cred_by_mech, |
| 365 |
_gsskrb5_export_sec_context, |
| 366 |
_gsskrb5_import_sec_context, |
| 367 |
_gsskrb5_inquire_names_for_mech, |
| 368 |
_gsskrb5_inquire_mechs_for_name, |
| 369 |
_gsskrb5_canonicalize_name, |
| 370 |
_gsskrb5_duplicate_name, |
| 371 |
_gsskrb5_inquire_sec_context_by_oid, |
| 372 |
_gsskrb5_inquire_cred_by_oid, |
| 373 |
_gsskrb5_set_sec_context_option, |
| 374 |
_gsskrb5_set_cred_option, |
| 375 |
_gsskrb5_pseudo_random, |
| 376 |
_gk_wrap_iov, |
| 377 |
_gk_unwrap_iov, |
| 378 |
_gk_wrap_iov_length, |
| 379 |
_gsskrb5_store_cred, |
| 380 |
_gsskrb5_export_cred, |
| 381 |
_gsskrb5_import_cred, |
| 382 |
_gsskrb5_acquire_cred_ext, |
| 383 |
NULL, |
| 384 |
NULL, |
| 385 |
NULL, |
| 386 |
NULL, |
| 387 |
NULL, |
| 388 |
NULL, |
| 389 |
krb5_mo, |
| 390 |
sizeof(krb5_mo) / sizeof(krb5_mo[0]), |
| 391 |
_gsskrb5_localname, |
| 392 |
_gsskrb5_authorize_localname, |
| 393 |
NULL, |
| 394 |
NULL, |
| 395 |
NULL, |
| 396 |
NULL, |
| 397 |
NULL, |
| 398 |
NULL, |
| 399 |
NULL |
| 400 |
}; |
| 401 |
|
| 402 |
gssapi_mech_interface |
| 403 |
__gss_krb5_initialize(void) |
| 404 |
{ |
| 405 |
return &krb5_mech; |
| 406 |
} |