I18N: reject SMTPUTF8 MAIL command when facility not advertised
authorJeremy Harris <jgh146exb@wizmail.org>
Wed, 18 Jul 2018 21:59:14 +0000 (22:59 +0100)
committerJeremy Harris <jgh146exb@wizmail.org>
Wed, 18 Jul 2018 21:59:14 +0000 (22:59 +0100)
doc/doc-txt/ChangeLog
src/src/smtp_in.c
test/log/4201
test/scripts/4200-International/4201
test/stdout/4201

index fbca09fb3190bc2149f7a745c19409201f39fadd..5b8ada93ae1f20ad2d557747551c73f2f5663b3e 100644 (file)
@@ -81,6 +81,10 @@ JH/18 Bug 2287: Fix the protocol name (eg utf8esmtp) for multiple messages
       using the SMTPUTF8 option on their MAIL FROM commands, in one connection.
       Previously the "utf8" would be re-prepended for every additional message.
 
+JH/19 Reject MAIL FROM commands with SMTPUTF8 when the facility was not advertised.
+      Previously thery were accepted, resulting in issues when attempting to
+      forward messages to a non-supporting MTA.
+
 
 Exim version 4.91
 -----------------
index 6e2c45a8cb37e304277b3946d2bff9814cfe42c8..ff0f6acaac71d15cff1c8a0212648fc6df4e0db8 100644 (file)
@@ -4580,7 +4580,7 @@ while (done <= 0)
           if (dsn_advertised)
            {
             /* Check if the dsn envid has been already set */
-            if (dsn_envid != NULL)
+            if (dsn_envid)
              {
               synprot_error(L_smtp_syntax_error, 501, NULL,
                 US"ENVID can be specified once only");
@@ -4669,17 +4669,21 @@ while (done <= 0)
 
 #ifdef SUPPORT_I18N
         case ENV_MAIL_OPT_UTF8:
-         if (smtputf8_advertised)
+         if (!smtputf8_advertised)
            {
-           DEBUG(D_receive) debug_printf("smtputf8 requested\n");
-           message_smtputf8 = allow_utf8_domains = TRUE;
-           if (Ustrncmp(received_protocol, US"utf8", 4) != 0)
-             {
-             int old_pool = store_pool;
-             store_pool = POOL_PERM;
-             received_protocol = string_sprintf("utf8%s", received_protocol);
-             store_pool = old_pool;
-             }
+           synprot_error(L_smtp_syntax_error, 501, NULL,
+             US"SMTPUTF8 used when not advertised");
+           goto COMMAND_LOOP;
+           }
+
+         DEBUG(D_receive) debug_printf("smtputf8 requested\n");
+         message_smtputf8 = allow_utf8_domains = TRUE;
+         if (Ustrncmp(received_protocol, US"utf8", 4) != 0)
+           {
+           int old_pool = store_pool;
+           store_pool = POOL_PERM;
+           received_protocol = string_sprintf("utf8%s", received_protocol);
+           store_pool = old_pool;
            }
          break;
 #endif
index 6b7c6ac970f00fa2aedaeaf0033c2eec35bc3a05..7b299c06a06813468d41335e74a1697180345855 100644 (file)
@@ -18,3 +18,4 @@
 1999-03-02 09:44:33 10HmaY-0005vi-00 => :blackhole: <usery@test.ex> R=localuser
 1999-03-02 09:44:33 10HmaY-0005vi-00 Completed
 1999-03-02 09:44:33 End queue run: pid=pppp -qqff
+1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port 1225
index fc9a50741745236a74c0a1dce024774c48b6f754..5a591fdea15c5138959c7ffbf3090d44fb8f0b2d 100644 (file)
@@ -84,4 +84,25 @@ QUIT
 killdaemon
 exim -DSERVER=server -DNOTDAEMON -qqff
 ****
+#
+#
+# Attempt to use when not advertised
+exim -DSERVER=server -DOPTION=: -bd -oX PORT_D
+****
+client 127.0.0.1 PORT_D
+??? 220
+EHLO client
+??? 250-
+??? 250-SIZE
+??? 250-8BITMIME
+??? 250-PIPELINING
+??? 250 HELP
+MAIL FROM: <someone@some.domain> SMTPUTF8
+??? 501
+QUIT
+??? 221
+****
+killdaemon
+#
+#
 no_msglog_check
index 08f6f114528242ca9dd70771f8f4d6681bfa05b4..9c95da74ed3e9f89ca1d5ecc97104ad9f0df9356 100644 (file)
@@ -95,3 +95,24 @@ End of script
 354 Enter message, ending with "." on a line by itself\r
 250 OK id=10HmaX-0005vi-00\r
 221 the.local.host.name closing connection\r
+Connecting to 127.0.0.1 port 1225 ... connected
+??? 220
+<<< 220 the.local.host.name ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+>>> EHLO client
+??? 250-
+<<< 250-the.local.host.name Hello client [127.0.0.1]
+??? 250-SIZE
+<<< 250-SIZE 52428800
+??? 250-8BITMIME
+<<< 250-8BITMIME
+??? 250-PIPELINING
+<<< 250-PIPELINING
+??? 250 HELP
+<<< 250 HELP
+>>> MAIL FROM: <someone@some.domain> SMTPUTF8
+??? 501
+<<< 501 SMTPUTF8 used when not advertised
+>>> QUIT
+??? 221
+<<< 221 the.local.host.name closing connection
+End of script