1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

Changed some FTP tests to validate the format of the PORT and EPRT commands

sent by curl, if not the addresses themselves.
This commit is contained in:
Dan Fandrich 2007-09-17 21:44:57 +00:00
parent 048c74f2fa
commit 7f496d8c3f
19 changed files with 74 additions and 73 deletions

View File

@ -6,6 +6,13 @@
Changelog Changelog
Dan F (17 September 2007)
- Added hooks to the test suite to make it possible to test a curl running
on a remote host.
- Changed some FTP tests to validate the format of the PORT and EPRT commands
sent by curl, if not the addresses themselves.
Daniel S (15 September 2007) Daniel S (15 September 2007)
- Michal Marek made libcurl automatically append ";type=<a|i>" when using HTTP - Michal Marek made libcurl automatically append ";type=<a|i>" when using HTTP
proxies for FTP urls. proxies for FTP urls.

View File

@ -34,17 +34,16 @@ ftp
FTP dir list, PORT with specified IP FTP dir list, PORT with specified IP
</name> </name>
<command> <command>
ftp://%HOSTIP:%FTPPORT/ -P %HOSTIP ftp://%HOSTIP:%FTPPORT/ -P %CLIENTIP
</command> </command>
</client> </client>
# Verify data after the test has been "shot" # Verify data after the test has been "shot"
<verify> <verify>
# strip all kinds of PORT, EPRT and LPRT curl can do # Strip all valid kinds of PORT and EPRT that curl can send
<strip> <strip>
^PORT 127,0,0,1,.* ^PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}
^EPRT.* ^EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|
^LPRT.*
</strip> </strip>
<protocol> <protocol>
USER anonymous USER anonymous

View File

@ -33,18 +33,18 @@ ftp://%HOSTIP:%FTPPORT/a/path/103 -P -
# Verify data after the test has been "shot" # Verify data after the test has been "shot"
<verify> <verify>
<strippart> # Strip all valid kinds of PORT and EPRT that curl can send
s/^LPRT.*[\r\n]*// <strip>
s/^EPRT.*[\r\n]*// ^PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}
s/^(PORT 127,0,0,1,)([0-9,]+)/$1/ ^EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|
</strippart> </strip>
<protocol> <protocol>
USER anonymous USER anonymous
PASS ftp@example.com PASS ftp@example.com
PWD PWD
CWD a CWD a
CWD path CWD path
PORT 127,0,0,1, PORT 127,0,0,1,0,0
TYPE I TYPE I
SIZE 103 SIZE 103
RETR 103 RETR 103

View File

@ -31,10 +31,10 @@ Moooooooooooo
# Verify data after the test has been "shot" # Verify data after the test has been "shot"
<verify> <verify>
# Strip all valid kinds of PORT and EPRT that curl can send
<strip> <strip>
^PORT .* ^PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}
^EPRT .* ^EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|
^LPRT .*
</strip> </strip>
<protocol> <protocol>
USER anonymous USER anonymous

View File

@ -22,7 +22,7 @@ ftp
FTP download, failed PORT FTP download, failed PORT
</name> </name>
<command> <command>
ftp://%HOSTIP:%FTPPORT/116 -P 127.0.0.1 ftp://%HOSTIP:%FTPPORT/116 -P 1.2.3.4
</command> </command>
</client> </client>
@ -31,15 +31,17 @@ ftp://%HOSTIP:%FTPPORT/116 -P 127.0.0.1
<errorcode> <errorcode>
30 30
</errorcode> </errorcode>
<strip> # Strip the port number but leave the rest
^PORT 127,0,0,1,.* <strippart>
^EPRT .* s/^(PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},)\d{1,3},\d{1,3}/$1/
^LPRT .* s/^(EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|)\d{1,5}\|/$1/
</strip> </strippart>
<protocol> <protocol>
USER anonymous USER anonymous
PASS ftp@example.com PASS ftp@example.com
PWD PWD
EPRT |1|1.2.3.4|
PORT 1,2,3,4,
QUIT QUIT
</protocol> </protocol>
</verify> </verify>

