Add server port option

This commit is contained in:
Giacomo Rizzi 2022-05-19 14:45:18 +02:00
commit f82d996f5d

View file

@ -28,11 +28,14 @@ class BasicAuth implements IAuth {
private $workgroup; private $workgroup;
/** @var string */ /** @var string */
private $password; private $password;
/** @var int|null */
private $port = null;
public function __construct(string $username, ?string $workgroup, string $password) { public function __construct(string $username, ?string $workgroup, string $password, int $port = null) {
$this->username = $username; $this->username = $username;
$this->workgroup = $workgroup; $this->workgroup = $workgroup;
$this->password = $password; $this->password = $password;
$this->port = $port;
} }
public function getUsername(): ?string { public function getUsername(): ?string {
@ -48,7 +51,10 @@ class BasicAuth implements IAuth {
} }
public function getExtraCommandLineArguments(): string { public function getExtraCommandLineArguments(): string {
return ($this->workgroup) ? '-W ' . escapeshellarg($this->workgroup) : ''; $ret = '';
if ($this->workgroup) $ret .= ' -W ' . escapeshellarg($this->workgroup);
if ($this->port) $ret .= ' -p ' . escapeshellarg($this->port);
return $ret;
} }
public function setExtraSmbClientOptions($smbClientState): void { public function setExtraSmbClientOptions($smbClientState): void {