mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-02-18 18:18:06 -05:00
Add crypt(3) sanity checks
This commit is contained in:
parent
f323caf25f
commit
2fd0d597cf
1 changed files with 15 additions and 3 deletions
|
|
@ -29,7 +29,7 @@ lutil_passwd(
|
|||
const char *passwd)
|
||||
{
|
||||
|
||||
if (cred == NULL || passwd == NULL) {
|
||||
if (cred == NULL || !cred[0] || passwd == NULL || !passwd[0] ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -134,10 +134,22 @@ lutil_passwd(
|
|||
|
||||
#ifdef SLAPD_CRYPT
|
||||
} else if (strncasecmp(passwd, "{CRYPT}", sizeof("{CRYPT}") - 1) == 0 ) {
|
||||
const char *p = passwd + (sizeof("{CRYPT}") - 1);
|
||||
const char *p;
|
||||
char *cr;
|
||||
|
||||
return( strcmp(p, crypt(cred, p)) );
|
||||
p = passwd + (sizeof("{CRYPT}") - 1);
|
||||
|
||||
if( !p[0] || !p[1] ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
cr = crypt( cred, p );
|
||||
|
||||
if( !cr || !cr[0] ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return strcmp(p, cr);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue