mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-19 05:13:35 -05:00
ITS#2153, make sure sockbuf buffer is empty before returning (-2) from
try_read1msg. Blind fix, problem was not duplicated/tested.
This commit is contained in:
parent
956f1d16aa
commit
4396ad3316
2 changed files with 17 additions and 4 deletions
|
|
@ -311,6 +311,9 @@ struct ldap {
|
|||
LDAPConn *ld_defconn; /* default connection */
|
||||
LDAPConn *ld_conns; /* list of server connections */
|
||||
void *ld_selectinfo; /* platform specifics for select */
|
||||
#ifdef HAVE_TLS
|
||||
void *ld_ssl; /* SSL session for next connection */
|
||||
#endif
|
||||
};
|
||||
#define LDAP_VALID(ld) ( (ld)->ld_valid == LDAP_VALID_SESSION )
|
||||
|
||||
|
|
|
|||
|
|
@ -416,6 +416,7 @@ try_read1msg(
|
|||
Debug( LDAP_DEBUG_TRACE, "read1msg: msgid %d, all %d\n", msgid, all, 0 );
|
||||
#endif
|
||||
|
||||
retry:
|
||||
if ( lc->lconn_ber == NULL ) {
|
||||
lc->lconn_ber = ldap_alloc_ber_with_options(ld);
|
||||
|
||||
|
|
@ -427,6 +428,7 @@ try_read1msg(
|
|||
ber = lc->lconn_ber;
|
||||
assert( LBER_VALID (ber) );
|
||||
|
||||
retry2:
|
||||
/* get the next message */
|
||||
errno = 0;
|
||||
#ifdef LDAP_CONNECTIONLESS
|
||||
|
|
@ -475,12 +477,17 @@ try_read1msg(
|
|||
|
||||
/* if it's been abandoned, toss it */
|
||||
if ( ldap_abandoned( ld, id ) ) {
|
||||
ber_free( ber, 1 );
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( OPERATION, DETAIL1, "read1msg: abandoned\n", 0, 0, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_ANY, "abandoned\n", 0, 0, 0);
|
||||
#endif
|
||||
retry_ber:
|
||||
if ( ber_sockbuf_ctrl( sb, LBER_SB_OPT_DATA_READY, NULL ) ) {
|
||||
ber_init2( ber, NULL, ld->ld_lberoptions );
|
||||
goto retry2;
|
||||
}
|
||||
ber_free( ber, 1 );
|
||||
return( -2 ); /* continue looking */
|
||||
}
|
||||
|
||||
|
|
@ -494,8 +501,7 @@ try_read1msg(
|
|||
"no request for response with msgid %ld (tossing)\n",
|
||||
(long) id, 0, 0 );
|
||||
#endif
|
||||
ber_free( ber, 1 );
|
||||
return( -2 ); /* continue looking */
|
||||
goto retry_ber;
|
||||
}
|
||||
#ifdef LDAP_CONNECTIONLESS
|
||||
if (LDAP_IS_UDP(ld) && ld->ld_options.ldo_version == LDAP_VERSION2) {
|
||||
|
|
@ -843,7 +849,7 @@ lr->lr_res_matched ? lr->lr_res_matched : "" );
|
|||
|
||||
new->lm_next = ld->ld_responses;
|
||||
ld->ld_responses = new;
|
||||
return( -2 ); /* continue looking */
|
||||
goto leave;
|
||||
}
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
|
|
@ -886,6 +892,10 @@ lr->lr_res_matched ? lr->lr_res_matched : "" );
|
|||
#endif /* !LDAP_WORLD_P16 */
|
||||
}
|
||||
|
||||
leave:
|
||||
if ( ber_sockbuf_ctrl( sb, LBER_SB_OPT_DATA_READY, NULL ) ) {
|
||||
goto retry;
|
||||
}
|
||||
return( -2 ); /* continue looking */
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue