diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2018-09-04 04:57:13 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2018-09-04 04:57:13 +0200 |
commit | 6122f67492401e04bab37bd864e3d5f53e6f4a75 (patch) | |
tree | 3262f0afadeebe3cfd284c2b5dda0008268f3479 /ext/ftp | |
parent | 1640d9182a3d8dbe14c1518a98fa49257d05e5a2 (diff) | |
parent | fcf78dfb8957f65351222752f2dcd85935ee2192 (diff) | |
download | php-git-6122f67492401e04bab37bd864e3d5f53e6f4a75.tar.gz |
Merge branch 'PHP-7.2' into PHP-7.3
Diffstat (limited to 'ext/ftp')
-rw-r--r-- | ext/ftp/tests/server.inc | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/ext/ftp/tests/server.inc b/ext/ftp/tests/server.inc index fb9ff57225..53501060a5 100644 --- a/ext/ftp/tests/server.inc +++ b/ext/ftp/tests/server.inc @@ -349,7 +349,7 @@ if ($pid) { fputs($s, "550 No file named \"{$matches [1]}\"\r\n"); break; } - }elseif (preg_match('/^RETR ([\w\h]+)/', $buf, $matches)) { + }elseif (preg_match('/^RETR ([\/]*[\w\h]+)/', $buf, $matches)) { if(!empty($pasv)){ ; } @@ -405,6 +405,10 @@ if ($pid) { fputs($fs, "This is line $i of the test data.\n"); } fputs($s, "226 Closing data Connection.\r\n"); + break; + case "/bug73457": + fputs($s, "150 File status okay; about to open data connection.\r\n"); + break; default: fputs($s, "550 {$matches[1]}: No such file or directory \r\n"); @@ -419,29 +423,35 @@ if ($pid) { $host = "127.0.0.1"; $i=0; - do { - if (!empty($ssl)) { - $soc = @stream_socket_server("tcp://127.0.0.1:$pasv_port", $errno, $errstr, STREAM_SERVER_BIND|STREAM_SERVER_LISTEN, $context); - } else { - $soc = @stream_socket_server("tcp://127.0.0.1:$pasv_port"); - } - /* Could bind port, Try another port */ + if (empty($bug73457)) { + do { + if (!empty($ssl)) { + $soc = @stream_socket_server("tcp://127.0.0.1:$pasv_port", $errno, $errstr, STREAM_SERVER_BIND|STREAM_SERVER_LISTEN, $context); + } else { + $soc = @stream_socket_server("tcp://127.0.0.1:$pasv_port"); + } + /* Could bind port, Try another port */ + if (!$soc) { + $pasv_port = rand(50000, 65535); + } + $i++; + } while ($i<10 && !$soc); + if (!$soc) { - $pasv_port = rand(50000, 65535); + echo "$errstr ($errno)\n"; + die("could not bind passive port\n"); } - $i++; - } while ($i<10 && !$soc); - - if (!$soc) { - echo "$errstr ($errno)\n"; - die("could not bind passive port\n"); + } else { + $pasv_port=1234; } $p2 = $pasv_port % ((int) 1 << 8); $p1 = ($pasv_port-$p2)/((int) 1 << 8); fputs($s, "227 Entering Passive Mode. (127,0,0,1,{$p1},{$p2})\r\n"); - $pasvs = stream_socket_accept($soc,10); + if (empty($bug73457)) { + $pasvs = stream_socket_accept($soc,10); + } } elseif (preg_match('/^EPSV/', $buf, $matches)) { fputs($s, "550 Extended passsive mode not supported.\r\n"); @@ -519,6 +529,8 @@ if ($pid) { fputs($s, "226 Closing data Connection.\r\n"); fclose($fs); + }elseif (preg_match('/^SIZE \/bug73457/', $buf)) { + fputs($s, "213 10\r\n"); }elseif (preg_match("/^SITE/", $buf)) { fputs($s, "500 Syntax error, command unrecognized.\r\n"); }else { |