check SyncService
This commit is contained in:
parent
693046bf5b
commit
bbb727cffe
|
|
@ -106,11 +106,16 @@ function ftpSession($ctrl, string $user, string $pass, string $root): void
|
|||
$pendUser = '';
|
||||
$pasvSock = null;
|
||||
|
||||
stream_set_timeout($ctrl, 300);
|
||||
ftpSend($ctrl, '220 matab-panel FTP Server');
|
||||
|
||||
while (!feof($ctrl)) {
|
||||
$line = ftpRead($ctrl);
|
||||
if ($line === '') continue;
|
||||
if ($line === '') {
|
||||
$info = stream_get_meta_data($ctrl);
|
||||
if ($info['timed_out']) continue;
|
||||
break;
|
||||
}
|
||||
|
||||
$parts = explode(' ', $line, 2);
|
||||
$cmd = strtoupper($parts[0]);
|
||||
|
|
@ -261,6 +266,31 @@ function ftpSession($ctrl, string $user, string $pass, string $root): void
|
|||
}
|
||||
break;
|
||||
|
||||
case 'OPTS':
|
||||
ftpSend($ctrl, '200 OK');
|
||||
break;
|
||||
|
||||
case 'PBSZ':
|
||||
ftpSend($ctrl, '200 PBSZ=0');
|
||||
break;
|
||||
|
||||
case 'PROT':
|
||||
ftpSend($ctrl, '200 Protection level set to ' . ($arg ?: 'C'));
|
||||
break;
|
||||
|
||||
case 'EPSV':
|
||||
if (!$authed) { ftpSend($ctrl, '530 Not logged in'); break; }
|
||||
if ($pasvSock) fclose($pasvSock);
|
||||
$pasvPort = rand(60000, 60020);
|
||||
$pasvSock = @stream_socket_server("tcp://0.0.0.0:{$pasvPort}", $e1, $e2);
|
||||
if (!$pasvSock) { ftpSend($ctrl, '425 Cannot open passive connection'); break; }
|
||||
ftpSend($ctrl, "229 Entering Extended Passive Mode (|||{$pasvPort}|)");
|
||||
break;
|
||||
|
||||
case 'EPRT':
|
||||
ftpSend($ctrl, '200 OK');
|
||||
break;
|
||||
|
||||
case 'NOOP':
|
||||
ftpSend($ctrl, '200 OK');
|
||||
break;
|
||||
|
|
@ -270,6 +300,7 @@ function ftpSession($ctrl, string $user, string $pass, string $root): void
|
|||
return;
|
||||
|
||||
default:
|
||||
echo " [UNKNOWN CMD] {$cmd} {$arg}\n";
|
||||
ftpSend($ctrl, '502 Not implemented: ' . $cmd);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue