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)
committerKarolin Seeger <kseeger@samba.org>
Mon, 6 Jul 2020 09:50:31 +0000 (09:50 +0000)
commit6eb3fba83cd374103821fbc5ce72cd1956b08045
treea70cba3f39aa4bf711d4299bc13ee41f1f7f781d
parent25f198a12b9898e69accbbe62cd3c4524644a57f
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>
(cherry picked from commit 91453f110fa72062291eb59ad9d95fab0f423557)
lib/replace/wscript
source4/dsdb/samdb/ldb_modules/password_hash.c