summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPhilip Hazel <ph10@hermes.cam.ac.uk>2006-04-18 11:13:19 +0000
committerPhilip Hazel <ph10@hermes.cam.ac.uk>2006-04-18 11:13:19 +0000
commit1cce3af8c29cfa691a3e28c79227f358e5a7b3b9 (patch)
tree1170b58efc2fdbc629d872b9df439ca772976d19 /test
parent94ebd6cb6496a79172a608928cbaf88b473e59c8 (diff)
Extend ${readsocket to TCP sockets (modified John Jetmore's patch).
Diffstat (limited to 'test')
-rw-r--r--test/confs/101027
-rw-r--r--test/dnszones-src/db.test.ex12
-rw-r--r--test/scripts/0000-Basic/037346
-rw-r--r--test/scripts/1000-Basic-ipv6/101043
-rw-r--r--test/stdout/037360
-rw-r--r--test/stdout/101055
6 files changed, 241 insertions, 2 deletions
diff --git a/test/confs/1010 b/test/confs/1010
new file mode 100644
index 000000000..4a4929bcf
--- /dev/null
+++ b/test/confs/1010
@@ -0,0 +1,27 @@
+# Exim test configuration 1010
+
+exim_path = EXIM_PATH
+host_lookup_order = bydns
+primary_hostname = myhost.test.ex
+rfc1413_query_timeout = 0s
+spool_directory = DIR/spool
+log_file_path = DIR/spool/log/%slog
+gecos_pattern = ""
+gecos_name = CALLER_NAME
+
+# ----- Main settings -----
+
+domainlist local_domains = test.ex : *.test.ex
+acl_smtp_connect = connect
+trusted_users = CALLER
+
+
+# ----- ACL -----
+
+begin acl
+
+connect:
+ deny condition = ${readsocket{DIR/test-socket}{QUERY-ACL\n}{2s}{*EOL*}}
+ accept
+
+# End
diff --git a/test/dnszones-src/db.test.ex b/test/dnszones-src/db.test.ex
index 534f3a71f..8ac35367e 100644
--- a/test/dnszones-src/db.test.ex
+++ b/test/dnszones-src/db.test.ex
@@ -1,4 +1,4 @@
-; $Cambridge: exim/test/dnszones-src/db.test.ex,v 1.3 2006/02/20 16:25:00 ph10 Exp $
+; $Cambridge: exim/test/dnszones-src/db.test.ex,v 1.4 2006/04/18 11:13:19 ph10 Exp $
; This is a testing zone file for use when testing DNS handling in Exim. This
; is a fake zone of no real use - hence no SOA record. The zone name is
@@ -48,6 +48,16 @@ mx.π A V4NET.255.255.255
thishost A 127.0.0.1
+; Something that gives both the IP and the loopback
+
+thisloop A HOSTIPV4
+ A 127.0.0.1
+
+; Something that gives an unreachable IP and the loopback
+
+badloop A V4NET.0.0.1
+ A 127.0.0.1
+
; Another host with both A and AAAA records
46 A V4NET.0.0.4
diff --git a/test/scripts/0000-Basic/0373 b/test/scripts/0000-Basic/0373
index a20e79ecd..d5e2cb182 100644
--- a/test/scripts/0000-Basic/0373
+++ b/test/scripts/0000-Basic/0373
@@ -1,4 +1,4 @@
-# ${readsocket
+# ${readsocket (Unix domain and IPv4)
need_ipv4
#
exim -be
@@ -55,3 +55,47 @@ QUERY-ACL
exim -odq -bs -oMa V4NET.0.0.0
quit
****
+#
+# Tests of IPv4 sockets
+#
+server PORT_S 10
+QUERY-1
+>LF>ANSWER-1
+>*eof
+QUERY-2
+>>ANSWER-2
+>*eof
+QUERY-3
+>LF>ANSWER-3
+>*eof
+QUERY-4
+>LF>ANSWER-4
+>*eof
+>>ANSWER-5
+>*eof
+*sleep 1
+>*eof
+>*eof
+QUERY-8
+*sleep 2
+*eof
+QUERY-9
+*sleep 2
+*eof
+QUERY-10
+>LF>ANSWER-10
+>*eof
+****
+millisleep 500
+exim -be
+1 >>${readsocket{inet:thisloop:PORT_S}{QUERY-1\n}}<<
+2 >>${readsocket{inet:127.0.0.1:PORT_S}{QUERY-2\n}}<<
+3 >>${readsocket{inet:127.0.0.1:PORT_S}{QUERY-3\n}{2s}{*EOL*}}<<
+4 >>${readsocket{inet:127.0.0.1:PORT_S}{QUERY-4\n}{2s}{*EOL*}{sock error}}<<
+5 >>${readsocket{inet:127.0.0.1:PORT_S}{}}<<
+6 >>${readsocket{inet:127.0.0.1:PORT_S}{QUERY-6\n}}<<
+7 >>${readsocket{inet:127.0.0.1:PORT_S}{QUERY-7\n}{1s}{}{sock error}}<<
+8 >>${readsocket{inet:127.0.0.1:PORT_S}{QUERY-8\n}{1s}}<<
+9 >>${readsocket{inet:127.0.0.1:PORT_S}{QUERY-9\n}{1s}{}{sock error}}<<
+10 >>${readsocket{inet:badloop:PORT_S}{QUERY-10\n}}<<
+****
diff --git a/test/scripts/1000-Basic-ipv6/1010 b/test/scripts/1000-Basic-ipv6/1010
new file mode 100644
index 000000000..720c0cffb
--- /dev/null
+++ b/test/scripts/1000-Basic-ipv6/1010
@@ -0,0 +1,43 @@
+# ${readsocket (IPv6)
+#
+# Note the difference between:
+# >*eof => close the connection
+# *eof => expect to read EOF from client
+#
+server PORT_S 9
+QUERY-1
+>LF>ANSWER-1
+>*eof
+QUERY-2
+>>ANSWER-2
+>*eof
+QUERY-3
+>LF>ANSWER-3
+>*eof
+QUERY-4
+>LF>ANSWER-4
+>*eof
+>>ANSWER-5
+>*eof
+*sleep 1
+>*eof
+>*eof
+QUERY-8
+*sleep 2
+*eof
+QUERY-9
+*sleep 2
+*eof
+****
+millisleep 500
+exim -be
+1 >>${readsocket{inet:[::1]:PORT_S}{QUERY-1\n}}<<
+2 >>${readsocket{inet:[::1]:PORT_S}{QUERY-2\n}}<<
+3 >>${readsocket{inet:[::1]:PORT_S}{QUERY-3\n}{2s}{*EOL*}}<<
+4 >>${readsocket{inet:[::1]:PORT_S}{QUERY-4\n}{2s}{*EOL*}{sock error}}<<
+5 >>${readsocket{inet:[::1]:PORT_S}{}}<<
+6 >>${readsocket{inet:[::1]:PORT_S}{QUERY-6\n}}<<
+7 >>${readsocket{inet:[::1]:PORT_S}{QUERY-7\n}{1s}{}{sock error}}<<
+8 >>${readsocket{inet:[::1]:PORT_S}{QUERY-8\n}{1s}}<<
+9 >>${readsocket{inet:[::1]:PORT_S}{QUERY-9\n}{1s}{}{sock error}}<<
+****
diff --git a/test/stdout/0373 b/test/stdout/0373
index 6cb4425eb..dabc1f5a7 100644
--- a/test/stdout/0373
+++ b/test/stdout/0373
@@ -13,6 +13,19 @@
> 9 >>sock error<<
>
451 Temporary local problem - please try later
+> 1 >>ANSWER-1
+<<
+> 2 >>ANSWER-2<<
+> 3 >>ANSWER-3*EOL*<<
+> 4 >>ANSWER-4*EOL*<<
+> 5 >>ANSWER-5<<
+> 6 >><<
+> 7 >><<
+> Failed: socket read timed out
+> 9 >>sock error<<
+> 10 >>ANSWER-10
+<<
+>
******** SERVER ********
Listening on TESTSUITE/test-socket ...
@@ -61,3 +74,50 @@ Connection request
QUERY-ACL
*sleep 3
End of script
+Listening on port 1224 ...
+Connection request from [ip4.ip4.ip4.ip4]
+QUERY-1
+>LF>ANSWER-1
+>*eof
+Listening on port 1224 ...
+Connection request from [127.0.0.1]
+QUERY-2
+>>ANSWER-2
+>*eof
+Listening on port 1224 ...
+Connection request from [127.0.0.1]
+QUERY-3
+>LF>ANSWER-3
+>*eof
+Listening on port 1224 ...
+Connection request from [127.0.0.1]
+QUERY-4
+>LF>ANSWER-4
+>*eof
+Listening on port 1224 ...
+Connection request from [127.0.0.1]
+>>ANSWER-5
+>*eof
+Listening on port 1224 ...
+Connection request from [127.0.0.1]
+*sleep 1
+>*eof
+Listening on port 1224 ...
+Connection request from [127.0.0.1]
+>*eof
+Listening on port 1224 ...
+Connection request from [127.0.0.1]
+QUERY-8
+*sleep 2
+Expected EOF read from client
+Listening on port 1224 ...
+Connection request from [127.0.0.1]
+QUERY-9
+*sleep 2
+Expected EOF read from client
+Listening on port 1224 ...
+Connection request from [127.0.0.1]
+QUERY-10
+>LF>ANSWER-10
+>*eof
+End of script
diff --git a/test/stdout/1010 b/test/stdout/1010
new file mode 100644
index 000000000..cacc1541b
--- /dev/null
+++ b/test/stdout/1010
@@ -0,0 +1,55 @@
+> 1 >>ANSWER-1
+<<
+> 2 >>ANSWER-2<<
+> 3 >>ANSWER-3*EOL*<<
+> 4 >>ANSWER-4*EOL*<<
+> 5 >>ANSWER-5<<
+> 6 >><<
+> 7 >><<
+> Failed: socket read timed out
+> 9 >>sock error<<
+>
+
+******** SERVER ********
+Listening on port 1224 ...
+Connection request from [::1]
+QUERY-1
+>LF>ANSWER-1
+>*eof
+Listening on port 1224 ...
+Connection request from [::1]
+QUERY-2
+>>ANSWER-2
+>*eof
+Listening on port 1224 ...
+Connection request from [::1]
+QUERY-3
+>LF>ANSWER-3
+>*eof
+Listening on port 1224 ...
+Connection request from [::1]
+QUERY-4
+>LF>ANSWER-4
+>*eof
+Listening on port 1224 ...
+Connection request from [::1]
+>>ANSWER-5
+>*eof
+Listening on port 1224 ...
+Connection request from [::1]
+*sleep 1
+>*eof
+Listening on port 1224 ...
+Connection request from [::1]
+>*eof
+Listening on port 1224 ...
+Connection request from [::1]
+QUERY-8
+*sleep 2
+Expected EOF read from client
+Listening on port 1224 ...
+Connection request from [::1]
+QUERY-9
+*sleep 2
+Expected EOF read from client
+End of script