From 340cc3f0929ecfeba848b638237d5a25bd96f21f Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Fri, 27 Dec 2019 00:15:13 +1100 Subject: [PATCH] gss: make krb5 default GSS mech earlier in path Defensively default to GSS_KRB5_MECHANISM on all calls to gss_init_sec_context() if mech_type is GSS_C_NO_OID (rather than only on the first call). --- lib/gssapi/mech/gss_init_sec_context.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/gssapi/mech/gss_init_sec_context.c b/lib/gssapi/mech/gss_init_sec_context.c index f18adbde3..0970513f9 100644 --- a/lib/gssapi/mech/gss_init_sec_context.c +++ b/lib/gssapi/mech/gss_init_sec_context.c @@ -173,6 +173,9 @@ gss_init_sec_context(OM_uint32 * minor_status, if (time_rec) *time_rec = 0; + if (mech_type == GSS_C_NO_OID) + mech_type = GSS_KRB5_MECHANISM; + _gss_mg_check_name(target_name); if (_gss_mg_log_level(1)) @@ -186,9 +189,6 @@ gss_init_sec_context(OM_uint32 * minor_status, * sure we use the same mechanism switch as before. */ if (!ctx) { - if (mech_type == NULL) - mech_type = GSS_KRB5_MECHANISM; - ctx = malloc(sizeof(struct _gss_context)); if (!ctx) { *minor_status = ENOMEM;