mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 17:24:07 +02:00
split test cases
This commit is contained in:
parent
78916cfc08
commit
c94eea8294
4 changed files with 59 additions and 15 deletions
|
|
@ -14,6 +14,6 @@ spl_autoload_register(function ($class) {
|
|||
if (substr($class, 0, 4) == 'SMB\\') {
|
||||
$class = strtolower($class);
|
||||
$file = str_replace('\\', '/', substr($class, 4));
|
||||
include $file . '.php';
|
||||
include __DIR__ . '/' . $file . '.php';
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -78,12 +78,26 @@ class Server {
|
|||
|
||||
/**
|
||||
* @return Share[]
|
||||
* @throws AuthenticationException
|
||||
* @throws InvalidHostException
|
||||
*/
|
||||
public function listShares() {
|
||||
$auth = escapeshellarg($this->getAuthString()); //TODO: don't pass password as shell argument
|
||||
$command = self::CLIENT . ' -N -U ' . $auth . ' ' . '-gL ' . escapeshellarg($this->getHost());// . ' 2> /dev/null';
|
||||
$command = self::CLIENT . ' -N -U ' . $auth . ' ' . '-gL ' . escapeshellarg($this->getHost()); // . ' 2> /dev/null';
|
||||
exec($command, $output);
|
||||
|
||||
$line = $output[0];
|
||||
$authError = 'NT_STATUS_LOGON_FAILURE';
|
||||
if (substr($line, -23) === $authError) {
|
||||
$this->pipes = array(null, null);
|
||||
throw new AuthenticationException();
|
||||
}
|
||||
$addressError = 'NT_STATUS_BAD_NETWORK_NAME';
|
||||
if (substr($line, -26) === $addressError) {
|
||||
$this->pipes = array(null, null);
|
||||
throw new InvalidHostException();
|
||||
}
|
||||
|
||||
$shareNames = array();
|
||||
foreach ($output as $line) {
|
||||
if (strpos($line, '|')) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue