]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: server: Only accept XCLIENT command when the XCLIENT capability is active.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Thu, 1 Mar 2018 13:53:11 +0000 (14:53 +0100)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Tue, 13 Mar 2018 05:11:25 +0000 (07:11 +0200)
Report "502 Unsupported command" otherwise. Before, it would complain about the
client not being trusted, which is confusing.

src/lib-smtp/smtp-server-cmd-xclient.c
src/lmtp/client.c
src/submission-login/client.c

index 29aa7f125270ba9b55ebf5752bc636d71e96ce33..78c039c3423eafcf4c03c67328db2f9244b1ae00 100644 (file)
@@ -95,6 +95,12 @@ void smtp_server_cmd_xclient(struct smtp_server_cmd_ctx *cmd,
           attribute-value = xtext
         */
 
+       if ((conn->set.capabilities & SMTP_CAPABILITY_XCLIENT) == 0) {
+               smtp_server_reply(cmd,
+                       502, "5.5.1", "Unsupported command");
+               return;
+       }
+
        /* check transaction state as far as possible */
        if (!cmd_xclient_check_state(cmd))
                return;
index 3affc7f45ef3b96a08345e9bf9ca263cb513369a..7089e888f7592a59dfae52ed60ae67360a337621 100644 (file)
@@ -150,7 +150,8 @@ struct client *client_create(int fd_in, int fd_out,
                SMTP_CAPABILITY_PIPELINING |
                SMTP_CAPABILITY_ENHANCEDSTATUSCODES |
                SMTP_CAPABILITY_8BITMIME |
-               SMTP_CAPABILITY_CHUNKING;
+               SMTP_CAPABILITY_CHUNKING |
+               SMTP_CAPABILITY_XCLIENT;
        if (!conn->ssl && master_service_ssl_is_enabled(master_service))
                lmtp_set.capabilities |= SMTP_CAPABILITY_STARTTLS;
        lmtp_set.hostname = client->unexpanded_lda_set->hostname;
index c71511ab14e92d46bee807bd000c829faaaf1b27..0669d1ae0065b94c53e66003a0316fb6d37b8627 100644 (file)
@@ -69,7 +69,8 @@ static void submission_client_create(struct client *client,
 
        i_zero(&smtp_set);
        smtp_set.capabilities = SMTP_CAPABILITY_SIZE |
-               SMTP_CAPABILITY_ENHANCEDSTATUSCODES | SMTP_CAPABILITY_AUTH;
+               SMTP_CAPABILITY_ENHANCEDSTATUSCODES | SMTP_CAPABILITY_AUTH |
+               SMTP_CAPABILITY_XCLIENT;
        if (client_is_tls_enabled(client))
                smtp_set.capabilities |= SMTP_CAPABILITY_STARTTLS;
        smtp_set.hostname = subm_client->set->hostname;