[exim-cvs] smtp output, no remote support

Top Page
Delete this message
Reply to this message
Author: Exim Git Commits Mailing List
Date:  
To: exim-cvs
Subject: [exim-cvs] smtp output, no remote support
Gitweb: http://git.exim.org/exim.git/commitdiff/250b68713b5810a824bb14337b98737b6b81bf53
Commit:     250b68713b5810a824bb14337b98737b6b81bf53
Parent:     7ade712cc84d7f822f04baf2f46daee81701174d
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Mon Apr 6 14:07:31 2015 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Sun Apr 12 19:20:13 2015 +0100


    smtp output, no remote support
---
 src/src/exim.c                       |   31 ++++++++++++++++++++++---------
 src/src/receive.c                    |   14 ++++++++++++++
 src/src/transports/smtp.c            |   34 +++++++++++++++++++++++++---------
 test/confs/4201                      |   14 +++++++++++++-
 test/log/4201                        |    7 +++++++
 test/scripts/4200-International/4201 |   19 +++++++++++++++++++
 test/stdout/4201                     |   12 ++++++++++++
 7 files changed, 112 insertions(+), 19 deletions(-)


diff --git a/src/src/exim.c b/src/src/exim.c
index 121c6c2..4248060 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 0b35463..7c56f47 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 ffba146..ef2650a 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 3b87cd5..36e38bc 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 ebc0993..7bd340b 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@??? for usery@???
1999-03-02 09:44:33 10HmaZ-0005vi-00 => usery@??? 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@???
+1999-03-02 09:44:33 10HmbB-0005vi-00 ** userz@??? 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: <userx@???> 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 1bb9786..17b97c7 100644
--- a/test/scripts/4200-International/4201
+++ b/test/scripts/4200-International/4201
@@ -73,6 +73,25 @@ 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: <userz@???>
+DATA
+Subject: test
+
+body
+.
+QUIT
+****
+#
+#
+#
+killdaemon
exim -DSERVER=server -qq
****
no_msglog_check
diff --git a/test/stdout/4201 b/test/stdout/4201
index 8b89b2b..e5f4886 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