summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>2021-04-19 22:23:14 +0200
committerHeiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>2021-04-28 00:40:54 +0200
commit39d83bf19fc0c4364e0a665360b14194c62e4ab4 (patch)
treeb1036bd247f75c9c7d8f08bc061bd97f46444ce9
parent611143d73ce446cb34c44e3dac2c7f321acaa225 (diff)
downloadexim4-39d83bf19fc0c4364e0a665360b14194c62e4ab4.tar.gz
Honour the outcome of parse_extract_address(), testsuite 471
-rw-r--r--src/src/exim.c9
-rw-r--r--src/src/receive.c9
-rw-r--r--src/src/rewrite.c15
-rw-r--r--test/log/04711
-rw-r--r--test/scripts/0000-Basic/04714
-rw-r--r--test/stderr/047189
6 files changed, 111 insertions, 16 deletions
diff --git a/src/src/exim.c b/src/src/exim.c
index 29e457fe2..ee75739ec 100644
--- a/src/src/exim.c
+++ b/src/src/exim.c
@@ -5540,11 +5540,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 cf3ef4b96..6eec73e2b 100644
--- a/src/src/receive.c
+++ b/src/src/receive.c
@@ -2562,11 +2562,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 db9a3ff07..781a2a33c 100644
--- a/src/src/rewrite.c
+++ b/src/src/rewrite.c
@@ -471,8 +471,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;
@@ -483,16 +484,26 @@ while (*s)
*ss = 0;
recipient = parse_extract_address(s,&errmess,&start,&end,&domain,FALSE);
+
*ss = terminator;
sprev = s;
s = ss + (terminator? 1:0);
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 fc09b4692..96d495748 100644
--- a/test/log/0471
+++ b/test/log/0471
@@ -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...
diff --git a/test/scripts/0000-Basic/0471 b/test/scripts/0000-Basic/0471
index e01ca28d2..9cf52943f 100644
--- a/test/scripts/0000-Basic/0471
+++ b/test/scripts/0000-Basic/0471
@@ -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
diff --git a/test/stderr/0471 b/test/stderr/0471
index 8fd0a8660..574cb02db 100644
--- a/test/stderr/0471
+++ b/test/stderr/0471
@@ -25882,7 +25882,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)
@@ -25937,11 +25937,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 "*@*")
@@ -25995,7 +25995,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>
@@ -26016,3 +26016,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 >>>>>>>>>>>>>>>>