+2004-06-02 Ken Raeburn <raeburn@mit.edu>
+
+ * srv_rcache.c (krb5_get_server_rcache): Use krb5_rc_resolve_full
+ instead of constructing an rcache object locally.
+
2004-05-25 Ezra Peisach <epeisach@mit.edu>
* conv_creds.c (krb5int_encode_v4tkt): Unsigned vs signed warning fix.
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;
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++) {
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++] = '-';
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.