From: Amaury Denoyelle Date: Fri, 29 Sep 2023 14:05:14 +0000 (+0200) Subject: BUG/MINOR: tcp_act: fix attach-srv rule ACL parsing X-Git-Tag: v2.9-dev7~58 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=753fe2b9acd3cee5ffd6d9ee8815d6c4face9867;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/tcp_act.c b/src/tcp_act.c index 291f70488d..ff3886abb3 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;