heimdal-discuss  

Re: gsskrb5_accept_delegated_token leaks a ccache

Love Hörnquist Åstrand
Wed, 07 Feb 2007 15:54:59 -0800

Doesn't the ccache = NULL in gsskrb5_accept_delegated_token prevent "id"
from being closed?

180 (*delegated_cred_handle)->cred_flags |= GSS_CF_DESTROY_CRED_ON_RELEASE;
181         ccache = NULL;
            ^^^^^^^^^^^^^^
182     }
183
184 out:
185     if (ccache) {
186         if (delegated_cred_handle == NULL)
187             krb5_cc_close(gssapi_krb5_context, ccache);
188         else
189             krb5_cc_destroy(gssapi_krb5_context, ccache);

Ah, you are running a diffrent version of what I'm using. Try apply
1.64 delta of that file, it will probably make you more happy.

Love

----------------------------
revision 1.64
date: 2006/10/25 04:19:45;  author: lha;  state: Exp;  lines: +2 -1
(gsskrb5_accept_delegated_token): need to free ccache
----------------------------

--- heimdal/lib/gssapi/krb5/accept_sec_context.c 7 Oct 2006 22:13:53 -0000 1.63 +++ heimdal/lib/gssapi/krb5/accept_sec_context.c 25 Oct 2006 04:19:45 -0000 1.64
@@ -181,6 +181,7 @@ gsskrb5_accept_delegated_token
        handle = (gsskrb5_cred) *delegated_cred_handle;

        handle->cred_flags |= GSS_CF_DESTROY_CRED_ON_RELEASE;
+       krb5_cc_close(_gsskrb5_context, ccache);
        ccache = NULL;
     }