From: Theodore Tso Date: Fri, 10 Jun 1994 22:32:09 +0000 (+0000) Subject: Fix bugs I introduced into srv_rcache. The rcache name wasn't being X-Git-Tag: krb5-1.0-beta4~117 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c6d421668433407a75ad8602e6a312686179bcec;p=krb5.git Fix bugs I introduced into srv_rcache. The rcache name wasn't being formed correctly (not adding rc_ at the beginning) and we weren't trying krb5_rc_recover() before trying krb5_rc_initialize(). git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@3736 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/krb/srv_rcache.c b/src/lib/krb5/krb/srv_rcache.c index c04e6249b..7edd1f62c 100644 --- a/src/lib/krb5/krb/srv_rcache.c +++ b/src/lib/krb5/krb/srv_rcache.c @@ -64,8 +64,9 @@ krb5_rcache *rcptr; retval = ENOMEM; goto cleanup; } + strcpy(cachename, "rc_"); p = 3; - for (i = 0; i <= piece->length; i++) { + for (i = 0; i < piece->length; i++) { if (piece->data[i] == '\\') { cachename[p++] = '\\'; cachename[p++] = '\\'; @@ -83,11 +84,17 @@ krb5_rcache *rcptr; if (retval = krb5_rc_resolve(rcache, cachename)) goto cleanup; - - if (retval = krb5_rc_initialize(rcache, krb5_clockskew)) { - krb5_rc_close(rcache); - rcache = 0; - goto cleanup; + + /* + * First try to recover the replay cache; if that doesn't work, + * initialize it. + */ + if (krb5_rc_recover(rcache)) { + if (retval = krb5_rc_initialize(rcache, krb5_clockskew)) { + krb5_rc_close(rcache); + rcache = 0; + goto cleanup; + } } *rcptr = rcache;