1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

s3:passdb: Consolidate error checking in fetch_ldap_pw()

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Aug 11 06:34:56 UTC 2022 on sn-devel-184
This commit is contained in:
Pavel Filipenský 2022-08-05 21:43:25 +02:00 committed by Andreas Schneider
parent 60ce54c36d
commit 1b470aaa67

View File

@ -379,15 +379,8 @@ bool fetch_ldap_pw(char **dn, char** pw)
*pw=(char *)secrets_fetch(key, &size);
SAFE_FREE(key);
if ((size != 0) && ((*pw)[size-1] != '\0')) {
DBG_ERR("Non 0-terminated password for dn %s\n", *dn);
SAFE_FREE(*pw);
SAFE_FREE(*dn);
return false;
}
if (!size) {
DBG_ERR("No password for %s\n", *dn);
if (*pw == NULL || size == 0 || (*pw)[size-1] != '\0') {
DBG_ERR("No valid password for %s\n", *dn);
SAFE_FREE(*pw);
SAFE_FREE(*dn);
return false;