From 0ec7e94825af4ec45b9ab92f9a2d22cf59952600 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Tue, 21 Apr 2015 23:59:07 +0100 Subject: [PATCH 1/1] UTF8: mua_wrapper --- src/src/deliver.c | 5 +++- src/src/exim.c | 3 +++ src/src/spool_in.c | 2 +- src/src/spool_out.c | 2 +- test/confs/4201 | 3 +++ test/confs/4209 | 1 + test/log/4207 | 2 +- test/log/4208 | 2 ++ test/log/4209 | 18 +++++++++++++ test/rejectlog/4208 | 1 + test/scripts/4200-International/4208 | 2 +- test/scripts/4200-International/4209 | 40 ++++++++++++++++++++++++++++ test/stdout/4208 | 20 ++++++++++++++ 13 files changed, 96 insertions(+), 5 deletions(-) create mode 120000 test/confs/4209 create mode 100644 test/log/4208 create mode 100644 test/log/4209 create mode 100644 test/rejectlog/4208 create mode 100644 test/scripts/4200-International/4209 create mode 100644 test/stdout/4208 diff --git a/src/src/deliver.c b/src/src/deliver.c index 58b9d3a01..88936b5f9 100644 --- a/src/src/deliver.c +++ b/src/src/deliver.c @@ -5606,8 +5606,11 @@ if (process_recipients != RECIP_IGNORE) { new->prop.utf8_downcvt = message_utf8_downconvert == 1; new->prop.utf8_downcvt_maybe = message_utf8_downconvert == -1; + DEBUG(D_deliver) debug_printf("utf8, downconvert %s\n", + new->prop.utf8_downcvt ? "yes" + : new->prop.utf8_downcvt_maybe ? "ifneeded" + : "no"); } - DEBUG(D_deliver) if (message_smtputf8) debug_printf("utf8\n"); #endif if (r->pno >= 0) diff --git a/src/src/exim.c b/src/src/exim.c index cae296477..e328fb521 100644 --- a/src/src/exim.c +++ b/src/src/exim.c @@ -5088,6 +5088,9 @@ if (mua_wrapper) deliver_drop_privilege = TRUE; queue_smtp = FALSE; queue_smtp_domains = NULL; +#ifdef EXPERIMENTAL_INTERNATIONAL + message_utf8_downconvert = -1; /* convert-if-needed */ +#endif } diff --git a/src/src/spool_in.c b/src/src/spool_in.c index 558d955c1..0780d5894 100644 --- a/src/src/spool_in.c +++ b/src/src/spool_in.c @@ -605,7 +605,7 @@ for (;;) case 'u': if (Ustrncmp(p, "tf8_downcvt", 11) == 0) message_utf8_downconvert = 1; - else if (Ustrncmp(p, "tf8_downcvt_opt", 15) == 0) + else if (Ustrncmp(p, "tf8_optdowncvt", 15) == 0) message_utf8_downconvert = -1; break; #endif diff --git a/src/src/spool_out.c b/src/src/spool_out.c index 48f27a8c6..e8d202033 100644 --- a/src/src/spool_out.c +++ b/src/src/spool_out.c @@ -250,7 +250,7 @@ if (message_smtputf8) { fprintf(f, "-smtputf8\n"); if (message_utf8_downconvert) - fprintf(f, "-utf8_downcvt%s\n", message_utf8_downconvert < 0 ? "_opt" : ""); + fprintf(f, "-utf8_%sdowncvt\n", message_utf8_downconvert < 0 ? "opt" : ""); } #endif diff --git a/test/confs/4201 b/test/confs/4201 index 4145325cc..6a16f4c6f 100644 --- a/test/confs/4201 +++ b/test/confs/4201 @@ -4,6 +4,7 @@ OPTION = * CONTROL = INSERT = +SUB = exim_path = EXIM_PATH host_lookup_order = bydns @@ -29,6 +30,8 @@ queue_run_in_order smtputf8_advertise_hosts = OPTION +SUB + # ----- ACL ----- diff --git a/test/confs/4209 b/test/confs/4209 new file mode 120000 index 000000000..73a348fee --- /dev/null +++ b/test/confs/4209 @@ -0,0 +1 @@ +4201 \ No newline at end of file diff --git a/test/log/4207 b/test/log/4207 index e1dd4f732..f6171fd45 100644 --- a/test/log/4207 +++ b/test/log/4207 @@ -1,7 +1,7 @@ 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 10HmaX-0005vi-00 <= 他们为什么不说中文@hebrew.למההםפשוטלאמדבריםעברית.com U=CALLER P=utf8local-esmtp S=sss for user.세계의모든사람들이한국어를이해한다면얼마나좋을까@test.ex 1999-03-02 09:44:33 10HmaY-0005vi-00 <= xn--ihqwcrb4cv8a8dqg056pqjye@hebrew.xn--4dbcagdahymbxekheh6e0a7fei0b.com H=localhost (the.local.host.name) [127.0.0.1] P=esmtp S=sss id=E10HmaX-0005vi-00@the.local.host.name for xn--user.-f99s29a80cg5i8xgv8fnb734dq4gv6av8eczab60f5jch09a5ea085a0marwd373e180hea90e@test.ex -1999-03-02 09:44:33 10HmaX-0005vi-00 => xn--user.-f99s29a80cg5i8xgv8fnb734dq4gv6av8eczab60f5jch09a5ea085a0marwd373e180hea90e@xn--test.ex- F= R=rmt T=rmt_smtp H=127.0.0.1 [127.0.0.1] C="250 OK id=10HmaY-0005vi-00" +1999-03-02 09:44:33 10HmaX-0005vi-00 => xn--user.-f99s29a80cg5i8xgv8fnb734dq4gv6av8eczab60f5jch09a5ea085a0marwd373e180hea90e@test.ex F= R=rmt T=rmt_smtp H=127.0.0.1 [127.0.0.1] C="250 OK id=10HmaY-0005vi-00" 1999-03-02 09:44:33 10HmaX-0005vi-00 Completed 1999-03-02 09:44:33 Start queue run: pid=pppp -qqff 1999-03-02 09:44:33 10HmaY-0005vi-00 => :blackhole: R=localuser diff --git a/test/log/4208 b/test/log/4208 new file mode 100644 index 000000000..73e18635a --- /dev/null +++ b/test/log/4208 @@ -0,0 +1,2 @@ +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 H=localhost (the.local.host.name) [127.0.0.1] F=<> rejected RCPT : relay not permitted diff --git a/test/log/4209 b/test/log/4209 new file mode 100644 index 000000000..0f42fec2a --- /dev/null +++ b/test/log/4209 @@ -0,0 +1,18 @@ +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 10HmaX-0005vi-00 <= 他们为什么不说中文@test1.com U=CALLER P=local S=sss for user.他们为什么不说中文@test.ex +1999-03-02 09:44:33 10HmaY-0005vi-00 <= 他们为什么不说中文@test1.com H=localhost (the.local.host.name) [127.0.0.1] P=utf8esmtp S=sss id=E10HmaX-0005vi-00@the.local.host.name for user.他们为什么不说中文@test.ex +1999-03-02 09:44:33 10HmaX-0005vi-00 => user.他们为什么不说中文@test.ex F=<他们为什么不说中文@test1.com> R=rmt T=rmt_smtp H=127.0.0.1 [127.0.0.1] C="250 OK id=10HmaY-0005vi-00" +1999-03-02 09:44:33 10HmaX-0005vi-00 Completed +1999-03-02 09:44:33 Start queue run: pid=pppp -qqff +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 +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 <= 他们为什么不说中文@test1.com U=CALLER P=local S=sss for user.他们为什么不说中文@test.ex +1999-03-02 09:44:33 10HmbA-0005vi-00 <= xn--ihqwcrb4cv8a8dqg056pqjye@test1.com H=localhost (the.local.host.name) [127.0.0.1] P=esmtp S=sss id=E10HmaZ-0005vi-00@the.local.host.name for xn--user.-si1hohvdvf05c4gvj200y0o6f@test.ex +1999-03-02 09:44:33 10HmaZ-0005vi-00 => xn--user.-si1hohvdvf05c4gvj200y0o6f@test.ex F= R=rmt T=rmt_smtp H=127.0.0.1 [127.0.0.1] C="250 OK id=10HmbA-0005vi-00" +1999-03-02 09:44:33 10HmaZ-0005vi-00 Completed +1999-03-02 09:44:33 Start queue run: pid=pppp -qqff +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 End queue run: pid=pppp -qqff diff --git a/test/rejectlog/4208 b/test/rejectlog/4208 new file mode 100644 index 000000000..2bbfb4fc6 --- /dev/null +++ b/test/rejectlog/4208 @@ -0,0 +1 @@ +1999-03-02 09:44:33 H=localhost (the.local.host.name) [127.0.0.1] F=<> rejected RCPT : relay not permitted diff --git a/test/scripts/4200-International/4208 b/test/scripts/4200-International/4208 index 0fa719019..880298798 100644 --- a/test/scripts/4200-International/4208 +++ b/test/scripts/4200-International/4208 @@ -13,7 +13,7 @@ QUIT **** # Recipient+random verify callout, pass only due to downconvert -exim -d+all -bs -odi -DINSERT="control=utf8_downconvert" -DCONTROL="verify=recipient/callout=random" +exim -bs -odi -DINSERT="control=utf8_downconvert" -DCONTROL="verify=recipient/callout=random" EHLO client.ffail MAIL FROM: SMTPUTF8 RCPT TO: diff --git a/test/scripts/4200-International/4209 b/test/scripts/4200-International/4209 new file mode 100644 index 000000000..6531103b9 --- /dev/null +++ b/test/scripts/4200-International/4209 @@ -0,0 +1,40 @@ +# Internationalised mail: mua_wrapper +# Exim test configuration 4209 +# +# featurefull server +exim -DSERVER=server -bd -oX PORT_D +**** +# +# commandline/stdin input, utf-8 rcpt & sender, forwarded +# should not downconvert +exim -DSUB=mua_wrapper -odi -f 他们为什么不说中文@test1.com user.他们为什么不说中文@test.ex +Test message 1. +. +**** +# +# +killdaemon +exim -DSERVER=server -qqff +**** +# +# +# +# featureless server +exim -DSERVER=server -DOPTION="" -bd -oX PORT_D +**** +# +# commandline/stdin input, utf-8 rcpt & sender, forwarded +# should downconvert +exim -DSUB=mua_wrapper -odi -f 他们为什么不说中文@test1.com user.他们为什么不说中文@test.ex +Test message 1. +. +**** +# +# +killdaemon +exim -DSERVER=server -qqff +**** +# +# +# +no_msglog_check diff --git a/test/stdout/4208 b/test/stdout/4208 new file mode 100644 index 000000000..b4bf77279 --- /dev/null +++ b/test/stdout/4208 @@ -0,0 +1,20 @@ +220 the.local.host.name ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000 +250-the.local.host.name Hello CALLER at client.ffail +250-SIZE 52428800 +250-8BITMIME +250-PIPELINING +250-SMTPUTF8 +250 HELP +250 OK +250 Accepted +221 the.local.host.name closing connection +220 the.local.host.name ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000 +250-the.local.host.name Hello CALLER at client.ffail +250-SIZE 52428800 +250-8BITMIME +250-PIPELINING +250-SMTPUTF8 +250 HELP +250 OK +250 Accepted +221 the.local.host.name closing connection -- 2.30.2