Honour the outcome of parse_extract_address(), testsuite 471
authorHeiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>
Mon, 19 Apr 2021 20:23:14 +0000 (22:23 +0200)
committerHeiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>
Thu, 27 May 2021 19:31:00 +0000 (21:31 +0200)
(cherry picked from commit 39d83bf19fc0c4364e0a665360b14194c62e4ab4)

src/src/exim.c
src/src/receive.c
src/src/rewrite.c
test/log/0471
test/scripts/0000-Basic/0471
test/stderr/0471

index a5f0bd578e5ba192f1582c0c06dfa9cf52b89eaa..6a9a1477f21e5774fe315050eab5e0373ce00ef3 100644 (file)
@@ -5593,11 +5593,12 @@ while (more)
           parse_extract_address(s, &errmess, &start, &end, &domain, FALSE);
 
 #ifdef SUPPORT_I18N
-       if (string_is_utf8(recipient))
-         message_smtputf8 = TRUE;
-       else
-         allow_utf8_domains = b;
+        if (recipient)
+          if (string_is_utf8(recipient)) message_smtputf8 = TRUE;
+          else allow_utf8_domains = b;
        }
+#else
+        ;
 #endif
         if (domain == 0 && !f.allow_unqualified_recipient)
           {
index 750744016e811a94a0e254139b9d7d502890681e..2223d46452fc43184f3f9e36e0c27c6f2e587a78 100644 (file)
@@ -2561,11 +2561,12 @@ if (extract_recip)
           &domain, FALSE);
 
 #ifdef SUPPORT_I18N
-       if (string_is_utf8(recipient))
-         message_smtputf8 = TRUE;
-       else
-         allow_utf8_domains = b;
+        if (recipient)
+          if (string_is_utf8(recipient)) message_smtputf8 = TRUE;
+          else allow_utf8_domains = b;
        }
+#else
+        ;
 #endif
 
         /* Keep a list of all the bad addresses so we can send a single
index ab5f78020ecdff3dd35947ac558f02daff3f9694..f40c73c5120e18cc49f45d2b3c71fc1d48915335 100644 (file)
@@ -468,8 +468,9 @@ while (*s)
   {
   uschar *sprev;
   uschar *ss = parse_find_address_end(s, FALSE);
-  uschar *recipient, *new, *errmess;
+  uschar *recipient, *new;
   rmark loop_reset_point = store_mark();
+  uschar *errmess = NULL;
   BOOL changed = FALSE;
   int terminator = *ss;
   int start, end, domain;
@@ -486,10 +487,19 @@ while (*s)
   while (isspace(*s)) s++;
 
   /* There isn't much we can do for syntactic disasters at this stage.
-  Pro tem (possibly for ever) ignore them. */
+  Pro tem (possibly for ever) ignore them.
+  If we got nothing, they there was any sort of error: non-parsable address,
+  empty address, overlong addres. Sometimes the result matters, sometimes not.
+  It seems this function is called for *any* header we see. */
+
 
   if (!recipient)
     {
+    if (rewrite_rules || routed_old)
+      {
+      log_write(0, LOG_MAIN, "rewrite: %s", errmess);
+      exim_exit(EXIT_FAILURE);
+      }
     loop_reset_point = store_reset(loop_reset_point);
     continue;
     }
index fc09b469215fba044c6c1b79a55caeadc185c1dd..96d49574813e0449b57ecd5a8abfe7baa6368fc9 100644 (file)
@@ -1,3 +1,4 @@
 1999-03-02 09:44:33 10HmaX-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local S=sss for r1@test.ex
 1999-03-02 09:44:33 10HmaY-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local S=sss for r2@test.ex
 1999-03-02 09:44:33 10HmaZ-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local S=sss for r3@test.ex
+1999-03-02 09:44:33 10HmbA-0005vi-00 rewrite: address is ridiculously long: localpart_with_256_chars_567890123456789012345678901234567890123...
index e01ca28d22736f714072030cae8ed57b023217dc..9cf52943fd559e5ca6b38ae7ff14ec4ab0d07109 100644 (file)
@@ -167,6 +167,10 @@ exim -d -odq r2@test.ex
 To: localpart_with_056_chars_56789012345678901234567890123456@test.example
 ****
 exim -d -odq r3@test.ex
+To: localpart_with_236_chars_56789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@test.example
+****
+1
+exim -d -odq r4@test.ex
 To: localpart_with_256_chars_5678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@test.example
 ****
 no_msglog_check
index 76b9b4a56c1de9ccb530e2b1bf7ab64f66388ccf..070b8447c973feda142c0554aba696a7fae94b60 100644 (file)
@@ -25894,7 +25894,7 @@ Recipients:
   r3@test.ex
 search_tidyup called
 >>Headers received:
-To: localpart_with_256_chars_5678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@test.example
+To: localpart_with_236_chars_56789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@test.example
 
 address match test: subject=r3@test.ex pattern=^.{40,}@*
 r3@test.ex in "^.{40,}@*"? no (end of list)
@@ -25953,11 +25953,11 @@ CALLER@myhost.test.ex in "*@*"? yes (matched "*@*")
  lookup failed
 rewritten sender = CALLER@myhost.test.ex
 rewrite_one_header: type=T:
-  To: localpart_with_256_chars_5678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@test.example
-address match test: subject=localpart_with_256_chars_5678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@test.example pattern=^.{40,}@*
-localpart_with_256_chars_5678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@test.example in "^.{40,}@*"? yes (matched "^.{40,}@*")
+  To: localpart_with_236_chars_56789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@test.example
+address match test: subject=localpart_with_236_chars_56789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@test.example pattern=^.{40,}@*
+localpart_with_236_chars_56789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@test.example in "^.{40,}@*"? yes (matched "^.{40,}@*")
 LOG: address_rewrite MAIN
