openldap: Prefer use of 'CURLcode result'

This commit is contained in:
Steve Holme 2014-12-27 21:22:45 +00:00
parent e9e48a6ff2
commit 325a64d8a2
1 changed files with 18 additions and 11 deletions

View File

@ -190,9 +190,11 @@ static Sockbuf_IO ldapsb_tls;
static CURLcode ldap_connect(struct connectdata *conn, bool *done) static CURLcode ldap_connect(struct connectdata *conn, bool *done)
{ {
ldapconninfo *li = conn->proto.generic; ldapconninfo *li = conn->proto.generic;
struct SessionHandle *data=conn->data; struct SessionHandle *data = conn->data;
int rc, proto = LDAP_VERSION3; int rc, proto = LDAP_VERSION3;
char hosturl[1024], *ptr; char hosturl[1024];
char *ptr;
(void)done; (void)done;
strcpy(hosturl, "ldap"); strcpy(hosturl, "ldap");
@ -213,10 +215,10 @@ static CURLcode ldap_connect(struct connectdata *conn, bool *done)
#ifdef USE_SSL #ifdef USE_SSL
if(conn->handler->flags & PROTOPT_SSL) { if(conn->handler->flags & PROTOPT_SSL) {
CURLcode res; CURLcode result;
res = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &li->ssldone); result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &li->ssldone);
if(res) if(result)
return res; return result;
} }
#endif #endif
@ -226,7 +228,7 @@ static CURLcode ldap_connect(struct connectdata *conn, bool *done)
static CURLcode ldap_connecting(struct connectdata *conn, bool *done) static CURLcode ldap_connecting(struct connectdata *conn, bool *done)
{ {
ldapconninfo *li = conn->proto.generic; ldapconninfo *li = conn->proto.generic;
struct SessionHandle *data=conn->data; struct SessionHandle *data = conn->data;
LDAPMessage *msg = NULL; LDAPMessage *msg = NULL;
struct timeval tv = {0,1}, *tvp; struct timeval tv = {0,1}, *tvp;
int rc, err; int rc, err;
@ -236,11 +238,12 @@ static CURLcode ldap_connecting(struct connectdata *conn, bool *done)
if(conn->handler->flags & PROTOPT_SSL) { if(conn->handler->flags & PROTOPT_SSL) {
/* Is the SSL handshake complete yet? */ /* Is the SSL handshake complete yet? */
if(!li->ssldone) { if(!li->ssldone) {
CURLcode res = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, CURLcode result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET,
&li->ssldone); &li->ssldone);
if(res || !li->ssldone) if(result || !li->ssldone)
return res; return result;
} }
/* Have we installed the libcurl SSL handlers into the sockbuf yet? */ /* Have we installed the libcurl SSL handlers into the sockbuf yet? */
if(!li->sslinst) { if(!li->sslinst) {
Sockbuf *sb; Sockbuf *sb;
@ -294,6 +297,7 @@ retry:
failf(data, "LDAP local: bind ldap_parse_result %s", ldap_err2string(rc)); failf(data, "LDAP local: bind ldap_parse_result %s", ldap_err2string(rc));
return CURLE_LDAP_CANNOT_BIND; return CURLE_LDAP_CANNOT_BIND;
} }
/* Try to fallback to LDAPv2? */ /* Try to fallback to LDAPv2? */
if(err == LDAP_PROTOCOL_ERROR) { if(err == LDAP_PROTOCOL_ERROR) {
int proto; int proto;
@ -322,6 +326,7 @@ retry:
ldap_memfree(info); ldap_memfree(info);
conn->recv[FIRSTSOCKET] = ldap_recv; conn->recv[FIRSTSOCKET] = ldap_recv;
*done = TRUE; *done = TRUE;
return CURLE_OK; return CURLE_OK;
} }
@ -390,6 +395,7 @@ static CURLcode ldap_done(struct connectdata *conn, CURLcode res,
bool premature) bool premature)
{ {
ldapreqinfo *lr = conn->data->req.protop; ldapreqinfo *lr = conn->data->req.protop;
(void)res; (void)res;
(void)premature; (void)premature;
@ -403,6 +409,7 @@ static CURLcode ldap_done(struct connectdata *conn, CURLcode res,
conn->data->req.protop = NULL; conn->data->req.protop = NULL;
free(lr); free(lr);
} }
return CURLE_OK; return CURLE_OK;
} }