[exim-cvs] testcases for value return

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Exim Git Commits Mailing List
Datum:  
To: exim-cvs
Betreff: [exim-cvs] testcases for value return
Gitweb: https://git.exim.org/exim.git/commitdiff/2a53e2464bfa1a831f544ed44d3690e5c22259a5
Commit:     2a53e2464bfa1a831f544ed44d3690e5c22259a5
Parent:     a368cc11b211657f86f2495002823bc09b71a9f1
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Wed May 6 15:19:24 2020 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Wed May 6 16:16:24 2020 +0100


    testcases for value return
---
 doc/doc-docbook/spec.xfpt    |  5 ++--
 src/src/match.c              |  2 +-
 test/confs/0624              | 23 +++++++++++++++
 test/log/0624                | 13 +++++++++
 test/rejectlog/0624          |  1 +
 test/scripts/0000-Basic/0624 | 69 ++++++++++++++++++++++++++++++++++++++++++++
 test/stderr/0362             |  4 +--
 test/stderr/5204             |  2 +-
 test/stdout/0624             | 45 +++++++++++++++++++++++++++++
 9 files changed, 158 insertions(+), 6 deletions(-)


diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt
index a05ad66..33e07db 100644
--- a/doc/doc-docbook/spec.xfpt
+++ b/doc/doc-docbook/spec.xfpt
@@ -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.
diff --git a/src/src/match.c b/src/src/match.c
index db02b37..f9b539d 100644
--- a/src/src/match.c
+++ b/src/src/match.c
@@ -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
index 0000000..d6f00b3
--- /dev/null
+++ b/test/confs/0624
@@ -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
index 0000000..3622b9f
--- /dev/null
+++ b/test/log/0624
@@ -0,0 +1,13 @@
+1999-03-02 09:44:33 U=CALLER F=<testclient@???> rejected RCPT <a@???>
+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
index 0000000..86b0ed7
--- /dev/null
+++ b/test/rejectlog/0624
@@ -0,0 +1 @@
+1999-03-02 09:44:33 U=CALLER F=<testclient@???> rejected RCPT <a@???>
diff --git a/test/scripts/0000-Basic/0624 b/test/scripts/0000-Basic/0624
new file mode 100644
index 0000000..d4e5acb
--- /dev/null
+++ b/test/scripts/0000-Basic/0624
@@ -0,0 +1,69 @@
+# domainlist match values
+#
+exim -bs -DOPT=:
+HELO test
+MAIL FROM:<testclient>
+RCPT TO:<a@???>
+QUIT
+****
+#
+exim -bs '-DOPT=notthis : plainstring.ex : nothiseither'
+HELO test
+MAIL FROM:<testclient>
+RCPT TO:<a@???>
+QUIT
+****
+#
+exim -bs '-DOPT=notthis : *tail.ex : nothiseither'
+HELO test
+MAIL FROM:<testclient>
+RCPT TO:<a@???>
+QUIT
+****
+#
+exim -bs '-DOPT=notthis : ^.*regex : nothiseither'
+HELO test
+MAIL FROM:<testclient>
+RCPT TO:<a@???>
+QUIT
+****
+#
+exim -bs '-DOPT=notthis : @ : nothiseither'
+HELO test
+MAIL FROM:<testclient>
+RCPT TO:<a@???>
+QUIT
+****
+#
+#
+exim -bs '-DOPT=notthis : @[] : nothiseither'
+HELO test
+MAIL FROM:<testclient>
+RCPT TO:<a@???>
+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@???>
+QUIT
+****
+#
diff --git a/test/stderr/0362 b/test/stderr/0362
index 7433c9d..79725a0 100644
--- a/test/stderr/0362
+++ b/test/stderr/0362
@@ -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@???
@@ -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@???
   transport: t2
diff --git a/test/stderr/5204 b/test/stderr/5204
index 81fede5..27b40de 100644
--- a/test/stderr/5204
+++ b/test/stderr/5204
@@ -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@???
   transport: null
diff --git a/test/stdout/0624 b/test/stdout/0624
new file mode 100644
index 0000000..c59ed78
--- /dev/null
+++ b/test/stdout/0624
@@ -0,0 +1,45 @@
+220 primaryhostname.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+250 primaryhostname.ex Hello CALLER at test
+250 OK
+550 Administrative prohibition
+221 primaryhostname.ex closing connection
+220 primaryhostname.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+250 primaryhostname.ex Hello CALLER at test
+250 OK
+250 Accepted
+221 primaryhostname.ex closing connection
+220 primaryhostname.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+250 primaryhostname.ex Hello CALLER at test
+250 OK
+250 Accepted
+221 primaryhostname.ex closing connection
+220 primaryhostname.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+250 primaryhostname.ex Hello CALLER at test
+250 OK
+250 Accepted
+221 primaryhostname.ex closing connection
+220 primaryhostname.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+250 primaryhostname.ex Hello CALLER at test
+250 OK
+250 Accepted
+221 primaryhostname.ex closing connection
+220 primaryhostname.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+250 primaryhostname.ex Hello CALLER at test
+250 OK
+250 Accepted
+221 primaryhostname.ex closing connection
+220 primaryhostname.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+250 primaryhostname.ex Hello CALLER at test
+250 OK
+501 <a@127.0.0.1]>: malformed address: ]> may not follow <a@127.0.0.1
+221 primaryhostname.ex closing connection
+220 primaryhostname.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+250 primaryhostname.ex Hello CALLER at test
+250 OK
+501 <a@[127.0.0.1>: malformed domain literal
+221 primaryhostname.ex closing connection
+220 primaryhostname.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+250 primaryhostname.ex Hello CALLER at test
+250 OK
+250 Accepted
+221 primaryhostname.ex closing connection