[exim-cvs] I18N: Fix protocol recorded for a multi-SMTPUTF8-…

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Exim Git Commits Mailing List
Dátum:  
Címzett: exim-cvs
Tárgy: [exim-cvs] I18N: Fix protocol recorded for a multi-SMTPUTF8-message connection. Bug 2287
Gitweb: https://git.exim.org/exim.git/commitdiff/946515bfe62796f6c0d6554e9e1e227f33253e7c
Commit:     946515bfe62796f6c0d6554e9e1e227f33253e7c
Parent:     d629c90c1c83ef1136008a4d6afeed9b6db903fc
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Wed Jul 18 22:16:38 2018 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Wed Jul 18 22:24:40 2018 +0100


    I18N: Fix protocol recorded for a multi-SMTPUTF8-message connection.  Bug 2287
---
 doc/doc-txt/ChangeLog                |  4 ++++
 src/src/smtp_in.c                    | 12 +++++++-----
 test/log/4201                        |  3 +++
 test/scripts/4200-International/4201 | 13 ++++++++++++-
 test/stdout/4201                     | 15 +++++++++++++++
 5 files changed, 41 insertions(+), 6 deletions(-)


diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index 754f48b..fbca09f 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -77,6 +77,10 @@ JH/16 Fix ARC verification to do AS checks in reverse order.

JH/17 Support a "tls" option on the ${readsocket } expansion item.

+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.
+


 Exim version 4.91
 -----------------
diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c
index 0afb97c..6e2c45a 100644
--- a/src/src/smtp_in.c
+++ b/src/src/smtp_in.c
@@ -4671,13 +4671,15 @@ while (done <= 0)
         case ENV_MAIL_OPT_UTF8:
       if (smtputf8_advertised)
         {
-        int old_pool = store_pool;
-
         DEBUG(D_receive) debug_printf("smtputf8 requested\n");
         message_smtputf8 = allow_utf8_domains = TRUE;
-        store_pool = POOL_PERM;
-        received_protocol = string_sprintf("utf8%s", received_protocol);
-        store_pool = old_pool;
+        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
diff --git a/test/log/4201 b/test/log/4201
index 2643dd9..6b7c6ac 100644
--- a/test/log/4201
+++ b/test/log/4201
@@ -6,12 +6,15 @@
 1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port 1225
 1999-03-02 09:44:33 10HmaZ-0005vi-00 <= someone@??? H=(client) [127.0.0.1] P=utf8esmtp S=sss for userx@???
 1999-03-02 09:44:33 10HmbA-0005vi-00 <= ليهمابتكلموشعربي؟@czech.Pročprostěnemluvíčesky.com H=(client) [127.0.0.1] P=utf8esmtp S=sss for userx@???
+1999-03-02 09:44:33 10HmbB-0005vi-00 <= ليهمابتكلموشعربي؟@czech.Pročprostěnemluvíčesky.com H=(client) [127.0.0.1] P=utf8esmtp S=sss for usery@???
 1999-03-02 09:44:33 10HmaY-0005vi-00 <= 他们为什么不说中文@hebrew.למההםפשוטלאמדבריםעברית.com H=localhost (the.local.host.name) [127.0.0.1] P=utf8esmtp S=sss id=E10HmaX-0005vi-00@??? for usery@???
 1999-03-02 09:44:33 Start queue run: pid=pppp -qqff
 1999-03-02 09:44:33 10HmaZ-0005vi-00 => :blackhole: <userx@???> R=localuser
 1999-03-02 09:44:33 10HmaZ-0005vi-00 Completed
 1999-03-02 09:44:33 10HmbA-0005vi-00 => :blackhole: <userx@???> R=localuser
 1999-03-02 09:44:33 10HmbA-0005vi-00 Completed
+1999-03-02 09:44:33 10HmbB-0005vi-00 => :blackhole: <usery@???> R=localuser
+1999-03-02 09:44:33 10HmbB-0005vi-00 Completed
 1999-03-02 09:44:33 10HmaY-0005vi-00 => :blackhole: <usery@???> R=localuser
 1999-03-02 09:44:33 10HmaY-0005vi-00 Completed
 1999-03-02 09:44:33 End queue run: pid=pppp -qqff
diff --git a/test/scripts/4200-International/4201 b/test/scripts/4200-International/4201
index 29e51a9..fc9a507 100644
--- a/test/scripts/4200-International/4201
+++ b/test/scripts/4200-International/4201
@@ -31,7 +31,7 @@ QUIT
 ****
 #
 #
-# utf-8 from, Basic smtp input, no delivery
+# utf-8 from, Basic smtp input, no delivery.  Two messages in a connection.
 client 127.0.0.1 PORT_D
 ??? 220
 EHLO client
@@ -52,6 +52,17 @@ Subject: test
 body
 .
 ??? 250
+MAIL FROM: <ليهمابتكلموشعربي؟@czech.Pročprostěnemluvíčesky.com> SMTPUTF8
+??? 250
+RCPT TO: <usery@???>
+??? 250
+DATA
+??? 354
+Subject: test
+
+body
+.
+??? 250
 QUIT
 ??? 221
 ****
diff --git a/test/stdout/4201 b/test/stdout/4201
index 5a110f2..08f6f11 100644
--- a/test/stdout/4201
+++ b/test/stdout/4201
@@ -64,6 +64,21 @@ Connecting to 127.0.0.1 port 1225 ... connected

>>> .

??? 250
<<< 250 OK id=10HmbA-0005vi-00
+>>> MAIL FROM: <ليهمابتكلموشعربي؟@czech.Pročprostěnemluvíčesky.com> SMTPUTF8
+??? 250
+<<< 250 OK
+>>> RCPT TO: <usery@???>
+??? 250
+<<< 250 Accepted
+>>> DATA
+??? 354
+<<< 354 Enter message, ending with "." on a line by itself
+>>> Subject: test
+>>>
+>>> body
+>>> .
+??? 250
+<<< 250 OK id=10HmbB-0005vi-00
>>> QUIT

??? 221
<<< 221 the.local.host.name closing connection