summaryrefslogtreecommitdiff
path: root/tests/ftpserver.pl
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2013-11-16 11:11:45 +0000
committerSteve Holme <steve_holme@hotmail.com>2013-11-16 11:17:23 +0000
commit0cbfe5a7d58ba44f05ad5c982b2e5a6d5babff49 (patch)
tree5c09e67355a1109e448d89e96da40c9d86de9550 /tests/ftpserver.pl
parenteedca5055e992fa9b035541e9dbff053c693415a (diff)
downloadcurl-0cbfe5a7d58ba44f05ad5c982b2e5a6d5babff49.tar.gz
ftpserver.pl: Added support for new SMTP commands
Diffstat (limited to 'tests/ftpserver.pl')
-rwxr-xr-xtests/ftpserver.pl112
1 files changed, 112 insertions, 0 deletions
diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl
index 96cfdfe98..a116850aa 100755
--- a/tests/ftpserver.pl
+++ b/tests/ftpserver.pl
@@ -627,9 +627,14 @@ sub protocolsetup {
%commandfunc = (
'DATA' => \&DATA_smtp,
'EHLO' => \&EHLO_smtp,
+ 'EXPN' => \&EXPN_smtp,
'HELO' => \&HELO_smtp,
+ 'HELP' => \&HELP_smtp,
'MAIL' => \&MAIL_smtp,
+ 'NOOP' => \&NOOP_smtp,
+ 'RSET' => \&RSET_smtp,
'RCPT' => \&RCPT_smtp,
+ 'VRFY' => \&VRFY_smtp,
'QUIT' => \&QUIT_smtp,
);
%displaytext = (
@@ -957,6 +962,113 @@ sub DATA_smtp {
return 0;
}
+sub NOOP_smtp {
+ my ($args) = @_;
+
+ if($args) {
+ sendcontrol "501 Unrecognized parameter\r\n";
+ }
+ else {
+ sendcontrol "250 OK\r\n";
+ }
+
+ return 0;
+}
+
+sub RSET_smtp {
+ my ($args) = @_;
+
+ if($args) {
+ sendcontrol "501 Unrecognized parameter\r\n";
+ }
+ else {
+ sendcontrol "250 Resetting\r\n";
+ }
+
+ return 0;
+}
+
+sub HELP_smtp {
+ my ($args) = @_;
+
+ # One argument is optional
+ if($args) {
+ logmsg "HELP_smtp got $args\n";
+ }
+
+ sendcontrol "214-This server supports the following commands:\r\n";
+
+ if(@auth_mechs) {
+ sendcontrol "214 HELO EHLO RCPT DATA RSET MAIL QUIT HELP AUTH\r\n";
+ }
+ else {
+ sendcontrol "214 HELO EHLO RCPT DATA RSET MAIL QUIT HELP\r\n";
+ }
+
+ return 0;
+}
+
+sub VRFY_smtp {
+ my ($args) = @_;
+ my ($username, $address) = split(/ /, $args, 2);
+
+ logmsg "VRFY_smtp got $args\n";
+
+ if($username eq "") {
+ sendcontrol "501 Unrecognized parameter\r\n";
+ }
+ else {
+ my $testno = $smtp_client;
+
+ $testno =~ s/^([^0-9]*)//;
+ my $testpart = "";
+ if ($testno > 10000) {
+ $testpart = $testno % 10000;
+ $testno = int($testno / 10000);
+ }
+
+ loadtest("$srcdir/data/test$testno");
+
+ my @data = getpart("reply", "data$testpart");
+
+ for my $d (@data) {
+ sendcontrol $d;
+ }
+ }
+
+ return 0;
+}
+
+sub EXPN_smtp {
+ my ($list_name) = @_;
+
+ logmsg "EXPN_smtp got $list_name\n";
+
+ if(!$list_name) {
+ sendcontrol "501 Unrecognized parameter\r\n";
+ }
+ else {
+ my $testno = $smtp_client;
+
+ $testno =~ s/^([^0-9]*)//;
+ my $testpart = "";
+ if ($testno > 10000) {
+ $testpart = $testno % 10000;
+ $testno = int($testno / 10000);
+ }
+
+ loadtest("$srcdir/data/test$testno");
+
+ my @data = getpart("reply", "data$testpart");
+
+ for my $d (@data) {
+ sendcontrol $d;
+ }
+ }
+
+ return 0;
+}
+
sub QUIT_smtp {
sendcontrol "221 cURL $smtp_type server signing off\r\n";