]> git.decadent.org.uk Git - nfs-utils.git/blob - utils/statd/callback.c
Use 65534 for anon uid/gid rather than -2
[nfs-utils.git] / utils / statd / callback.c
1 /*
2  * Copyright (C) 1995, 1997-1999 Jeffrey A. Uphoff
3  * Modified by Olaf Kirch, Oct. 1996.
4  * Modified by Lon Hohberger, Oct. 2000.
5  *
6  * NSM for Linux.
7  */
8
9 #ifdef HAVE_CONFIG_H
10 #include <config.h>
11 #endif
12 #include "statd.h"
13 #include "notlist.h"
14
15 /* Callback notify list. */
16 /* notify_list *cbnl = NULL; ... never used */
17
18
19 /* 
20  * Services SM_NOTIFY requests.
21  * Any clients that have asked us to monitor that host are put on
22  * the global callback list, which is processed as soon as statd
23  * returns to svc_run.
24  */
25 void *
26 sm_notify_1_svc(struct stat_chge *argp, struct svc_req *rqstp)
27 {
28         notify_list    *lp, *call;
29         static char    *result = NULL;
30
31         dprintf(N_DEBUG, "Received SM_NOTIFY from %s, state: %d",
32                                 argp->mon_name, argp->state);
33
34         /* quick check - don't bother if we're not monitoring anyone */
35         /* LH - this was != MULL, meaning that if anyone _was_ in our RTNL,
36          * we'd never pass this point. */
37         if (!(lp = rtnl)) {
38                 note(N_WARNING, "SM_NOTIFY from %s while not monitoring any hosts.",
39                                 argp->mon_name, argp->state);
40                 return ((void *) &result);
41         }
42
43         /* okir change: statd doesn't remove the remote host from its
44          * internal monitor list when receiving an SM_NOTIFY call from
45          * it. Lockd will want to continue monitoring the remote host
46          * until it issues an SM_UNMON call.
47          */
48         while ((lp = nlist_gethost(lp, argp->mon_name, 0)) != NULL) {
49                 if (NL_STATE(lp) != argp->state) {
50                         NL_STATE(lp) = argp->state;
51                         call = nlist_clone(lp);
52                         NL_TYPE(call) = NOTIFY_CALLBACK;
53                         nlist_insert(&notify, call);
54                 }
55                 lp = NL_NEXT(lp);
56         }
57
58         return ((void *) &result);
59 }