summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlaf Kirch <okir@suse.de>2008-09-30 14:41:35 -0400
committerSteve Dickson <steved@redhat.com>2008-09-30 14:41:35 -0400
commit3d9f63a9c308b305dfca745dafae63d8f96b313c (patch)
tree5cf24626768c7159532c9c25ae2cad7b290f8b16
parent1d92cd58eb471765eba08ec819f7b5ae1d5e96ab (diff)
downloadrpcbind-3d9f63a9c308b305dfca745dafae63d8f96b313c.tar.gz
Fix for warm start
If you use rpcbind with the warm start functionality, it will load *all* registrations from the warm start files, including those for rpcbind and portmap. This is wrong, as that information may be stale - a user may specifically edit the netconfig file and restart rpcbind to change the transports it supports. In this case we want the registrations to match the status quo, rather than the status before the restart. This patch changes read_warmstart() to merge the existing rpcb/pmap lists, which contain only the rpcbind/portmap entries, with the saved start lists, but ignoring any rpcbind/portmap entries present in the warm start files. Signed-off-by: Olaf Kirch <okir@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
-rw-r--r--src/warmstart.c44
1 files changed, 40 insertions, 4 deletions
diff --git a/src/warmstart.c b/src/warmstart.c
index 91e482b..c78b7de 100644
--- a/src/warmstart.c
+++ b/src/warmstart.c
@@ -161,14 +161,50 @@ read_warmstart()
rc = read_struct(RPCBFILE, (xdrproc_t)xdr_rpcblist_ptr, &tmp_rpcbl);
if (rc == TRUE) {
- xdr_free((xdrproc_t) xdr_rpcblist_ptr, (char *)&list_rbl);
- list_rbl = tmp_rpcbl;
+ rpcblist *pos, **tail;
+
+ /* The current rpcblist contains only the registrations
+ * for rpcbind and portmap. We keep those, since the
+ * info from the warm start file may be stale if the
+ * netconfig file was changed in the meantime.
+ * From the warm start file, we weed out any rpcbind info.
+ */
+ for (tail = &list_rbl; *tail; tail = &(*tail)->rpcb_next)
+ ;
+ while ((pos = tmp_rpcbl) != NULL) {
+ tmp_rpcbl = pos->rpcb_next;
+ if (pos->rpcb_map.r_prog != RPCBPROG) {
+ *tail = pos;
+ tail = &pos->rpcb_next;
+ } else {
+ free(pos);
+ }
+ }
+ *tail = NULL;
}
#ifdef PORTMAP
rc = read_struct(PMAPFILE, (xdrproc_t)xdr_pmaplist_ptr, &tmp_pmapl);
if (rc == TRUE) {
- xdr_free((xdrproc_t) xdr_pmaplist_ptr, (char *)&list_pml);
- list_pml = tmp_pmapl;
+ struct pmaplist *pos, **tail;
+
+ /* The current pmaplist contains only the registrations
+ * for rpcbind and portmap. We keep those, since the
+ * info from the warm start file may be stale if the
+ * netconfig file was changed in the meantime.
+ * From the warm start file, we weed out any rpcbind info.
+ */
+ for (tail = &list_pml; *tail; tail = &(*tail)->pml_next)
+ ;
+ while ((pos = tmp_pmapl) != NULL) {
+ tmp_pmapl = pos->pml_next;
+ if (pos->pml_map.pm_prog != PMAPPROG) {
+ *tail = pos;
+ tail = &pos->pml_next;
+ } else {
+ free(pos);
+ }
+ }
+ *tail = NULL;
}
#endif