rc_mem.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
*
* This file of the Kerberos V5 software is derived from public-domain code
* contributed by Daniel J. Bernstein, <brnstnd@acf10.nyu.edu>.
*/
/*
* An implementation for the memory only (mem) replay cache type.
*/
#include "rc_common.h"
#include "rc_mem.h"
/*
* of course, list is backwards
* hash could be forwards since we have to search on match, but naaaah
*/
static int
{
int rephash;
/* Solaris: calling krb_timeofday() here, once for better perf. */
/*
* Solaris: calling alive() on rep since it doesn't make sense to store
* an expired replay.
*/
return (CMP_EXPIRED);
case CMP_REPLAY:
return (CMP_REPLAY);
case CMP_HOHUM:
== CMP_EXPIRED) {
if (pta) {
} else {
}
continue;
}
}
}
return (CMP_MALLOC);
return (CMP_MALLOC);
}
return (CMP_MALLOC);
}
return (CMP_HOHUM);
}
/*ARGSUSED*/
char *KRB5_CALLCONV
{
}
/*ARGSUSED*/
{
return (0);
}
{
/* default to clockskew from the context */
return (0);
}
{
int i;
if (t->name)
for (i = 0; i < t->hsize; i++)
for (q = t->h[i]; q; q = qt) {
free(q);
}
if (t->h)
free(t->h);
free(t);
return (0);
}
{
return (0);
}
{
}
/*ARGSUSED*/
{
struct mem_data *t = 0;
/* allocate id? no */
return (KRB5_RC_MALLOC);
if (name) {
if (!t->name) {
goto cleanup;
}
} else
t->name = 0;
if (!t->h) {
goto cleanup;
}
return (0);
if (t) {
if (t->name)
krb5_xfree(t->name);
if (t->h)
krb5_xfree(t->h);
krb5_xfree(t);
}
return (retval);
}
{
return (KRB5_RC_NOIO);
}
{
case CMP_MALLOC:
return (KRB5_RC_MALLOC);
case CMP_REPLAY:
return (KRB5KRB_AP_ERR_REPEAT);
case CMP_EXPIRED:
return (KRB5KRB_AP_ERR_SKEW);
case CMP_HOHUM:
break;
}
return (0);
}