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-11-23 09:20:30 +0100 |
commit | df25a6de310608925bc96ca5fd91bcc851f49969 (patch) | |
tree | b6fe2c14aa3009b9cba39e250b6faf501b67af82 /apps | |
parent | 14f00208e284d8f28594677d3ecf26a7647e6cdd (diff) | |
download | nextcloud-server-df25a6de310608925bc96ca5fd91bcc851f49969.tar.gz nextcloud-server-df25a6de310608925bc96ca5fd91bcc851f49969.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>
Diffstat (limited to 'apps')
-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 18b76a0bf15..aea40c577b6 100644 --- a/apps/user_ldap/lib/Mapping/AbstractMapping.php +++ b/apps/user_ldap/lib/Mapping/AbstractMapping.php @@ -191,7 +191,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'); + } } /** |