]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: smtpchk: Update expect rule to fully match replies to EHLO commands
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 21 Sep 2022 12:42:47 +0000 (14:42 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 21 Sep 2022 13:11:26 +0000 (15:11 +0200)
The response to EHLO command is a multiline reply. However the corresponding
expect rule only match on the first line. For now, it is not an issue. But
to be able to send the QUIT command and gracefully close the connection, we
must be sure to consume the full EHLO reply first.

To do so, the regex has been updated to match all 2xx lines at a time.

src/tcpcheck.c

index fc5197d5a96fda4b444eb8c4b9afd66ded086f4e..deb744535470c08b13df93e2f48bf7ee96bf5e43 100644 (file)
@@ -4344,8 +4344,7 @@ int proxy_parse_smtpchk_opt(char **args, int cur_arg, struct proxy *curpx, const
        chk->index = 3;
        LIST_APPEND(&rs->rules, &chk->list);
 
-       chk = parse_tcpcheck_expect((char *[]){"tcp-check", "expect", "rstring", "^2[0-9]{2}[- \r]",
-                                              "min-recv", "4",
+       chk = parse_tcpcheck_expect((char *[]){"tcp-check", "expect", "rstring", "^(2[0-9]{2}-[^\r]*\r\n)*2[0-9]{2}[ \r]",
                                               "error-status", "L7STS",
                                               "on-error", "%[res.payload(4,0),ltrim(' '),cut_crlf]",
                                               "on-success", "%[res.payload(4,0),ltrim(' '),cut_crlf]",