diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/data/test1320 | 4 | ||||
-rw-r--r-- | tests/data/test1406 | 6 | ||||
-rw-r--r-- | tests/data/test1507 | 4 | ||||
-rw-r--r-- | tests/data/test900 | 4 | ||||
-rw-r--r-- | tests/data/test901 | 4 | ||||
-rw-r--r-- | tests/data/test902 | 6 | ||||
-rw-r--r-- | tests/data/test903 | 4 | ||||
-rw-r--r-- | tests/data/test904 | 4 | ||||
-rw-r--r-- | tests/data/test905 | 4 | ||||
-rw-r--r-- | tests/data/test906 | 4 | ||||
-rw-r--r-- | tests/data/test907 | 4 | ||||
-rw-r--r-- | tests/data/test908 | 4 | ||||
-rw-r--r-- | tests/data/test909 | 4 | ||||
-rw-r--r-- | tests/data/test910 | 4 | ||||
-rw-r--r-- | tests/data/test911 | 4 | ||||
-rw-r--r-- | tests/data/test912 | 4 | ||||
-rw-r--r-- | tests/data/test913 | 4 | ||||
-rw-r--r-- | tests/data/test914 | 4 | ||||
-rw-r--r-- | tests/data/test915 | 4 | ||||
-rw-r--r-- | tests/data/test916 | 4 | ||||
-rw-r--r-- | tests/data/test917 | 4 | ||||
-rw-r--r-- | tests/data/test918 | 4 | ||||
-rwxr-xr-x | tests/ftpserver.pl | 24 |
23 files changed, 61 insertions, 55 deletions
diff --git a/tests/data/test1320 b/tests/data/test1320 index 7fbefc9d0..4d6c8ea85 100644 --- a/tests/data/test1320 +++ b/tests/data/test1320 @@ -35,7 +35,7 @@ To: another body
</stdin> <command> -smtp://smtp.1320:%SMTPPORT/user --mail-rcpt 1320@example.com --mail-from 1320@example.com -T - -p -x %HOSTIP:%PROXYPORT +smtp://smtp.1320:%SMTPPORT/1320 --mail-rcpt 1320@example.com --mail-from 1320@example.com -T - -p -x %HOSTIP:%PROXYPORT </command> </client> @@ -46,7 +46,7 @@ smtp://smtp.1320:%SMTPPORT/user --mail-rcpt 1320@example.com --mail-from 1320@ex ^User-Agent: curl/.* </strip> <protocol> -EHLO user
+EHLO 1320
MAIL FROM:<1320@example.com>
RCPT TO:<1320@example.com>
DATA
diff --git a/tests/data/test1406 b/tests/data/test1406 index b330691fa..819e44313 100644 --- a/tests/data/test1406 +++ b/tests/data/test1406 @@ -32,7 +32,7 @@ To: another body
</file> <command> -smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 1406@example.com --mail-rcpt 1406@foobar.example.com --mail-from 1406@example.com -T log/test1406.eml --libcurl log/test1406.c +smtp://%HOSTIP:%SMTPPORT/1406 --mail-rcpt 1406@example.com --mail-rcpt 1406@foobar.example.com --mail-from 1406@example.com -T log/test1406.eml --libcurl log/test1406.c </command> </client> @@ -40,7 +40,7 @@ smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 1406@example.com --mail-rcpt 1406@foob # Verify data after the test has been "shot" <verify> <protocol> -EHLO user
+EHLO 1406
MAIL FROM:<1406@example.com> SIZE=38
RCPT TO:<1406@example.com>
RCPT TO:<1406@foobar.example.com>
@@ -73,7 +73,7 @@ int main(int argc, char *argv[]) hnd = curl_easy_init(); curl_easy_setopt(hnd, CURLOPT_INFILESIZE_LARGE, (curl_off_t)38); - curl_easy_setopt(hnd, CURLOPT_URL, "smtp://%HOSTIP:%SMTPPORT/user"); + curl_easy_setopt(hnd, CURLOPT_URL, "smtp://%HOSTIP:%SMTPPORT/1406"); curl_easy_setopt(hnd, CURLOPT_HEADER, 1L); curl_easy_setopt(hnd, CURLOPT_UPLOAD, 1L); curl_easy_setopt(hnd, CURLOPT_USERAGENT, "stripped"); diff --git a/tests/data/test1507 b/tests/data/test1507 index 76ec5320d..ab7b47eb3 100644 --- a/tests/data/test1507 +++ b/tests/data/test1507 @@ -32,7 +32,7 @@ To: another body </stdin> <command> -smtp://%HOSTIP:%SMTPPORT/user +smtp://%HOSTIP:%SMTPPORT/1507 </command> </client> @@ -40,7 +40,7 @@ smtp://%HOSTIP:%SMTPPORT/user # Verify data after the test has been "shot" <verify> <protocol> -EHLO user
+EHLO 1507
MAIL FROM:<1507-realuser@example.com>
RCPT TO:<1507-recipient@example.com>
DATA
diff --git a/tests/data/test900 b/tests/data/test900 index 5c30ec620..36f063388 100644 --- a/tests/data/test900 +++ b/tests/data/test900 @@ -26,7 +26,7 @@ To: another body
</stdin> <command> -smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 900@example.com --mail-from 900@example.com -T - +smtp://%HOSTIP:%SMTPPORT/900 --mail-rcpt 900@example.com --mail-from 900@example.com -T - </command> </client> @@ -34,7 +34,7 @@ smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 900@example.com --mail-from 900@exampl # Verify data after the test has been "shot" <verify> <protocol> -EHLO user
+EHLO 900
MAIL FROM:<900@example.com>
RCPT TO:<900@example.com>
DATA
diff --git a/tests/data/test901 b/tests/data/test901 index 7d660868f..7836dcfb3 100644 --- a/tests/data/test901 +++ b/tests/data/test901 @@ -32,7 +32,7 @@ To: another body
</stdin> <command> -smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 901@example.com --mail-from 901@example.com -T - +smtp://%HOSTIP:%SMTPPORT/901 --mail-rcpt 901@example.com --mail-from 901@example.com -T - </command> </client> @@ -40,7 +40,7 @@ smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 901@example.com --mail-from 901@exampl # Verify data after the test has been "shot" <verify> <protocol> -EHLO user
+EHLO 901
MAIL FROM:<901@example.com>
RCPT TO:<901@example.com>
DATA
diff --git a/tests/data/test902 b/tests/data/test902 index e18550139..2994eeff3 100644 --- a/tests/data/test902 +++ b/tests/data/test902 @@ -31,7 +31,7 @@ To: another body
</stdin> <command> -smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 902@example.com --mail-from 902@example.com -T - +smtp://%HOSTIP:%SMTPPORT/902 --mail-rcpt 902@example.com --mail-from 902@example.com -T - </command> </client> @@ -39,8 +39,8 @@ smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 902@example.com --mail-from 902@exampl # Verify data after the test has been "shot" <verify> <protocol> -EHLO user
-HELO user
+EHLO 902
+HELO 902
MAIL FROM:<902@example.com>
RCPT TO:<902@example.com>
DATA
diff --git a/tests/data/test903 b/tests/data/test903 index 56ab36ebb..1b4530dc1 100644 --- a/tests/data/test903 +++ b/tests/data/test903 @@ -31,7 +31,7 @@ SMTP plain authentication mail body
</stdin> <command> -smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 903@example.com --mail-from 903@example.com -u test:1234 -T - +smtp://%HOSTIP:%SMTPPORT/903 --mail-rcpt 903@example.com --mail-from 903@example.com -u test:1234 -T - </command> </client> @@ -39,7 +39,7 @@ smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 903@example.com --mail-from 903@exampl # Verify data after the test has been "shot" <verify> <protocol> -EHLO user
+EHLO 903
AUTH PLAIN
dGVzdAB0ZXN0ADEyMzQ=
MAIL FROM:<903@example.com>
diff --git a/tests/data/test904 b/tests/data/test904 index a1d47ba5e..cb4014a5e 100644 --- a/tests/data/test904 +++ b/tests/data/test904 @@ -31,7 +31,7 @@ SMTP login authentication mail body
</stdin> <command> -smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 904@example.com --mail-from 904@example.com -u test:1234 -T - +smtp://%HOSTIP:%SMTPPORT/904 --mail-rcpt 904@example.com --mail-from 904@example.com -u test:1234 -T - </command> </client> @@ -39,7 +39,7 @@ smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 904@example.com --mail-from 904@exampl # Verify data after the test has been "shot" <verify> <protocol> -EHLO user
+EHLO 904
AUTH LOGIN
dGVzdA==
MTIzNA==
diff --git a/tests/data/test905 b/tests/data/test905 index e6c4864ea..214bc1822 100644 --- a/tests/data/test905 +++ b/tests/data/test905 @@ -34,7 +34,7 @@ SMTP CRAM-MD5 authentication mail body
</stdin> <command> -smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 905@example.com --mail-from 905@example.com -u tim:tanstaaftanstaaf -T - +smtp://%HOSTIP:%SMTPPORT/905 --mail-rcpt 905@example.com --mail-from 905@example.com -u tim:tanstaaftanstaaf -T - </command> </client> @@ -42,7 +42,7 @@ smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 905@example.com --mail-from 905@exampl # Verify data after the test has been "shot" <verify> <protocol> -EHLO user
+EHLO 905
AUTH CRAM-MD5
dGltIGI5MTNhNjAyYzdlZGE3YTQ5NWI0ZTZlNzMzNGQzODkw
MAIL FROM:<905@example.com>
diff --git a/tests/data/test906 b/tests/data/test906 index d87f70e57..f60cec3f7 100644 --- a/tests/data/test906 +++ b/tests/data/test906 @@ -39,7 +39,7 @@ LD_PRELOAD=%PWD/libtest/.libs/libhostname.so mail body
</stdin> <command> -smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 906@example.com --mail-from 906@example.com -u testuser:testpass -T - +smtp://%HOSTIP:%SMTPPORT/906 --mail-rcpt 906@example.com --mail-from 906@example.com -u testuser:testpass -T - </command> </client> @@ -47,7 +47,7 @@ smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 906@example.com --mail-from 906@exampl # Verify data after the test has been "shot" <verify> <protocol> -EHLO user
+EHLO 906
AUTH NTLM
TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAAIAAgAeAAAAAAAAAAAAAAABoKBAFpkQwKRCZFMhjj0tw47wEjKHRHlvzfxQamFcheMuv8v+xeqphEO5V41xRd7R9deOXRlc3R1c2VyY3VybGhvc3Q=
diff --git a/tests/data/test907 b/tests/data/test907 index 0265f2605..7bdde410e 100644 --- a/tests/data/test907 +++ b/tests/data/test907 @@ -30,7 +30,7 @@ SMTP plain authentication with initial response mail body
</stdin> <command> -smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 907@example.com --mail-from 907@example.com -u test:1234 --sasl-ir -T - +smtp://%HOSTIP:%SMTPPORT/907 --mail-rcpt 907@example.com --mail-from 907@example.com -u test:1234 --sasl-ir -T - </command> </client> @@ -38,7 +38,7 @@ smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 907@example.com --mail-from 907@exampl # Verify data after the test has been "shot" <verify> <protocol> -EHLO user
+EHLO 907
AUTH PLAIN dGVzdAB0ZXN0ADEyMzQ=
MAIL FROM:<907@example.com>
RCPT TO:<907@example.com>
diff --git a/tests/data/test908 b/tests/data/test908 index f77a61a78..0c1667a3b 100644 --- a/tests/data/test908 +++ b/tests/data/test908 @@ -30,7 +30,7 @@ SMTP login authentication with initial response mail body
</stdin> <command> -smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 908@example.com --mail-from 908@example.com -u test:1234 --sasl-ir -T - +smtp://%HOSTIP:%SMTPPORT/908 --mail-rcpt 908@example.com --mail-from 908@example.com -u test:1234 --sasl-ir -T - </command> </client> @@ -38,7 +38,7 @@ smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 908@example.com --mail-from 908@exampl # Verify data after the test has been "shot" <verify> <protocol> -EHLO user
+EHLO 908
AUTH LOGIN dGVzdA==
MTIzNA==
MAIL FROM:<908@example.com>
diff --git a/tests/data/test909 b/tests/data/test909 index b92a872dd..ffe42ba42 100644 --- a/tests/data/test909 +++ b/tests/data/test909 @@ -30,7 +30,7 @@ To: another body
</file> <command> -smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 909@example.com --mail-from 909@example.com -T log/test909.eml +smtp://%HOSTIP:%SMTPPORT/909 --mail-rcpt 909@example.com --mail-from 909@example.com -T log/test909.eml </command> </client> @@ -38,7 +38,7 @@ smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 909@example.com --mail-from 909@exampl # Verify data after the test has been "shot" <verify> <protocol> -EHLO user
+EHLO 909
MAIL FROM:<909@example.com>
RCPT TO:<909@example.com>
DATA
diff --git a/tests/data/test910 b/tests/data/test910 index ecf7557e5..a3bf480bd 100644 --- a/tests/data/test910 +++ b/tests/data/test910 @@ -26,7 +26,7 @@ To: another body </stdin> <command> -smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 910@example.com --mail-from 910@example.com -T - +smtp://%HOSTIP:%SMTPPORT/910 --mail-rcpt 910@example.com --mail-from 910@example.com -T - </command> </client> @@ -34,7 +34,7 @@ smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 910@example.com --mail-from 910@exampl # Verify data after the test has been "shot" <verify> <protocol> -EHLO user
+EHLO 910
MAIL FROM:<910@example.com>
RCPT TO:<910@example.com>
DATA
diff --git a/tests/data/test911 b/tests/data/test911 index 18a8fc62a..206f8afe0 100644 --- a/tests/data/test911 +++ b/tests/data/test911 @@ -25,7 +25,7 @@ SMTP with no mail data </stdin> <command> -smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 911@example.com --mail-from 911@example.com -T - +smtp://%HOSTIP:%SMTPPORT/911 --mail-rcpt 911@example.com --mail-from 911@example.com -T - </command> </client> @@ -33,7 +33,7 @@ smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 911@example.com --mail-from 911@exampl # Verify data after the test has been "shot" <verify> <protocol> -EHLO user
+EHLO 911
MAIL FROM:<911@example.com>
RCPT TO:<911@example.com>
DATA
diff --git a/tests/data/test912 b/tests/data/test912 index 5e3718400..04abfd79a 100644 --- a/tests/data/test912 +++ b/tests/data/test912 @@ -30,7 +30,7 @@ To: another body
</file> <command> -smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 912@example.com --mail-from 912@example.com -T log/test912.eml +smtp://%HOSTIP:%SMTPPORT/912 --mail-rcpt 912@example.com --mail-from 912@example.com -T log/test912.eml </command> </client> @@ -38,7 +38,7 @@ smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 912@example.com --mail-from 912@exampl # Verify data after the test has been "shot" <verify> <protocol> -EHLO user
+EHLO 912
MAIL FROM:<912@example.com> SIZE=38
RCPT TO:<912@example.com>
DATA
diff --git a/tests/data/test913 b/tests/data/test913 index ceabe1182..8c016e930 100644 --- a/tests/data/test913 +++ b/tests/data/test913 @@ -30,7 +30,7 @@ To: another body
</file> <command> -smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 913@example.com --mail-from 913@example.com -T log/test913.eml +smtp://%HOSTIP:%SMTPPORT/913 --mail-rcpt 913@example.com --mail-from 913@example.com -T log/test913.eml </command> </client> @@ -41,7 +41,7 @@ smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 913@example.com --mail-from 913@exampl 55 </errorcode> <protocol> -EHLO user
+EHLO 913
MAIL FROM:<913@example.com> SIZE=38
QUIT
</protocol> diff --git a/tests/data/test914 b/tests/data/test914 index c2599f64a..cc97bdd9f 100644 --- a/tests/data/test914 +++ b/tests/data/test914 @@ -26,7 +26,7 @@ To: another body
</file> <command> -smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 914@example.com --mail-from invalid -T log/test914.eml +smtp://%HOSTIP:%SMTPPORT/914 --mail-rcpt 914@example.com --mail-from invalid -T log/test914.eml </command> </client> @@ -37,7 +37,7 @@ smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 914@example.com --mail-from invalid -T 55 </errorcode> <protocol> -EHLO user
+EHLO 914
MAIL FROM:<invalid>
QUIT
</protocol> diff --git a/tests/data/test915 b/tests/data/test915 index da851c34c..3b5b62e16 100644 --- a/tests/data/test915 +++ b/tests/data/test915 @@ -26,7 +26,7 @@ To: another body
</stdin> <command> -smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 915@example.com -T - +smtp://%HOSTIP:%SMTPPORT/915 --mail-rcpt 915@example.com -T - </command> </client> @@ -34,7 +34,7 @@ smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 915@example.com -T - # Verify data after the test has been "shot" <verify> <protocol> -EHLO user
+EHLO 915
MAIL FROM:<>
RCPT TO:<915@example.com>
DATA
diff --git a/tests/data/test916 b/tests/data/test916 index 3a9ccea18..f2e0aedd0 100644 --- a/tests/data/test916 +++ b/tests/data/test916 @@ -26,7 +26,7 @@ To: another body
</stdin> <command> -smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt invalid --mail-from 916@example.com -T - +smtp://%HOSTIP:%SMTPPORT/916 --mail-rcpt invalid --mail-from 916@example.com -T - </command> </client> @@ -37,7 +37,7 @@ smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt invalid --mail-from 916@example.com -T 55 </errorcode> <protocol> -EHLO user
+EHLO 916
MAIL FROM:<916@example.com>
RCPT TO:<invalid>
QUIT
diff --git a/tests/data/test917 b/tests/data/test917 index d5dc4f8ef..23a05ecb1 100644 --- a/tests/data/test917 +++ b/tests/data/test917 @@ -26,7 +26,7 @@ To: another body
</stdin> <command> -smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 917@example.com --mail-rcpt 917@foo.example.com --mail-rcpt 917@bar.example.com --mail-rcpt 917@foobar.example.com --mail-rcpt 917@another.example.com --mail-from 917@example.com -T - +smtp://%HOSTIP:%SMTPPORT/917 --mail-rcpt 917@example.com --mail-rcpt 917@foo.example.com --mail-rcpt 917@bar.example.com --mail-rcpt 917@foobar.example.com --mail-rcpt 917@another.example.com --mail-from 917@example.com -T - </command> </client> @@ -34,7 +34,7 @@ smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 917@example.com --mail-rcpt 917@foo.ex # Verify data after the test has been "shot" <verify> <protocol> -EHLO user
+EHLO 917
MAIL FROM:<917@example.com>
RCPT TO:<917@example.com>
RCPT TO:<917@foo.example.com>
diff --git a/tests/data/test918 b/tests/data/test918 index be9ec853f..4817e2814 100644 --- a/tests/data/test918 +++ b/tests/data/test918 @@ -26,7 +26,7 @@ To: another body
</stdin> <command> -smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 918@example.com --mail-rcpt invalid --mail-rcpt 918@bar.example.com --mail-rcpt sTrAnGe --mail-rcpt 918@another.example.com --mail-from 918@example.com -T - +smtp://%HOSTIP:%SMTPPORT/918 --mail-rcpt 918@example.com --mail-rcpt invalid --mail-rcpt 918@bar.example.com --mail-rcpt sTrAnGe --mail-rcpt 918@another.example.com --mail-from 918@example.com -T - </command> </client> @@ -37,7 +37,7 @@ smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 918@example.com --mail-rcpt invalid -- 55
</errorcode>
<protocol> -EHLO user
+EHLO 918
MAIL FROM:<918@example.com>
RCPT TO:<918@example.com>
RCPT TO:<invalid>
diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl index 838d849a0..907846ab9 100755 --- a/tests/ftpserver.pl +++ b/tests/ftpserver.pl @@ -685,12 +685,12 @@ sub close_dataconn { ################ SMTP commands ################ -# what set by "RCPT" -my $smtp_rcpt; - # The type of server (SMTP or ESMTP) my $smtp_type; +# The client (which normally contains the test number) +my $smtp_client; + sub EHLO_smtp { my ($client) = @_; @@ -753,6 +753,9 @@ sub EHLO_smtp { sendcontrol "250 $d\r\n"; } } + + # Store the client (as it may contain the test number) + $smtp_client = $client; } return 0; @@ -784,6 +787,9 @@ sub HELO_smtp { # Send the HELO response sendcontrol "250 $smtp_type pingpong test server Hello $client\r\n"; + + # Store the client (as it may contain the test number) + $smtp_client = $client; } return 0; @@ -854,11 +860,11 @@ sub RCPT_smtp { sendcontrol "501 Unrecognized parameter\r\n"; } else { - $smtp_rcpt = $1; + my $to = $1; # Validate the to address (only a valid email address inside <> is # allowed, such as <user@example.com>) - if ($smtp_rcpt !~ + if ($to !~ /^<([a-zA-Z0-9._%+-]+)\@([a-zA-Z0-9.-]+).([a-zA-Z]{2,4})>$/) { sendcontrol "501 Invalid address\r\n"; } @@ -872,17 +878,17 @@ sub RCPT_smtp { sub DATA_smtp { my ($args) = @_; - my $testno = $smtp_rcpt; if ($args) { sendcontrol "501 Unrecognized parameter\r\n"; } + elsif ($smtp_client !~ /^(\d*)$/) + sendcontrol "501 Invalid arguments\r\n"; + } else { - $testno =~ s/^([^0-9]*)([0-9]+).*/$2/; sendcontrol "354 Show me the mail\r\n"; - logmsg "===> rcpt $testno was $smtp_rcpt\n"; - + my $testno = $smtp_client; my $filename = "log/upload.$testno"; logmsg "Store test number $testno in $filename\n"; |