From: Greg Hudson Date: Fri, 22 Jul 2011 16:56:36 +0000 (+0000) Subject: Fix gss_set_cred_option cred creation with no name X-Git-Tag: krb5-1.10-alpha1~338 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=bd18687a705a8a6cdcb7c140764d1a7c6a3381b5;p=krb5.git Fix gss_set_cred_option cred creation with no name When creating a cred in the mechglue with gss_acquire_cred, the mechanism is allowed to return no name from gss_inquire_cred. But in the analagous operation in gss_set_cred_option, that would result in an error from gss_display_name. Make the call to gss_display_name conditional on the mechanism name being set. Reported by Andrew Bartlett. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25037 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/gssapi/mechglue/g_set_cred_option.c b/src/lib/gssapi/mechglue/g_set_cred_option.c index 897c84fe0..b530b1e05 100644 --- a/src/lib/gssapi/mechglue/g_set_cred_option.c +++ b/src/lib/gssapi/mechglue/g_set_cred_option.c @@ -85,12 +85,14 @@ alloc_union_cred(OM_uint32 *minor_status, if (status != GSS_S_COMPLETE) goto cleanup; - status = mech->gss_display_name(minor_status, - mech_name, - &cred->auxinfo.name, - &cred->auxinfo.name_type); - if (status != GSS_S_COMPLETE) - goto cleanup; + if (mech_name != GSS_C_NO_NAME) { + status = mech->gss_display_name(minor_status, + mech_name, + &cred->auxinfo.name, + &cred->auxinfo.name_type); + if (status != GSS_S_COMPLETE) + goto cleanup; + } status = GSS_S_COMPLETE; *pcred = cred;