]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lmtp: lmtp-commands - Explicity prohibit empty RCPT path.
authorStephan Bosch <stephan.bosch@open-xchange.com>
Fri, 20 Mar 2020 12:38:41 +0000 (13:38 +0100)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Wed, 20 May 2020 07:54:00 +0000 (07:54 +0000)
The empty path <""> will yield an empty username.

src/lmtp/lmtp-commands.c

index 2c0d57f2cbf6b18273175a631aa4c22ef8ff1fc1..2988c88730bbb934763f43e5583da2efac53669d 100644 (file)
@@ -66,10 +66,18 @@ int client_default_cmd_rcpt(struct client *client,
        char delim = '\0';
        int ret;
 
+       i_assert(!smtp_address_isnull(rcpt->path));
+       if (*rcpt->path->localpart == '\0' && rcpt->path->domain == NULL) {
+               smtp_server_recipient_reply(
+                       rcpt, 550, "5.1.1",
+                       "Unacceptable TO: Empty path not allowed");
+               return -1;
+       }
 
        smtp_address_detail_parse_temp(
                client->unexpanded_lda_set->recipient_delimiter,
                rcpt->path, &username, &delim, &detail);
+       i_assert(*username != '\0');
 
        /* Make user name and detail available in the recipient event. The
           mail_user event (for local delivery) also adds the user field, but