]> granicus.if.org Git - curl/commitdiff
Changed some FTP tests to validate the format of the PORT and EPRT commands
authorDan Fandrich <dan@coneharvesters.com>
Mon, 17 Sep 2007 21:44:57 +0000 (21:44 +0000)
committerDan Fandrich <dan@coneharvesters.com>
Mon, 17 Sep 2007 21:44:57 +0000 (21:44 +0000)
sent by curl, if not the addresses themselves.

19 files changed:
CHANGES
tests/data/test101
tests/data/test103
tests/data/test108
tests/data/test116
tests/data/test119
tests/data/test144
tests/data/test145
tests/data/test146
tests/data/test147
tests/data/test148
tests/data/test149
tests/data/test212
tests/data/test251
tests/data/test406
tests/data/test408
tests/data/test525
tests/data/test529
tests/data/test531

diff --git a/CHANGES b/CHANGES
index 361e81662b8b1553345c7452f26a7a271e363a76..cee4d48c80430e9a50088abd7c7060791c1f1cb4 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,13 @@
 
                                   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)
 - Michal Marek made libcurl automatically append ";type=<a|i>" when using HTTP
   proxies for FTP urls.
index a9314a71f7144d34b254034bc639025d7ace1b5d..815292b2cb337c4dce2cf8592b2bbd8b8f549174 100644 (file)
@@ -34,17 +34,16 @@ ftp
 FTP dir list, PORT with specified IP
  </name>
  <command>
-ftp://%HOSTIP:%FTPPORT/ -P %HOSTIP
+ftp://%HOSTIP:%FTPPORT/ -P %CLIENTIP
 </command>
 </client>
 
 # Verify data after the test has been "shot"
 <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>
-^PORT 127,0,0,1,.*
-^EPRT.*
-^LPRT.*
+^PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}
+^EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|
 </strip>
 <protocol>
 USER anonymous\r
index 27d4cb0efb57fa0eb1769052700e8878fefc33be..15712f5da11220436931cacd542eec8cb57cc2e6 100644 (file)
@@ -33,18 +33,18 @@ ftp://%HOSTIP:%FTPPORT/a/path/103 -P -
 
 # Verify data after the test has been "shot"
 <verify>
-<strippart>
-s/^LPRT.*[\r\n]*//
-s/^EPRT.*[\r\n]*//
-s/^(PORT 127,0,0,1,)([0-9,]+)/$1/
-</strippart>
+# Strip all valid kinds of PORT and EPRT that curl can send
+<strip>
+^PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}
+^EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|
+</strip>
 <protocol>
 USER anonymous\r
 PASS ftp@example.com\r
 PWD\r
 CWD a\r
 CWD path\r
-PORT 127,0,0,1,\r
+PORT 127,0,0,1,0,0\r
 TYPE I\r
 SIZE 103\r
 RETR 103\r
index ff7b5e13170bf64d0a9b5adf8c04be782a9db59c..eb2ea63c137222ad8491ccaf5e76adbf988f7971 100644 (file)
@@ -31,10 +31,10 @@ Moooooooooooo
 
 # Verify data after the test has been "shot"
 <verify>
+# Strip all valid kinds of PORT and EPRT that curl can send
 <strip>
-^PORT .*
-^EPRT .*
-^LPRT .*
+^PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}
+^EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|
 </strip>
 <protocol>
 USER anonymous\r
index d3718e39335cff161e68466d7cfd22f7cc31f0de..b396c96b2bd0eff7c11a3cc1aee772ef83570417 100644 (file)
@@ -22,7 +22,7 @@ ftp
 FTP download, failed PORT
  </name>
  <command>
-ftp://%HOSTIP:%FTPPORT/116 -P 127.0.0.1
+ftp://%HOSTIP:%FTPPORT/116 -P 1.2.3.4
 </command>
 </client>
 
@@ -31,15 +31,17 @@ ftp://%HOSTIP:%FTPPORT/116 -P 127.0.0.1
 <errorcode>
 30
 </errorcode>
-<strip>
-^PORT 127,0,0,1,.*
-^EPRT .*
-^LPRT .*
-</strip>
+# Strip the port number but leave the rest
+<strippart>
+s/^(PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},)\d{1,3},\d{1,3}/$1/
+s/^(EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|)\d{1,5}\|/$1/
+</strippart>
 <protocol>
 USER anonymous\r
 PASS ftp@example.com\r
 PWD\r
+EPRT |1|1.2.3.4|\r
+PORT 1,2,3,4,\r
 QUIT\r
 </protocol>
 </verify>
index 0db6d297cdd1a5eba8692adf1c62f5eaf357bacc..00a24287b76483aae7766ac7f18a6dd64f633a1f 100644 (file)
@@ -32,10 +32,10 @@ ftp://%HOSTIP:%FTPPORT/119 -P -
 <errorcode>
 19
 </errorcode>
+# Strip all valid kinds of PORT and EPRT that curl can send
 <strip>
-^PORT.*
-^EPRT .*
-^LPRT .*
+^PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}
+^EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|
 </strip>
 <protocol>
 USER anonymous\r
index 4a9f0038ea68a374058f47e74bb32c9bbdadd402..b6fa260cda2fb98504015e1faf2d25bd265fde0b 100644 (file)
@@ -23,11 +23,10 @@ ftp://%HOSTIP:%FTPPORT/ -P - -l
 
 # Verify data after the test has been "shot"
 <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>
-^PORT 127,0,0,1,.*
-^EPRT.*
-^LPRT.*
+^PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}
+^EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|
 </strip>
 <protocol>
 USER anonymous\r
index 931d52745b0b261f322053a641d2bae47124c0c1..a35c3f0ac90be86ab983689328b4ff3b57cc4d40 100644 (file)
@@ -26,11 +26,10 @@ ftp://%HOSTIP:%FTPPORT/ -P - -l
 <errorcode>
 19
 </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>
-^PORT 127,0,0,1,.*
-^EPRT.*
-^LPRT.*
+^PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}
+^EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|
 </strip>
 <protocol>
 USER anonymous\r
index 73895f29b46c4ee27b17fcd3fc3a6adfb6542bcb..1c9779463cb85925bf388da4eb43ee164f6cbdac 100644 (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>
-# strip all kinds of PORT, EPRT and LPRT curl can do
+# Strip all valid kinds of PORT and EPRT that curl can send
 <strip>
-^PORT 127,0,0,1,.*
-^EPRT.*
-^LPRT.*
+^PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}
+^EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|
 </strip>
 <protocol>
 USER anonymous\r
index 9d2b27aeacc929463e7a203708d13e5643bf43f9..aaa4ca15699ac1fae5601ccc9600e6db771a26e9 100644 (file)
@@ -25,11 +25,10 @@ ftp://%HOSTIP:%FTPPORT/first/dir/here/147 --ftp-create-dirs
 
 # Verify data after the test has been "shot"
 <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>
-^PORT 127,0,0,1,.*
-^EPRT.*
-^LPRT.*
+^PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}
+^EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|
 </strip>
 <protocol>
 USER anonymous\r
index ace4b4d4e963427ec7f0306ab81c4de0a7eb378c..de0fa7ab339db81aaa5cd7319b6394d4718db5a7 100644 (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>
-# strip all kinds of PORT, EPRT and LPRT curl can do
+# Strip all valid kinds of PORT and EPRT that curl can send
 <strip>
-^PORT 127,0,0,1,.*
-^EPRT.*
-^LPRT.*
+^PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}
+^EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|
 </strip>
 <errorcode>
 9
index c50f134eb4308b598da507e5b1fbe46d274b5194..64c0c6ca4eb59c29c58124d2e30ab9ffc7f8204b 100644 (file)
@@ -21,11 +21,10 @@ send away this contents
 
 # Verify data after the test has been "shot"
 <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>
-^PORT 127,0,0,1,.*
-^EPRT.*
-^LPRT.*
+^PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}
+^EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|
 </strip>
 <protocol>
 USER anonymous\r
index d00e677d75e53788bea862ef587ee01e362f8a3c..9a802c0c338cc40ae9a08138f599194c92344f95 100644 (file)
@@ -31,9 +31,10 @@ data blobb
 
 # Verify data after the test has been "shot"
 <verify>
