From 096f00e1426533d92fd75865baf7b3cd34ed6458 Mon Sep 17 00:00:00 2001 From: Tom Yu Date: Fri, 20 Feb 1998 00:06:11 +0000 Subject: [PATCH] * 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 --- src/lib/krb5/krb/ChangeLog | 6 ++++++ src/lib/krb5/krb/recvauth.c | 13 ++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) 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; } -- 2.26.2