Do not try to dereference bindpw if it is null
Fixes: https://fedorahosted.org/freeipa/ticket/783
This commit is contained in:
1 parent
01f907c01b
commit
8a6547943f
1 file changed
+7
-2
@@ -213,8 +213,13 @@ connect_ldap(const char *hostname, const char *binddn, const char *bindpw) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
bindpw_bv.bv_val = discard_const(bindpw);
|
||||
bindpw_bv.bv_len = strlen(bindpw);
|
||||
if (bindpw) {
|
||||
bindpw_bv.bv_val = discard_const(bindpw);
|
||||
bindpw_bv.bv_len = strlen(bindpw);
|
||||
} else {
|
||||
bindpw_bv.bv_val = NULL;
|
||||
bindpw_bv.bv_len = 0;
|
||||
}
|
||||
|
||||
ret = ldap_sasl_bind_s(ld, binddn, LDAP_SASL_SIMPLE, &bindpw_bv,
|
||||
NULL, NULL, NULL);
|
||||
|
||||
Reference in new issue
Block a user