]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: tcp_act: fix attach-srv rule ACL parsing
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 29 Sep 2023 14:05:14 +0000 (16:05 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 29 Sep 2023 16:07:52 +0000 (18:07 +0200)
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

index 291f70488d26e6caa2d71e1c46067ce6c1a97043..ff3886abb3e38e30e5300d0f081a16b50a03db2c 100644 (file)
@@ -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;