[MEDIUM] add the 'acl' keyword to the config language
The 'acl' keyword allows one to declare a new ACL. It is an important part
of the ACL framework.
diff --git a/include/types/proxy.h b/include/types/proxy.h
index e446ed9..6a96f94 100644
--- a/include/types/proxy.h
+++ b/include/types/proxy.h
@@ -34,6 +34,7 @@
#include <common/regex.h>
#include <common/tools.h>
+#include <types/acl.h>
#include <types/buffers.h>
#include <types/httperr.h>
#include <types/session.h>
@@ -82,6 +83,7 @@
struct proxy *be; /* default backend, or NULL if none set */
char *name; /* default backend name during config parse */
} defbe;
+ struct list acl; /* ACL declared on this proxy */
struct server *srv; /* known servers */
int srv_act, srv_bck; /* # of running servers */
int tot_wact, tot_wbck; /* total weights of active and backup servers */
diff --git a/src/cfgparse.c b/src/cfgparse.c
index c5d1744..c4c6c8c 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -33,6 +33,7 @@
#include <types/proxy.h>
#include <types/queue.h>
+#include <proto/acl.h>
#include <proto/backend.h>
#include <proto/buffers.h>
#include <proto/checks.h>
@@ -492,6 +493,7 @@
curproxy->next = proxy;
proxy = curproxy;
LIST_INIT(&curproxy->pendconns);
+ LIST_INIT(&curproxy->acl);
curproxy->id = strdup(args[1]);
curproxy->cap = rc;
@@ -667,6 +669,13 @@
else if (!strcmp(args[0], "enabled")) { /* enables this proxy (used to revert a disabled default) */
curproxy->state = PR_STNEW;
}
+ else if (!strcmp(args[0], "acl")) { /* add an ACL */
+ if (parse_acl((const char **)args + 1, &curproxy->acl) == NULL) {
+ Alert("parsing [%s:%d] : error detected while parsing ACL '%s'.\n",
+ file, linenum, args[1]);
+ return -1;
+ }
+ }
else if (!strcmp(args[0], "cookie")) { /* cookie name */
int cur_arg;
// if (curproxy == &defproxy) {