com php-src: Test case for bug #72771: ext/ftp/tests/server.inc ext/standard/tests/streams/bug72771.phpt
| From: | Nikita Popov | Date: | Tue, 30 Aug 2016 11:44:34 +0000 |
| Subject: | com php-src: Test case for bug #72771: ext/ftp/tests/server.inc ext/standard/tests/streams/bug72771.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-94156@lists.php.net to get a copy of this message | ||
Commit: af7828a20f085c6cd2b720b093ee08f299505257
Author: Ville Hukkamäki <vhu@iki.fi> Fri, 19 Aug 2016 22:05:04 +0000
Committer: Nikita Popov <nikic@php.net> Tue, 30 Aug 2016 13:44:34 +0200
Parents: 207dab585aadd9f320976a0895734d7d9ca7b862
Branches: PHP-5.6 PHP-7.0 PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=af7828a20f085c6cd2b720b093ee08f299505257
Log:
Test case for bug #72771
Bugs:
https://bugs.php.net/72771
Changed paths:
M ext/ftp/tests/server.inc
A ext/standard/tests/streams/bug72771..phpt
Diff:
diff --git a/ext/ftp/tests/server.inc b/ext/ftp/tests/server.inc
index 5629c2e..1a04cd1 100644
--- a/ext/ftp/tests/server.inc
+++ b/ext/ftp/tests/server.inc
@@ -139,7 +139,10 @@ if ($pid) {
$buf = fread($s, 2048);
}
- if (!preg_match('/^USER (\w+)\r\n$/', $buf, $m)) {
+ if ($buf == "AUTH TLS\r\n") {
+ fputs($s, "500 not supported.\r\n");
+ return ;
+ } else if (!preg_match('/^USER (\w+)\r\n$/', $buf, $m)) {
fputs($s, "500 Syntax error, command unrecognized.\r\n");
dump_and_exit($buf);
}
@@ -208,6 +211,10 @@ if ($pid) {
$ascii = true;
fputs($s, "200 OK\r\n");
+ } elseif ($buf === "AUTH SSL\r\n") {
+ $ascii = true;
+ fputs($s, "500 not supported\r\n");
+
} elseif ($buf === "TYPE I\r\n") {
$ascii = false;
fputs($s, "200 OK\r\n");
diff --git a/ext/standard/tests/streams/bug72771.phpt b/ext/standard/tests/streams/bug72771.phpt
new file mode 100644
index 0000000..b38ccbd
--- /dev/null
+++ b/ext/standard/tests/streams/bug72771.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Bug #72771. FTPS to FTP downgrade not allowed when server doesn't support AUTH TLS or AUTH
SSL.
+--SKIPIF--
+<?php
+if (array_search('ftp',stream_get_wrappers()) === FALSE) die("skip ftp wrapper not
available.");
+if (!function_exists('pcntl_fork')) die("skip pcntl_fork() not available.");
+if (!extension_loaded('openssl')) die ("skip openssl not available.");
+?>
+--FILE--
+<?php
+
+require __DIR__ . "/../../../ftp/tests/server.inc";
+
+$path="ftps://127.0.0.1:" . $port."/";
+
+$ds=opendir($path, $context);
+var_dump($ds);
+?>
+==DONE==
+--EXPECTF--
+Warning: opendir(ftps://127.0.0.1:%d/): failed to open dir: Server doesn't support FTPS. in %s
on line %d
+bool(false)
+==DONE==