From 4e3035c6f811535a53054f6bf14c1c4e84bea2ea Mon Sep 17 00:00:00 2001 From: John Kohl Date: Tue, 5 Mar 1991 17:40:14 +0000 Subject: [PATCH] condense common code into function git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1861 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/krb/rd_req_sim.c | 32 ++++++-------------------------- 1 file changed, 6 insertions(+), 26 deletions(-) diff --git a/src/lib/krb5/krb/rd_req_sim.c b/src/lib/krb5/krb/rd_req_sim.c index 2c964e8ba..e8a6c3500 100644 --- a/src/lib/krb5/krb/rd_req_sim.c +++ b/src/lib/krb5/krb/rd_req_sim.c @@ -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; -- 2.26.2