]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: server: Fix application of pre-login HELO domain when no post-login HELO...
authorStephan Bosch <stephan.bosch@dovecot.fi>
Wed, 7 Mar 2018 14:03:42 +0000 (15:03 +0100)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Tue, 13 Mar 2018 04:25:16 +0000 (06:25 +0200)
The substituted domain was not marked as valid, which caused the HELO field of
the produced received line to be set to 'unknown'.

src/lib-smtp/smtp-server-cmd-mail.c

index f1574bf6f11dfd299f1b04db3c4165597545c0b2..abb9cee778095a31131d3a0c5df4229341dd0021 100644 (file)
@@ -105,11 +105,13 @@ void smtp_server_cmd_mail(struct smtp_server_cmd_ctx *cmd,
                return;
        }
 
-       if (conn->pending_helo == NULL && conn->helo.domain == NULL) {
+       if (conn->pending_helo == NULL && conn->helo.domain == NULL &&
+           conn->helo_login != NULL && *conn->helo_login != '\0') {
                /* no EHLO executed post-login, use pre-login value instead */
                conn->helo_domain = conn->helo_login;
-               conn->helo_login = NULL;
                conn->helo.domain = conn->helo_domain;
+               conn->helo.domain_valid = TRUE;
+               conn->helo_login = NULL;
        }
 
        mail_data = p_new(cmd->pool, struct smtp_server_cmd_mail, 1);