[29547] in CVS-changelog-for-Kerberos-V5

home help back first fref pref prev next nref lref last post

krb5 commit: Fix leaks on error in krb5 gss_acquire_cred()

daemon@ATHENA.MIT.EDU (Greg Hudson)
Wed Aug 10 13:53:58 2016

Date: Wed, 10 Aug 2016 13:51:35 -0400
From: Greg Hudson <ghudson@mit.edu>
Message-Id: <201608101751.u7AHpZPT009322@drugstore.mit.edu>
To: cvs-krb5@mit.edu
Reply-To: krbdev@mit.edu
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu

https://github.com/krb5/krb5/commit/ee7315964e52fe351ddb6884e0e8baf1ecce2144
commit ee7315964e52fe351ddb6884e0e8baf1ecce2144
Author: Greg Hudson <ghudson@mit.edu>
Date:   Mon Jun 27 17:49:57 2016 -0400

    Fix leaks on error in krb5 gss_acquire_cred()
    
    In acquire_cred_context(), when releasing the partially constructed
    cred on error, make sure to free the password and impersonator fields,
    and to destroy the ccache if we created it.
    
    ticket: 8437 (new)
    target_version: 1.14-next
    target_version: 1.13-next
    tags: pullup

 src/lib/gssapi/krb5/acquire_cred.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/lib/gssapi/krb5/acquire_cred.c b/src/lib/gssapi/krb5/acquire_cred.c
index 2247c49..03ee25e 100644
--- a/src/lib/gssapi/krb5/acquire_cred.c
+++ b/src/lib/gssapi/krb5/acquire_cred.c
@@ -864,8 +864,12 @@ krb_error_out:
 
 error_out:
     if (cred != NULL) {
-        if (cred->ccache)
-            krb5_cc_close(context, cred->ccache);
+        if (cred->ccache) {
+            if (cred->destroy_ccache)
+                krb5_cc_destroy(context, cred->ccache);
+            else
+                krb5_cc_close(context, cred->ccache);
+        }
         if (cred->client_keytab)
             krb5_kt_close(context, cred->client_keytab);
 #ifndef LEAN_CLIENT
@@ -876,6 +880,8 @@ error_out:
             krb5_rc_close(context, cred->rcache);
         if (cred->name)
             kg_release_name(context, &cred->name);
+        krb5_free_principal(context, cred->impersonator);
+        zapfreestr(cred->password);
         k5_mutex_destroy(&cred->lock);
         xfree(cred);
     }
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5

home help back first fref pref prev next nref lref last post