From 7fd7d7274639da4c78790ebb9b737213d2109703 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Wed, 2 Jun 2004 22:29:18 +0000 Subject: [PATCH] * srv_rcache.c (krb5_get_server_rcache): Use krb5_rc_resolve_full instead of constructing an rcache object locally. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16387 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/krb/ChangeLog | 5 +++++ src/lib/krb5/krb/srv_rcache.c | 21 ++++++++------------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/lib/krb5/krb/ChangeLog b/src/lib/krb5/krb/ChangeLog index f51b665ef..9b360d777 100644 --- a/src/lib/krb5/krb/ChangeLog +++ b/src/lib/krb5/krb/ChangeLog @@ -1,3 +1,8 @@ +2004-06-02 Ken Raeburn + + * srv_rcache.c (krb5_get_server_rcache): Use krb5_rc_resolve_full + instead of constructing an rcache object locally. + 2004-05-25 Ezra Peisach * conv_creds.c (krb5int_encode_v4tkt): Unsigned vs signed warning fix. diff --git a/src/lib/krb5/krb/srv_rcache.c b/src/lib/krb5/krb/srv_rcache.c index e66d2d366..99e965563 100644 --- a/src/lib/krb5/krb/srv_rcache.c +++ b/src/lib/krb5/krb/srv_rcache.c @@ -37,7 +37,7 @@ krb5_error_code KRB5_CALLCONV krb5_get_server_rcache(krb5_context context, const krb5_data *piece, krb5_rcache *rcptr) { krb5_rcache rcache = 0; - char *cachename = 0; + char *cachename = 0, *cachetype; char tmp[4]; krb5_error_code retval; int p, i; @@ -51,13 +51,7 @@ krb5_get_server_rcache(krb5_context context, const krb5_data *piece, krb5_rcache if (piece == NULL) return ENOMEM; - rcache = (krb5_rcache) malloc(sizeof(*rcache)); - if (!rcache) - return ENOMEM; - - retval = krb5_rc_resolve_type(context, &rcache, - krb5_rc_default_type(context)); - if (retval) goto cleanup; + cachetype = krb5_rc_default_type(context); len = piece->length + 3 + 1; for (i = 0; i < piece->length; i++) { @@ -73,13 +67,13 @@ krb5_get_server_rcache(krb5_context context, const krb5_data *piece, krb5_rcache len++; #endif - cachename = malloc(len); + cachename = malloc(strlen(cachetype) + 5 + len); if (!cachename) { retval = ENOMEM; goto cleanup; } - strcpy(cachename, "rc_"); - p = 3; + + p = strlen(cachename); for (i = 0; i < piece->length; i++) { if (piece->data[i] == '-') { cachename[p++] = '-'; @@ -107,9 +101,10 @@ krb5_get_server_rcache(krb5_context context, const krb5_data *piece, krb5_rcache cachename[p++] = '\0'; - if ((retval = krb5_rc_resolve(context, rcache, cachename))) + retval = krb5_rc_resolve_full(context, &rcache, cachename); + if (retval) goto cleanup; - + /* * First try to recover the replay cache; if that doesn't work, * initialize it. -- 2.26.2