From: Greg Hudson Date: Sat, 23 Jul 2011 13:15:09 +0000 (+0000) Subject: Clean up the lock in gss_krb5int_import_cred X-Git-Tag: krb5-1.10-alpha1~335 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b11e3ceee62898638d18abd764b0b2193e593876;p=krb5.git Clean up the lock in gss_krb5int_import_cred git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25040 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/gssapi/krb5/acquire_cred.c b/src/lib/gssapi/krb5/acquire_cred.c index df029cc32..055b3eb4c 100644 --- a/src/lib/gssapi/krb5/acquire_cred.c +++ b/src/lib/gssapi/krb5/acquire_cred.c @@ -845,6 +845,17 @@ gss_krb5int_import_cred(OM_uint32 *minor_status, memset(&args, 0, sizeof(args)); + if (req->id && req->keytab) + args.cred_usage = GSS_C_BOTH; + else if (req->id) + args.cred_usage = GSS_C_INITIATE; + else if (req->keytab) + args.cred_usage = GSS_C_ACCEPT; + else { + *minor_status = EINVAL; + return GSS_S_FAILURE; + } + if (req->keytab_principal) { memset(&name, 0, sizeof(name)); code = k5_mutex_init(&name.lock); @@ -859,17 +870,9 @@ gss_krb5int_import_cred(OM_uint32 *minor_status, args.ccache = req->id; args.keytab = req->keytab; - if (req->id && req->keytab) - args.cred_usage = GSS_C_BOTH; - else if (req->id) - args.cred_usage = GSS_C_INITIATE; - else if (req->keytab) - args.cred_usage = GSS_C_ACCEPT; - else { - *minor_status = EINVAL; - return GSS_S_FAILURE; - } - - return acquire_cred(minor_status, &args, cred_handle, &time_rec); + code = acquire_cred(minor_status, &args, cred_handle, &time_rec); + if (req->keytab_principal) + k5_mutex_destroy(&name.lock); + return code; }