]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/syncrepl.c
queue implicit binds (ITS#4409)
[openldap] / servers / slapd / syncrepl.c
index 083811043d9d1457ea2d92d0dc6bab049c784a22..ac1042abd18ead5b9b81c4801875252bc221de56 100644 (file)
@@ -1359,11 +1359,17 @@ syncrepl_message_to_op(
                                        text, 0, 0 );
                        } else {
                                rc = op->o_bd->be_add( op, &rs );
+                               Debug( LDAP_DEBUG_SYNC,
+                                       "syncrepl_message_to_op: be_add %s (%d)\n", 
+                                       op->o_req_dn.bv_val, rc, 0 );
                        }
                        be_entry_release_w( op, op->ora_e );
                } else {
                        op->orm_modlist = modlist;
                        rc = op->o_bd->be_modify( op, &rs );
+                       Debug( LDAP_DEBUG_SYNC,
+                               "syncrepl_message_to_op: be_modify %s (%d)\n", 
+                               op->o_req_dn.bv_val, rc, 0 );
                }
                break;
        case LDAP_REQ_MODRDN:
@@ -1387,9 +1393,15 @@ syncrepl_message_to_op(
                        goto done;
                rc = op->o_bd->be_modrdn( op, &rs );
                slap_mods_free( op->orr_modlist, 1 );
+               Debug( LDAP_DEBUG_SYNC,
+                       "syncrepl_message_to_op: be_modrdn %s (%d)\n", 
+                       op->o_req_dn.bv_val, rc, 0 );
                break;
        case LDAP_REQ_DELETE:
                rc = op->o_bd->be_delete( op, &rs );
+               Debug( LDAP_DEBUG_SYNC,
+                       "syncrepl_message_to_op: be_delete %s (%d)\n", 
+                       op->o_req_dn.bv_val, rc, 0 );
                break;
        }
 done:
@@ -1839,7 +1851,7 @@ retry_add:;
 
                        dnParent( &dni.ndn, &noldp );
                        dnParent( &entry->e_nname, &nnewp );
-                       if ( !dn_match( &noldp, &newp )) {
+                       if ( !dn_match( &noldp, &nnewp )) {
                                dnParent( &entry->e_name, &newp );
                                op->orr_newSup = &newp;
                                op->orr_nnewSup = &nnewp;
@@ -2039,8 +2051,12 @@ syncrepl_del_nonpresent(
 
                for (i=0; uuids[i].bv_val; i++) {
                        op->ors_slimit = 1;
+                       slap_uuidstr_from_normalized( &uf.f_av_value, &uuids[i],
+                               op->o_tmpmemctx );
+                       filter2bv_x( op, op->ors_filter, &op->ors_filterstr );
                        uf.f_av_value = uuids[i];
                        rc = be->be_search( op, &rs_search );
+                       op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
                }
                si->si_refreshDelete ^= NP_DELETE_ONE;
        } else {
@@ -2078,6 +2094,9 @@ syncrepl_del_nonpresent(
                        op->o_req_dn = *np_prev->npe_name;
                        op->o_req_ndn = *np_prev->npe_nname;
                        rc = op->o_bd->be_delete( op, &rs_delete );
+                       Debug( LDAP_DEBUG_SYNC,
+                               "syncrepl_del_nonpresent: be_delete %s (%d)\n", 
+                               op->o_req_dn.bv_val, rc, 0 );
 
                        if ( rs_delete.sr_err == LDAP_NOT_ALLOWED_ON_NONLEAF ) {
                                Modifications mod1, mod2;
@@ -2581,6 +2600,16 @@ avl_ber_bvfree( void *v_bv )
 void
 syncinfo_free( syncinfo_t *sie )
 {
+       if ( sie->si_ld ) {
+               if ( sie->si_conn_setup ) {
+                       ber_socket_t s;
+                       ldap_get_option( sie->si_ld, LDAP_OPT_DESC, &s );
+                       connection_client_stop( s );
+                       sie->si_conn_setup = 0;
+               }
+               ldap_unbind_ext( sie->si_ld, NULL, NULL );
+       }
+
        /* re-fetch it, in case it was already removed */
        sie->si_re = ldap_pvt_runqueue_find( &slapd_rq, do_syncrepl, sie );
        if ( sie->si_re ) {
@@ -2644,9 +2673,6 @@ syncinfo_free( syncinfo_t *sie )
        if ( sie->si_presentlist ) {
            avl_free( sie->si_presentlist, avl_ber_bvfree );
        }
-       if ( sie->si_ld ) {
-               ldap_unbind_ext( sie->si_ld, NULL, NULL );
-       }
        while ( !LDAP_LIST_EMPTY( &sie->si_nonpresentlist )) {
                struct nonpresent_entry* npe;
                npe = LDAP_LIST_FIRST( &sie->si_nonpresentlist );