-  "localpart_with_256_chars_5678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@test.example" from to: rewritten as "deny_me@test.example" by rule 1
+  "localpart_with_236_chars_56789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@test.example" from to: rewritten as "deny_me@test.example" by rule 1
 address match test: subject=deny_me@test.example pattern=*@*
 test.example in "*"? yes (matched "*")
 deny_me@test.example in "*@*"? yes (matched "*@*")
@@ -26012,7 +26012,7 @@ CALLER@myhost.test.ex in "*@*"? yes (matched "*@*")
  lookup failed
 search_tidyup called
 >>Headers after rewriting and local additions:
-* To: localpart_with_256_chars_5678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@test.example
+* To: localpart_with_236_chars_56789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@test.example
 T To: deny_me@rwtest.example
 I Message-Id: <E10HmaZ-0005vi-00@myhost.test.ex>
 F From: CALLER_NAME <CALLER@myhost.test.ex>
@@ -26034,3 +26034,80 @@ LOG: MAIN
   <= CALLER@myhost.test.ex U=CALLER P=local S=sss
 search_tidyup called
 >>>>>>>>>>>>>>>> Exim pid=pppp (fresh-exec) terminating with rc=0 >>>>>>>>>>>>>>>>
+Exim version x.yz ....
+changed uid/gid: forcing real = effective
+  uid=uuuu gid=CALLER_GID pid=pppp
+configuration file is TESTSUITE/test-config
+admin user
+changed uid/gid: privilege not needed
+  uid=EXIM_UID gid=EXIM_GID pid=pppp
+originator: uid=CALLER_UID gid=CALLER_GID login=CALLER name=CALLER_NAME
+sender address = CALLER@myhost.test.ex
+set_process_info: pppp accepting a local non-SMTP message from <CALLER@myhost.test.ex>
+spool directory space = nnnnnK inodes = nnnnn check_space = 10240K inodes = 100 msg_size = 0
+log directory space = nnnnnK inodes = nnnnn check_space = 10240K inodes = 100
+Sender: CALLER@myhost.test.ex
+Recipients:
+  r4@test.ex
+search_tidyup called
+>>Headers received:
+To: localpart_with_256_chars_5678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@test.example
+
+address match test: subject=r4@test.ex pattern=^.{40,}@*
+r4@test.ex in "^.{40,}@*"? no (end of list)
+address match test: subject=r4@test.ex pattern=*@*
+test.ex in "*"? yes (matched "*")
+r4@test.ex in "*@*"? yes (matched "*@*")
+ search_open: lsearch "TESTSUITE/aux-fixed/0471.rw"
+ search_find: file="TESTSUITE/aux-fixed/0471.rw"
+   key="test.ex" partial=2 affix=*. starflags=0 opts=NULL
+ LRU list:
+   0TESTSUITE/aux-fixed/0471.rw
+   End
+ internal_search_find: file="TESTSUITE/aux-fixed/0471.rw"
+   type=lsearch key="test.ex" opts=NULL
+ file lookup required for test.ex
+   in TESTSUITE/aux-fixed/0471.rw
+ lookup failed
+ trying partial match *.test.ex
+ internal_search_find: file="TESTSUITE/aux-fixed/0471.rw"
+   type=lsearch key="*.test.ex" opts=NULL
+ file lookup required for *.test.ex
+   in TESTSUITE/aux-fixed/0471.rw
+ lookup failed
+address match test: subject=CALLER@myhost.test.ex pattern=^.{40,}@*
+CALLER@myhost.test.ex in "^.{40,}@*"? no (end of list)
+address match test: subject=CALLER@myhost.test.ex pattern=*@*
+myhost.test.ex in "*"? yes (matched "*")
+CALLER@myhost.test.ex in "*@*"? yes (matched "*@*")
+ search_open: lsearch "TESTSUITE/aux-fixed/0471.rw"
+   cached open
+ search_find: file="TESTSUITE/aux-fixed/0471.rw"
+   key="myhost.test.ex" partial=2 affix=*. starflags=0 opts=NULL
+ LRU list:
+   0TESTSUITE/aux-fixed/0471.rw
+   End
+ internal_search_find: file="TESTSUITE/aux-fixed/0471.rw"
+   type=lsearch key="myhost.test.ex" opts=NULL
+ file lookup required for myhost.test.ex
+   in TESTSUITE/aux-fixed/0471.rw
+ lookup failed
+ trying partial match *.myhost.test.ex
+ internal_search_find: file="TESTSUITE/aux-fixed/0471.rw"
+   type=lsearch key="*.myhost.test.ex" opts=NULL
+ file lookup required for *.myhost.test.ex
+   in TESTSUITE/aux-fixed/0471.rw
+ lookup failed
+ trying partial match *.test.ex
+ internal_search_find: file="TESTSUITE/aux-fixed/0471.rw"
+   type=lsearch key="*.test.ex" opts=NULL
+ cached data used for lookup of *.test.ex
+   in TESTSUITE/aux-fixed/0471.rw
+ lookup failed
+rewritten sender = CALLER@myhost.test.ex
+rewrite_one_header: type=T:
+  To: localpart_with_256_chars_5678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@test.example
+LOG: MAIN
+  rewrite: address is ridiculously long: localpart_with_256_chars_567890123456789012345678901234567890123...
+search_tidyup called
+>>>>>>>>>>>>>>>> Exim pid=pppp (fresh-exec) terminating with rc=1 >>>>>>>>>>>>>>>>