From 484b5b4cf4f88a9ddd04cdbe870d9c2959ef266c Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Sat, 23 Apr 2011 16:32:10 -0500 Subject: [PATCH] viced: Force valid host enumeration flags Make sure that the callback functions for h_Enumerate and h_Enumerate_r give us back valid flags values by aborting if they return an invalid value. Change-Id: Id34b461d5452ac318a1714b6c3ffdaf41015995c Reviewed-on: http://gerrit.openafs.org/4528 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/viced/host.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/viced/host.c b/src/viced/host.c index 212c6c7..f74de56 100644 --- a/src/viced/host.c +++ b/src/viced/host.c @@ -1000,8 +1000,12 @@ h_Enumerate(int (*proc) (struct host*, void *), void *param) h_Release_r(list[i]); H_UNLOCK; /* bail out of the enumeration early */ - if (H_ENUMERATE_ISSET_BAIL(flags)) + if (H_ENUMERATE_ISSET_BAIL(flags)) { break; + } else if (flags) { + ViceLog(0, ("h_Enumerate got back invalid return value %d\n", flags)); + ShutDownAndCore(PANIC); + } } free((void *)list); } /* h_Enumerate */ @@ -1084,6 +1088,9 @@ h_Enumerate_r(int (*proc) (struct host *, void *), if (H_ENUMERATE_ISSET_BAIL(flags)) { h_Release_r(host); /* this might free up the host */ break; + } else if (flags) { + ViceLog(0, ("h_Enumerate_r got back invalid return value %d\n", flags)); + ShutDownAndCore(PANIC); } } h_Release_r(host); /* this might free up the host */ -- 1.9.4