mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 17:24:07 +02:00
handle smbclient help message
This commit is contained in:
parent
c97dee758e
commit
0ef64a9156
2 changed files with 12 additions and 0 deletions
|
|
@ -34,6 +34,14 @@ class Connection extends RawConnection {
|
||||||
parent::write($input . PHP_EOL);
|
parent::write($input . PHP_EOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function clearTillPrompt() {
|
||||||
|
do {
|
||||||
|
$promptLine = $this->readLine();
|
||||||
|
} while (!$this->isPrompt($promptLine));
|
||||||
|
$this->write('');
|
||||||
|
$this->readLine();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get all unprocessed output from smbclient until the next prompt
|
* get all unprocessed output from smbclient until the next prompt
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,9 @@ class Share extends AbstractShare {
|
||||||
if (!$connection->isValid()) {
|
if (!$connection->isValid()) {
|
||||||
throw new ConnectionException($connection->readLine());
|
throw new ConnectionException($connection->readLine());
|
||||||
}
|
}
|
||||||
|
$connection->write('');
|
||||||
|
// some versions of smbclient add a help message in first of the first prompt
|
||||||
|
$connection->clearTillPrompt();
|
||||||
return $connection;
|
return $connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -125,6 +128,7 @@ class Share extends AbstractShare {
|
||||||
//check output for errors
|
//check output for errors
|
||||||
$this->parseOutput($output, $path);
|
$this->parseOutput($output, $path);
|
||||||
$output = $this->execute('dir');
|
$output = $this->execute('dir');
|
||||||
|
|
||||||
$this->execute('cd /');
|
$this->execute('cd /');
|
||||||
|
|
||||||
return $this->parser->parseDir($output, $path);
|
return $this->parser->parseDir($output, $path);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue