testcases for value return
authorJeremy Harris <jgh146exb@wizmail.org>
Wed, 6 May 2020 14:19:24 +0000 (15:19 +0100)
committerJeremy Harris <jgh146exb@wizmail.org>
Wed, 6 May 2020 15:16:24 +0000 (16:16 +0100)
doc/doc-docbook/spec.xfpt
src/src/match.c
test/confs/0624 [new file with mode: 0644]
test/log/0624 [new file with mode: 0644]
test/rejectlog/0624 [new file with mode: 0644]
test/scripts/0000-Basic/0624 [new file with mode: 0644]
test/stderr/0362
test/stderr/5204
test/stdout/0624 [new file with mode: 0644]

index a05ad66500c41b18652aac93a40d759523347763..33e07db0a833fc18bd1ca0b83e15c1749beadf9b 100644 (file)
@@ -8528,7 +8528,7 @@ possible to use the same configuration file on several different hosts that
 differ only in their names.
 
 .new
-The value for a match will be the primary host name/
+The value for a match will be the primary host name.
 .wen
 
 
@@ -8541,7 +8541,8 @@ in square brackets (as in an email address that contains a domain literal), but
 only if that IP address is recognized as local for email routing purposes. The
 &%local_interfaces%& and &%extra_local_interfaces%& options can be used to
 control which of a host's several IP addresses are treated as local.
-In today's Internet, the use of domain literals is controversial.
+In today's Internet, the use of domain literals is controversial;
+see the &%allow_domain_literals%& main option.
 
 .new
 The value for a match will be the &`@[]`& string.
index db02b37bd519c3c050e8aa413681361b00a0dc9f..f9b539d10e87ca931a5d033ef1d0ecfe8341800d 100644 (file)
@@ -160,7 +160,7 @@ if (pattern[0] == '*')
     expand_nlength[expand_setup] = slen - patlen;
     expand_nmax = expand_setup;
     }
-  if (valueptr) *valueptr = pattern;   /* "value" gets the pattern */
+  if (valueptr) *valueptr = pattern - 1;       /* "value" gets the (original) pattern */
   return OK;
   }
 
