2 Copyright (C) 1989 by the Massachusetts Institute of Technology
4 Export of this software from the United States of America is assumed
5 to require a specific license from the United States Government.
6 It is the responsibility of any person or organization contemplating
7 export to obtain such a license before exporting.
9 WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
10 distribute this software and its documentation for any purpose and
11 without fee is hereby granted, provided that the above copyright
12 notice appear in all copies and that both that copyright notice and
13 this permission notice appear in supporting documentation, and that
14 the name of M.I.T. not be used in advertising or publicity pertaining
15 to distribution of the software without specific, written prior
16 permission. M.I.T. makes no representations about the suitability of
17 this software for any purpose. It is provided "as is" without express
23 * This is where a cache would be implemented, if it were necessary.
28 RCSID("$Id: krb_cache.c,v 1.7 1998/06/09 19:25:14 joda Exp $");
32 extern long kerb_debug;
37 * initialization routine for cache
48 * look up a principal in the cache returns number of principals found
52 kerb_cache_get_principal(char *serv, /* could have wild card */
53 char *inst, /* could have wild card */
55 unsigned int max) /* max number of name structs to return */
63 fprintf(stderr, "cache_get_principal for %s %s max = %d\n",
70 fprintf(stderr, "cache get %s %s found %s %s sid = %d\n",
71 serv, inst, principal->name, principal->instance);
73 fprintf(stderr, "cache %s %s not found\n", serv,
82 * insert/replace a principal in the cache returns number of principals
87 kerb_cache_put_principal(Principal *principal,
89 /* max number of principal structs to
100 fprintf(stderr, "kerb_cache_put_principal max = %d",
105 for (i = 0; i < max; i++) {
108 fprintf(stderr, "\n %s %s",
109 principal->name, principal->instance);
119 * look up a dba in the cache returns number of dbas found
123 kerb_cache_get_dba(char *serv, /* could have wild card */
124 char *inst, /* could have wild card */
126 unsigned int max) /* max number of name structs to return */
135 fprintf(stderr, "cache_get_dba for %s %s max = %d\n",
140 if (kerb_debug & 2) {
142 fprintf(stderr, "cache get %s %s found %s %s sid = %d\n",
143 serv, inst, dba->name, dba->instance);
145 fprintf(stderr, "cache %s %s not found\n", serv, inst);
153 * insert/replace a dba in the cache returns number of dbas inserted
157 kerb_cache_put_dba(Dba *dba,
159 /* max number of dba structs to insert */
167 if (kerb_debug & 2) {
168 fprintf(stderr, "kerb_cache_put_dba max = %d", max);
171 for (i = 0; i < max; i++) {
174 fprintf(stderr, "\n %s %s",
175 dba->name, dba->instance);