+# Strip the addresses and port number but leave the rest
 <strippart>
-s/^(EPRT \|1\|127.0.0.1).*/$1/
-s/^(PORT 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 )\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}/$1/
 </strippart>
 <protocol>
 USER anonymous\r
@@ -41,12 +42,12 @@ PASS ftp@example.com
 PWD\r
 CWD a\r
 CWD path\r
-EPRT |1|127.0.0.1
-PORT 127,0,0,1,
+EPRT |1|\r
+PORT \r
 TYPE I\r
 SIZE 212\r
 RETR 212\r
-PORT 127,0,0,1,
+PORT \r
 SIZE 212\r
 RETR 212\r
 QUIT\r
index 84d2a995d7496d373ab6502ed726bd319589c069..6b0d321ec87ce4bde79c872faca705fc82051c68 100644 (file)
@@ -36,11 +36,10 @@ ftp://%HOSTIP:%FTPPORT/ -P %HOSTIP
 
 # Verify data after the test has been "shot"
 <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>
-^PORT 127,0,0,1,.*
-^EPRT.*
-^LPRT.*
+^PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}
+^EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|
 </strip>
 <protocol>
 USER anonymous\r
index d3ff294b488ea78677f2160f8e1a56f89d561786..3259bc6ae2b70eea8424a5859b3cb48c70c00de7 100644 (file)
@@ -39,18 +39,17 @@ ftps
 FTPS dir list, PORT with specified IP
  </name>
  <command>
--k --ftp-ssl-control -P %HOSTIP ftps://%HOSTIP:%FTPSPORT/
+-k --ftp-ssl-control -P %CLIENTIP ftps://%HOSTIP:%FTPSPORT/
 </command>
 </client>
 
 #
 # Verify data after the test has been "shot"
 <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>
-^PORT 127,0,0,1,.*
-^EPRT.*
-^LPRT.*
+^PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}
+^EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|
 </strip>
 <protocol>
 USER anonymous\r
index 211d1fa04ca4fb6758ea887afc98e678ce65de5b..d0aa13b8aa879be22816bc1d6c0ee9b0f979d75d 100644 (file)
@@ -34,10 +34,10 @@ Moooooooooooo
 
 # Verify data after the test has been "shot"
 <verify>
+# Strip all valid kinds of PORT and EPRT that curl can send
 <strip>
-^PORT .*
-^EPRT .*
-^LPRT .*
+^PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}
+^EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|
 </strip>
 <protocol>
 USER anonymous\r
index 598f5402941e102ffef658ec36997a4193ce5d46..9c0d926eaa36c2a93ed1f5cdff16c08d4f24784d 100644 (file)
@@ -34,10 +34,10 @@ Moooooooooooo
 
 # Verify data after the test has been "shot"
 <verify>
+# Strip all valid kinds of PORT and EPRT that curl can send
 <strip>
-^PORT .*
-^EPRT .*
-^LPRT .*
+^PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}
+^EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|
 </strip>
 <protocol>
 USER anonymous\r
index 1374c1642d4bf90ec365b309c0770a7cef3e57de..6ee6fe926461ce01a18b4bf9a5d6dfaabb49db28 100644 (file)
@@ -34,10 +34,10 @@ Moooooooooooo
 
 # Verify data after the test has been "shot"
 <verify>
+# Strip all valid kinds of PORT and EPRT that curl can send
 <strip>
-^PORT .*
-^EPRT .*
-^LPRT .*
+^PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}
+^EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|
 </strip>
 <protocol>
 USER anonymous\r
index 48807f03d1918ed19c84fcfa1a731114346df964..d986128fc0a0193c04f3b1dae9cb2ed1cba0ef31 100644 (file)
@@ -37,10 +37,10 @@ don't upload this
 
 # Verify data after the test has been "shot"
 <verify>
+# Strip all valid kinds of PORT and EPRT that curl can send
 <strip>
-^PORT .*
-^EPRT .*
-^LPRT .*
+^PORT \d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3},\d{1,3}
+^EPRT \|1\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\|\d{1,5}\|
 </strip>
 <protocol>
 USER anonymous\r