xref: /titanic_41/usr/src/lib/gss_mechs/mech_krb5/krb5/rcache/rc_common.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1 /*
2  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 #ifndef	_KRB5_RC_COM_H
7 #define	_KRB5_RC_COM_H
8 
9 #pragma ident	"%Z%%M%	%I%	%E% SMI"
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 /*
16  * mech_krb5/krb5/rcache/rc_common.h
17  *
18  * This file of the Kerberos V5 software is derived from public-domain code
19  * contributed by Daniel J. Bernstein, <brnstnd@acf10.nyu.edu>.
20  */
21 
22 #include "rc_base.h"
23 #include "rc_io.h"
24 #include <k5-int.h>
25 
26 /*
27  * Declarations shared for the file and memory replay cache implementation.
28  */
29 
30 #ifndef HASHSIZE
31 #define	HASHSIZE 997 /* a convenient prime */
32 #endif
33 
34 #define	CMP_MALLOC -3
35 #define	CMP_EXPIRED -2
36 #define	CMP_REPLAY -1
37 #define	CMP_HOHUM 0
38 
39 /*
40  * Solaris: made cmp a macro and removed unused t arg to help perf
41  */
42 #define	cmp(old, new) \
43 	(((old)->cusec == (new)->cusec) && \
44 	((old)->ctime == (new)->ctime) && \
45 	(strcmp((old)->client, (new)->client) == 0) && \
46 	(strcmp((old)->server, (new)->server) == 0) ? CMP_REPLAY : CMP_HOHUM)
47 
48 /*
49  * Solaris: made alive a macro and time a arg instead of calling
50  * krb5_timeofday() for better perf.
51  */
52 #define	alive(context, new, t, time) \
53 	(((new)->ctime + (t)) < (time) ? CMP_EXPIRED : CMP_HOHUM)
54 
55 struct authlist {
56 	krb5_donot_replay rep;
57 	struct authlist *na;
58 	struct authlist *nh;
59 };
60 
61 int hash(krb5_donot_replay *rep, int hsize);
62 
63 #ifdef __cplusplus
64 }
65 #endif
66 
67 #endif /* !_KRB5_RC_COM_H */
68