summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2022-11-07 13:40:30 +0100
committerCôme Chilliet <come.chilliet@nextcloud.com>2023-01-02 15:02:28 +0100
commita372564850cb2f8813c4c3cca67bd1b6cfcdb882 (patch)
treefc879b783dae0d038c60111b7adbb3b0749c6d09 /apps/user_ldap
parente4e20bf40ad8ca139655b36a6efa2b1710ae50f0 (diff)
downloadnextcloud-server-a372564850cb2f8813c4c3cca67bd1b6cfcdb882.tar.gz
nextcloud-server-a372564850cb2f8813c4c3cca67bd1b6cfcdb882.zip
Fix psalm spotted errors with new requirements
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps/user_ldap')
-rw-r--r--apps/user_ldap/ajax/wizard.php4
-rw-r--r--apps/user_ldap/lib/Mapping/AbstractMapping.php9
2 files changed, 6 insertions, 7 deletions
diff --git a/apps/user_ldap/ajax/wizard.php b/apps/user_ldap/ajax/wizard.php
index 8cae22daf19..dcfe9ff76b8 100644
--- a/apps/user_ldap/ajax/wizard.php
+++ b/apps/user_ldap/ajax/wizard.php
@@ -111,6 +111,10 @@ switch ($action) {
\OC_JSON::error(['message' => $l->t('No data specified')]);
exit;
}
+ if (is_array($key)) {
+ \OC_JSON::error(['message' => $l->t('Invalid data specified')]);
+ exit;
+ }
$cfg = [$key => $val];
$setParameters = [];
$configuration->setConfiguration($cfg, $setParameters);
diff --git a/apps/user_ldap/lib/Mapping/AbstractMapping.php b/apps/user_ldap/lib/Mapping/AbstractMapping.php
index 8fbad6aae3a..3f05091a537 100644
--- a/apps/user_ldap/lib/Mapping/AbstractMapping.php
+++ b/apps/user_ldap/lib/Mapping/AbstractMapping.php
@@ -27,9 +27,9 @@
namespace OCA\User_LDAP\Mapping;
use Doctrine\DBAL\Exception;
+use Doctrine\DBAL\Platforms\SqlitePlatform;
use OCP\DB\IPreparedStatement;
use OCP\DB\QueryBuilder\IQueryBuilder;
-use Doctrine\DBAL\Platforms\SqlitePlatform;
/**
* Class AbstractMapping
@@ -191,12 +191,7 @@ abstract class AbstractMapping {
* Get the hash to store in database column ldap_dn_hash for a given dn
*/
protected function getDNHash(string $fdn): string {
- $hash = hash('sha256', $fdn, false);
- if (is_string($hash)) {
- return $hash;
- } else {
- throw new \RuntimeException('hash function did not return a string');
- }
+ return hash('sha256', $fdn, false);
}
/**