X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fsyncrepl.c;h=6282013598b927df02897dadb30d78c02d3e89de;hb=9767c87531d193a4bef19286b77623aff18590fb;hp=1c838d6a65f4cc87c53694f0578c7bb87e5e35ff;hpb=ae3fb6acfa1f6aab56067e6d8c82fcc5fa669296;p=openldap diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index 1c838d6a65..6282013598 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -1302,10 +1302,6 @@ do_syncrepl( connection_fake_init( &conn, &opbuf, ctx ); op = &opbuf.ob_op; - /* use global malloc for now */ - op->o_tmpmemctx = NULL; - op->o_tmpmfuncs = &ch_mfuncs; - op->o_managedsait = SLAP_CONTROL_NONCRITICAL; be = si->si_be; @@ -1626,7 +1622,16 @@ syncrepl_message_to_op( if ( !ber_bvstrcasecmp( &bv, &ls->ls_dn ) ) { bdn = bvals[0]; - dnPrettyNormal( NULL, &bdn, &dn, &ndn, op->o_tmpmemctx ); + rc = dnPrettyNormal( NULL, &bdn, &dn, &ndn, op->o_tmpmemctx ); + if ( rc != LDAP_SUCCESS ) { + Debug( LDAP_DEBUG_ANY, + "syncrepl_message_to_op: %s " + "dn \"%s\" normalization failed (%d)", + si->si_ridtxt, bdn.bv_val, rc ); + rc = -1; + ch_free( bvals ); + goto done; + } ber_dupbv( &op->o_req_dn, &dn ); ber_dupbv( &op->o_req_ndn, &ndn ); slap_sl_free( ndn.bv_val, op->o_tmpmemctx ); @@ -1858,7 +1863,21 @@ syncrepl_message_to_entry( return -1; } - dnPrettyNormal( NULL, &bdn, &dn, &ndn, op->o_tmpmemctx ); + rc = dnPrettyNormal( NULL, &bdn, &dn, &ndn, op->o_tmpmemctx ); + if ( rc != LDAP_SUCCESS ) { + /* One of the things that could happen is that the schema + * is not lined-up; this could result in unknown attributes. + * A value non conformant to the syntax should be unlikely, + * except when replicating between different versions + * of the software, or when syntax validation bugs are fixed + */ + Debug( LDAP_DEBUG_ANY, + "syncrepl_message_to_entry: " + "%s dn \"%s\" normalization failed (%d)", + si->si_ridtxt, bdn.bv_val, rc ); + return rc; + } + ber_dupbv( &op->o_req_dn, &dn ); ber_dupbv( &op->o_req_ndn, &ndn ); slap_sl_free( ndn.bv_val, op->o_tmpmemctx ); @@ -4381,7 +4400,7 @@ add_syncrepl( si->si_cookieState = c->be->be_syncinfo->si_cookieState; - // add new syncrepl to end of list (same order as when deleting) + /* add new syncrepl to end of list (same order as when deleting) */ for ( sip = c->be->be_syncinfo; sip->si_next; sip = sip->si_next ); sip->si_next = si; } else {