From: Jong Hyuk Choi Date: Fri, 29 Aug 2003 17:02:53 +0000 (+0000) Subject: more patches for ITS#2692 (Thanks Luke!) X-Git-Tag: OPENLDAP_REL_ENG_2_1_MP~763 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=853c03e38ddee8dc3210a8ef0888afe63fc12ac6;p=openldap more patches for ITS#2692 (Thanks Luke!) --- diff --git a/servers/slapd/back-bdb/search.c b/servers/slapd/back-bdb/search.c index 5fc72c5818..e98e41fb91 100644 --- a/servers/slapd/back-bdb/search.c +++ b/servers/slapd/back-bdb/search.c @@ -450,7 +450,7 @@ bdb_do_search( Operation *op, SlapReply *rs, Operation *sop, if ( sop->o_req_ndn.bv_len == 0 ) { /* DIT root special case */ e = (Entry *) &slap_entry_root; - rs->sr_err = 0; + rs->sr_err = LDAP_SUCCESS; } else { dn2entry_retry: /* get entry with reader lock */ @@ -508,7 +508,7 @@ dn2entry_retry: NULL, &sop->o_req_dn, sop->oq_search.rs_scope ); } - rs->sr_err=LDAP_REFERRAL; + rs->sr_err = LDAP_REFERRAL; rs->sr_matched = matched_dn.bv_val; send_ldap_result( sop, rs ); @@ -608,7 +608,7 @@ dn2entry_retry: } else if ( limit->lms_t_hard > 0 ) { rs->sr_err = LDAP_ADMINLIMIT_EXCEEDED; send_ldap_result( sop, rs ); - rs->sr_err = 0; + rs->sr_err = LDAP_SUCCESS; goto done; } @@ -635,7 +635,7 @@ dn2entry_retry: } else if ( limit->lms_s_hard > 0 ) { rs->sr_err = LDAP_ADMINLIMIT_EXCEEDED; send_ldap_result( sop, rs ); - rs->sr_err = 0; + rs->sr_err = LDAP_SUCCESS; goto done; } @@ -760,8 +760,8 @@ ctxcsn_retry : #endif rs->sr_err = LDAP_SUCCESS; + rs->sr_entry = NULL; send_ldap_result( sop, rs ); - rs->sr_err = 1; goto done; } @@ -770,7 +770,7 @@ ctxcsn_retry : if ( BDB_IDL_N(candidates) > (unsigned) limit->lms_s_unchecked ) { rs->sr_err = LDAP_ADMINLIMIT_EXCEEDED; send_ldap_result( sop, rs ); - rs->sr_err = 1; + rs->sr_err = LDAP_SUCCESS; goto done; } } @@ -806,7 +806,7 @@ ctxcsn_retry : #endif send_pagerequest_response( sop, rs, lastid, 0 ); - rs->sr_err = 1; + rs->sr_err = LDAP_OTHER; goto done; } goto loop_begin; @@ -877,7 +877,7 @@ ctxcsn_retry : loop_begin: /* check for abandon */ if ( sop->o_abandon ) { - rs->sr_err = 0; + rs->sr_err = LDAP_SUCCESS; goto done; } @@ -887,7 +887,7 @@ loop_begin: rs->sr_err = LDAP_CANCELLED; send_ldap_result( sop, rs ); sop->o_cancel = SLAP_CANCEL_ACK; - rs->sr_err = 0; + rs->sr_err = LDAP_SUCCESS; goto done; } #endif @@ -897,6 +897,7 @@ loop_begin: rs->sr_err = LDAP_TIMELIMIT_EXCEEDED; rs->sr_ref = rs->sr_v2ref; send_ldap_result( sop, rs ); + rs->sr_err = LDAP_SUCCESS; goto done; } @@ -919,7 +920,7 @@ id2entry_retry: goto id2entry_retry; } - if ( ei && rs->sr_err == 0 ) { + if ( ei && rs->sr_err == LDAP_SUCCESS ) { e = ei->bei_e; } else { e = NULL; @@ -1135,6 +1136,7 @@ id2entry_retry: rs->sr_err = LDAP_SIZELIMIT_EXCEEDED; rs->sr_ref = rs->sr_v2ref; send_ldap_result( sop, rs ); + rs->sr_err = LDAP_SUCCESS; goto done; } @@ -1193,7 +1195,7 @@ id2entry_retry: } else if ( ps_type == LDAP_PSEARCH_BY_SCOPEOUT ) entry_sync_state = LDAP_SYNC_DELETE; else { - rs->sr_err = 1; + rs->sr_err = LDAP_OTHER; goto done; } rs->sr_err = bdb_build_sync_state_ctrl( sop, diff --git a/servers/slapd/back-ldbm/search.c b/servers/slapd/back-ldbm/search.c index 3ce70492a9..4a46352208 100644 --- a/servers/slapd/back-ldbm/search.c +++ b/servers/slapd/back-ldbm/search.c @@ -193,7 +193,7 @@ searchit: rs->sr_err = LDAP_SUCCESS; send_ldap_result( op, rs ); - rc = LDAP_OTHER; + rc = LDAP_SUCCESS; goto done; } @@ -214,7 +214,7 @@ searchit: if ( ID_BLOCK_NIDS( candidates ) > (unsigned) limit->lms_s_unchecked ) { send_ldap_error( op, rs, LDAP_ADMINLIMIT_EXCEEDED, NULL ); - rc = 0; + rc = LDAP_SUCCESS; goto done; } } @@ -247,7 +247,7 @@ searchit: send_ldap_error( op, rs, LDAP_ADMINLIMIT_EXCEEDED, NULL ); - rc = 0; + rc = LDAP_SUCCESS; goto done; } @@ -271,7 +271,7 @@ searchit: send_ldap_error( op, rs, LDAP_ADMINLIMIT_EXCEEDED, NULL ); - rc = 0; + rc = LDAP_SUCCESS; goto done; } @@ -291,7 +291,7 @@ searchit: /* check for abandon */ if ( op->o_abandon ) { - rc = 0; + rc = LDAP_SUCCESS; goto done; } @@ -299,7 +299,7 @@ searchit: if ( op->oq_search.rs_tlimit != -1 && slap_get_time() > stoptime ) { rs->sr_err = LDAP_TIMELIMIT_EXCEEDED; send_ldap_result( op, rs ); - rc = 0; + rc = LDAP_SUCCESS; goto done; } @@ -470,7 +470,7 @@ searchit: cache_return_entry_r( &li->li_cache, e ); rs->sr_err = LDAP_SIZELIMIT_EXCEEDED; send_ldap_result( op, rs ); - rc = 0; + rc = LDAP_SUCCESS; goto done; } @@ -485,7 +485,7 @@ searchit: break; case -1: /* connection closed */ cache_return_entry_r( &li->li_cache, e ); - rc = 0; + rc = LDAP_SUCCESS; goto done; } } @@ -526,7 +526,7 @@ loop_continue: rs->sr_ref = rs->sr_v2ref; send_ldap_result( op, rs ); - rc = 0; + rc = LDAP_SUCCESS; done: ldap_pvt_thread_rdwr_runlock(&li->li_giant_rwlock); diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index 79cd3de82b..d6e6ee6787 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -1006,6 +1006,8 @@ syncrepl_entry( cb.sc_response = dn_callback; cb.sc_private = si; + si->syncUUID_ndn = NULL; + rc = be->be_search( op, &rs ); ch_free( op->o_req_dn.bv_val ); @@ -1053,6 +1055,18 @@ syncrepl_entry( op->o_req_ndn = e->e_nname; rc = be->be_modify( op, &rs ); si->e = NULL; + if ( rc != LDAP_SUCCESS ) { +#ifdef NEW_LOGGING + LDAP_LOG( OPERATION, ERR, + "syncrepl_entry : be_modify failed (%d)\n", + rc, 0, 0 ); +#else + Debug( LDAP_DEBUG_ANY, + "syncrepl_entry : be_modify failed (%d)\n", + rc, 0, 0 ); +#endif + return 1; + } return 0; } else if ( rc == LDAP_REFERRAL || rc == LDAP_NO_SUCH_OBJECT ) { @@ -1064,11 +1078,11 @@ syncrepl_entry( } else { #ifdef NEW_LOGGING LDAP_LOG( OPERATION, ERR, - "be_modify failed (%d)\n", + "syncrepl_entry : be_add failed (%d)\n", rc, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, - "be_modify failed (%d)\n", + "syncrepl_entry : be_add failed (%d)\n", rc, 0, 0 ); #endif si->e = NULL; @@ -1082,10 +1096,10 @@ syncrepl_entry( } else { #ifdef NEW_LOGGING LDAP_LOG( OPERATION, ERR, - "be_modify/be_delete failed (%d)\n", rc, 0, 0 ); + "syncrepl_entry : be_search failed (%d)\n", rc, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, - "be_modify/be_delete failed (%d)\n", rc, 0, 0 ); + "syncrepl_entry : be_search failed (%d)\n", rc, 0, 0 ); #endif si->e = NULL; return 1; @@ -1104,10 +1118,10 @@ syncrepl_entry( default : #ifdef NEW_LOGGING LDAP_LOG( OPERATION, ERR, - "unknown syncstate\n", 0, 0, 0 ); + "syncrepl_entry : unknown syncstate\n", 0, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, - "unknown syncstate\n", 0, 0, 0 ); + "syncrepl_entry : unknown syncstate\n", 0, 0, 0 ); #endif return 1; } @@ -1579,9 +1593,23 @@ dn_callback( ) { syncinfo_t *si = op->o_callback->sc_private; - + if ( rs->sr_type == REP_SEARCH ) { - si->syncUUID_ndn = ber_dupbv( NULL, &rs->sr_entry->e_nname ); + if ( si->syncUUID_ndn != NULL ) { +#ifdef NEW_LOGGING + LDAP_LOG( OPERATION, ERR, + "dn_callback : multiple entries match dn\n", 0, 0, 0 ); +#else + Debug( LDAP_DEBUG_ANY, + "dn_callback : multiple entries match dn\n", 0, 0, 0 ); +#endif + } else { + if ( rs->sr_entry == NULL ) { + si->syncUUID_ndn = NULL; + } else { + si->syncUUID_ndn = ber_dupbv( NULL, &rs->sr_entry->e_nname ); + } + } } return LDAP_SUCCESS;