diff --git a/lib/policy/checker/checker.go b/lib/policy/checker/checker.go index 5c76d97a..31551cd9 100644 --- a/lib/policy/checker/checker.go +++ b/lib/policy/checker/checker.go @@ -20,8 +20,6 @@ type List []Impl // It returns true only if *all* checkers return true (AND semantics). // If any checker returns an error, the function returns false and the error. func (l List) Check(r *http.Request) (bool, error) { - // Assume success until a checker says otherwise. - allOk := true for _, c := range l { ok, err := c.Check(r) if err != nil { @@ -31,11 +29,11 @@ func (l List) Check(r *http.Request) (bool, error) { if !ok { // One false means the combined result is false. Short-circuit // so we don't waste time. - allOk = false - break + return false, err } } - return allOk, nil + // Assume success until a checker says otherwise. + return true, nil } func (l List) Hash() string {