diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2020-03-01 14:05:43 +0000 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2020-03-01 15:10:32 +0000 |
commit | b273058b341903372bdebe67d2960e4f8d2d8689 (patch) | |
tree | 1140121e22e294bc5b118ab0fd76df6c6c0dcbb1 /test/scripts/4000-scanning | |
parent | 84a655513611641b55a8f46c13ee0e3cb141477f (diff) |
Fix $mime_part_count for non-mime message on multi-message connection. Bug 2537
Diffstat (limited to 'test/scripts/4000-scanning')
-rw-r--r-- | test/scripts/4000-scanning/4001 | 104 | ||||
-rw-r--r-- | test/scripts/4000-scanning/4002 | 248 | ||||
-rw-r--r-- | test/scripts/4000-scanning/4003 | 225 | ||||
-rw-r--r-- | test/scripts/4000-scanning/4004 | 51 |
4 files changed, 350 insertions, 278 deletions
diff --git a/test/scripts/4000-scanning/4001 b/test/scripts/4000-scanning/4001 index a660f6805..060e4d148 100644 --- a/test/scripts/4000-scanning/4001 +++ b/test/scripts/4000-scanning/4001 @@ -1,38 +1,72 @@ -# ACL regex= test -# -# These tests are copies from testcase 4000; -# they should be removed from there but I don't -# run spamassassin so can't verify the change. -# -exim -odi -bs -ehlo test.ex -mail from:<> -rcpt to:<userx@test.ex> -data -From: Test person <tp@cam.ac.uk> -To: Me <userx@test.ex> -Subject: A real test message -Date: Fri, 17 Dec 2004 16:13:04 +0100 -Message-ID: <41C2F849.3060203@projectile.test.ex> - -OK, this should look like a genuine message. +# multiple messages in connection + +exim -bh 127.0.0.1 +EHLO mailserver.test +MAIL FROM:<sender@test.ex> +RCPT TO:<heiko@test.ex> +DATA +From: sender@test.ex +To: heiko@test.ex +Subject: test no attachment + +This is a test mailing + . -quit -**** -exim -odi -bs -ehlo test.ex -mail from:<> -rcpt to:<userx@test.ex> -data -From: Test person <tp@cam.ac.uk> -To: Me <userx@test.ex> -Subject: A real test message -Date: Fri, 17 Dec 2004 16:13:04 +0100 -Message-ID: <41C2F849.3060203@projectile.test.ex> -FakeReject: test fakereject - -OK, this should look like a genuine message, but -it will trip on THIS gazornenplaz REGEX. +MAIL FROM:<sender@test.ex> +RCPT TO:<heiko@test.ex> +DATA +From: sender@test.ex +To: heiko@test.ex +Subject: test with attachment +MIME-Version: 1.0 +Content-Type: multipart/mixed; boundary="----=_MIME_BOUNDARY_000_431036" + +------=_MIME_BOUNDARY_000_431036 +Content-Type: text/plain + +This is a test mailing +------=_MIME_BOUNDARY_000_431036 +Content-Type: application/octet-stream +Content-Disposition: attachment +Content-Transfer-Encoding: BASE64 + +U2F0IEZlYiAyOSAxNDo1ODowMyBDRVQgMjAyMAo= + +------=_MIME_BOUNDARY_000_431036-- + +. +MAIL FROM:<sender@test.ex> +RCPT TO:<heiko@test.ex> +DATA +From: sender@test.ex +To: heiko@test.ex +Subject: test with attachment +MIME-Version: 1.0 +Content-Type: multipart/mixed; boundary="----=_MIME_BOUNDARY_000_431036" + +------=_MIME_BOUNDARY_000_431036 +Content-Type: text/plain + +This is a test mailing +------=_MIME_BOUNDARY_000_431036 +Content-Type: application/octet-stream +Content-Disposition: attachment +Content-Transfer-Encoding: BASE64 + +U2F0IEZlYiAyOSAxNDo1ODowMyBDRVQgMjAyMAo= + +------=_MIME_BOUNDARY_000_431036-- + +. +MAIL FROM:<sender@test.ex> +RCPT TO:<heiko@test.ex> +DATA +From: sender@test.ex +To: heiko@test.ex +Subject: test no attachment + +This is a test mailing ($(date "+%F %T")) + . -quit +QUIT **** diff --git a/test/scripts/4000-scanning/4002 b/test/scripts/4000-scanning/4002 index d9849c341..a660f6805 100644 --- a/test/scripts/4000-scanning/4002 +++ b/test/scripts/4000-scanning/4002 @@ -1,242 +1,38 @@ -# content scan interface: spamassassin +# ACL regex= test # -# The spooled file for scanning includes the test-runner's user name -# hence size varies. Munge that. -munge scanfile_size +# These tests are copies from testcase 4000; +# they should be removed from there but I don't +# run spamassassin so can't verify the change. # -# -# A good-comms test, returning not-spam. -# (we could use a second one that returns is-spam...) -server 7833 -<REPORT SPAMC -<User: -<Content-length: -< -<From -<X-Envelope-From -<X-Envelope-To -<Received: -< by -< (envelope -< id -< for -<Content-type: text/plain -<Message-Id: -<From: -<Date: -< -<test ->SPAMD/1.1 0 EX_OK ->Spam: False ; 4.5 / 5.0 -> ->Spam detection software, running on the system "demo", ->has NOT identified this incoming email as spam. The original ->message has been attached to this so you can view it or label ->similar future email. If you have any questions, see ->@@CONTACT_ADDRESS@@ for details. -> ->Content preview: test [...] -> ->Content analysis details: (4.5 points, 5.0 required) -> -> pts rule name description ->---- ---------------------- -------------------------------------------------- ->-1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -> 1.2 MISSING_HEADERS Missing To: header -> 1.0 MISSING_FROM Missing From: header -> 1.8 MISSING_SUBJECT Missing Subject: header -> 1.4 MISSING_DATE Missing Date: header -> 0.1 MISSING_MID Missing Message-Id: header -> -*eof -**** -exim -odi -oMt fromuser -bs +exim -odi -bs ehlo test.ex -mail from:<fromuser@myhost.test.ex> +mail from:<> rcpt to:<userx@test.ex> data -Content-type: text/plain +From: Test person <tp@cam.ac.uk> +To: Me <userx@test.ex> +Subject: A real test message +Date: Fri, 17 Dec 2004 16:13:04 +0100 +Message-ID: <41C2F849.3060203@projectile.test.ex> -test +OK, this should look like a genuine message. . quit **** -# -# -# -# -# Server spec line with timeout option, not exercised -# (could we cut down the massive content?) -server 7833 -<REPORT SPAMC -<User: -<Content-length: -< -<From -<X-Envelope-From -<X-Envelope-To -<Received: -< by -< (envelope -< id -< for -<Content-type: text/plain -<Message-Id: -<From: -<Date: -< -<test ->SPAMD/1.1 0 EX_OK ->Spam: False ; 4.5 / 5.0 -> ->Spam detection software, running on the system "demo", ->has NOT identified this incoming email as spam. The original ->message has been attached to this so you can view it or label ->similar future email. If you have any questions, see ->@@CONTACT_ADDRESS@@ for details. -> ->Content preview: test [...] -> ->Content analysis details: (4.5 points, 5.0 required) -> -> pts rule name description ->---- ---------------------- -------------------------------------------------- ->-1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -> 1.2 MISSING_HEADERS Missing To: header -> 1.0 MISSING_FROM Missing From: header -> 1.8 MISSING_SUBJECT Missing Subject: header -> 1.4 MISSING_DATE Missing Date: header -> 0.1 MISSING_MID Missing Message-Id: header -> -*eof -**** -exim -odi -oMt fromuser -bs -DOPT='127.0.0.1 7833 retry=10s' +exim -odi -bs ehlo test.ex -mail from:<fromuser@myhost.test.ex> +mail from:<> rcpt to:<userx@test.ex> data -Content-type: text/plain +From: Test person <tp@cam.ac.uk> +To: Me <userx@test.ex> +Subject: A real test message +Date: Fri, 17 Dec 2004 16:13:04 +0100 +Message-ID: <41C2F849.3060203@projectile.test.ex> +FakeReject: test fakereject -test +OK, this should look like a genuine message, but +it will trip on THIS gazornenplaz REGEX. . quit **** -# -# -# -# Server spec line with timeout option, exercised -server -i 2 7833 -<REPORT SPAMC -<User: -<Content-length: -< -<From -<X-Envelope-From -<X-Envelope-To -<Received: -< by -< (envelope -< id -< for -<Content-type: text/plain -<Message-Id: -<From: -<Date: -< -<test ->SPAMD/1.1 0 EX_OK ->Spam: False ; 4.5 / 5.0 -> ->Spam detection software, running on the system "demo", ->has NOT identified this incoming email as spam. The original ->message has been attached to this so you can view it or label ->similar future email. If you have any questions, see ->@@CONTACT_ADDRESS@@ for details. -> ->Content preview: test [...] -> ->Content analysis details: (4.5 points, 5.0 required) -> -> pts rule name description ->---- ---------------------- -------------------------------------------------- ->-1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -> 1.2 MISSING_HEADERS Missing To: header -> 1.0 MISSING_FROM Missing From: header -> 1.8 MISSING_SUBJECT Missing Subject: header -> 1.4 MISSING_DATE Missing Date: header -> 0.1 MISSING_MID Missing Message-Id: header -> -*eof -**** -exim -odi -oMt fromuser -bs -DOPT='127.0.0.1 7833 retry=4s' -ehlo test.ex -mail from:<fromuser@myhost.test.ex> -rcpt to:<userx@test.ex> -data -Content-type: text/plain - -test -. -quit -**** -# -# -# -# Multiple servers, prioritised, with timeout spec; first one fails -# List separator changed -server 7833 -<REPORT SPAMC -<User: -<Content-length: -< -<From -<X-Envelope-From -<X-Envelope-To -<Received: -< by -< (envelope -< id -< for -<Content-type: text/plain -<Message-Id: -<From: -<Date: -< -<test ->SPAMD/1.1 0 EX_OK ->Spam: False ; 4.5 / 5.0 -> ->Spam detection software, running on the system "demo", ->has NOT identified this incoming email as spam. The original ->message has been attached to this so you can view it or label ->similar future email. If you have any questions, see ->@@CONTACT_ADDRESS@@ for details. -> ->Content preview: test [...] -> ->Content analysis details: (4.5 points, 5.0 required) -> -> pts rule name description ->---- ---------------------- -------------------------------------------------- ->-1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -> 1.2 MISSING_HEADERS Missing To: header -> 1.0 MISSING_FROM Missing From: header -> 1.8 MISSING_SUBJECT Missing Subject: header -> 1.4 MISSING_DATE Missing Date: header -> 0.1 MISSING_MID Missing Message-Id: header -> -*eof -**** -exim -odi -oMt fromuser -bs -DOPT='<; 127.0.0.1 7833 ; HOSTIPV4 7834 pri=2 tmo=2s' -ehlo test.ex -mail from:<fromuser@myhost.test.ex> -rcpt to:<userx@test.ex> -data -Content-type: text/plain - -test -. -quit -**** -# -# diff --git a/test/scripts/4000-scanning/4003 b/test/scripts/4000-scanning/4003 index e5a7c9492..d9849c341 100644 --- a/test/scripts/4000-scanning/4003 +++ b/test/scripts/4000-scanning/4003 @@ -1,18 +1,134 @@ -# content scan interface: rspamd +# content scan interface: spamassassin # # The spooled file for scanning includes the test-runner's user name # hence size varies. Munge that. munge scanfile_size # -server 11333 -<CHECK RSPAMC/1.3 +# +# A good-comms test, returning not-spam. +# (we could use a second one that returns is-spam...) +server 7833 +<REPORT SPAMC +<User: +<Content-length: +< +<From +<X-Envelope-From +<X-Envelope-To +<Received: +< by +< (envelope +< id +< for +<Content-type: text/plain +<Message-Id: +<From: +<Date: +< +<test +>SPAMD/1.1 0 EX_OK +>Spam: False ; 4.5 / 5.0 +> +>Spam detection software, running on the system "demo", +>has NOT identified this incoming email as spam. The original +>message has been attached to this so you can view it or label +>similar future email. If you have any questions, see +>@@CONTACT_ADDRESS@@ for details. +> +>Content preview: test [...] +> +>Content analysis details: (4.5 points, 5.0 required) +> +> pts rule name description +>---- ---------------------- -------------------------------------------------- +>-1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP +> 1.2 MISSING_HEADERS Missing To: header +> 1.0 MISSING_FROM Missing From: header +> 1.8 MISSING_SUBJECT Missing Subject: header +> 1.4 MISSING_DATE Missing Date: header +> 0.1 MISSING_MID Missing Message-Id: header +> +*eof +**** +exim -odi -oMt fromuser -bs +ehlo test.ex +mail from:<fromuser@myhost.test.ex> +rcpt to:<userx@test.ex> +data +Content-type: text/plain + +test +. +quit +**** +# +# +# +# +# Server spec line with timeout option, not exercised +# (could we cut down the massive content?) +server 7833 +<REPORT SPAMC +<User: <Content-length: -<Queue-Id: +< +<From +<X-Envelope-From +<X-Envelope-To +<Received: +< by +< (envelope +< id +< for +<Content-type: text/plain +<Message-Id: <From: -<Recipient-Number: 1 -<Rcpt: -<Helo: +<Date: +< +<test +>SPAMD/1.1 0 EX_OK +>Spam: False ; 4.5 / 5.0 +> +>Spam detection software, running on the system "demo", +>has NOT identified this incoming email as spam. The original +>message has been attached to this so you can view it or label +>similar future email. If you have any questions, see +>@@CONTACT_ADDRESS@@ for details. +> +>Content preview: test [...] +> +>Content analysis details: (4.5 points, 5.0 required) +> +> pts rule name description +>---- ---------------------- -------------------------------------------------- +>-1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP +> 1.2 MISSING_HEADERS Missing To: header +> 1.0 MISSING_FROM Missing From: header +> 1.8 MISSING_SUBJECT Missing Subject: header +> 1.4 MISSING_DATE Missing Date: header +> 0.1 MISSING_MID Missing Message-Id: header +> +*eof +**** +exim -odi -oMt fromuser -bs -DOPT='127.0.0.1 7833 retry=10s' +ehlo test.ex +mail from:<fromuser@myhost.test.ex> +rcpt to:<userx@test.ex> +data +Content-type: text/plain + +test +. +quit +**** +# +# +# +# Server spec line with timeout option, exercised +server -i 2 7833 +<REPORT SPAMC <User: +<Content-length: < <From <X-Envelope-From @@ -22,30 +138,105 @@ server 11333 < (envelope < id < for +<Content-type: text/plain +<Message-Id: <From: +<Date: +< +<test +>SPAMD/1.1 0 EX_OK +>Spam: False ; 4.5 / 5.0 +> +>Spam detection software, running on the system "demo", +>has NOT identified this incoming email as spam. The original +>message has been attached to this so you can view it or label +>similar future email. If you have any questions, see +>@@CONTACT_ADDRESS@@ for details. +> +>Content preview: test [...] +> +>Content analysis details: (4.5 points, 5.0 required) +> +> pts rule name description +>---- ---------------------- -------------------------------------------------- +>-1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP +> 1.2 MISSING_HEADERS Missing To: header +> 1.0 MISSING_FROM Missing From: header +> 1.8 MISSING_SUBJECT Missing Subject: header +> 1.4 MISSING_DATE Missing Date: header +> 0.1 MISSING_MID Missing Message-Id: header +> +*eof +**** +exim -odi -oMt fromuser -bs -DOPT='127.0.0.1 7833 retry=4s' +ehlo test.ex +mail from:<fromuser@myhost.test.ex> +rcpt to:<userx@test.ex> +data +Content-type: text/plain + +test +. +quit +**** +# +# +# +# Multiple servers, prioritised, with timeout spec; first one fails +# List separator changed +server 7833 +<REPORT SPAMC +<User: +<Content-length: +< +<From +<X-Envelope-From +<X-Envelope-To +<Received: +< by +< (envelope +< id +< for <Content-type: text/plain <Message-Id: -<Sender: +<From: <Date: < <test ->RSPAMD/1.3 0 EX_OK ->Metric: default; True; 15.00 / 15.00 / 0.0 ->Action: reject ->Symbol: FAKE_SYMBOL_A(15.00) ->Symbol: FAKE_SYMBOL_B(0.00) ->Message-ID: undef +>SPAMD/1.1 0 EX_OK +>Spam: False ; 4.5 / 5.0 +> +>Spam detection software, running on the system "demo", +>has NOT identified this incoming email as spam. The original +>message has been attached to this so you can view it or label +>similar future email. If you have any questions, see +>@@CONTACT_ADDRESS@@ for details. +> +>Content preview: test [...] +> +>Content analysis details: (4.5 points, 5.0 required) +> +> pts rule name description +>---- ---------------------- -------------------------------------------------- +>-1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP +> 1.2 MISSING_HEADERS Missing To: header +> 1.0 MISSING_FROM Missing From: header +> 1.8 MISSING_SUBJECT Missing Subject: header +> 1.4 MISSING_DATE Missing Date: header +> 0.1 MISSING_MID Missing Message-Id: header +> *eof **** -exim -odi -bs +exim -odi -oMt fromuser -bs -DOPT='<; 127.0.0.1 7833 ; HOSTIPV4 7834 pri=2 tmo=2s' ehlo test.ex -mail from:<> +mail from:<fromuser@myhost.test.ex> rcpt to:<userx@test.ex> data -From: MAILER_DAEMON <> Content-type: text/plain test . quit **** +# +# diff --git a/test/scripts/4000-scanning/4004 b/test/scripts/4000-scanning/4004 new file mode 100644 index 000000000..e5a7c9492 --- /dev/null +++ b/test/scripts/4000-scanning/4004 @@ -0,0 +1,51 @@ +# content scan interface: rspamd +# +# The spooled file for scanning includes the test-runner's user name +# hence size varies. Munge that. +munge scanfile_size +# +server 11333 +<CHECK RSPAMC/1.3 +<Content-length: +<Queue-Id: +<From: +<Recipient-Number: 1 +<Rcpt: +<Helo: +<User: +< +<From +<X-Envelope-From +<X-Envelope-To +<Received: +< by +< (envelope +< id +< for +<From: +<Content-type: text/plain +<Message-Id: +<Sender: +<Date: +< +<test +>RSPAMD/1.3 0 EX_OK +>Metric: default; True; 15.00 / 15.00 / 0.0 +>Action: reject +>Symbol: FAKE_SYMBOL_A(15.00) +>Symbol: FAKE_SYMBOL_B(0.00) +>Message-ID: undef +*eof +**** +exim -odi -bs +ehlo test.ex +mail from:<> +rcpt to:<userx@test.ex> +data +From: MAILER_DAEMON <> +Content-type: text/plain + +test +. +quit +**** |