File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -139,7 +139,10 @@ if ($pid) {
139
139
$ buf = fread ($ s , 2048 );
140
140
}
141
141
142
- if (!preg_match ('/^USER (\w+)\r\n$/ ' , $ buf , $ m )) {
142
+ if ($ buf == "AUTH TLS \r\n" ) {
143
+ fputs ($ s , "500 not supported. \r\n" );
144
+ return ;
145
+ } else if (!preg_match ('/^USER (\w+)\r\n$/ ' , $ buf , $ m )) {
143
146
fputs ($ s , "500 Syntax error, command unrecognized. \r\n" );
144
147
dump_and_exit ($ buf );
145
148
}
@@ -208,6 +211,10 @@ if ($pid) {
208
211
$ ascii = true ;
209
212
fputs ($ s , "200 OK \r\n" );
210
213
214
+ } elseif ($ buf === "AUTH SSL \r\n" ) {
215
+ $ ascii = true ;
216
+ fputs ($ s , "500 not supported \r\n" );
217
+
211
218
} elseif ($ buf === "TYPE I \r\n" ) {
212
219
$ ascii = false ;
213
220
fputs ($ s , "200 OK \r\n" );
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #72771. FTPS to FTP downgrade not allowed when server doesn't support AUTH TLS or AUTH SSL.
3
+ --SKIPIF--
4
+ <?php
5
+ if (array_search ('ftp ' ,stream_get_wrappers ()) === FALSE ) die ("skip ftp wrapper not available. " );
6
+ if (!function_exists ('pcntl_fork ' )) die ("skip pcntl_fork() not available. " );
7
+ if (!extension_loaded ('openssl ' )) die ("skip openssl not available. " );
8
+ ?>
9
+ --FILE--
10
+ <?php
11
+
12
+ require __DIR__ . "/../../../ftp/tests/server.inc " ;
13
+
14
+ $ path ="ftps://127.0.0.1: " . $ port ."/ " ;
15
+
16
+ $ ds =opendir ($ path , $ context );
17
+ var_dump ($ ds );
18
+ ?>
19
+ ==DONE==
20
+ --EXPECTF--
21
+ Warning: opendir(ftps://127.0.0.1:%d/): failed to open dir: Server doesn't support FTPS. in %s on line %d
22
+ bool(false)
23
+ ==DONE==
You can’t perform that action at this time.
0 commit comments