gssapi: credential store extensions (#451)

Implement the GSS-API credential store API extensions defined by MIT here:

https://k5wiki.kerberos.org/wiki/Projects/Credential_Store_extensions

Note: we kill off gss_acquire_cred_ext() here. This was never a public API,
although mechanisms could have implemented it and I briefly used it in my
BrowserID prototype mechanism. gss_acquire_cred_ext_from() occupies the place
in the dispatch table where gss_acquire_cred_ext() used to, but this structure
was never visible outside Heimdal (i.e. it is only used by internal
mechanisms);

(Mechanisms that need to accept arbitrary key/value dictionaries from
applications should now implement gss_acquire_cred_from().)
This commit is contained in:
Luke Howard
2019-01-03 09:26:41 +11:00
committed by Nico Williams
parent a7d42cdf6b
commit e0bb9c10ca
39 changed files with 1289 additions and 1054 deletions

View File

@@ -54,12 +54,13 @@ _gss_spnego_release_cred(OM_uint32 *minor_status, gss_cred_id_t *cred_handle)
* we support gss_{get,set}_neg_mechs() we will need to expose
* more functionality.
*/
OM_uint32 GSSAPI_CALLCONV _gss_spnego_acquire_cred
OM_uint32 GSSAPI_CALLCONV _gss_spnego_acquire_cred_from
(OM_uint32 *minor_status,
gss_const_name_t desired_name,
OM_uint32 time_req,
const gss_OID_set desired_mechs,
gss_cred_usage_t cred_usage,
gss_const_key_value_set_t cred_store,
gss_cred_id_t * output_cred_handle,
gss_OID_set * actual_mechs,
OM_uint32 * time_rec
@@ -106,16 +107,16 @@ OM_uint32 GSSAPI_CALLCONV _gss_spnego_acquire_cred
}
actual_desired_mechs.count = j;
ret = gss_acquire_cred(minor_status, name,
time_req, &actual_desired_mechs,
cred_usage,
output_cred_handle,
actual_mechs, time_rec);
ret = gss_acquire_cred_from(minor_status, name,
time_req, &actual_desired_mechs,
cred_usage, cred_store,
output_cred_handle,
actual_mechs, time_rec);
if (ret != GSS_S_COMPLETE)
goto out;
out:
gss_release_name(minor_status, &name);
gss_release_name(&tmp, &name);
gss_release_oid_set(&tmp, &mechs);
if (actual_desired_mechs.elements != NULL) {
free(actual_desired_mechs.elements);

View File

@@ -89,7 +89,7 @@ static gssapi_mech_interface_desc spnego_mech = {
"spnego",
{6, rk_UNCONST("\x2b\x06\x01\x05\x05\x02") },
0,
_gss_spnego_acquire_cred,
NULL, /* gm_acquire_cred */
_gss_spnego_release_cred,
_gss_spnego_init_sec_context,
_gss_spnego_accept_sec_context,
@@ -129,7 +129,7 @@ static gssapi_mech_interface_desc spnego_mech = {
NULL,
_gss_spnego_export_cred,
_gss_spnego_import_cred,
NULL,
_gss_spnego_acquire_cred_from,
NULL,
NULL,
NULL,
@@ -147,6 +147,8 @@ static gssapi_mech_interface_desc spnego_mech = {
NULL, /* gm_delete_name_attribute */
NULL, /* gm_export_name_composite */
NULL, /* gm_duplicate_cred */
gss_add_cred_from,
NULL, /* gm_store_cred_into */
NULL /* gm_compat */
};