]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] add ACL_TEST_F_NULL_MATCH
authorKrzysztof Piotr Oledzki <ole@ans.pl>
Fri, 29 Jan 2010 16:55:53 +0000 (17:55 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 31 Jan 2010 18:14:07 +0000 (19:14 +0100)
Add ACL_TEST_F_NULL_MATCH so expr->kw->match can be called
even if expr->patterns is empty.

include/types/acl.h
src/acl.c

index aff330ea691773adcc0a273b587dc5d35220a6f3..fad3761054b2c2383aeb2bfbf2b96d8ea3d5cf52 100644 (file)
@@ -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 */
index 08aac69f5f2abde68c2ed6b1c4c83f9777577d52..eb75b0ee62036bc0f8706e628f9476d289039122 100644 (file)
--- 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