summaryrefslogtreecommitdiff
path: root/ext/ftp/tests
diff options
context:
space:
mode:
authorNuno Lopes <nlopess@php.net>2007-02-13 18:29:10 +0000
committerNuno Lopes <nlopess@php.net>2007-02-13 18:29:10 +0000
commit3d65d6d8d937337b46b924bd4e5df1a22f0676c6 (patch)
tree8193dddf797685551c49eecc4bca757890ca24a9 /ext/ftp/tests
parentdc9e17faf3ca0a2d357913ee48266c9120225fcf (diff)
downloadphp-git-3d65d6d8d937337b46b924bd4e5df1a22f0676c6.tar.gz
Fixed bug #37799 (ftp_ssl_connect() falls back to non-ssl connection)
Diffstat (limited to 'ext/ftp/tests')
-rw-r--r--ext/ftp/tests/bug37799.phpt21
-rw-r--r--ext/ftp/tests/server.inc10
2 files changed, 29 insertions, 2 deletions
diff --git a/ext/ftp/tests/bug37799.phpt b/ext/ftp/tests/bug37799.phpt
new file mode 100644
index 0000000000..73f191a7a8
--- /dev/null
+++ b/ext/ftp/tests/bug37799.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #37799: ftp_ssl_connect() falls back to non-ssl connection
+--SKIPIF--
+<?php
+require 'skipif.inc';
+?>
+--FILE--
+<?php
+$bug37799=$ssl=1;
+require 'server.inc';
+
+$ftp = ftp_ssl_connect('127.0.0.1', $port);
+if (!$ftp) die("Couldn't connect to the server");
+
+var_dump(ftp_login($ftp, 'user', 'pass'));
+
+ftp_close($ftp);
+?>
+--EXPECTF--
+Warning: ftp_login(): bogus msg in %sbug37799.php on line 8
+bool(false)
diff --git a/ext/ftp/tests/server.inc b/ext/ftp/tests/server.inc
index e08eeb438a..c101c7c70f 100644
--- a/ext/ftp/tests/server.inc
+++ b/ext/ftp/tests/server.inc
@@ -59,7 +59,7 @@ $buf = fread($s, 2048);
function user_auth($buf) {
- global $user, $s, $ssl;
+ global $user, $s, $ssl, $bug37799;
if (!empty($ssl)) {
if ($buf !== "AUTH TLS\r\n") {
@@ -67,7 +67,13 @@ if (!empty($ssl)) {
dump_and_exit($buf);
}
- fputs($s, "234 auth type accepted\r\n");
+ if (empty($bug37799)) {
+ fputs($s, "234 auth type accepted\r\n");
+ } else {
+ fputs($s, "666 dummy\r\n");
+ fputs($s, "666 bogus msg\r\n");
+ exit;
+ }
if (!stream_socket_enable_crypto($s, true, STREAM_CRYPTO_METHOD_SSLv23_SERVER)) {
die("SSLv23 handshake failed.\n");