files_external SMB: throw InvalidArgument when user is not set

Signed-off-by: Anderson Luiz Alves <alacn1@gmail.com>
This commit is contained in:
Anderson Luiz Alves 2021-12-03 10:57:00 -03:00
parent b067ae78c5
commit 4e65441cb2

View file

@ -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'),