View File

@ -32,10 +32,10 @@ ftp://%HOSTIP:%FTPPORT/119 -P -
<errorcode> <errorcode>
19 19
</errorcode> </errorcode>
# Strip all valid kinds of PORT and EPRT that curl can send
<strip> <strip>
^PORT.* ^PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}
^EPRT .* ^EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|
^LPRT .*
</strip> </strip>
<protocol> <protocol>
USER anonymous USER anonymous

View File

@ -23,11 +23,10 @@ ftp://%HOSTIP:%FTPPORT/ -P - -l
# Verify data after the test has been "shot" # Verify data after the test has been "shot"
<verify> <verify>
# strip all kinds of PORT, EPRT and LPRT curl can do # Strip all valid kinds of PORT and EPRT that curl can send
<strip> <strip>
^PORT 127,0,0,1,.* ^PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}
^EPRT.* ^EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|
^LPRT.*
</strip> </strip>
<protocol> <protocol>
USER anonymous USER anonymous

View File

@ -26,11 +26,10 @@ ftp://%HOSTIP:%FTPPORT/ -P - -l
<errorcode> <errorcode>
19 19
</errorcode> </errorcode>
# strip all kinds of PORT, EPRT and LPRT curl can do # Strip all valid kinds of PORT and EPRT that curl can send
<strip> <strip>
^PORT 127,0,0,1,.* ^PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}
^EPRT.* ^EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|
^LPRT.*
</strip> </strip>
<protocol> <protocol>
USER anonymous USER anonymous

View File

@ -21,11 +21,10 @@ ftp://%HOSTIP:%FTPPORT/first/dir/here/146 ftp://%HOSTIP:%FTPPORT/146
# Verify data after the test has been "shot" # Verify data after the test has been "shot"
<verify> <verify>
# strip all kinds of PORT, EPRT and LPRT curl can do # Strip all valid kinds of PORT and EPRT that curl can send
<strip> <strip>
^PORT 127,0,0,1,.* ^PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}
^EPRT.* ^EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|
^LPRT.*
</strip> </strip>
<protocol> <protocol>
USER anonymous USER anonymous

View File

@ -25,11 +25,10 @@ ftp://%HOSTIP:%FTPPORT/first/dir/here/147 --ftp-create-dirs
# Verify data after the test has been "shot" # Verify data after the test has been "shot"
<verify> <verify>
# strip all kinds of PORT, EPRT and LPRT curl can do # Strip all valid kinds of PORT and EPRT that curl can send
<strip> <strip>
^PORT 127,0,0,1,.* ^PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}
^EPRT.* ^EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|
^LPRT.*
</strip> </strip>
<protocol> <protocol>
USER anonymous USER anonymous

View File

@ -22,11 +22,10 @@ ftp://%HOSTIP:%FTPPORT/attempt/to/get/this/148 --ftp-create-dirs
# Verify data after the test has been "shot" # Verify data after the test has been "shot"
<verify> <verify>
# strip all kinds of PORT, EPRT and LPRT curl can do # Strip all valid kinds of PORT and EPRT that curl can send
<strip> <strip>
^PORT 127,0,0,1,.* ^PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}
^EPRT.* ^EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|
^LPRT.*
</strip> </strip>
<errorcode> <errorcode>
9 9

View File

@ -21,11 +21,10 @@ send away this contents
# Verify data after the test has been "shot" # Verify data after the test has been "shot"
<verify> <verify>
# strip all kinds of PORT, EPRT and LPRT curl can do # Strip all valid kinds of PORT and EPRT that curl can send
<strip> <strip>
^PORT 127,0,0,1,.* ^PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}
^EPRT.* ^EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|
^LPRT.*
</strip> </strip>
<protocol> <protocol>
USER anonymous USER anonymous

View File

