mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:41:40 +03:00
openldap: check ber_sockbuf_add_io() return code
The man page says nothing about what the return code means but Howard Chu tells me it is 0 on success, -1 on fail. Help-by: Howard Chu Closes #18747
This commit is contained in:
parent
84d9627531
commit
72f72f678d
1 changed files with 23 additions and 24 deletions
|
|
@ -531,19 +531,19 @@ static CURLcode oldap_ssl_connect(struct Curl_easy *data, ldapstate newstate)
|
|||
if(!li)
|
||||
return CURLE_FAILED_INIT;
|
||||
result = Curl_conn_connect(data, FIRSTSOCKET, FALSE, &ssldone);
|
||||
if(!result) {
|
||||
oldap_state(data, li, newstate);
|
||||
if(result)
|
||||
return result;
|
||||
oldap_state(data, li, newstate);
|
||||
|
||||
if(ssldone) {
|
||||
Sockbuf *sb;
|
||||
if(ssldone) {
|
||||
Sockbuf *sb;
|
||||
|
||||
/* Install the libcurl SSL handlers into the sockbuf. */
|
||||
if(ldap_get_option(li->ld, LDAP_OPT_SOCKBUF, &sb) != LDAP_OPT_SUCCESS)
|
||||
return CURLE_FAILED_INIT;
|
||||
ber_sockbuf_add_io(sb, &ldapsb_tls, LBER_SBIOD_LEVEL_TRANSPORT, data);
|
||||
li->recv = conn->recv[FIRSTSOCKET];
|
||||
li->send = conn->send[FIRSTSOCKET];
|
||||
}
|
||||
/* Install the libcurl SSL handlers into the sockbuf. */
|
||||
if((ldap_get_option(li->ld, LDAP_OPT_SOCKBUF, &sb) != LDAP_OPT_SUCCESS) ||
|
||||
ber_sockbuf_add_io(sb, &ldapsb_tls, LBER_SBIOD_LEVEL_TRANSPORT, data))
|
||||
return CURLE_FAILED_INIT;
|
||||
li->recv = conn->recv[FIRSTSOCKET];
|
||||
li->send = conn->send[FIRSTSOCKET];
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
@ -947,19 +947,18 @@ static CURLcode oldap_disconnect(struct Curl_easy *data,
|
|||
(void)data;
|
||||
#endif
|
||||
|
||||
if(li) {
|
||||
if(li->ld) {
|
||||
if(li && li->ld) {
|
||||
#ifdef USE_SSL
|
||||
if(ssl_installed(conn)) {
|
||||
Sockbuf *sb;
|
||||
if(ldap_get_option(li->ld, LDAP_OPT_SOCKBUF, &sb) != LDAP_OPT_SUCCESS)
|
||||
return CURLE_FAILED_INIT;
|
||||
ber_sockbuf_add_io(sb, &ldapsb_tls, LBER_SBIOD_LEVEL_TRANSPORT, data);
|
||||
}
|
||||
#endif
|
||||
ldap_unbind_ext(li->ld, NULL, NULL);
|
||||
li->ld = NULL;
|
||||
if(ssl_installed(conn)) {
|
||||
Sockbuf *sb;
|
||||
if((ldap_get_option(li->ld, LDAP_OPT_SOCKBUF, &sb) != LDAP_OPT_SUCCESS)
|
||||
||
|
||||
ber_sockbuf_add_io(sb, &ldapsb_tls, LBER_SBIOD_LEVEL_TRANSPORT, data))
|
||||
return CURLE_FAILED_INIT;
|
||||
}
|
||||
#endif
|
||||
ldap_unbind_ext(li->ld, NULL, NULL);
|
||||
li->ld = NULL;
|
||||
}
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
|
@ -988,9 +987,9 @@ static CURLcode oldap_do(struct Curl_easy *data, bool *done)
|
|||
if(ssl_installed(conn)) {
|
||||
Sockbuf *sb;
|
||||
/* re-install the libcurl SSL handlers into the sockbuf. */
|
||||
if(ldap_get_option(li->ld, LDAP_OPT_SOCKBUF, &sb) != LDAP_OPT_SUCCESS)
|
||||
if((ldap_get_option(li->ld, LDAP_OPT_SOCKBUF, &sb) != LDAP_OPT_SUCCESS) ||
|
||||
ber_sockbuf_add_io(sb, &ldapsb_tls, LBER_SBIOD_LEVEL_TRANSPORT, data))
|
||||
return CURLE_FAILED_INIT;
|
||||
ber_sockbuf_add_io(sb, &ldapsb_tls, LBER_SBIOD_LEVEL_TRANSPORT, data);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue