mirror of
https://github.com/samba-team/samba.git
synced 2025-01-10 01:18:15 +03:00
s4:dsdb/password_hash: Add a more useful error message for passwords too long to be hashed
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14621 Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
e656d8b1ad
commit
de28d915d7
@ -1561,16 +1561,23 @@ static int setup_primary_userPassword_hash(
|
||||
*/
|
||||
if (hash == NULL || hash[0] == '*') {
|
||||
char buf[1024];
|
||||
int err = strerror_r(errno, buf, sizeof(buf));
|
||||
if (err != 0) {
|
||||
strlcpy(buf, "Unknown error", sizeof(buf)-1);
|
||||
const char *reason = NULL;
|
||||
if (errno == ERANGE) {
|
||||
reason = "Password exceeds maximum length allowed for crypt() hashing";
|
||||
} else {
|
||||
int err = strerror_r(errno, buf, sizeof(buf));
|
||||
if (err == 0) {
|
||||
reason = buf;
|
||||
} else {
|
||||
reason = "Unknown error";
|
||||
}
|
||||
}
|
||||
ldb_asprintf_errstring(
|
||||
ldb,
|
||||
"setup_primary_userPassword: generation of a %s "
|
||||
"password hash failed: (%s)",
|
||||
scheme,
|
||||
buf);
|
||||
reason);
|
||||
TALLOC_FREE(frame);
|
||||
return LDB_ERR_OPERATIONS_ERROR;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user