mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-03-01 14:15:49 +08:00
initial round of fixes related to ITS#2986
This commit is contained in:
parent
ea0d619dae
commit
abf2df7a11
@ -414,6 +414,7 @@ meta_back_op_result( struct metaconn *lc, Operation *op, SlapReply *rs )
|
||||
struct metasingleconn *lsc;
|
||||
char *rmsg = NULL;
|
||||
char *rmatch = NULL;
|
||||
int free_rmsg = 0, free_rmatch = 0;
|
||||
|
||||
for ( i = 0, lsc = lc->conns; !META_LAST(lsc); ++i, ++lsc ) {
|
||||
char *msg = NULL;
|
||||
@ -457,9 +458,17 @@ meta_back_op_result( struct metaconn *lc, Operation *op, SlapReply *rs )
|
||||
switch ( rs->sr_err ) {
|
||||
default:
|
||||
rerr = rs->sr_err;
|
||||
if ( rmsg ) {
|
||||
ber_memfree( rmsg );
|
||||
}
|
||||
rmsg = msg;
|
||||
free_rmsg = 1;
|
||||
msg = NULL;
|
||||
if ( rmatch ) {
|
||||
ber_memfree( rmatch );
|
||||
}
|
||||
rmatch = match;
|
||||
free_rmatch = 1;
|
||||
match = NULL;
|
||||
break;
|
||||
}
|
||||
@ -478,6 +487,12 @@ meta_back_op_result( struct metaconn *lc, Operation *op, SlapReply *rs )
|
||||
rs->sr_text = rmsg;
|
||||
rs->sr_matched = rmatch;
|
||||
send_ldap_result( op, rs );
|
||||
if ( free_rmsg ) {
|
||||
ber_memfree( rmsg );
|
||||
}
|
||||
if ( free_rmatch ) {
|
||||
ber_memfree( rmatch );
|
||||
}
|
||||
rs->sr_text = NULL;
|
||||
rs->sr_matched = NULL;
|
||||
|
||||
|
@ -204,6 +204,12 @@ meta_clear_one_candidate(
|
||||
lsc->bound_dn.bv_len = 0;
|
||||
}
|
||||
|
||||
if ( lsc->cred.bv_val != NULL ) {
|
||||
ber_memfree( lsc->cred.bv_val );
|
||||
lsc->cred.bv_val = NULL;
|
||||
lsc->cred.bv_len = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -254,6 +254,11 @@ init_one_conn(
|
||||
return rs->sr_err;
|
||||
}
|
||||
|
||||
/* copy the DN idf needed */
|
||||
if ( lsc->bound_dn.bv_val == op->o_conn->c_dn.bv_val ) {
|
||||
ber_dupbv( &lsc->bound_dn, &op->o_conn->c_dn );
|
||||
}
|
||||
|
||||
assert( lsc->bound_dn.bv_val );
|
||||
|
||||
} else {
|
||||
|
@ -58,7 +58,7 @@ meta_back_search( Operation *op, SlapReply *rs )
|
||||
struct metaconn *lc;
|
||||
struct metasingleconn *lsc;
|
||||
struct timeval tv = { 0, 0 };
|
||||
LDAPMessage *res, *e;
|
||||
LDAPMessage *res = NULL, *e;
|
||||
int rc = 0, *msgid, sres = LDAP_SUCCESS;
|
||||
char *err = NULL;
|
||||
struct berval match = { 0, NULL }, mmatch = { 0, NULL };
|
||||
@ -382,6 +382,11 @@ new_candidate:;
|
||||
0, &tv, &res );
|
||||
|
||||
if ( rc == 0 ) {
|
||||
/* timeout exceeded */
|
||||
|
||||
/* FIXME: res should not need to be freed */
|
||||
assert( res == NULL );
|
||||
|
||||
continue;
|
||||
|
||||
} else if ( rc == -1 ) {
|
||||
@ -393,12 +398,19 @@ new_candidate:;
|
||||
send_ldap_result( op, rs );
|
||||
|
||||
/* anything else needs be done? */
|
||||
|
||||
/* FIXME: res should not need to be freed */
|
||||
assert( res == NULL );
|
||||
|
||||
goto finish;
|
||||
|
||||
} else if ( rc == LDAP_RES_SEARCH_ENTRY ) {
|
||||
e = ldap_first_entry( lsc->ld, res );
|
||||
meta_send_entry( op, rs, lc, i, e );
|
||||
|
||||
ldap_msgfree( res );
|
||||
res = NULL;
|
||||
|
||||
/*
|
||||
* If scope is BASE, we need to jump out
|
||||
* as soon as one entry is found; if
|
||||
@ -412,7 +424,7 @@ new_candidate:;
|
||||
sres = LDAP_SUCCESS;
|
||||
break;
|
||||
}
|
||||
ldap_msgfree( res );
|
||||
|
||||
gotit = 1;
|
||||
|
||||
} else if ( rc == LDAP_RES_SEARCH_REFERENCE ) {
|
||||
@ -460,9 +472,14 @@ new_candidate:;
|
||||
rs->sr_ctrls = NULL;
|
||||
}
|
||||
|
||||
ldap_msgfree( res );
|
||||
res = NULL;
|
||||
|
||||
} else {
|
||||
rs->sr_err = ldap_result2error( lsc->ld,
|
||||
res, 1 );
|
||||
res = NULL;
|
||||
|
||||
sres = ldap_back_map_result( rs );
|
||||
if ( err != NULL ) {
|
||||
free( err );
|
||||
|
Loading…
Reference in New Issue
Block a user