From: Tom Yu Date: Fri, 20 Feb 1998 00:06:11 +0000 (+0000) Subject: * recvauth.c (krb5_recvauth): Add some bookkeeping flags so we X-Git-Tag: krb5-1.1-beta1~808 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=096f00e1426533d92fd75865baf7b3cd34ed6458;p=krb5.git * recvauth.c (krb5_recvauth): Add some bookkeeping flags so we know how much stuff to free upon cleanup. Fix the up cleanup code. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10465 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/krb/ChangeLog b/src/lib/krb5/krb/ChangeLog index a4053da26..48278958e 100644 --- a/src/lib/krb5/krb/ChangeLog +++ b/src/lib/krb5/krb/ChangeLog @@ -1,3 +1,9 @@ +Thu Feb 19 19:03:20 1998 Tom Yu + + * recvauth.c (krb5_recvauth): Add some bookkeeping flags so we + know how much stuff to free upon cleanup. Fix the up cleanup + code. + Wed Feb 18 16:24:02 1998 Tom Yu * Makefile.in: Remove trailing slash from thisconfigdir. Fix up diff --git a/src/lib/krb5/krb/recvauth.c b/src/lib/krb5/krb/recvauth.c index 5bde73aa4..8ee99fbb1 100644 --- a/src/lib/krb5/krb/recvauth.c +++ b/src/lib/krb5/krb/recvauth.c @@ -58,6 +58,7 @@ krb5_recvauth(context, auth_context, krb5_octet response; krb5_data null_server; int need_error_free = 0; + int local_rcache = 0, local_authcon = 0; /* * Zero out problem variable. If problem is set at the end of @@ -141,8 +142,10 @@ krb5_recvauth(context, auth_context, if (*auth_context == NULL) { problem = krb5_auth_con_init(context, &new_auth_context); *auth_context = new_auth_context; + local_authcon = 1; } - if ((!problem) && ((*auth_context)->rcache == NULL)) { + krb5_auth_con_getrcache(context, *auth_context, &rcache); + if ((!problem) && rcache == NULL) { /* * Setup the replay cache. */ @@ -156,6 +159,7 @@ krb5_recvauth(context, auth_context, } if (!problem) problem = krb5_auth_con_setrcache(context, *auth_context, rcache); + local_rcache = 1; } if (!problem) { problem = krb5_rd_req(context, auth_context, &inbuf, server, @@ -227,9 +231,12 @@ krb5_recvauth(context, auth_context, cleanup:; if (retval) { - if (rcache) + if (local_authcon) { + krb5_auth_con_free(context, *auth_context); + } else if (local_rcache && rcache != NULL) { krb5_rc_close(context, rcache); - krb5_auth_con_free(context, *auth_context); + krb5_auth_con_setrcache(context, *auth_context, NULL); + } } return retval; }