From: Jeremy Harris Date: Wed, 18 Jul 2018 21:16:38 +0000 (+0100) Subject: I18N: Fix protocol recorded for a multi-SMTPUTF8-message connection. Bug 2287 X-Git-Tag: exim-4.92-RC1~148 X-Git-Url: https://vcs.fsf.org/?p=exim.git;a=commitdiff_plain;h=946515bfe62796f6c0d6554e9e1e227f33253e7c I18N: Fix protocol recorded for a multi-SMTPUTF8-message connection. Bug 2287 --- diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 754f48b15..fbca09fb3 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 0afb97ca6..6e2c45a8c 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 2643dd9ec..6b7c6ac97 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@some.domain H=(client) [127.0.0.1] P=utf8esmtp S=sss for userx@test.ex 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@test.ex +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@test.ex 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@the.local.host.name for usery@test.ex 1999-03-02 09:44:33 Start queue run: pid=pppp -qqff 1999-03-02 09:44:33 10HmaZ-0005vi-00 => :blackhole: R=localuser 1999-03-02 09:44:33 10HmaZ-0005vi-00 Completed 1999-03-02 09:44:33 10HmbA-0005vi-00 => :blackhole: R=localuser 1999-03-02 09:44:33 10HmbA-0005vi-00 Completed +1999-03-02 09:44:33 10HmbB-0005vi-00 => :blackhole: R=localuser +1999-03-02 09:44:33 10HmbB-0005vi-00 Completed 1999-03-02 09:44:33 10HmaY-0005vi-00 => :blackhole: 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 29e51a9db..fc9a50741 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 @@ -49,6 +49,17 @@ DATA ??? 354 Subject: test +body +. +??? 250 +MAIL FROM: <ليهمابتكلموشعربي؟@czech.Pročprostěnemluvíčesky.com> SMTPUTF8 +??? 250 +RCPT TO: +??? 250 +DATA +??? 354 +Subject: test + body . ??? 250 diff --git a/test/stdout/4201 b/test/stdout/4201 index 5a110f292..08f6f1145 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: +??? 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