@ -31,9 +31,10 @@ data blobb
# Verify data after the test has been "shot" # Verify data after the test has been "shot"
<verify> <verify>
# Strip the addresses and port number but leave the rest
<strippart> <strippart>
s/^(EPRT \|1\|127.0.0.1).*/$1/ s/^(EPRT \|1\|)\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|/$1/
s/^(PORT 127,0,0,1,).*/$1/ s/^(PORT )\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}/$1/
</strippart> </strippart>
<protocol> <protocol>
USER anonymous USER anonymous
@ -41,12 +42,12 @@ PASS ftp@example.com
PWD PWD
CWD a CWD a
CWD path CWD path
EPRT |1|127.0.0.1 EPRT |1|
PORT 127,0,0,1, PORT
TYPE I TYPE I
SIZE 212 SIZE 212
RETR 212 RETR 212
PORT 127,0,0,1, PORT
SIZE 212 SIZE 212
RETR 212 RETR 212
QUIT QUIT

View File

@ -36,11 +36,10 @@ ftp://%HOSTIP:%FTPPORT/ -P %HOSTIP
# Verify data after the test has been "shot" # Verify data after the test has been "shot"
<verify> <verify>
# strip all kinds of PORT, EPRT and LPRT curl can do # Strip all valid kinds of PORT and EPRT that curl can send
<strip> <strip>
^PORT 127,0,0,1,.* ^PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}
^EPRT.* ^EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|
^LPRT.*
</strip> </strip>
<protocol> <protocol>
USER anonymous USER anonymous

View File

@ -39,18 +39,17 @@ ftps
FTPS dir list, PORT with specified IP FTPS dir list, PORT with specified IP
</name> </name>
<command> <command>
-k --ftp-ssl-control -P %HOSTIP ftps://%HOSTIP:%FTPSPORT/ -k --ftp-ssl-control -P %CLIENTIP ftps://%HOSTIP:%FTPSPORT/
</command> </command>
</client> </client>
# #
# Verify data after the test has been "shot" # Verify data after the test has been "shot"
<verify> <verify>
# strip all kinds of PORT, EPRT and LPRT curl can do # Strip all valid kinds of PORT and EPRT that curl can send
<strip> <strip>
^PORT 127,0,0,1,.* ^PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}
^EPRT.* ^EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|
^LPRT.*
</strip> </strip>
<protocol> <protocol>
USER anonymous USER anonymous

View File

@ -34,10 +34,10 @@ Moooooooooooo
# Verify data after the test has been "shot" # Verify data after the test has been "shot"
<verify> <verify>
# Strip all valid kinds of PORT and EPRT that curl can send
<strip> <strip>
^PORT .* ^PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}
^EPRT .* ^EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|
^LPRT .*
</strip> </strip>
<protocol> <protocol>
USER anonymous USER anonymous

View File

@ -34,10 +34,10 @@ Moooooooooooo
# Verify data after the test has been "shot" # Verify data after the test has been "shot"
<verify> <verify>
# Strip all valid kinds of PORT and EPRT that curl can send
<strip> <strip>
^PORT .* ^PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}
^EPRT .* ^EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|
^LPRT .*
</strip> </strip>
<protocol> <protocol>
USER anonymous USER anonymous

View File

@ -34,10 +34,10 @@ Moooooooooooo
# Verify data after the test has been "shot" # Verify data after the test has been "shot"
<verify> <verify>
# Strip all valid kinds of PORT and EPRT that curl can send
<strip> <strip>
^PORT .* ^PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}
^EPRT .* ^EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|
^LPRT .*
</strip> </strip>
<protocol> <protocol>
USER anonymous USER anonymous

View File

@ -37,10 +37,10 @@ don't upload this
# Verify data after the test has been "shot" # Verify data after the test has been "shot"
<verify> <verify>
# Strip all valid kinds of PORT and EPRT that curl can send
<strip> <strip>
^PORT .* ^PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}
^EPRT .* ^EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|
^LPRT .*
</strip> </strip>
<protocol> <protocol>
USER anonymous USER anonymous