diff --git a/test/confs/0624 b/test/confs/0624
new file mode 100644 (file)
index 0000000..d6f00b3
--- /dev/null
@@ -0,0 +1,23 @@
+# Exim test configuration 0624
+
+.include DIR/aux-var/std_conf_prefix
+
+
+# ----- Main settings -----
+
+primary_hostname = primaryhostname.ex
+hosts_treat_as_local = 46.test.ex
+allow_domain_literals
+
+acl_smtp_rcpt = chk_rcpt
+
+# ----- ACL -----
+
+begin acl
+
+chk_rcpt:
+  accept       domains = OPT
+               logwrite = domain $domain
+               logwrite = value $domain_data
+
+# End
diff --git a/test/log/0624 b/test/log/0624
new file mode 100644 (file)
index 0000000..3622b9f
--- /dev/null
@@ -0,0 +1,13 @@
+1999-03-02 09:44:33 U=CALLER F=<testclient@primaryhostname.ex> rejected RCPT <a@notmatched.ex>
+1999-03-02 09:44:33 domain plainstring.ex
+1999-03-02 09:44:33 value plainstring.ex
+1999-03-02 09:44:33 domain headtail.ex
+1999-03-02 09:44:33 value *tail.ex
+1999-03-02 09:44:33 domain headregextail.ex
+1999-03-02 09:44:33 value ^.*regex
+1999-03-02 09:44:33 domain primaryhostname.ex
+1999-03-02 09:44:33 value primaryhostname.ex
+1999-03-02 09:44:33 domain [127.0.0.1]
+1999-03-02 09:44:33 value @[]
+1999-03-02 09:44:33 domain mx46.test.ex
+1999-03-02 09:44:33 value @mx_any/ignore=1.1.1.1
diff --git a/test/rejectlog/0624 b/test/rejectlog/0624
new file mode 100644 (file)
index 0000000..86b0ed7
--- /dev/null
@@ -0,0 +1 @@
+1999-03-02 09:44:33 U=CALLER F=<testclient@primaryhostname.ex> rejected RCPT <a@notmatched.ex>
diff --git a/test/scripts/0000-Basic/0624 b/test/scripts/0000-Basic/0624
new file mode 100644 (file)
index 0000000..d4e5acb
--- /dev/null
@@ -0,0 +1,69 @@
+# domainlist match values
+#
+exim -bs -DOPT=:
+HELO test
+MAIL FROM:<testclient>
+RCPT TO:<a@notmatched.ex>
+QUIT
+****
+#
+exim -bs '-DOPT=notthis : plainstring.ex : nothiseither'
+HELO test
+MAIL FROM:<testclient>
+RCPT TO:<a@plainstring.ex>
+QUIT
+****
+#
+exim -bs '-DOPT=notthis : *tail.ex : nothiseither'
+HELO test
+MAIL FROM:<testclient>
+RCPT TO:<a@headtail.ex>
+QUIT
+****
+#
+exim -bs '-DOPT=notthis : ^.*regex : nothiseither'
+HELO test
+MAIL FROM:<testclient>
+RCPT TO:<a@headregextail.ex>
+QUIT
+****
+#
+exim -bs '-DOPT=notthis : @ : nothiseither'
+HELO test
+MAIL FROM:<testclient>
+RCPT TO:<a@primaryhostname.ex>
+QUIT
+****
+#
+#
+exim -bs '-DOPT=notthis : @[] : nothiseither'
+HELO test
+MAIL FROM:<testclient>
+RCPT TO:<a@[127.0.0.1]>
+QUIT
+****
+#
+# malformed
+exim -bs '-DOPT=notthis : @[] : nothiseither'
+HELO test
+MAIL FROM:<testclient>
+RCPT TO:<a@127.0.0.1]>
+QUIT
+****
+#
+# malformed
+exim -bs '-DOPT=notthis : @[] : nothiseither'
+HELO test
+MAIL FROM:<testclient>
+RCPT TO:<a@[127.0.0.1>
+QUIT
+****
+#
+#
+exim -bs '-DOPT=notthis : @mx_any/ignore=1.1.1.1 : nothiseither'
+HELO test
+MAIL FROM:<testclient>
+RCPT TO:<a@mx46.test.ex>
+QUIT
+****
+#
index 7433c9d046d4c98e7eb1a3d3d7ad901e9dc4a93c..79725a0fa5b7eff6dfe60d0f67e40ae840f4a465 100644 (file)
@@ -62,7 +62,7 @@ r1 router skipped: domains mismatch
 local_part=x domain=x.test.ex
 checking domains
 x.test.ex in "*.test.ex"? yes (matched "*.test.ex")
-data from lookup saved for cache for +local_domains: key 'x.test.ex' value '.test.ex'
+data from lookup saved for cache for +local_domains: key 'x.test.ex' value '*.test.ex'
 x.test.ex in "+local_domains"? yes (matched "+local_domains")
 calling r2 router
 r2 router called for x@x.test.ex
@@ -71,7 +71,7 @@ set transport t2
 queued for t2 transport: local_part = x
 domain = x.test.ex
   errors_to=NULL
-  domain_data=.test.ex localpart_data=NULL
+  domain_data=*.test.ex localpart_data=NULL
 routed by r2 router
   envelope to: x@x.test.ex
   transport: t2
index 81fede5b65f8d325c3db60694f61d6d5c0ace1ae..27b40de677277633e4cbaf030aad14ffbe726f36 100644 (file)
@@ -220,7 +220,7 @@ set transport null
 queued for null transport: local_part = postmaster
 domain = test.ex
   errors_to=NULL
-  domain_data=NULL localpart_data=NULL
+  domain_data=NULL localpart_data=postmaster
 routed by pm router
   envelope to: postmaster@test.ex
   transport: null
diff --git a/test/stdout/0624 b/test/stdout/0624
new file mode 100644 (file)
index 0000000..c59ed78
--- /dev/null
@@ -0,0 +1,45 @@
+220 primaryhostname.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000\r
+250 primaryhostname.ex Hello CALLER at test\r
+250 OK\r
+550 Administrative prohibition\r
+221 primaryhostname.ex closing connection\r
+220 primaryhostname.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000\r
+250 primaryhostname.ex Hello CALLER at test\r
+250 OK\r
+250 Accepted\r
+221 primaryhostname.ex closing connection\r
+220 primaryhostname.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000\r
+250 primaryhostname.ex Hello CALLER at test\r
+250 OK\r
+250 Accepted\r
+221 primaryhostname.ex closing connection\r
+220 primaryhostname.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000\r
+250 primaryhostname.ex Hello CALLER at test\r
+250 OK\r
+250 Accepted\r
+221 primaryhostname.ex closing connection\r
+220 primaryhostname.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000\r
+250 primaryhostname.ex Hello CALLER at test\r
+250 OK\r
+250 Accepted\r
+221 primaryhostname.ex closing connection\r
+220 primaryhostname.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000\r
+250 primaryhostname.ex Hello CALLER at test\r
+250 OK\r
+250 Accepted\r
+221 primaryhostname.ex closing connection\r
+220 primaryhostname.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000\r
+250 primaryhostname.ex Hello CALLER at test\r
+250 OK\r
+501 <a@127.0.0.1]>: malformed address: ]> may not follow <a@127.0.0.1\r
+221 primaryhostname.ex closing connection\r
+220 primaryhostname.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000\r
+250 primaryhostname.ex Hello CALLER at test\r
+250 OK\r
+501 <a@[127.0.0.1>: malformed domain literal\r
+221 primaryhostname.ex closing connection\r
+220 primaryhostname.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000\r
+250 primaryhostname.ex Hello CALLER at test\r
+250 OK\r
+250 Accepted\r
+221 primaryhostname.ex closing connection\r