diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/data/Makefile.am | 2 | ||||
-rw-r--r-- | tests/data/test805 | 54 | ||||
-rw-r--r-- | tests/data/test806 | 55 | ||||
-rw-r--r-- | tests/data/test807 | 59 | ||||
-rwxr-xr-x | tests/ftpserver.pl | 19 | ||||
-rwxr-xr-x | tests/runtests.pl | 1 |
6 files changed, 181 insertions, 9 deletions
diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index 6f2c09079..b28c5adc2 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -65,7 +65,7 @@ EXTRA_DIST = test1 test108 test117 test127 test20 test27 test34 test46 \ test564 test1101 test1102 test1103 test1104 test299 test310 test311 \ test312 test1105 test565 test800 test1106 test801 test566 test802 test803 \ test1107 test1108 test1109 test1110 test1111 test1112 test129 test567 \ - test568 test569 test570 test571 test804 test572 + test568 test569 test570 test571 test572 test804 test805 test806 test807 filecheck: @mkdir test-place; \ diff --git a/tests/data/test805 b/tests/data/test805 new file mode 100644 index 000000000..fba5124f3 --- /dev/null +++ b/tests/data/test805 @@ -0,0 +1,54 @@ +<testcase> +<info> +<keywords> +SMTP +SMTP AUTH PLAIN +RFC4616 +RFC4954 +</keywords> +</info> + +# +# Server-side +<reply> +<servercmd> +REPLY EHLO 220 AUTH PLAIN +REPLY AUTH 235 Authenticated +</servercmd> +</reply> + +# +# Client-side +<client> +<server> +smtp +</server> + <name> +SMTP plain authentication + </name> +<stdin> +mail body +</stdin> + <command> +smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 805@foo --mail-from 805@from -u test:1234 -T - +</command> +</client> + +# +# Verify data after the test has been "shot" +<verify> +<protocol> +EHLO user
+AUTH PLAIN dGVzdAB0ZXN0ADEyMzQ=
+MAIL FROM:805@from
+RCPT TO:<805@foo>
+DATA
+QUIT
+</protocol> +<upload> +mail body +
+.
+</upload> +</verify> +</testcase> diff --git a/tests/data/test806 b/tests/data/test806 new file mode 100644 index 000000000..8ece5dc8c --- /dev/null +++ b/tests/data/test806 @@ -0,0 +1,55 @@ +<testcase> +<info> +<keywords> +SMTP +SMTP AUTH LOGIN +RFC4954 +</keywords> +</info> + +# +# Server-side +<reply> +<servercmd> +REPLY EHLO 220 AUTH LOGIN +REPLY AUTH 334 UGFzc3dvcmQ6 +REPLY MTIzNA== 235 Authenticated +</servercmd> +</reply> + +# +# Client-side +<client> +<server> +smtp +</server> + <name> +SMTP login authentication + </name> +<stdin> +mail body +</stdin> + <command> +smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 806@foo --mail-from 806@from -u test:1234 -T - +</command> +</client> + +# +# Verify data after the test has been "shot" +<verify> +<protocol> +EHLO user
+AUTH LOGIN dGVzdA==
+MTIzNA==
+MAIL FROM:806@from
+RCPT TO:<806@foo>
+DATA
+QUIT
+</protocol> +<upload> +mail body +
+.
+</upload> +</verify> +</testcase> diff --git a/tests/data/test807 b/tests/data/test807 new file mode 100644 index 000000000..6daa1d02b --- /dev/null +++ b/tests/data/test807 @@ -0,0 +1,59 @@ +<testcase> +<info> +<keywords> +SMTP +SMTP AUTH CRAM-MD5 +RFC2195 +RFC4954 +</keywords> +</info> + +# +# Server-side +<reply> +<servercmd> +REPLY EHLO 220 AUTH CRAM-MD5 +REPLY AUTH 334 PDE4OTYuNjk3MTcwOTUyQHBvc3RvZmZpY2UucmVzdG9uLm1jaS5uZXQ+ +REPLY dGltIGI5MTNhNjAyYzdlZGE3YTQ5NWI0ZTZlNzMzNGQzODkw 235 Authenticated +</servercmd> +</reply> + +# +# Client-side +<client> +<server> +smtp +</server> +<features> +crypto +</features> + <name> +SMTP CRAM-MD5 authentication + </name> +<stdin> +mail body +</stdin> + <command> +smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 807@foo --mail-from 807@from -u tim:tanstaaftanstaaf -T - +</command> +</client> + +# +# Verify data after the test has been "shot" +<verify> +<protocol> +EHLO user
+AUTH CRAM-MD5
+dGltIGI5MTNhNjAyYzdlZGE3YTQ5NWI0ZTZlNzMzNGQzODkw
+MAIL FROM:807@from
+RCPT TO:<807@foo>
+DATA
+QUIT
+</protocol> +<upload> +mail body +
+.
+</upload> +</verify> +</testcase> diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl index d6b676cab..cc69585c8 100755 --- a/tests/ftpserver.pl +++ b/tests/ftpserver.pl @@ -1118,7 +1118,7 @@ sub customize { logmsg "FTPD: Getting commands from log/ftpserver.cmd\n"; while(<CUSTOM>) { - if($_ =~ /REPLY ([A-Z]+) (.*)/) { + if($_ =~ /REPLY ([A-Za-z0-9+\/=]+) (.*)/) { $customreply{$1}=eval "qq{$2}"; logmsg "FTPD: set custom reply for $1\n"; } @@ -1380,13 +1380,18 @@ while(1) { $FTPCMD=$2; $FTPARG=$3; } - else { - unless (m/^([A-Z]{3,4})\s?(.*)/i) { - sendcontrol "500 '$_': command not understood.\r\n"; - last; - } + elsif (m/^([A-Z]{3,4})(\s(.*))?$/i) { $FTPCMD=$1; - $FTPARG=$2; + $FTPARG=$3; + } + elsif($proto eq "smtp" && m/^[A-Z0-9+\/]{0,512}={0,2}$/i) { + # SMTP long "commands" are base64 authentication data. + $FTPCMD=$_; + $FTPARG=""; + } + else { + sendcontrol "500 '$_': command not understood.\r\n"; + last; } logmsg "< \"$full\"\n"; diff --git a/tests/runtests.pl b/tests/runtests.pl index 6e3b5b9cf..c8a54f05a 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -755,7 +755,6 @@ sub verifyftp { # has _no_ output! $extra .= "--mail-rcpt verifiedserver "; $extra .= "--mail-from fake "; - $extra .= "--user localhost:unused "; $extra .= "--upload /dev/null "; $extra .= "--stderr - "; # move stderr to parse the verbose stuff } |