make the SPNEGO mech store the error itself instead, works for everything except other stackable mechs

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22600 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2008-02-21 12:46:24 +00:00
parent a7b1b3b1aa
commit 3673482a9b
7 changed files with 33 additions and 15 deletions

View File

@@ -1,3 +1,8 @@
2008-02-21 Love H<>rnquist <20>strand <lha@it.su.se>
* make the SPNEGO mech store the error itself instead, works for
everything except other stackable mechs
2008-02-18 Love H<>rnquist <20>strand <lha@it.su.se> 2008-02-18 Love H<>rnquist <20>strand <lha@it.su.se>
* spnego/init_sec_context.c (spnego_reply): if the reply token was * spnego/init_sec_context.c (spnego_reply): if the reply token was

View File

@@ -356,4 +356,6 @@ gssapi_mech_interface __gss_spnego_initialize(void);
gssapi_mech_interface __gss_krb5_initialize(void); gssapi_mech_interface __gss_krb5_initialize(void);
gssapi_mech_interface __gss_ntlm_initialize(void); gssapi_mech_interface __gss_ntlm_initialize(void);
void gss_mg_collect_error(gss_OID, OM_uint32, OM_uint32);
#endif /* GSSAPI_MECH_H */ #endif /* GSSAPI_MECH_H */

View File

@@ -107,6 +107,13 @@ _gss_mg_error(gssapi_mech_interface m, OM_uint32 maj, OM_uint32 min)
OM_uint32 message_content; OM_uint32 message_content;
struct mg_thread_ctx *mg; struct mg_thread_ctx *mg;
/*
* Mechs without gss_display_status() does
* gss_mg_collect_error() by themself.
*/
if (m->gm_display_status == NULL)
return ;
mg = _gss_mechglue_thread(); mg = _gss_mechglue_thread();
if (mg == NULL) if (mg == NULL)
return; return;
@@ -139,3 +146,12 @@ _gss_mg_error(gssapi_mech_interface m, OM_uint32 maj, OM_uint32 min)
mg->min_error.length = 0; mg->min_error.length = 0;
} }
} }
void
gss_mg_collect_error(gss_OID mech, OM_uint32 maj, OM_uint32 min)
{
gssapi_mech_interface m = __gss_get_mechanism(mech);
if (m == NULL)
return;
_gss_mg_error(m, maj, min);
}

View File

@@ -609,7 +609,7 @@ acceptor_start
/* /*
* First we try the opportunistic token if we have support for it, * First we try the opportunistic token if we have support for it,
* don't try to verify we have credential for the token, * don't try to verify we have credential for the token,
* gss_accept_sec_context will (hopefully) tell us that. * gss_accept_sec_context() will (hopefully) tell us that.
* If that failes, * If that failes,
*/ */
@@ -674,6 +674,8 @@ acceptor_start
goto out; goto out;
first_ok = 1; first_ok = 1;
} else {
gss_mg_collect_error(preferred_mech_type, ret, *minor_status);
} }
} }
@@ -879,6 +881,7 @@ acceptor_continue
} }
if (ret != GSS_S_COMPLETE && ret != GSS_S_CONTINUE_NEEDED) { if (ret != GSS_S_COMPLETE && ret != GSS_S_CONTINUE_NEEDED) {
free_NegotiationToken(&nt); free_NegotiationToken(&nt);
gss_mg_collect_error(ctx->negotiated_mech_type, ret, minor);
send_reject (minor_status, output_token); send_reject (minor_status, output_token);
HEIMDAL_MUTEX_unlock(&ctx->ctx_id_mutex); HEIMDAL_MUTEX_unlock(&ctx->ctx_id_mutex);
return ret; return ret;

View File

@@ -263,18 +263,6 @@ OM_uint32 _gss_spnego_unwrap
qop_state); qop_state);
} }
OM_uint32 _gss_spnego_display_status
(OM_uint32 * minor_status,
OM_uint32 status_value,
int status_type,
const gss_OID mech_type,
OM_uint32 * message_context,
gss_buffer_t status_string
)
{
return GSS_S_FAILURE;
}
OM_uint32 _gss_spnego_compare_name OM_uint32 _gss_spnego_compare_name
(OM_uint32 *minor_status, (OM_uint32 *minor_status,
const gss_name_t name1, const gss_name_t name1,

View File

@@ -57,7 +57,7 @@ static gssapi_mech_interface_desc spnego_mech = {
_gss_spnego_verify_mic, _gss_spnego_verify_mic,
_gss_spnego_wrap, _gss_spnego_wrap,
_gss_spnego_unwrap, _gss_spnego_unwrap,
_gss_spnego_display_status, NULL,
NULL, NULL,
_gss_spnego_compare_name, _gss_spnego_compare_name,
_gss_spnego_display_name, _gss_spnego_display_name,

View File

@@ -59,8 +59,10 @@ initiator_approved(gss_name_t target_name, gss_OID mech)
&out, &out,
NULL, NULL,
NULL); NULL);
if (GSS_ERROR(maj_stat)) if (GSS_ERROR(maj_stat)) {
gss_mg_collect_error(mech, maj_stat, min_stat);
return GSS_S_BAD_MECH; return GSS_S_BAD_MECH;
}
gss_release_buffer(&min_stat, &out); gss_release_buffer(&min_stat, &out);
gss_delete_sec_context(&min_stat, &ctx, NULL); gss_delete_sec_context(&min_stat, &ctx, NULL);
@@ -268,6 +270,7 @@ spnego_initial
if (GSS_ERROR(sub)) { if (GSS_ERROR(sub)) {
free_NegTokenInit(&ni); free_NegTokenInit(&ni);
*minor_status = minor; *minor_status = minor;
gss_mg_collect_error(ctx->preferred_mech_type, sub, minor);
_gss_spnego_internal_delete_sec_context(&minor, &context, GSS_C_NO_BUFFER); _gss_spnego_internal_delete_sec_context(&minor, &context, GSS_C_NO_BUFFER);
return sub; return sub;
} }
@@ -516,6 +519,7 @@ spnego_reply
if (GSS_ERROR(ret)) { if (GSS_ERROR(ret)) {
HEIMDAL_MUTEX_unlock(&ctx->ctx_id_mutex); HEIMDAL_MUTEX_unlock(&ctx->ctx_id_mutex);
free_NegTokenResp(&resp); free_NegTokenResp(&resp);
gss_mg_collect_error(&mech, ret, minor);
*minor_status = minor; *minor_status = minor;
return ret; return ret;
} }