diff options
Diffstat (limited to 'src/lib/krb5/krb/srv_rcache.c')
-rw-r--r-- | src/lib/krb5/krb/srv_rcache.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/lib/krb5/krb/srv_rcache.c b/src/lib/krb5/krb/srv_rcache.c new file mode 100644 index 0000000000..0faa07f3b4 --- /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 + * <krb5/copyright.h>. + * + * 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 <krb5/krb5.h> +#include <krb5/ext-proto.h> + +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; +} |