split test cases

This commit is contained in:
Robin Appelman 2013-05-01 16:11:01 +02:00
commit c94eea8294
4 changed files with 59 additions and 15 deletions

View file

@ -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';
}
});

View file

@ -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, '|')) {