File tree Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,19 @@ $ftp = ftp_connect('127.0.0.1', $port);
13
13
ftp_login ($ ftp , 'user ' , 'pass ' );
14
14
$ ftp or die ("Couldn't connect to the server " );
15
15
16
- var_dump (is_array (ftp_rawlist ($ ftp , 'www/ ' )));
16
+ $ result = ftp_rawlist ($ ftp , 'www/ ' );
17
+ var_dump (is_array ($ result ));
18
+ var_dump ($ result );
19
+ ftp_close ($ ftp );
17
20
?>
18
21
--EXPECT--
19
22
bool(true)
23
+ array(3) {
24
+ [0]=>
25
+ string(5) "file1"
26
+ [1]=>
27
+ string(5) "file1"
28
+ [2]=>
29
+ string(9) "file
30
+ b0rk"
31
+ }
Original file line number Diff line number Diff line change @@ -446,8 +446,27 @@ if ($pid) {
446
446
fputs ($ s , "200 " . $ matches [1 ] . " bytes allocated \r\n" );
447
447
448
448
}elseif (preg_match ('/^LIST www\// ' , $ buf , $ matches )) {
449
- fputs ($ s , "226 Transfer complete \r\n" );
449
+ if (empty ($ pasv )) {
450
+ fputs ($ s , "150 File status okay; about to open data connection \r\n" );
451
+ if (!$ fs = stream_socket_client ("tcp:// $ host: $ port " )) {
452
+ fputs ($ s , "425 Can't open data connection \r\n" );
453
+ continue ;
454
+ }
455
+ } else {
456
+ fputs ($ s , "125 Data connection already open; transfer starting. \r\n" );
457
+ $ fs = $ pasvs ;
458
+ }
459
+
450
460
461
+ if ((!empty ($ ssl )) && (!stream_socket_enable_crypto ($ pasvs , true , STREAM_CRYPTO_METHOD_SSLv23_SERVER))) {
462
+ die ("SSLv23 handshake failed. \n" );
463
+ }
464
+
465
+ fputs ($ fs , "file1 \r\nfile1 \r\nfile \nb0rk \r\n" );
466
+ fputs ($ s , "226 Closing data Connection. \r\n" );
467
+ fclose ($ fs );
468
+
469
+ fputs ($ s , "226 Transfer complete \r\n" );
451
470
}elseif (preg_match ('/^LIST no_exists\// ' , $ buf , $ matches )) {
452
471
fputs ($ s , "425 Error establishing connection \r\n" );
453
472
You can’t perform that action at this time.
0 commit comments