From 3d65d6d8d937337b46b924bd4e5df1a22f0676c6 Mon Sep 17 00:00:00 2001 From: Nuno Lopes Date: Tue, 13 Feb 2007 18:29:10 +0000 Subject: Fixed bug #37799 (ftp_ssl_connect() falls back to non-ssl connection) --- ext/ftp/tests/bug37799.phpt | 21 +++++++++++++++++++++ ext/ftp/tests/server.inc | 10 ++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 ext/ftp/tests/bug37799.phpt (limited to 'ext/ftp/tests') 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-- + +--FILE-- + +--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"); -- cgit v1.2.1