From 2ec1ffaed061cd3560934c7525b204dbca25ace3 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Wed, 21 Sep 2022 14:42:47 +0200 Subject: [PATCH] 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. --- src/tcpcheck.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/tcpcheck.c b/src/tcpcheck.c index fc5197d5a..deb744535 100644 --- a/src/tcpcheck.c +++ b/src/tcpcheck.c @@ -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]",