*/
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;
}