mirror of
https://github.com/nextcloud/server.git
synced 2026-04-27 17:18:48 -04:00
fix: make smb auth failure on forbidden exception more reliable
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
43727cb72c
commit
4dcd4223de
1 changed files with 8 additions and 2 deletions
|
|
@ -178,9 +178,15 @@ class SMB extends Common implements INotifyStorage {
|
|||
throw new \OCP\Files\NotFoundException($e->getMessage(), 0, $e);
|
||||
} catch (ForbiddenException $e) {
|
||||
// with php-smbclient, this exception 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) {
|
||||
// we check if we can stat the root, which should only fail in authentication failures
|
||||
if ($path === '') {
|
||||
$this->throwUnavailable($e);
|
||||
} else {
|
||||
try {
|
||||
$this->share->stat('');
|
||||
} catch (\Exception $e) {
|
||||
$this->throwUnavailable($e);
|
||||
}
|
||||
}
|
||||
throw new \OCP\Files\ForbiddenException($e->getMessage(), false, $e);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue