From: Willy Tarreau Date: Sun, 6 May 2007 22:53:22 +0000 (+0200) Subject: [MEDIUM] add the 'acl' keyword to the config language X-Git-Tag: v1.3.10~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eb0c614f0e3ecaaf8f58a2a5fe1c9cc230676a05;p=thirdparty%2Fhaproxy.git [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 e446ed9e11..6a96f94b9c 100644 --- a/include/types/proxy.h +++ b/include/types/proxy.h @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -82,6 +83,7 @@ struct proxy { 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 c5d17440f5..c4c6c8c273 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -33,6 +33,7 @@ #include #include +#include #include #include #include @@ -492,6 +493,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args) 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 @@ int cfg_parse_listen(const char *file, int linenum, char **args) 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) {