Fix ${domain:} for a bare local-part input. Bug 2375
authorJeremy Harris <jgh146exb@wizmail.org>
Tue, 27 Aug 2019 16:44:52 +0000 (17:44 +0100)
committerJeremy Harris <jgh146exb@wizmail.org>
Tue, 27 Aug 2019 16:44:52 +0000 (17:44 +0100)
Broken-by: e2ff8e24f4
src/src/expand.c
test/scripts/0000-Basic/0002
test/stdout/0002

index 205ac33f09838674f9b215bdda5712dd25be388c..f38d7a49232d9665190774a278f19336f00e2c4e 100644 (file)
@@ -7206,11 +7206,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;
         }
 
index 8e654ac95fa4fb2b003e405e7fe6e4ef7ad516db..2bf8f164e3f79ba5847527493fcb67e21403ce4f 100644 (file)
@@ -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 <local-part@dom.ain> (that's me)}
 domain: ${domain:Exim Person <local-part(foo)@(bar)dom.ain> (that's me)}
+domain: ${domain:a.b.c}
 
 addresses: ${addresses:>' 'abc@xyz, 'pqr@xyz}
 addresses: ${addresses:Exim Person <local-part@dom.ain> (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 <local-part@dom.ain> (that's me)}
 lclpt:  ${local_part:Exim Person <local(comment).part@dom.(comment2)ain> (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)}
index 6319fdc655e055cd69d2d0d333504780d8e09303..01e96fe78cffcc33f00567b58c777fcf47c06aa5 100644 (file)
 > 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)"