From 74b98a8c22132165eddbd212584410575fde9325 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sat, 16 Jun 2007 19:35:18 +0200 Subject: [PATCH] [BUG] negation in ACL conds was not cleared between terms The exclamation mark (!) in front of an ACL condition was propagated to the whole line instead of being flushed after parsing an acl name. --- src/acl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/acl.c b/src/acl.c index 0cc924833..c4860abdf 100644 --- a/src/acl.c +++ b/src/acl.c @@ -546,8 +546,7 @@ struct acl_cond *prune_acl_cond(struct acl_cond *cond) struct acl_cond *parse_acl_cond(const char **args, struct list *known_acl, int pol) { __label__ out_return, out_free_suite, out_free_term; - int arg; - int neg = 0; + int arg, neg; const char *word; struct acl *cur_acl; struct acl_term *cur_term; @@ -563,6 +562,7 @@ struct acl_cond *parse_acl_cond(const char **args, struct list *known_acl, int p cond->pol = pol; cur_suite = NULL; + neg = 0; for (arg = 0; *args[arg]; arg++) { word = args[arg]; @@ -605,6 +605,7 @@ struct acl_cond *parse_acl_cond(const char **args, struct list *known_acl, int p LIST_ADDQ(&cond->suites, &cur_suite->list); } LIST_ADDQ(&cur_suite->terms, &cur_term->list); + neg = 0; } return cond; @@ -677,7 +678,7 @@ int acl_exec_cond(struct acl_cond *cond, struct proxy *px, struct session *l4, v } } /* - * OK now we have the result of this expression in expr_res. + * OK now we have the result of this expression in acl_res. * - we have the PASS bit set if at least one pattern matched ; * - we have the MISS bit set if at least one pattern may match * later so that we should not cache a failure ;