From 92b922fae5bbd5a70da4c5aa2f43a457842c30eb Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Tue, 27 Aug 2019 17:44:52 +0100 Subject: [PATCH] Fix ${domain:} for a bare local-part input. Bug 2375 Broken-by: cebd5bd2ab (cherry picked from commit c5b0340697326238b0e2afd9d341185077d60d35) --- src/src/expand.c | 11 ++++++----- test/scripts/0000-Basic/0002 | 2 ++ test/stdout/0002 | 2 ++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/src/expand.c b/src/src/expand.c index fbb2dfb14..0a8c5fbc0 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -7151,11 +7151,12 @@ while (*s != 0) uschar * t = parse_extract_address(sub, &error, &start, &end, &domain, FALSE); if (t) - yield = c == EOP_DOMAIN - ? string_cat(yield, t + domain) - : c == EOP_LOCAL_PART && domain > 0 - ? string_catn(yield, t, domain - 1 ) - : string_cat(yield, t); + if (c != EOP_DOMAIN) + yield = c == EOP_LOCAL_PART && domain > 0 + ? string_catn(yield, t, domain - 1) + : string_cat(yield, t); + else if (domain > 0) + yield = string_cat(yield, t + domain); continue; } diff --git a/test/scripts/0000-Basic/0002 b/test/scripts/0000-Basic/0002 index e4ba4ec3e..86404f6b7 100644 --- a/test/scripts/0000-Basic/0002 +++ b/test/scripts/0000-Basic/0002 @@ -169,6 +169,7 @@ addrss: ${address:Exim Person <(comment)local-part@dom.ain(comment2)> (that's me domain: ${domain:local-part@dom.ain} domain: ${domain:Exim Person (that's me)} domain: ${domain:Exim Person (that's me)} +domain: ${domain:a.b.c} addresses: ${addresses:>' 'abc@xyz, 'pqr@xyz} addresses: ${addresses:Exim Person (that's me)} @@ -255,6 +256,7 @@ length: ${length_10:The quick brown fox} ${l_10:abc} lclpt: ${local_part:local-part@dom.ain} lclpt: ${local_part:Exim Person (that's me)} lclpt: ${local_part:Exim Person (that's me)} +lclpt: ${local_part:a.b.c} quote: ${quote:aZ09_.-Q} ${quote:ab*cd} ${quote:ab\cd"ef} quote: ${quote:nl(\n)} quote: ${quote:cr(\r)} diff --git a/test/stdout/0002 b/test/stdout/0002 index 7ee82ca98..a29296ca4 100644 --- a/test/stdout/0002 +++ b/test/stdout/0002 @@ -161,6 +161,7 @@ > domain: dom.ain > domain: dom.ain > domain: dom.ain +> domain: > > addresses: ''abc@xyz' ''pqr@xyz > addresses: local-part@dom.ain @@ -237,6 +238,7 @@ newline tab\134backslash ~tilde\177DEL\200\201. > lclpt: local-part > lclpt: local-part > lclpt: local.part +> lclpt: a.b.c > quote: aZ09_.-Q "ab*cd" "abcd\"ef" > quote: "nl(\n)" > quote: "cr(\r)" -- 2.30.2