From 6d3f51c7251979dded2f176393555878c060b764 Mon Sep 17 00:00:00 2001 From: Johan Danielsson Date: Wed, 4 Sep 2002 21:34:43 +0000 Subject: [PATCH] close ccache if we opened it git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@11388 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/krb5/sendauth.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/krb5/sendauth.c b/lib/krb5/sendauth.c index 0a0194f3c..642d4594d 100644 --- a/lib/krb5/sendauth.c +++ b/lib/krb5/sendauth.c @@ -86,6 +86,7 @@ krb5_sendauth(krb5_context context, krb5_principal this_client = NULL; krb5_creds *creds; ssize_t sret; + krb5_boolean my_ccache = FALSE; len = strlen(version) + 1; net_len = htonl(len); @@ -125,12 +126,16 @@ krb5_sendauth(krb5_context context, ret = krb5_cc_default (context, &ccache); if (ret) return ret; + my_ccache = TRUE; } if (client == NULL) { ret = krb5_cc_get_principal (context, ccache, &this_client); - if (ret) + if (ret) { + if(my_ccache) + krb5_cc_close(context, ccache); return ret; + } client = this_client; } memset(&this_cred, 0, sizeof(this_cred)); @@ -142,11 +147,16 @@ krb5_sendauth(krb5_context context, } if (in_creds->ticket.length == 0) { ret = krb5_get_credentials (context, 0, ccache, in_creds, &creds); - if (ret) + if (ret) { + if(my_ccache) + krb5_cc_close(context, ccache); return ret; + } } else { creds = in_creds; } + if(my_ccache) + krb5_cc_close(context, ccache); ret = krb5_mk_req_extended (context, auth_context, ap_req_options,