condense common code into function
authorJohn Kohl <jtkohl@mit.edu>
Tue, 5 Mar 1991 17:40:14 +0000 (17:40 +0000)
committerJohn Kohl <jtkohl@mit.edu>
Tue, 5 Mar 1991 17:40:14 +0000 (17:40 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1861 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/krb/rd_req_sim.c

index 2c964e8ba75178b051260f4eb68672ccf786cdbd..e8a6c35009bbebc52d00e96de318dcb22860c5a7 100644 (file)
@@ -60,33 +60,13 @@ krb5_tkt_authent **authdat;
            return(retval);
        }
     }
-    if (rcache = (krb5_rcache) malloc(sizeof(*rcache))) {
-       if (!(retval = krb5_rc_resolve_type(&rcache, "dfl"))) {
-           char *cachename;
-           extern krb5_deltat krb5_clockskew;
-
-           if (cachename = malloc(server[1]->length+1+3)) {
-               strcpy(cachename, "rc_");
-               strncat(cachename, server[1]->data, server[1]->length);
-               cachename[server[1]->length+3] = '\0';
-
-               if (!(retval = krb5_rc_resolve(rcache, cachename))) {
-                   if (!((retval = krb5_rc_recover(rcache)) &&
-                         (retval = krb5_rc_initialize(rcache,
-                                                      krb5_clockskew)))) {
-                       retval = krb5_rd_req_decoded(request, server,
-                                                    sender_addr, 0,
-                                                    0, 0, rcache, authdat);
-                       krb5_rc_close(rcache);
-                   }
-               }
-               free(cachename);
-           } else
-               retval = ENOMEM;
-       }
+    if (!(retval = krb5_get_server_rcache(server[1]->data, &rcache))) {
+       retval = krb5_rd_req_decoded(request, server,
+                                    sender_addr, 0,
+                                    0, 0, rcache, authdat);
+       krb5_rc_close(rcache);
        xfree(rcache);
-    } else
-       retval = ENOMEM;
+    }
     krb5_free_ap_req(request);
 
     return retval;