[exim-cvs] Honour the outcome of parse_extract_address(), t…

Inizio della pagina
Delete this message
Reply to this message
Autore: Exim Git Commits Mailing List
Data:  
To: exim-cvs
Oggetto: [exim-cvs] Honour the outcome of parse_extract_address(), testsuite 471
Gitweb: https://git.exim.org/exim.git/commitdiff/84227d174eec333d01ff494695bea0febf11575e
Commit:     84227d174eec333d01ff494695bea0febf11575e
Parent:     9370c62082c6596c3eaf5dcf6c0b29cf002bd321
Author:     Heiko Schlittermann (HS12-RIPE) <hs@???>
AuthorDate: Mon Apr 19 22:23:14 2021 +0200
Committer:  Heiko Schlittermann (HS12-RIPE) <hs@???>
CommitDate: Thu May 27 21:31:00 2021 +0200


    Honour the outcome of parse_extract_address(), testsuite 471


    (cherry picked from commit 39d83bf19fc0c4364e0a665360b14194c62e4ab4)
---
 src/src/exim.c               |  9 +++--
 src/src/receive.c            |  9 +++--
 src/src/rewrite.c            | 14 ++++++-
 test/log/0471                |  1 +
 test/scripts/0000-Basic/0471 |  4 ++
 test/stderr/0471             | 89 +++++++++++++++++++++++++++++++++++++++++---
 6 files changed, 110 insertions(+), 16 deletions(-)


diff --git a/src/src/exim.c b/src/src/exim.c
index a5f0bd5..6a9a147 100644
--- a/src/src/exim.c
+++ b/src/src/exim.c
@@ -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)
           {
diff --git a/src/src/receive.c b/src/src/receive.c
index 7507440..2223d46 100644
--- a/src/src/receive.c
+++ b/src/src/receive.c
@@ -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
diff --git a/src/src/rewrite.c b/src/src/rewrite.c
index ab5f780..f40c73c 100644
--- a/src/src/rewrite.c
+++ b/src/src/rewrite.c
@@ -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;
     }
diff --git a/test/log/0471 b/test/log/0471
index fc09b46..96d4957 100644
--- a/test/log/0471
+++ b/test/log/0471
@@ -1,3 +1,4 @@
 1999-03-02 09:44:33 10HmaX-0005vi-00 <= CALLER@??? U=CALLER P=local S=sss for r1@???
 1999-03-02 09:44:33 10HmaY-0005vi-00 <= CALLER@??? U=CALLER P=local S=sss for r2@???
 1999-03-02 09:44:33 10HmaZ-0005vi-00 <= CALLER@??? U=CALLER P=local S=sss for r3@???
+1999-03-02 09:44:33 10HmbA-0005vi-00 rewrite: address is ridiculously long: localpart_with_256_chars_567890123456789012345678901234567890123...
diff --git a/test/scripts/0000-Basic/0471 b/test/scripts/0000-Basic/0471
index e01ca28..9cf5294 100644
--- a/test/scripts/0000-Basic/0471
+++ b/test/scripts/0000-Basic/0471
@@ -167,6 +167,10 @@ exim -d -odq r2@???
 To: localpart_with_056_chars_56789012345678901234567890123456@???
 ****
 exim -d -odq r3@???
+To: localpart_with_236_chars_56789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@???
+****
+1
+exim -d -odq r4@???
 To: localpart_with_256_chars_5678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@???
 ****
 no_msglog_check
diff --git a/test/stderr/0471 b/test/stderr/0471
index 76b9b4a..070b844 100644
--- a/test/stderr/0471
+++ b/test/stderr/0471
@@ -25894,7 +25894,7 @@ Recipients:
   r3@???
 search_tidyup called

>>Headers received:

-To: localpart_with_256_chars_5678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@???
+To: localpart_with_236_chars_56789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@???

address match test: subject=r3@??? pattern=^.{40,}@*
r3@??? in "^.{40,}@*"? no (end of list)
@@ -25953,11 +25953,11 @@ CALLER@??? in "*@*"? yes (matched "*@*")
lookup failed
rewritten sender = CALLER@???
rewrite_one_header: type=T:
- To: localpart_with_256_chars_5678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@???
-address match test: subject=localpart_with_256_chars_5678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@??? pattern=^.{40,}@*
-localpart_with_256_chars_5678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@??? in "^.{40,}@*"? yes (matched "^.{40,}@*")
+ To: localpart_with_236_chars_56789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@???
+address match test: subject=localpart_with_236_chars_56789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@??? pattern=^.{40,}@*
+localpart_with_236_chars_56789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@??? in "^.{40,}@*"? yes (matched "^.{40,}@*")
LOG: address_rewrite MAIN
- "localpart_with_256_chars_5678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@???" from to: rewritten as "deny_me@???" by rule 1
+ "localpart_with_236_chars_56789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@???" from to: rewritten as "deny_me@???" by rule 1
address match test: subject=deny_me@??? pattern=*@*
test.example in "*"? yes (matched "*")
deny_me@??? in "*@*"? yes (matched "*@*")
@@ -26012,7 +26012,7 @@ CALLER@??? in "*@*"? yes (matched "*@*")
lookup failed
search_tidyup called
>>Headers after rewriting and local additions:

-* To: localpart_with_256_chars_5678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@???
+* To: localpart_with_236_chars_56789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@???
T To: deny_me@???
I Message-Id: <E10HmaZ-0005vi-00@???>
F From: CALLER_NAME <CALLER@???>
@@ -26034,3 +26034,80 @@ LOG: MAIN
<= CALLER@??? 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@???
+set_process_info: pppp accepting a local non-SMTP message from <CALLER@???>
+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@???
+Recipients:
+ r4@???
+search_tidyup called
+>>Headers received:
+To: localpart_with_256_chars_5678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@???
+
+address match test: subject=r4@??? pattern=^.{40,}@*
+r4@??? in "^.{40,}@*"? no (end of list)
+address match test: subject=r4@??? pattern=*@*
+test.ex in "*"? yes (matched "*")
+r4@??? 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@??? pattern=^.{40,}@*
+CALLER@??? in "^.{40,}@*"? no (end of list)
+address match test: subject=CALLER@??? pattern=*@*
+myhost.test.ex in "*"? yes (matched "*")
+CALLER@??? 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@???
+rewrite_one_header: type=T:
+ To: localpart_with_256_chars_5678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@???
+LOG: MAIN
+ rewrite: address is ridiculously long: localpart_with_256_chars_567890123456789012345678901234567890123...
+search_tidyup called
+>>>>>>>>>>>>>>>> Exim pid=pppp (fresh-exec) terminating with rc=1 >>>>>>>>>>>>>>>>