MINOR: smtpchk: Update expect rule to fully match replies to EHLO commands

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.

(cherry picked from commit 2ec1ffaed0)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
This commit is contained in:
Christopher Faulet
2022-09-21 14:42:47 +02:00
parent 88316b6b99
commit 9d21c53f63

View 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]",