From 753fe2b9acd3cee5ffd6d9ee8815d6c4face9867 Mon Sep 17 00:00:00 2001 From: Amaury Denoyelle Date: Fri, 29 Sep 2023 16:05:14 +0200 Subject: [PATCH] BUG/MINOR: tcp_act: fix attach-srv rule ACL parsing Fix parser for tcp-request session attach-srv rule. Before this commit, it was impossible to use an anonymous ACL with it. This was caused because support for optional name argument was badly implemented. No need to backport this. --- src/tcp_act.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/src/tcp_act.c b/src/tcp_act.c index 291f704..ff3886a 100644 --- a/src/tcp_act.c +++ b/src/tcp_act.c @@ -505,23 +505,20 @@ static enum act_parse_ret tcp_parse_attach_srv(const char **args, int *cur_arg, ++(*cur_arg); - while (args[*cur_arg] && args[*cur_arg][0] != '\0') { - if (strcmp(args[*cur_arg], "name") == 0) { - ++(*cur_arg); - - expr = sample_parse_expr((char **)args, cur_arg, px->conf.args.file, px->conf.args.line, - err, &px->conf.args, NULL); - if (!expr) - return ACT_RET_PRS_ERR; - - rule->arg.attach_srv.name = expr; - rule->release_ptr = release_attach_srv_action; - ++(*cur_arg); - } - else { - memprintf(err, "Unknown argument."); + if (strcmp(args[*cur_arg], "name") == 0) { + if (!*args[*cur_arg + 1]) { + memprintf(err, "missing name value"); return ACT_RET_PRS_ERR; } + ++(*cur_arg); + + expr = sample_parse_expr((char **)args, cur_arg, px->conf.args.file, px->conf.args.line, + err, &px->conf.args, NULL); + if (!expr) + return ACT_RET_PRS_ERR; + + rule->arg.attach_srv.name = expr; + rule->release_ptr = release_attach_srv_action; } return ACT_RET_PRS_OK; -- 1.7.10.4