From: Andrew Deason Date: Sat, 23 Apr 2011 21:32:10 +0000 (-0500) Subject: viced: Force valid host enumeration flags X-Git-Tag: upstream/1.6.0.pre5^2~13 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=a62adf29e05dc52debd7bd5ed065ee40893921b8;p=packages%2Fo%2Fopenafs.git 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. Reviewed-on: http://gerrit.openafs.org/4528 Tested-by: BuildBot Reviewed-by: Derrick Brashear (cherry picked from commit 484b5b4cf4f88a9ddd04cdbe870d9c2959ef266c) Change-Id: Ia1b7537d7988203bd8c0bbc619c04f5b3f9387a1 Reviewed-on: http://gerrit.openafs.org/4532 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- diff --git a/src/viced/host.c b/src/viced/host.c index c41d896b7..92baaa4c7 100644 --- a/src/viced/host.c +++ b/src/viced/host.c @@ -1011,8 +1011,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 */ @@ -1095,6 +1099,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 */