summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2017-01-24 18:17:10 +0000
committerJeremy Harris <jgh146exb@wizmail.org>2017-01-24 18:17:10 +0000
commitd7a2c8337f7b615763d4429ab27653862756b6fb (patch)
tree2773466acc4e142d3be96b9f30ab139e2d7ac5cc
parent4c0899659502d1ab14f30b02ec78261728caf9c8 (diff)
Fix reception of (quoted) local-parts with embedded spaces. Bug 2025
-rw-r--r--src/src/smtp_in.c8
-rw-r--r--test/confs/057931
-rw-r--r--test/scripts/0000-Basic/057928
3 files changed, 66 insertions, 1 deletions
diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c
index 9c647efda..8de12156d 100644
--- a/src/src/smtp_in.c
+++ b/src/src/smtp_in.c
@@ -1674,7 +1674,13 @@ uschar *n;
uschar *v = smtp_cmd_data + Ustrlen(smtp_cmd_data) - 1;
while (isspace(*v)) v--;
v[1] = 0;
-while (v > smtp_cmd_data && *v != '=' && !isspace(*v)) v--;
+while (v > smtp_cmd_data && *v != '=' && !isspace(*v))
+ {
+ /* Take care to not stop at a space embedded in a quoted local-part */
+
+ if (*v == '"') do v--; while (*v != '"' && v > smtp_cmd_data+1);
+ v--;
+ }
n = v;
if (*v == '=')
diff --git a/test/confs/0579 b/test/confs/0579
new file mode 100644
index 000000000..5e61752ab
--- /dev/null
+++ b/test/confs/0579
@@ -0,0 +1,31 @@
+# Exim test configuration 0579
+
+.include DIR/aux-var/std_conf_prefix
+
+primary_hostname = myhost.test.ex
+
+# ----- Main settings -----
+
+domainlist local_domains = test.ex
+log_selector = +received_recipients
+
+acl_smtp_rcpt = accept logwrite=cmd '$smtp_command'
+
+# ------ ACLs ------
+
+begin acl
+
+# ------ Routers ------
+
+begin routers
+
+r1:
+ driver = redirect
+ data = :blackhole:
+
+
+# ------ Transports ------
+
+begin transports
+
+# End
diff --git a/test/scripts/0000-Basic/0579 b/test/scripts/0000-Basic/0579
new file mode 100644
index 000000000..7a5f3ff6f
--- /dev/null
+++ b/test/scripts/0000-Basic/0579
@@ -0,0 +1,28 @@
+# local-part with space, esmtp reception
+#
+exim -DSERVER=server -bd -oX PORT_D
+****
+#
+client 127.0.0.1 PORT_D
+??? 220
+EHLO test
+??? 250-
+??? 250-
+??? 250-
+??? 250-
+??? 250 HELP
+MAIL FROM:<>
+??? 250
+RCPT TO:<"name with spaces"@test.ex>
+??? 250
+DATA
+??? 354
+Subject: test
+
+body
+.
+??? 250
+QUIT
+??? 221
+****
+killdaemon