From 4e65441cb2cfe7f93476d64cb0ce68de722632c6 Mon Sep 17 00:00:00 2001 From: Anderson Luiz Alves Date: Fri, 3 Dec 2021 10:57:00 -0300 Subject: files_external SMB: throw InvalidArgument when user is not set Signed-off-by: Anderson Luiz Alves --- apps/files_external/lib/Lib/Backend/SMB.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'apps/files_external/lib/Lib') diff --git a/apps/files_external/lib/Lib/Backend/SMB.php b/apps/files_external/lib/Lib/Backend/SMB.php index 73e6b67614b..867648824ac 100644 --- a/apps/files_external/lib/Lib/Backend/SMB.php +++ b/apps/files_external/lib/Lib/Backend/SMB.php @@ -76,6 +76,10 @@ class SMB extends Backend { public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) { $auth = $storage->getAuthMechanism(); if ($auth->getScheme() === AuthMechanism::SCHEME_PASSWORD) { + if (!is_string($storage->getBackendOption('user')) || !is_string($storage->getBackendOption('password'))) { + throw new \InvalidArgumentException('user or password is not set'); + } + $smbAuth = new BasicAuth( $storage->getBackendOption('user'), $storage->getBackendOption('domain'), -- cgit v1.2.3