Discard password prompts from smbclient's output

This commit is contained in:
Robin Appelman 2013-11-26 16:58:23 +01:00
commit bb92259b32
5 changed files with 23 additions and 6 deletions

View file

@ -78,6 +78,8 @@ class Server {
/**
* @return Share[]
* @throws \SMB\AuthenticationException
* @throws \SMB\InvalidHostException
*/
public function listShares() {
$user = escapeshellarg($this->getUser());
@ -88,6 +90,11 @@ class Server {
$line = $output[0];
// disregard password prompt
if (substr($line, 0, 6) == 'Enter ' and count($output) > 1) {
$line = $output[1];
}
$line = rtrim($line, ')');
if (substr($line, -23) === ErrorCodes::LogonFailure) {
throw new AuthenticationException();