summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/README9
-rw-r--r--test/confs/40064
-rw-r--r--test/log/40063
-rw-r--r--test/scripts/4006_scan_clamd/400662
-rw-r--r--test/stdout/400638
5 files changed, 97 insertions, 19 deletions
diff --git a/test/README b/test/README
index c0f548292..bca17eb18 100644
--- a/test/README
+++ b/test/README
@@ -1119,13 +1119,16 @@ are of the following kinds:
(2) A line that starts with "*sleep" specifies a number of seconds to wait
before proceeding.
-(3) A line containing "*eof" specifies that the client is expected to close
+(3) A line containing "*data" and a number specifies that the client is
+ expected to send that many byte; the server discards them
+
+(4) A line containing "*eof" specifies that the client is expected to close
the connection at this point.
-(4) A line containing just '.' specifies that the client is expected to send
+(5) A line containing just '.' specifies that the client is expected to send
many lines, terminated by one that contains just a dot.
-(5) Otherwise, the line defines the start of an input line that the client
+(6) Otherwise, the line defines the start of an input line that the client
is expected to send. To allow for lines that start with digits, the line
may start with '<', which is not taken as part of the input data. If the
lines starts with '<<' then only the characters are expected; no return-
diff --git a/test/confs/4006 b/test/confs/4006
index 4c7059fdf..f8b216b99 100644
--- a/test/confs/4006
+++ b/test/confs/4006
@@ -2,6 +2,7 @@
# Content-scan: clamav interface
OPT=
+SRV=unset
CONTROL=
.include DIR/aux-var/std_conf_prefix
@@ -9,8 +10,7 @@ CONTROL=
log_selector = +subject
primary_hostname = myhost.test.ex
-#XXX we need an additional test for tcp-connected clamd
-av_scanner = clamd : DIR/eximdir/clam_sock CONTROL
+av_scanner = clamd : SRV CONTROL
# ----- Main settings -----
diff --git a/test/log/4006 b/test/log/4006
index 33f47f90e..1b7196869 100644
--- a/test/log/4006
+++ b/test/log/4006
@@ -14,3 +14,6 @@
1999-03-02 09:44:33 10HmbC-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local-esmtp S=sss T="message should be accepted after a retry"
1999-03-02 09:44:33 10HmbC-0005vi-00 => :blackhole: <userx@test.ex> R=r
1999-03-02 09:44:33 10HmbC-0005vi-00 Completed
+1999-03-02 09:44:33 10HmbD-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local-esmtp S=sss T="message should be accepted"
+1999-03-02 09:44:33 10HmbD-0005vi-00 => :blackhole: <userx@test.ex> R=r
+1999-03-02 09:44:33 10HmbD-0005vi-00 Completed
diff --git a/test/scripts/4006_scan_clamd/4006 b/test/scripts/4006_scan_clamd/4006
index d251c1a1f..91d08bd68 100644
--- a/test/scripts/4006_scan_clamd/4006
+++ b/test/scripts/4006_scan_clamd/4006
@@ -2,15 +2,16 @@
#
# SCAN command interface, on a unix socket, only. No ExtendedDetectionInfo.
#
+# Pass
server DIR/eximdir/clam_sock
<SCAN
>LF>scanned_file_name: OK
-<*eof
+*eof
****
#
#
#
-exim -odi -bs -DOPT=
+exim -odi -bs -DSRV=DIR/eximdir/clam_sock -DOPT=
ehlo test.ex
mail from:<>
rcpt to:<userx@test.ex>
@@ -24,15 +25,16 @@ quit
#
#
#
+# fail/error
server DIR/eximdir/clam_sock
<SCAN
>LF>scanned_file_name: 666 ERROR
-<*eof
+*eof
****
#
#
#
-exim -odi -bs -DOPT=
+exim -odi -bs -DSRV=DIR/eximdir/clam_sock -DOPT=
ehlo test.ex
mail from:<>
rcpt to:<userx@test.ex>
@@ -46,15 +48,16 @@ quit
#
#
#
+# fail/virus-found
server DIR/eximdir/clam_sock
<SCAN
>LF>scanned_file_name: VNAME FOUND
-<*eof
+*eof
****
#
#
#
-exim -odi -bs -DOPT=/defer_ok
+exim -odi -bs -DSRV=DIR/eximdir/clam_sock -DOPT=/defer_ok
ehlo test.ex
mail from:<>
rcpt to:<userx@test.ex>
@@ -68,13 +71,14 @@ quit
#
#
#
+# times out
server DIR/eximdir/clam_sock
*sleep 3
****
#
#
#
-exim -odi -bs -DOPT="/ tmo=2s"
+exim -odi -bs -DSRV=DIR/eximdir/clam_sock -DOPT="/ tmo=2s"
ehlo test.ex
mail from:<>
rcpt to:<userx@test.ex>
@@ -88,13 +92,14 @@ quit
#
#
#
+# times out
server DIR/eximdir/clam_sock
*sleep 3
****
#
#
#
-exim -odi -bs -DOPT="/ tmo=2s / defer_ok"
+exim -odi -bs -DSRV=DIR/eximdir/clam_sock -DOPT="/ tmo=2s / defer_ok"
ehlo test.ex
mail from:<>
rcpt to:<userx@test.ex>
@@ -109,13 +114,14 @@ quit
#
#
#
+# connect-fail (server not initially listenting), retry
server -i 2 DIR/eximdir/clam_sock
<SCAN
>LF>scanned_file_name: OK
-<*eof
+*eof
****
#
-exim -odi -bs -DCONTROL="retry=4s"
+exim -odi -bs -DSRV=DIR/eximdir/clam_sock -DCONTROL="retry=4s"
ehlo test.ex
mail from:<>
rcpt to:<userx@test.ex>
@@ -127,3 +133,39 @@ Subject: message should be accepted after a retry
quit
****
#
+################################################################################
+#
+# TCP clamd server connection, default protocol
+# only checks the protocol header, filesize element and start of eml file lines;
+# not the post-file protocol mark
+# Pass
+server PORT_D
+<zINSTREAM\x00\x00\x00\x01\xe5From MAILER-DAEMON
+<X-Envelope-From: <
+<X-Envelope-To: userx@test.ex
+<Received: from
+<\x09by myhost.test.ex with local-esmtp
+<\x09(envelope-from <
+<\x09id
+<\x09for userx@test.ex;
+<Date:
+<Subject: message should be accepted
+<Message-Id: <
+<From:
+<
+<
+>LF>scanned_file_name: OK
+*eof
+****
+#
+exim -odi -bs -DSRV="127.0.0.1 PORT_D" -DOPT=
+ehlo test.ex
+mail from:<>
+rcpt to:<userx@test.ex>
+data
+Date: Fri, 17 Dec 2004 14:35:01 +0100
+Subject: message should be accepted
+
+.
+quit
+****
diff --git a/test/stdout/4006 b/test/stdout/4006
index 4d858c5b1..b4a72b826 100644
--- a/test/stdout/4006
+++ b/test/stdout/4006
@@ -64,25 +64,36 @@
354 Enter message, ending with "." on a line by itself
250 OK id=10HmbC-0005vi-00
221 myhost.test.ex closing connection
+220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+250-myhost.test.ex Hello CALLER at test.ex
+250-SIZE 52428800
+250-8BITMIME
+250-PIPELINING
+250 HELP
+250 OK
+250 Accepted
+354 Enter message, ending with "." on a line by itself
+250 OK id=10HmbD-0005vi-00
+221 myhost.test.ex closing connection
******** SERVER ********
Listening on TESTSUITE/eximdir/clam_sock ...
Connection request
<SCAN TESTSUITE/spool/scan/10HmbB-0005vi-00/10HmbB-0005vi-00.eml
>LF>scanned_file_name: OK
-Unexpected EOF read from client
+Expected EOF read from client
End of script
Listening on TESTSUITE/eximdir/clam_sock ...
Connection request
<SCAN TESTSUITE/spool/scan/10HmaX-0005vi-00/10HmaX-0005vi-00.eml
>LF>scanned_file_name: 666 ERROR
-Unexpected EOF read from client
+Expected EOF read from client
End of script
Listening on TESTSUITE/eximdir/clam_sock ...
Connection request
<SCAN TESTSUITE/spool/scan/10HmbA-0005vi-00/10HmbA-0005vi-00.eml
>LF>scanned_file_name: VNAME FOUND
-Unexpected EOF read from client
+Expected EOF read from client
End of script
Listening on TESTSUITE/eximdir/clam_sock ...
Connection request
@@ -97,5 +108,24 @@ Listening on TESTSUITE/eximdir/clam_sock ...
Connection request
<SCAN TESTSUITE/spool/scan/10HmbC-0005vi-00/10HmbC-0005vi-00.eml
>LF>scanned_file_name: OK
-Unexpected EOF read from client
+Expected EOF read from client
+End of script
+Listening on port 1225 ...
+Connection request from [127.0.0.1]
+<zINSTREAM
+<X-Envelope-From: <CALLER@myhost.test.ex>
+<X-Envelope-To: userx@test.ex
+<Received: from CALLER (helo=test.ex)
+< by myhost.test.ex with local-esmtp (Exim x.yz)
+< (envelope-from <CALLER@myhost.test.ex>)
+< id 10HmbD-0005vi-00
+< for userx@test.ex; Tue, 2 Mar 1999 09:44:33 +0000
+<Date: Tue, 2 Mar 1999 09:44:33 +0000
+<Subject: message should be accepted
+<Message-Id: <E10HmbD-0005vi-00@myhost.test.ex>
+<From: CALLER_NAME <CALLER@myhost.test.ex>
+<
+<
+>LF>scanned_file_name: OK
+Expected EOF read from client
End of script