op->ors_slimit, &msgid );
if ( rs->sr_err != LDAP_SUCCESS ) {
-fail:;
switch ( rs->sr_err ) {
case LDAP_SERVER_DOWN:
if ( do_retry ) {
} else if ( rc == LDAP_RES_SEARCH_ENTRY ) {
Entry ent = { 0 };
struct berval bdn = BER_BVNULL;
- int abort = 0;
do_retry = 0;
rs->sr_attrs = op->ors_attrs;
rs->sr_operational_attrs = NULL;
rs->sr_flags = 0;
- abort = send_search_entry( op, rs );
+ rc = rs->sr_err = send_search_entry( op, rs );
if ( !BER_BVISNULL( &ent.e_name ) ) {
assert( ent.e_name.bv_val != bdn.bv_val );
free( ent.e_name.bv_val );
entry_clean( &ent );
}
ldap_msgfree( res );
- if ( abort ) {
- ldap_abandon_ext( lc->lc_ld, msgid, NULL, NULL );
+ if ( rc != LDAP_SUCCESS ) {
+ if ( rc == LDAP_UNAVAILABLE ) {
+ rc = rs->sr_err = LDAP_OTHER;
+ } else {
+ ldap_abandon_ext( lc->lc_ld, msgid, NULL, NULL );
+ }
goto finish;
}
}
if ( match.bv_val != NULL ) {
+#ifndef LDAP_NULL_IS_NULL
if ( match.bv_val[ 0 ] == '\0' ) {
LDAP_FREE( match.bv_val );
BER_BVZERO( &match );
- } else {
+ } else
+#endif /* LDAP_NULL_IS_NULL */
+ {
match.bv_len = strlen( match.bv_val );
}
}
+#ifndef LDAP_NULL_IS_NULL
+ if ( rs->sr_text != NULL && rs->sr_text[ 0 ] == '\0' ) {
+ LDAP_FREE( (char *)rs->sr_text );
+ rs->sr_text = NULL;
+ }
+#endif /* LDAP_NULL_IS_NULL */
/* cleanup */
if ( references ) {