dsdb: Allow "password hash userPassword schemes = CryptSHA256" to work on RHEL7
authorAndrew Bartlett <abartlet@samba.org>
Wed, 1 Jul 2020 02:35:39 +0000 (14:35 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 1 Jul 2020 13:34:30 +0000 (13:34 +0000)
commit91453f110fa72062291eb59ad9d95fab0f423557
tree749c4a683ba43ea8567f2b663544c5a1645da6d9
parent213501163c0cd139b711e8b62bd21d4d7011045b
dsdb: Allow "password hash userPassword schemes = CryptSHA256" to work on RHEL7

On RHEL7 crypt_r() will set errno.  This is a problem because the implementation of crypt_r()
in RHEL8 and elsewhere in libcrypt will return non-NULL but set errno on failure.

The workaround is to use crypt_rn(), provided only by libcrypt, which will return NULL
on failure, and so avoid checking errno in the non-failure case.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14424

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
lib/replace/wscript
source4/dsdb/samdb/ldb_modules/password_hash.c