mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 23:27:04 +02:00
[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.
This commit is contained in:
parent
a84d374367
commit
eb0c614f0e
@ -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 {
|
||||
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 */
|
||||
|
@ -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 @@ 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) {
|
||||
|
Loading…
Reference in New Issue
Block a user