2 * keys.c Key management for nfsd. Currently, keys
3 * are kept in a single file only, but eventually,
4 * support for a key server should be added.
6 * Copyright (C) 1995 Olaf Kirch <okir@monad.swb.de>
17 struct keycache * k_next;
18 struct nfskeyent k_data;
21 static struct keycache * keycache = NULL;
22 static time_t lastmod = 0;
24 static void key_reload(void);
28 key_lookup(char *hname)
34 for (kc = keycache; kc; kc = kc->k_next) {
36 if (matchhostname(kc->k_data.k_hostname, hname))
38 if (!strcmp(kc->k_data.k_hostname, hname))
40 return &kc->k_data.k_key;
53 if (stat(_PATH_NFSKEYS, &stb) >= 0 && stb.st_mtime == lastmod)
57 cp = keycache->k_next;
62 setnfskeyent(_PATH_NFSKEYS);
63 while ((kp = getnfskeyent()) != NULL) {
64 cp = (struct keycache *) xmalloc(sizeof(*cp));
66 cp->k_next = keycache;
71 lastmod = stb.st_mtime;