pullup from trunk
authorTom Yu <tlyu@mit.edu>
Thu, 13 Jan 2005 21:55:10 +0000 (21:55 +0000)
committerTom Yu <tlyu@mit.edu>
Thu, 13 Jan 2005 21:55:10 +0000 (21:55 +0000)
ticket: 2872
version_fixed: 1.4

git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-4@17027 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/gssapi/krb5/ChangeLog
src/lib/gssapi/krb5/acquire_cred.c
src/lib/gssapi/krb5/init_sec_context.c

index 3237548d3bdc6f7b589ed8d857e7973207f0a86c..e49be6ba37b802d8ca7e47fc42ac9c9e89f087d8 100644 (file)
@@ -1,3 +1,9 @@
+2005-01-13 Jeffrey Altman <jaltman@mit.edu>
+
+        * 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  <tlyu@mit.edu>
 
        * init_sec_context.c (make_ap_req_v1): Free checksum data
index 12d2cacc0b4595e365706cb16a747b2a406b32c7..56d6a473c88a74baebed557a5c5161e981224718 100644 (file)
@@ -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);
index 3ffb5154d9a8645e86c2fedce38c43585f2dce26..4f4055932d7f3e4ed58bbe367224da9d77bcbb3d 100644 (file)
@@ -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);
 }