aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/FILEFORMAT1
-rw-r--r--tests/data/Makefile.am2
-rw-r--r--tests/data/test27048
-rw-r--r--tests/ftpserver.pl11
4 files changed, 60 insertions, 2 deletions
diff --git a/tests/FILEFORMAT b/tests/FILEFORMAT
index 57850fb64..e862f90c8 100644
--- a/tests/FILEFORMAT
+++ b/tests/FILEFORMAT
@@ -81,6 +81,7 @@ RETRWEIRDO
RETRNOSIZE
NOSAVE
SLOWDOWN
+PASVBADIP - makes PASV send back an illegal IP in its 227 response
For HTTP, one specified command is supported:
"auth_required" - if this is set and a POST/PUT is made without auth, the
diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
index 416c2bb60..0b9e4a2ea 100644
--- a/tests/data/Makefile.am
+++ b/tests/data/Makefile.am
@@ -33,4 +33,4 @@ EXTRA_DIST = test1 test108 test117 test127 test20 test27 test34 test46 \
test237 test238 test239 test243 test245 test246 test247 test248 test249 \
test250 test251 test252 test253 test254 test255 test521 test522 test523 \
test256 test257 test258 test259 test260 test261 test262 test263 test264 \
- test265 test266 test267 test268 test269
+ test265 test266 test267 test268 test269 test270
diff --git a/tests/data/test270 b/tests/data/test270
new file mode 100644
index 000000000..6c47b559e
--- /dev/null
+++ b/tests/data/test270
@@ -0,0 +1,48 @@
+<info>
+<keywords>
+FTP
+PASV
+RETR
+</keywords>
+</info>
+# Server-side
+<reply>
+<data>
+data
+ to
+ see
+that FTP
+works
+ so does it?
+</data>
+<servercmd>
+PASVBADIP
+</servercmd>
+</reply>
+
+# Client-side
+<client>
+<server>
+ftp
+</server>
+ <name>
+FTP RETR PASV --ftp-skip-pasv-ip
+ </name>
+ <command>
+ftp://%HOSTIP:%FTPPORT/270 --ftp-skip-pasv-ip --disable-epsv
+</command>
+</client>
+
+# Verify data after the test has been "shot"
+<verify>
+<protocol>
+USER anonymous
+PASS curl_by_daniel@haxx.se
+PWD
+PASV
+TYPE I
+SIZE 270
+RETR 270
+QUIT
+</protocol>
+</verify>
diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl
index e721bec2a..4c74cc1cf 100644
--- a/tests/ftpserver.pl
+++ b/tests/ftpserver.pl
@@ -70,6 +70,7 @@ sub ftpmsg {
}
my $verbose=0; # set to 1 for debugging
+my $pasvbadip=0;
my $retrweirdo=0;
my $retrnosize=0;
my $srcdir=".";
@@ -564,7 +565,11 @@ sub PASV_command {
if($cmd ne "EPSV") {
# PASV reply
- sendcontrol sprintf("227 Entering Passive Mode (127,0,0,1,%d,%d)\n",
+ my $p="127,0,0,1";
+ if($pasvbadip) {
+ $p="1,2,3,4";
+ }
+ sendcontrol sprintf("227 Entering Passive Mode ($p,%d,%d)\n",
($pasvport/256), ($pasvport%256));
}
else {
@@ -703,6 +708,10 @@ sub customize {
logmsg "FTPD: instructed to use RETRNOSIZE\n";
$retrnosize=1;
}
+ elsif($_ =~ /PASVBADIP/) {
+ logmsg "FTPD: instructed to use PASVBADIP\n";
+ $pasvbadip=1;
+ }
elsif($_ =~ /NOSAVE/) {
# don't actually store the file we upload - to be used when
# uploading insanely huge amounts