mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-12-13 05:30:59 +01:00
BUG/MINOR: acls: Set the right refflag when patterns are loaded from a map
For an ACL, we can load patterns from a map using the flag -M. For example:
acl test hdr(host) -M -f hosts.map
The file is parsed as a map et the ACL will be executed as expected. But the
reference flag is wrong. It is set to PAT_REF_ACL. So the map will never be
listed by a "show map" on the stat socket. Setting the reference flag to
PAT_REF_ACL|PAT_REF_MAP fixes the bug.
This commit is contained in:
parent
a4d0361969
commit
54ceb041d6
@ -140,7 +140,7 @@ struct acl_expr *parse_acl_expr(const char **args, char **err, struct arg_list *
|
|||||||
__label__ out_return, out_free_expr;
|
__label__ out_return, out_free_expr;
|
||||||
struct acl_expr *expr;
|
struct acl_expr *expr;
|
||||||
struct acl_keyword *aclkw;
|
struct acl_keyword *aclkw;
|
||||||
int patflags;
|
int refflags, patflags;
|
||||||
const char *arg;
|
const char *arg;
|
||||||
struct sample_expr *smp = NULL;
|
struct sample_expr *smp = NULL;
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
@ -441,6 +441,7 @@ struct acl_expr *parse_acl_expr(const char **args, char **err, struct arg_list *
|
|||||||
* -u : force the unique id of the acl
|
* -u : force the unique id of the acl
|
||||||
* -- : everything after this is not an option
|
* -- : everything after this is not an option
|
||||||
*/
|
*/
|
||||||
|
refflags = PAT_REF_ACL;
|
||||||
patflags = 0;
|
patflags = 0;
|
||||||
is_loaded = 0;
|
is_loaded = 0;
|
||||||
unique_id = -1;
|
unique_id = -1;
|
||||||
@ -470,7 +471,7 @@ struct acl_expr *parse_acl_expr(const char **args, char **err, struct arg_list *
|
|||||||
goto out_free_expr;
|
goto out_free_expr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pattern_read_from_file(&expr->pat, PAT_REF_ACL, args[1], patflags, load_as_map, err, file, line))
|
if (!pattern_read_from_file(&expr->pat, refflags, args[1], patflags, load_as_map, err, file, line))
|
||||||
goto out_free_expr;
|
goto out_free_expr;
|
||||||
is_loaded = 1;
|
is_loaded = 1;
|
||||||
args++;
|
args++;
|
||||||
@ -503,6 +504,7 @@ struct acl_expr *parse_acl_expr(const char **args, char **err, struct arg_list *
|
|||||||
args++;
|
args++;
|
||||||
}
|
}
|
||||||
else if (strcmp(*args, "-M") == 0) {
|
else if (strcmp(*args, "-M") == 0) {
|
||||||
|
refflags |= PAT_REF_MAP;
|
||||||
load_as_map = 1;
|
load_as_map = 1;
|
||||||
}
|
}
|
||||||
else if (strcmp(*args, "--") == 0) {
|
else if (strcmp(*args, "--") == 0) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user