mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-04 01:34:07 +02:00
Discard password prompts from smbclient's output
This commit is contained in:
parent
f8bc64f097
commit
bb92259b32
5 changed files with 23 additions and 6 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue