From f82d996f5d1e6f44047443abfec10d05819154df Mon Sep 17 00:00:00 2001 From: Giacomo Rizzi Date: Thu, 19 May 2022 14:45:18 +0200 Subject: [PATCH] Add server port option --- src/BasicAuth.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/BasicAuth.php b/src/BasicAuth.php index 04004e6..5e4b4b7 100644 --- a/src/BasicAuth.php +++ b/src/BasicAuth.php @@ -28,11 +28,14 @@ class BasicAuth implements IAuth { private $workgroup; /** @var string */ 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->workgroup = $workgroup; $this->password = $password; + $this->port = $port; } public function getUsername(): ?string { @@ -48,7 +51,10 @@ class BasicAuth implements IAuth { } 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 {