From: Stephan Bosch Date: Wed, 27 Jan 2021 12:40:43 +0000 (+0100) Subject: lib-smtp: smtp-server - Add support for suppressing the inital greeting reply. X-Git-Tag: 2.3.18~163 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a0eeeb6c76d374563a7b6994c9ec47844915058c;p=thirdparty%2Fdovecot%2Fcore.git lib-smtp: smtp-server - Add support for suppressing the inital greeting reply. --- diff --git a/src/lib-smtp/smtp-server-connection.c b/src/lib-smtp/smtp-server-connection.c index 9d7ce4f220..43abb24f74 100644 --- a/src/lib-smtp/smtp-server-connection.c +++ b/src/lib-smtp/smtp-server-connection.c @@ -284,7 +284,9 @@ static void smtp_server_connection_ready(struct smtp_server_connection *conn) smtp_server_connection_output, conn); o_stream_cork(conn->conn.output); - if (conn->authenticated) { + if (conn->set.no_greeting) { + /* Don't send greeting or login reply. */ + } else if (conn->authenticated) { /* RFC 4954, Section 4: Should the client successfully complete the exchange, the SMTP server issues a 235 reply. */ @@ -912,6 +914,8 @@ smtp_server_connection_alloc(struct smtp_server *server, conn->set.rcpt_domain_optional = conn->set.rcpt_domain_optional || set->rcpt_domain_optional; + conn->set.no_greeting = + conn->set.no_greeting || set->no_greeting; conn->set.debug = conn->set.debug || set->debug; } diff --git a/src/lib-smtp/smtp-server.c b/src/lib-smtp/smtp-server.c index a47930edc9..e0afde3116 100644 --- a/src/lib-smtp/smtp-server.c +++ b/src/lib-smtp/smtp-server.c @@ -85,6 +85,7 @@ struct smtp_server *smtp_server_init(const struct smtp_server_settings *set) server->set.auth_optional = set->auth_optional; server->set.rcpt_domain_optional = set->rcpt_domain_optional; server->set.mail_path_allow_broken = set->mail_path_allow_broken; + server->set.no_greeting = set->no_greeting; server->set.debug = set->debug; server->set.no_state_in_reason = set->no_state_in_reason; diff --git a/src/lib-smtp/smtp-server.h b/src/lib-smtp/smtp-server.h index f3f1b5ef08..a31a535bba 100644 --- a/src/lib-smtp/smtp-server.h +++ b/src/lib-smtp/smtp-server.h @@ -394,6 +394,9 @@ struct smtp_server_settings { bool rcpt_domain_optional:1; /* Don't include "(state=%s)" in the disconnection reason string. */ bool no_state_in_reason:1; + /* Don't send a greeting or login success message to the client upon + connection start. */ + bool no_greeting:1; }; struct smtp_server_stats {