ldap: support empty username and password

Prior to this change an empty username or password was passed to the
LDAP bind function as NULL instead of an empty string.

Regression since 8f71d0fd.

Reported-by: Yoshiro Yoneya

Fixes https://github.com/curl/curl/issues/22162
Closes https://github.com/curl/curl/pull/22196
This commit is contained in:
Jay Satiro 2026-06-26 14:12:43 -04:00
parent a7f82509e4
commit c4fe0c7b9f

View file

@ -282,10 +282,8 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
#else
char *host = NULL;
#endif
const char *user = Curl_creds_has_user(data->state.creds) ?
data->state.creds->user : NULL;
const char *passwd = Curl_creds_has_passwd(data->state.creds) ?
data->state.creds->passwd : NULL;
const char *user = data->state.creds ? data->state.creds->user : NULL;
const char *passwd = data->state.creds ? data->state.creds->passwd : NULL;
struct ip_quadruple ipquad;
bool is_ipv6;
BerElement *ber = NULL;