From: Jeremy Harris Date: Mon, 6 Apr 2015 13:07:31 +0000 (+0100) Subject: smtp output, no remote support X-Git-Tag: exim-4_86_RC1~88^2~12 X-Git-Url: https://git.exim.org/exim.git/commitdiff_plain/250b68713b5810a824bb14337b98737b6b81bf53 smtp output, no remote support --- diff --git a/src/src/exim.c b/src/src/exim.c index 121c6c2e3..424806012 100644 --- a/src/src/exim.c +++ b/src/src/exim.c @@ -2519,7 +2519,7 @@ for (i = 1; i < argc; i++) case 'f': { - int start, end; + int dummy_start, dummy_end; uschar *errmess; if (*argrest == 0) { @@ -2527,9 +2527,7 @@ for (i = 1; i < argc; i++) { badarg = TRUE; break; } } if (*argrest == 0) - { sender_address = string_sprintf(""); /* Ensure writeable memory */ - } else { uschar *temp = argrest + Ustrlen(argrest) - 1; @@ -2537,8 +2535,15 @@ for (i = 1; i < argc; i++) if (temp >= argrest && *temp == '.') f_end_dot = TRUE; allow_domain_literals = TRUE; strip_trailing_dot = TRUE; - sender_address = parse_extract_address(argrest, &errmess, &start, &end, - &sender_address_domain, TRUE); +#ifdef EXPERIMENTAL_INTERNATIONAL + allow_utf8_domains = TRUE; +#endif + sender_address = parse_extract_address(argrest, &errmess, + &dummy_start, &dummy_end, &sender_address_domain, TRUE); +#ifdef EXPERIMENTAL_INTERNATIONAL + message_smtputf8 = string_is_utf8(sender_address); + allow_utf8_domains = FALSE; +#endif allow_domain_literals = FALSE; strip_trailing_dot = FALSE; if (sender_address == NULL) @@ -5358,7 +5363,6 @@ while (more) if (recipients_max > 0 && ++rcount > recipients_max && !extract_recipients) - { if (error_handling == ERRORS_STDERR) { fprintf(stderr, "exim: too many recipients\n"); @@ -5370,11 +5374,22 @@ while (more) moan_to_sender(ERRMESS_TOOMANYRECIP, NULL, NULL, stdin, TRUE)? errors_sender_rc : EXIT_FAILURE; } - } +#ifdef EXPERIMENTAL_INTERNATIONAL + { + BOOL b = allow_utf8_domains; + allow_utf8_domains = TRUE; +#endif recipient = parse_extract_address(s, &errmess, &start, &end, &domain, FALSE); +#ifdef EXPERIMENTAL_INTERNATIONAL + if (string_is_utf8(recipient)) + message_smtputf8 = TRUE; + else + allow_utf8_domains = b; + } +#endif if (domain == 0 && !allow_unqualified_recipient) { recipient = NULL; @@ -5474,9 +5489,7 @@ while (more) return_path = string_copy(sender_address); } else - { printf("Return-path = %s\n", (return_path[0] == 0)? US"<>" : return_path); - } printf("Sender = %s\n", (sender_address[0] == 0)? US"<>" : sender_address); receive_add_recipient( diff --git a/src/src/receive.c b/src/src/receive.c index 0b3546317..7c56f47ba 100644 --- a/src/src/receive.c +++ b/src/src/receive.c @@ -2303,9 +2303,23 @@ if (extract_recip) pp = recipient = store_get(ss - s + 1); for (p = s; p < ss; p++) if (*p != '\n') *pp++ = *p; *pp = 0; + +#ifdef EXPERIMENTAL_INTERNATIONAL + { + BOOL b = allow_utf8_domains; + allow_utf8_domains = TRUE; +#endif recipient = parse_extract_address(recipient, &errmess, &start, &end, &domain, FALSE); +#ifdef EXPERIMENTAL_INTERNATIONAL + if (string_is_utf8(recipient)) + message_smtputf8 = TRUE; + else + allow_utf8_domains = b; + } +#endif + /* Keep a list of all the bad addresses so we can send a single error message at the end. However, an empty address is not an error; just ignore it. This can come from an empty group list like diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index ffba14662..ef2650a3e 100644 --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@ -570,6 +570,16 @@ if (*errno_value == ERRNO_WRITEINCOMPLETE) return FALSE; } +#ifdef EXPERIMENTAL_INTERNATIONAL +/* Handle lack of advertised SMTPUTF8, for international message */ +if (*errno_value == ERRNO_UTF8_FWD) + { + *message = US string_sprintf("utf8 support required for forwarding"); + DEBUG(D_deliver|D_transport) debug_printf("%s\n", *message); + return TRUE; + } +#endif + /* Handle error responses from the remote mailer. */ if (buffer[0] != 0) @@ -2524,24 +2534,29 @@ if (!ok) switch(save_errno) { +#ifdef EXPERIMENTAL_INTERNATIONAL + case ERRNO_UTF8_FWD: + code = '5'; + /*FALLTHROUGH*/ +#endif case 0: case ERRNO_MAIL4XX: case ERRNO_DATA4XX: - message_error = TRUE; - break; + message_error = TRUE; + break; case ETIMEDOUT: - message_error = Ustrncmp(smtp_command,"MAIL",4) == 0 || - Ustrncmp(smtp_command,"end ",4) == 0; - break; + message_error = Ustrncmp(smtp_command,"MAIL",4) == 0 || + Ustrncmp(smtp_command,"end ",4) == 0; + break; case ERRNO_SMTPCLOSED: - message_error = Ustrncmp(smtp_command,"end ",4) == 0; - break; + message_error = Ustrncmp(smtp_command,"end ",4) == 0; + break; default: - message_error = FALSE; - break; + message_error = FALSE; + break; } /* Handle the cases that are treated as message errors. These are: @@ -2549,6 +2564,7 @@ if (!ok) (a) negative response or timeout after MAIL (b) negative response after DATA (c) negative response or timeout or dropped connection after "." + (d) utf8 support required and not offered It won't be a negative response or timeout after RCPT, as that is dealt with separately above. The action in all cases is to set an appropriate diff --git a/test/confs/4201 b/test/confs/4201 index 3b87cd5fc..36e38bcd5 100644 --- a/test/confs/4201 +++ b/test/confs/4201 @@ -1,4 +1,7 @@ # Exim test configuration 4201 +# SMTPUTF8 handling + +OPTION = * exim_path = EXIM_PATH host_lookup_order = bydns @@ -20,7 +23,7 @@ queue_only queue_run_in_order .endif -smtputf8_advertise_hosts = * +smtputf8_advertise_hosts = OPTION # ----- ACL ----- @@ -28,6 +31,10 @@ smtputf8_advertise_hosts = * begin acl check_recipient: + +.ifndef SERVER + accept domains = * +.endif accept hosts = : accept domains = +local_domains deny message = relay not permitted @@ -51,10 +58,15 @@ localuser: rmt: driver = manualroute + domains = +local_domains route_data = <;[127.0.0.1]:PORT_D transport = rmt_smtp self = send +hole: + driver = redirect + data = :blackhole: + .endif # ----- Transports ----- diff --git a/test/log/4201 b/test/log/4201 index ebc09936a..7bd340b59 100644 --- a/test/log/4201 +++ b/test/log/4201 @@ -5,6 +5,13 @@ 1999-03-02 09:44:33 10HmbA-0005vi-00 <= 他们为什么不说中文@hebrew.למההםפשוטלאמדבריםעברית.com H=localhost (the.local.host.name) [127.0.0.1] P=utf8esmtp S=sss id=E10HmaZ-0005vi-00@the.local.host.name for usery@test.ex 1999-03-02 09:44:33 10HmaZ-0005vi-00 => usery@test.ex 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 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port 1225 +1999-03-02 09:44:33 10HmbB-0005vi-00 <= यहलोगहिन्दीक्योंनहींबोलसकतेहैं@japanese.なぜみんな日本語を話してくれないのか.com U=CALLER P=utf8local-esmtp S=sss for userz@test.ex +1999-03-02 09:44:33 10HmbB-0005vi-00 ** userz@test.ex R=rmt T=rmt_smtp H=127.0.0.1 [127.0.0.1]: utf8 support required for forwarding +1999-03-02 09:44:33 10HmbC-0005vi-00 <= <> R=10HmbB-0005vi-00 U=EXIMUSER P=local S=sss for यहलोगहिन्दीक्योंनहींबोलसकतेहैं@japanese.なぜみんな日本語を話してくれないのか.com +1999-03-02 09:44:33 10HmbC-0005vi-00 => :blackhole: <यहलोगहिन्दीक्योंनहींबोलसकतेहैं@japanese.なぜみんな日本語を話してくれないのか.com> R=hole +1999-03-02 09:44:33 10HmbC-0005vi-00 Completed +1999-03-02 09:44:33 10HmbB-0005vi-00 Completed 1999-03-02 09:44:33 Start queue run: pid=pppp -qq 1999-03-02 09:44:33 10HmaX-0005vi-00 => :blackhole: R=localuser 1999-03-02 09:44:33 10HmaX-0005vi-00 Completed diff --git a/test/scripts/4200-International/4201 b/test/scripts/4200-International/4201 index 1bb978634..17b97c7e6 100644 --- a/test/scripts/4200-International/4201 +++ b/test/scripts/4200-International/4201 @@ -65,6 +65,25 @@ RCPT TO: DATA Subject: test +body +. +QUIT +**** +# +# +# +killdaemon +exim -DSERVER=server -DOPTION="" -bd -oX PORT_D +**** +# +# forwarding fails when target does not support SMTPUTF8 +exim -bs -odi +EHLO client.ffail +MAIL FROM: <यहलोगहिन्दीक्योंनहींबोलसकतेहैं@japanese.なぜみんな日本語を話してくれないのか.com> SMTPUTF8 +RCPT TO: +DATA +Subject: test + body . QUIT diff --git a/test/stdout/4201 b/test/stdout/4201 index 8b89b2bd3..e5f488632 100644 --- a/test/stdout/4201 +++ b/test/stdout/4201 @@ -80,3 +80,15 @@ End of script 354 Enter message, ending with "." on a line by itself 250 OK id=10HmaZ-0005vi-00 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 +354 Enter message, ending with "." on a line by itself +250 OK id=10HmbB-0005vi-00 +221 the.local.host.name closing connection