diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2021-11-18 10:30:35 +0100 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2021-12-14 10:58:47 +0100 |
commit | 41e365aa3bdb9ae39ec81844eda62eadb0f780f9 (patch) | |
tree | b55efdd27a74b0214c15d9133fdd46d2a208db0a | |
parent | d8263692d0b2d904b0d785a5270d801da8bc078d (diff) | |
download | nextcloud-server-41e365aa3bdb9ae39ec81844eda62eadb0f780f9.tar.gz nextcloud-server-41e365aa3bdb9ae39ec81844eda62eadb0f780f9.zip |
Make sure that hash function returns a string
The documentation says it can return false, and even if that is highly
unlikely for sha256, better safe than sorry.
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
-rw-r--r-- | apps/user_ldap/lib/Mapping/AbstractMapping.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/apps/user_ldap/lib/Mapping/AbstractMapping.php b/apps/user_ldap/lib/Mapping/AbstractMapping.php index 966d930481c..20f22b7529f 100644 --- a/apps/user_ldap/lib/Mapping/AbstractMapping.php +++ b/apps/user_ldap/lib/Mapping/AbstractMapping.php @@ -192,7 +192,12 @@ abstract class AbstractMapping { * Get the hash to store in database column ldap_dn_hash for a given dn */ protected function getDNHash(string $fdn): string { - return (string)hash('sha256', $fdn, false); + $hash = hash('sha256', $fdn, false); + if (is_string($hash)) { + return $hash; + } else { + throw new \RuntimeException('hash function did not return a string'); + } } /** |