From: John Kohl Date: Tue, 5 Mar 1991 17:39:24 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: krb5-1.0-alpha4~113 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=67826e1afc51731a8b83d4d3f2ad4f3c2ef7c77c;p=krb5.git *** empty log message *** git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1859 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/krb/srv_rcache.c b/src/lib/krb5/krb/srv_rcache.c new file mode 100644 index 000000000..0faa07f3b --- /dev/null +++ b/src/lib/krb5/krb/srv_rcache.c @@ -0,0 +1,56 @@ +/* + * $Source$ + * $Author$ + * + * Copyright 1991 by the Massachusetts Institute of Technology. + * All Rights Reserved. + * + * For copying and distribution information, please see the file + * . + * + * Allocate & prepare a default replay cache for a server. + */ + +#if !defined(lint) && !defined(SABER) +static char rcsid_srv_rcache_c[] = +"$Id$"; +#endif /* !lint & !SABER */ + +#include +#include + +krb5_error_code +krb5_get_server_rcache(piece, rcptr) +const char *piece; +krb5_rcache *rcptr; +{ + krb5_rcache rcache; + char *cachename; + extern krb5_deltat krb5_clockskew; + krb5_error_code retval; + int len = strlen(piece); + + if (rcache = (krb5_rcache) malloc(sizeof(*rcache))) { + if (!(retval = krb5_rc_resolve_type(&rcache, "dfl"))) { + + if (cachename = malloc(len+1+3)) { + strcpy(cachename, "rc_"); + strcat(cachename, piece); + cachename[len+3] = '\0'; + + if (!(retval = krb5_rc_resolve(rcache, cachename))) { + if (!((retval = krb5_rc_recover(rcache)) && + (retval = krb5_rc_initialize(rcache, + krb5_clockskew)))) { + *rcptr = rcache; + return 0; + } + } + } else + retval = ENOMEM; + } + xfree(rcache); + } else + retval = ENOMEM; + return retval; +}