From: Arthur Schiwon Date: Thu, 22 Aug 2019 09:12:43 +0000 (+0200) Subject: catch auth issues also when php-smbclient is in use X-Git-Tag: v15.0.12RC1~9^2~2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9e3cbeeaf15f5307c7f8e8c3965a7cea4aeca514;p=nextcloud-server.git catch auth issues also when php-smbclient is in use Signed-off-by: Arthur Schiwon --- diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php index 760cc9ef98b..5e3a5d69ebd 100644 --- a/apps/files_external/lib/Lib/Storage/SMB.php +++ b/apps/files_external/lib/Lib/Storage/SMB.php @@ -167,6 +167,14 @@ class SMB extends Common implements INotifyStorage { } catch (ConnectException $e) { $this->logger->logException($e, ['message' => 'Error while getting file info']); throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e); + } catch (ForbiddenException $e) { + // with php-smbclient, this exceptions is thrown when the provided password is invalid. + // Possible is also ForbiddenException with a different error code, so we check it. + if($e->getCode() === 1) { + $this->logger->logException($e, ['message' => 'Error while getting file info']); + throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e); + } + throw $e; } }