Fix bugs I introduced into srv_rcache. The rcache name wasn't being
authorTheodore Tso <tytso@mit.edu>
Fri, 10 Jun 1994 22:32:09 +0000 (22:32 +0000)
committerTheodore Tso <tytso@mit.edu>
Fri, 10 Jun 1994 22:32:09 +0000 (22:32 +0000)
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

src/lib/krb5/krb/srv_rcache.c

index c04e6249baf078dc57da911068ef0d7387b83cce..7edd1f62c33f2771cfd893f41fa6f7f3a9c8f853 100644 (file)
@@ -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;