From: Tom Yu Date: Thu, 13 Jan 2005 21:55:10 +0000 (+0000) Subject: pullup from trunk X-Git-Tag: krb5-1.4.3-beta1~106 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=54744c3b5e1ae88a4436dfa938797f3b6944e226;p=krb5.git pullup from trunk ticket: 2872 version_fixed: 1.4 git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-4@17027 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/gssapi/krb5/ChangeLog b/src/lib/gssapi/krb5/ChangeLog index 3237548d3..e49be6ba3 100644 --- a/src/lib/gssapi/krb5/ChangeLog +++ b/src/lib/gssapi/krb5/ChangeLog @@ -1,3 +1,9 @@ +2005-01-13 Jeffrey Altman + + * init_sec_context.c, acquire_cred.c: fix calls to + krb5_gss_release_cred() to pass in the correct type. + This fixes a mutex leak. + 2004-08-27 Tom Yu * init_sec_context.c (make_ap_req_v1): Free checksum data diff --git a/src/lib/gssapi/krb5/acquire_cred.c b/src/lib/gssapi/krb5/acquire_cred.c index 12d2cacc0..56d6a473c 100644 --- a/src/lib/gssapi/krb5/acquire_cred.c +++ b/src/lib/gssapi/krb5/acquire_cred.c @@ -444,6 +444,7 @@ krb5_gss_acquire_cred(minor_status, desired_name, time_req, if ((cred_usage != GSS_C_INITIATE) && (cred_usage != GSS_C_ACCEPT) && (cred_usage != GSS_C_BOTH)) { + k5_mutex_destroy(&cred->lock); xfree(cred); *minor_status = (OM_uint32) G_BAD_USAGE; krb5_free_context(context); @@ -460,7 +461,8 @@ krb5_gss_acquire_cred(minor_status, desired_name, time_req, != GSS_S_COMPLETE) { if (cred->princ) krb5_free_principal(context, cred->princ); - xfree(cred); + k5_mutex_destroy(&cred->lock); + xfree(cred); /* minor_status set by acquire_accept_cred() */ krb5_free_context(context); return(ret); @@ -481,7 +483,8 @@ krb5_gss_acquire_cred(minor_status, desired_name, time_req, krb5_kt_close(context, cred->keytab); if (cred->princ) krb5_free_principal(context, cred->princ); - xfree(cred); + k5_mutex_destroy(&cred->lock); + xfree(cred); /* minor_status set by acquire_init_cred() */ krb5_free_context(context); return(ret); @@ -496,7 +499,8 @@ krb5_gss_acquire_cred(minor_status, desired_name, time_req, (void)krb5_cc_close(context, cred->ccache); if (cred->keytab) (void)krb5_kt_close(context, cred->keytab); - xfree(cred); + k5_mutex_destroy(&cred->lock); + xfree(cred); *minor_status = code; krb5_free_context(context); return(GSS_S_FAILURE); @@ -519,7 +523,8 @@ krb5_gss_acquire_cred(minor_status, desired_name, time_req, (void)krb5_kt_close(context, cred->keytab); if (cred->princ) krb5_free_principal(context, cred->princ); - xfree(cred); + k5_mutex_destroy(&cred->lock); + xfree(cred); *minor_status = code; krb5_free_context(context); return(GSS_S_FAILURE); @@ -548,6 +553,7 @@ krb5_gss_acquire_cred(minor_status, desired_name, time_req, (void)krb5_kt_close(context, cred->keytab); if (cred->princ) krb5_free_principal(context, cred->princ); + k5_mutex_destroy(&cred->lock); xfree(cred); /* *minor_status set above */ krb5_free_context(context); @@ -566,6 +572,7 @@ krb5_gss_acquire_cred(minor_status, desired_name, time_req, (void)krb5_kt_close(context, cred->keytab); if (cred->princ) krb5_free_principal(context, cred->princ); + k5_mutex_destroy(&cred->lock); xfree(cred); *minor_status = (OM_uint32) G_VALIDATE_FAILED; krb5_free_context(context); diff --git a/src/lib/gssapi/krb5/init_sec_context.c b/src/lib/gssapi/krb5/init_sec_context.c index 3ffb5154d..4f4055932 100644 --- a/src/lib/gssapi/krb5/init_sec_context.c +++ b/src/lib/gssapi/krb5/init_sec_context.c @@ -925,7 +925,7 @@ krb5_gss_init_sec_context(minor_status, claimant_cred_handle, if (err) { k5_mutex_unlock(&cred->lock); if (claimant_cred_handle == GSS_C_NO_CREDENTIAL) - krb5_gss_release_cred(minor_status, (gss_cred_id_t)cred); + krb5_gss_release_cred(minor_status, (gss_cred_id_t)&cred); *minor_status = 0; if (*context_handle == GSS_C_NO_CONTEXT) krb5_free_context(context); @@ -962,7 +962,7 @@ krb5_gss_init_sec_context(minor_status, claimant_cred_handle, } if (claimant_cred_handle == GSS_C_NO_CREDENTIAL) - krb5_gss_release_cred(&tmp_min_stat, (gss_cred_id_t)cred); + krb5_gss_release_cred(&tmp_min_stat, (gss_cred_id_t)&cred); return(major_status); }