]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: server: Use the HELO domain provided to smtp_server_connection_login()...
authorStephan Bosch <stephan.bosch@dovecot.fi>
Mon, 3 Dec 2018 17:45:39 +0000 (18:45 +0100)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Tue, 12 Feb 2019 13:42:06 +0000 (15:42 +0200)
Before, it was only used when no new HELO/EHLO command was issued before MAIL.

src/lib-smtp/smtp-server-cmd-mail.c
src/lib-smtp/smtp-server-connection.c
src/lib-smtp/smtp-server-private.h

index a4eb4fcbb3da753d9105a9808cf390d1e5a39745..998b9ba4860e8a005524d265151ee23596571b4b 100644 (file)
@@ -128,15 +128,6 @@ void smtp_server_cmd_mail(struct smtp_server_cmd_ctx *cmd,
                return;
        }
 
-       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.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);
 
        if (conn->set.protocol == SMTP_PROTOCOL_LMTP)
index 0beb6fd52528ded901b327151b7cdd36b8956a82..a2b3f81dfcfff61e68770e8eb662c1f8362f14ec 100644 (file)
@@ -1178,7 +1178,6 @@ bool smtp_server_connection_unref(struct smtp_server_connection **_conn)
        connection_deinit(&conn->conn);
 
        i_free(conn->helo_domain);
-       i_free(conn->helo_login);
        i_free(conn->username);
        i_free(conn->disconnect_reason);
        pool_unref(&conn->pool);
@@ -1268,10 +1267,15 @@ void smtp_server_connection_login(struct smtp_server_connection *conn,
 {
        i_assert(!conn->started);
        i_assert(conn->username == NULL);
+       i_assert(conn->helo_domain == NULL);
 
        conn->set.capabilities &= ~SMTP_CAPABILITY_STARTTLS;
        conn->username = i_strdup(username);
-       conn->helo_login = i_strdup(helo);
+       if (helo != NULL && *helo != '\0') {
+               conn->helo_domain = i_strdup(helo);
+               conn->helo.domain = conn->helo_domain;
+               conn->helo.domain_valid = TRUE;
+       }
        conn->authenticated = TRUE;
        conn->ssl_secured = ssl_secured;
 
@@ -1422,7 +1426,6 @@ void smtp_server_connection_clear(struct smtp_server_connection *conn)
        smtp_server_connection_debug(conn, "Connection clear");
 
        i_free(conn->helo_domain);
-       i_free(conn->helo_login);
        i_zero(&conn->helo);
        smtp_server_connection_reset_state(conn);
 }
index aa1605abdcc27d5adf2d9efd76d52c9aa7f34564..70f8762797eab7100487e2260f5b3e1d7fb0f10b 100644 (file)
@@ -161,7 +161,7 @@ struct smtp_server_connection {
        unsigned int proxy_timeout_secs;
 
        struct smtp_server_helo_data helo, *pending_helo;
-       char *helo_domain, *helo_login, *username;
+       char *helo_domain, *username;
        unsigned int id;
 
        struct timeout *to_idle;