]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
viced: Force valid host enumeration flags
authorAndrew Deason <adeason@sinenomine.net>
Sat, 23 Apr 2011 21:32:10 +0000 (16:32 -0500)
committerDerrick Brashear <shadow@dementia.org>
Tue, 3 May 2011 02:17:44 +0000 (19:17 -0700)
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 <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 484b5b4cf4f88a9ddd04cdbe870d9c2959ef266c)

Change-Id: Ia1b7537d7988203bd8c0bbc619c04f5b3f9387a1
Reviewed-on: http://gerrit.openafs.org/4532
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
src/viced/host.c

index c41d896b78dd7b7502399337dfdef1fc6898d89b..92baaa4c71beee4084b4cb06207237668a1336a3 100644 (file)
@@ -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 */