From: Krzysztof Piotr Oledzki Date: Fri, 29 Jan 2010 16:55:53 +0000 (+0100) Subject: [MINOR] add ACL_TEST_F_NULL_MATCH X-Git-Tag: v1.4-rc1~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d7528e5a60014843854fe671f8fcaac9b30592c9;p=thirdparty%2Fhaproxy.git [MINOR] add ACL_TEST_F_NULL_MATCH Add ACL_TEST_F_NULL_MATCH so expr->kw->match can be called even if expr->patterns is empty. --- diff --git a/include/types/acl.h b/include/types/acl.h index aff330ea69..fad3761054 100644 --- a/include/types/acl.h +++ b/include/types/acl.h @@ -84,6 +84,7 @@ enum { ACL_TEST_F_RES_PASS = 1 << 10,/* with SET_RESULT, sets result to PASS (defaults to FAIL) */ ACL_TEST_F_SET_RES_PASS = (ACL_TEST_F_RES_SET|ACL_TEST_F_RES_PASS), /* sets result to PASS */ ACL_TEST_F_SET_RES_FAIL = (ACL_TEST_F_RES_SET), /* sets result to FAIL */ + ACL_TEST_F_NULL_MATCH = 1 << 11,/* call expr->kw->match with NULL pattern if expr->patterns is empty */ }; /* ACLs can be evaluated on requests and on responses, and on partial or complete data */ diff --git a/src/acl.c b/src/acl.c index 08aac69f5f..eb75b0ee62 100644 --- a/src/acl.c +++ b/src/acl.c @@ -1087,6 +1087,9 @@ int acl_exec_cond(struct acl_cond *cond, struct proxy *px, struct session *l4, v if (acl_res == ACL_PAT_PASS) break; } + + if ((test.flags & ACL_TEST_F_NULL_MATCH) && LIST_ISEMPTY(&expr->patterns)) + acl_res |= expr->kw->match(&test, NULL); } /* * OK now acl_res holds the result of this expression