mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 17:24: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
|
|
@ -21,20 +21,20 @@ class Connection extends RawConnection {
|
|||
}
|
||||
|
||||
/**
|
||||
* get all unprocessed output from smbclient untill the next prompt
|
||||
* get all unprocessed output from smbclient until the next prompt
|
||||
*
|
||||
* @throws ConnectionError
|
||||
* @return array
|
||||
* @return string
|
||||
*/
|
||||
public function read() {
|
||||
if (!$this->isValid()) {
|
||||
throw new ConnectionError();
|
||||
}
|
||||
$line = parent::read(); //first line is prompt
|
||||
$line = $this->readLine(); //first line is prompt
|
||||
$this->checkConnectionError($line);
|
||||
|
||||
$output = array();
|
||||
$line = parent::read();
|
||||
$line = $this->readLine();
|
||||
$length = strlen(self::DELIMITER);
|
||||
while (substr($line, 0, $length) !== self::DELIMITER) { //next prompt functions as delimiter
|
||||
$output[] .= $line;
|
||||
|
|
@ -43,6 +43,15 @@ class Connection extends RawConnection {
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* read a single line of unprocessed output
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function readLine() {
|
||||
return parent::read();
|
||||
}
|
||||
|
||||
/**
|
||||
* check if the first line holds a connection failure
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue