]> source.dussan.org Git - nextcloud-server.git/commitdiff
catch auth issues also when php-smbclient is in use
authorArthur Schiwon <blizzz@arthur-schiwon.de>
Thu, 22 Aug 2019 09:12:43 +0000 (11:12 +0200)
committerBackportbot <backportbot-noreply@rullzer.com>
Mon, 9 Sep 2019 14:52:15 +0000 (14:52 +0000)
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
apps/files_external/lib/Lib/Storage/SMB.php

index 760cc9ef98b826ad6197206bddb1097e59b2ece3..5e3a5d69ebdf3c9850d8c90f88e00987a8215ac6 100644 (file)
@@ -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;
                }
        }