MINOR: acl: add new matches for header/path/url length
This patch introduces hdr_len, path_len and url_len for matching these
respective parts lengths against integers. This can be used to detect
abuse or empty headers.
diff --git a/src/acl.c b/src/acl.c
index 33f00ed..3546ef7 100644
--- a/src/acl.c
+++ b/src/acl.c
@@ -1,7 +1,7 @@
/*
* ACL management functions.
*
- * Copyright 2000-2010 Willy Tarreau <w@1wt.eu>
+ * Copyright 2000-2011 Willy Tarreau <w@1wt.eu>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -650,6 +650,15 @@
return ACL_PAT_FAIL;
}
+/* Checks that the length of the pattern in <test> is included between min and max */
+int acl_match_len(struct acl_test *test, struct acl_pattern *pattern)
+{
+ if ((!pattern->val.range.min_set || pattern->val.range.min <= test->len) &&
+ (!pattern->val.range.max_set || test->len <= pattern->val.range.max))
+ return ACL_PAT_PASS;
+ return ACL_PAT_FAIL;
+}
+
int acl_match_ip(struct acl_test *test, struct acl_pattern *pattern)
{
struct in_addr *s;