summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2020-05-25 22:57:57 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2020-05-26 11:33:14 +0100
commit5fbb51949cbd9765421c5832c2d391f80f8183e9 (patch)
tree3617837129ef7c502c4f5daebaabf79b9d2ec101 /test
parent4284f0712acb9ba047fc32792472b348181d98d8 (diff)
Quota checking during reception. Bug 163
Diffstat (limited to 'test')
-rw-r--r--test/confs/058960
-rw-r--r--test/log/058917
-rw-r--r--test/rejectlog/05896
-rw-r--r--test/scripts/0000-Basic/058944
-rw-r--r--test/stdout/058961
5 files changed, 188 insertions, 0 deletions
diff --git a/test/confs/0589 b/test/confs/0589
new file mode 100644
index 000000000..b0f731143
--- /dev/null
+++ b/test/confs/0589
@@ -0,0 +1,60 @@
+# Exim test configuration 0589
+
+.include DIR/aux-var/std_conf_prefix
+
+primary_hostname = myhost.test.ex
+
+# ----- Main settings -----
+
+acl_smtp_rcpt = chk_rcpt
+log_selector = +millisec
+
+# --- ACL ---
+
+begin acl
+
+chk_rcpt:
+ deny !verify = recipient/quota=cachepos=20s,cacheneg=100s
+ logwrite = where='$recipient_verify_failure' msg='$acl_verify_message'
+ accept
+
+loggit:
+ accept logwrite = $acl_arg1 was called for $local_part@$domain
+ message = /
+
+# ----- Routers -----
+
+begin routers
+
+localuser:
+ driver = accept
+ local_parts = !route_fail
+ transport = appendfile
+ # set address_data purely to get logging of use of the router
+ address_data = ${acl {loggit}{router }}
+
+failrouter:
+ driver = accept
+ condition = ${if eq {${acl {loggit}{router }}}{} {no}{no}}
+ transport = appendfile
+
+# ----- Transports -----
+
+begin transports
+
+appendfile:
+ driver = appendfile
+ file = DIR/test-mail/themailfile
+ quota = 1k
+ user = CALLER
+ # set homedir purely to get logging of use of the transport
+ home_directory = ${acl {loggit}{transport}}
+
+# ----- Retry -----
+
+begin retry
+
+* * F,5d,1d
+
+
+# End
diff --git a/test/log/0589 b/test/log/0589
new file mode 100644
index 000000000..dcbd6565a
--- /dev/null
+++ b/test/log/0589
@@ -0,0 +1,17 @@
+
+******** SERVER ********
+2017-07-30 18:51:05.712 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port PORT_D
+2017-07-30 18:51:05.712 router was called for quota_good@test.ex
+2017-07-30 18:51:05.712 transport was called for quota_good@test.ex
+2017-07-30 18:51:05.712 router was called for quota_fail@test.ex
+2017-07-30 18:51:05.712 transport was called for quota_fail@test.ex
+2017-07-30 18:51:05.712 where='quota' msg='Over quota'
+2017-07-30 18:51:05.712 H=(test) [127.0.0.1] F=<b@test.ex> rejected RCPT <quota_fail@test.ex>: Over quota
+2017-07-30 18:51:05.712 router was called for route_fail@test.ex
+2017-07-30 18:51:05.712 where='route' msg='Unrouteable address'
+2017-07-30 18:51:05.712 H=(test) [127.0.0.1] F=<c@test.ex> rejected RCPT <route_fail@test.ex>: Unrouteable address
+2017-07-30 18:51:05.712 where='quota' msg='Previous (cached) quota verification failure'
+2017-07-30 18:51:05.712 H=(test) [127.0.0.1] F=<e@test.ex> rejected RCPT <quota_fail@test.ex>: Previous (cached) quota verification failure
+2017-07-30 18:51:05.712 router was called for route_fail@test.ex
+2017-07-30 18:51:05.712 where='route' msg='Unrouteable address'
+2017-07-30 18:51:05.712 H=(test) [127.0.0.1] F=<f@test.ex> rejected RCPT <route_fail@test.ex>: Unrouteable address
diff --git a/test/rejectlog/0589 b/test/rejectlog/0589
new file mode 100644
index 000000000..432b6780f
--- /dev/null
+++ b/test/rejectlog/0589
@@ -0,0 +1,6 @@
+
+******** SERVER ********
+2017-07-30 18:51:05.712 H=(test) [127.0.0.1] F=<b@test.ex> rejected RCPT <quota_fail@test.ex>: Over quota
+2017-07-30 18:51:05.712 H=(test) [127.0.0.1] F=<c@test.ex> rejected RCPT <route_fail@test.ex>: Unrouteable address
+2017-07-30 18:51:05.712 H=(test) [127.0.0.1] F=<e@test.ex> rejected RCPT <quota_fail@test.ex>: Previous (cached) quota verification failure
+2017-07-30 18:51:05.712 H=(test) [127.0.0.1] F=<f@test.ex> rejected RCPT <route_fail@test.ex>: Unrouteable address
diff --git a/test/scripts/0000-Basic/0589 b/test/scripts/0000-Basic/0589
new file mode 100644
index 000000000..8cea367eb
--- /dev/null
+++ b/test/scripts/0000-Basic/0589
@@ -0,0 +1,44 @@
+# verify quota at smtp time
+#
+exim -bd -DSERVER=server -oX PORT_D
+****
+client 127.0.0.1 PORT_D
+??? 220
+EHLO test
+??? 250-
+??? 250-SIZE
+??? 250-8BITMIME
+??? 250-PIPELINING
+??? 250 HELP
+MAIL FROM:<a@test.ex>\r\nRCPT TO:<quota_good@test.ex>
+??? 250
+??? 250
+RSET
+??? 250
+MAIL FROM:<b@test.ex> SIZE=2048\r\nRCPT TO:<quota_fail@test.ex>
+??? 250
+??? 550
+RSET
+??? 250
+MAIL FROM:<c@test.ex>\r\nRCPT TO:<route_fail@test.ex>
+??? 250
+??? 550
+RSET
+??? 250
+MAIL FROM:<d@test.ex>\r\nRCPT TO:<quota_good@test.ex>
+??? 250
+??? 250
+RSET
+??? 250
+MAIL FROM:<e@test.ex> SIZE=512\r\nRCPT TO:<quota_fail@test.ex>
+??? 250
+??? 550
+RSET
+??? 250
+MAIL FROM:<f@test.ex>\r\nRCPT TO:<route_fail@test.ex>
+??? 250
+??? 550
+QUIT
+****
+#
+killdaemon
diff --git a/test/stdout/0589 b/test/stdout/0589
new file mode 100644
index 000000000..9f70b7343
--- /dev/null
+++ b/test/stdout/0589
@@ -0,0 +1,61 @@
+Connecting to 127.0.0.1 port 1225 ... connected
+??? 220
+<<< 220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+>>> EHLO test
+??? 250-
+<<< 250-myhost.test.ex Hello test [127.0.0.1]
+??? 250-SIZE
+<<< 250-SIZE 52428800
+??? 250-8BITMIME
+<<< 250-8BITMIME
+??? 250-PIPELINING
+<<< 250-PIPELINING
+??? 250 HELP
+<<< 250 HELP
+>>> MAIL FROM:<a@test.ex>\r\nRCPT TO:<quota_good@test.ex>
+??? 250
+<<< 250 OK
+??? 250
+<<< 250 Accepted
+>>> RSET
+??? 250
+<<< 250 Reset OK
+>>> MAIL FROM:<b@test.ex> SIZE=ssss\r\nRCPT TO:<quota_fail@test.ex>
+??? 250
+<<< 250 OK
+??? 550
+<<< 550 Administrative prohibition
+>>> RSET
+??? 250
+<<< 250 Reset OK
+>>> MAIL FROM:<c@test.ex>\r\nRCPT TO:<route_fail@test.ex>
+??? 250
+<<< 250 OK
+??? 550
+<<< 550 Administrative prohibition
+>>> RSET
+??? 250
+<<< 250 Reset OK
+>>> MAIL FROM:<d@test.ex>\r\nRCPT TO:<quota_good@test.ex>
+??? 250
+<<< 250 OK
+??? 250
+<<< 250 Accepted
+>>> RSET
+??? 250
+<<< 250 Reset OK
+>>> MAIL FROM:<e@test.ex> SIZE=ssss\r\nRCPT TO:<quota_fail@test.ex>
+??? 250
+<<< 250 OK
+??? 550
+<<< 550 Administrative prohibition
+>>> RSET
+??? 250
+<<< 250 Reset OK
+>>> MAIL FROM:<f@test.ex>\r\nRCPT TO:<route_fail@test.ex>
+??? 250
+<<< 250 OK
+??? 550
+<<< 550 Administrative prohibition
+>>> QUIT
+End of script