rs.sr_entry = *e;
                if ( rs.sr_entry->e_private )
                        rs.sr_flags = REP_ENTRY_MUSTRELEASE;
-               if ( opc->sreference ) {
+               if ( opc->sreference && so->s_op->o_managedsait <= SLAP_CONTROL_IGNORED ) {
                        rs.sr_ref = get_entry_referrals( op, rs.sr_entry );
                        rs.sr_err = send_search_reference( op, &rs );
                        ber_bvarray_free( rs.sr_ref );
                e_uuid.e_name = opc->sdn;
                e_uuid.e_nname = opc->sndn;
                rs.sr_entry = &e_uuid;
-               if ( opc->sreference ) {
+               if ( opc->sreference && so->s_op->o_managedsait <= SLAP_CONTROL_IGNORED ) {
                        struct berval bv = BER_BVNULL;
                        rs.sr_ref = &bv;
                        rs.sr_err = send_search_reference( op, &rs );
        op2->o_time = op->o_time;
        op2->o_bd = on->on_info->oi_origdb;
        op2->o_request = op->o_request;
+       op2->o_managedsait = op->o_managedsait;
        LDAP_SLIST_FIRST(&op2->o_extra)->oe_key = on;
        LDAP_SLIST_NEXT(LDAP_SLIST_FIRST(&op2->o_extra), oe_next) = NULL;
 
        }
 
        srs = op->o_controls[slap_cids.sc_LDAPsync];
-       op->o_managedsait = SLAP_CONTROL_NONCRITICAL;
 
        /* If this is a persistent search, set it up right away */
        if ( op->o_sync_mode & SLAP_SYNC_PERSIST ) {
 
 {
        BerElementBuffer berbuf;
        BerElement *ber = (BerElement *)&berbuf;
-       LDAPControl c[2], *ctrls[3];
+       LDAPControl c[3], *ctrls[4];
        int rc;
        int rhint;
        char *base;
        c[0].ldctl_iscritical = si->si_type < 0;
        ctrls[0] = &c[0];
 
+       c[1].ldctl_oid = LDAP_CONTROL_MANAGEDSAIT;
+       BER_BVZERO( &c[1].ldctl_value );
+       c[1].ldctl_iscritical = 1;
+       ctrls[1] = &c[1];
+
        if ( !BER_BVISNULL( &si->si_bindconf.sb_authzId ) ) {
-               c[1].ldctl_oid = LDAP_CONTROL_PROXY_AUTHZ;
-               c[1].ldctl_value = si->si_bindconf.sb_authzId;
-               c[1].ldctl_iscritical = 1;
-               ctrls[1] = &c[1];
-               ctrls[2] = NULL;
+               c[2].ldctl_oid = LDAP_CONTROL_PROXY_AUTHZ;
+               c[2].ldctl_value = si->si_bindconf.sb_authzId;
+               c[2].ldctl_iscritical = 1;
+               ctrls[2] = &c[2];
+               ctrls[3] = NULL;
        } else {
-               ctrls[1] = NULL;
+               ctrls[2] = NULL;
        }
 
        rc = ldap_search_ext( si->si_ld, base, scope, filter, attrs, attrsonly,
        rc = LDAP_DEREF_NEVER;  /* actually could allow DEREF_FINDING */
        ldap_set_option( si->si_ld, LDAP_OPT_DEREF, &rc );
 
+       ldap_set_option( si->si_ld, LDAP_OPT_REFERRALS, LDAP_OPT_OFF );
+
        si->si_syncCookie.rid = si->si_rid;
 
        /* whenever there are multiple data sources possible, advertise sid */