BackendDB *si_wbe;
struct re_s *si_re;
int si_rid;
- char si_ridtxt[ STRLENOF("rid=4095") + 1 ];
+ char si_ridtxt[ STRLENOF("rid=999") + 1 ];
slap_bindconf si_bindconf;
struct berval si_base;
struct berval si_logbase;
ldap_pvt_thread_mutex_lock( &si->si_cookieState->cs_mutex );
rc = backend_operational( op, &rs );
if ( rc == LDAP_SUCCESS && a.a_vals ) {
- int num;
- for (i=0; !BER_BVISNULL( &a.a_vals[i] ); i++) ;
- num = i;
+ int num = a.a_numvals;
/* check for differences */
if ( num != si->si_cookieState->cs_num ) {
changed = 1;
}
if ( ber_peek_tag( ber, &len ) == LDAP_TAG_SYNC_COOKIE ) {
ber_scanf( ber, /*"{"*/ "m}", &cookie );
+
+ Debug( LDAP_DEBUG_SYNC, "do_syncrep2: cookie=%s\n",
+ BER_BVISNULL( &cookie ) ? "" : cookie.bv_val, 0, 0 );
+
if ( !BER_BVISNULL( &cookie ) ) {
ch_free( syncCookie.octet_str.bv_val );
ber_dupbv( &syncCookie.octet_str, &cookie );
ber_scanf( ber, "{" /*"}"*/);
if ( ber_peek_tag( ber, &len ) == LDAP_TAG_SYNC_COOKIE ) {
ber_scanf( ber, "m", &cookie );
+
+ Debug( LDAP_DEBUG_SYNC, "do_syncrep2: cookie=%s\n",
+ BER_BVISNULL( &cookie ) ? "" : cookie.bv_val, 0, 0 );
+
if ( !BER_BVISNULL( &cookie ) ) {
ch_free( syncCookie.octet_str.bv_val );
ber_dupbv( &syncCookie.octet_str, &cookie);
if ( ber_peek_tag( ber, &len ) == LDAP_TAG_SYNC_COOKIE )
{
ber_scanf( ber, "m", &cookie );
+
+ Debug( LDAP_DEBUG_SYNC, "do_syncrep2: cookie=%s\n",
+ BER_BVISNULL( &cookie ) ? "" : cookie.bv_val, 0, 0 );
+
if ( !BER_BVISNULL( &cookie ) ) {
ch_free( syncCookie.octet_str.bv_val );
ber_dupbv( &syncCookie.octet_str, &cookie );
LDAP_TAG_SYNC_COOKIE )
{
ber_scanf( ber, "m", &cookie );
+
+ Debug( LDAP_DEBUG_SYNC, "do_syncrep2: cookie=%s\n",
+ BER_BVISNULL( &cookie ) ? "" : cookie.bv_val, 0, 0 );
+
if ( !BER_BVISNULL( &cookie ) ) {
ch_free( syncCookie.octet_str.bv_val );
ber_dupbv( &syncCookie.octet_str, &cookie );
if ( rc ) {
if ( fail == RETRYNUM_TAIL ) {
Debug( LDAP_DEBUG_ANY,
- "do_syncrepl: rid %03d quitting\n",
- si->si_rid, 0, 0 );
+ "do_syncrepl: %s quitting\n",
+ si->si_ridtxt, 0, 0 );
} else if ( fail > 0 ) {
Debug( LDAP_DEBUG_ANY,
- "do_syncrepl: rid %03d retrying (%d retries left)\n",
- si->si_rid, fail, 0 );
+ "do_syncrepl: %s retrying (%d retries left)\n",
+ si->si_ridtxt, fail, 0 );
} else {
Debug( LDAP_DEBUG_ANY,
- "do_syncrepl: rid %03d retrying\n",
- si->si_rid, 0, 0 );
+ "do_syncrepl: %s retrying\n",
+ si->si_ridtxt, 0, 0 );
}
}
mod->sml_type = ad->ad_cname;
mod->sml_values = NULL;
mod->sml_nvalues = NULL;
+ mod->sml_numvals = 0;
*modtail = mod;
modtail = &mod->sml_next;
bv.bv_len = vals[i].bv_len - ( bv.bv_val - vals[i].bv_val );
ber_dupbv( &bv2, &bv );
ber_bvarray_add( &mod->sml_values, &bv2 );
+ mod->sml_numvals++;
}
}
return modlist;
mod->sml_type = tmp.sml_type;
mod->sml_values = tmp.sml_values;
mod->sml_nvalues = NULL;
+ mod->sml_numvals = 0; /* slap_mods_check will set this */
*modtail = mod;
modtail = &mod->sml_next;
mod1.sml_flags = 0;
mod1.sml_desc = slap_schema.si_ad_objectClass;
mod1.sml_type = mod1.sml_desc->ad_cname;
+ mod1.sml_numvals = 2;
mod1.sml_values = &gcbva[0];
mod1.sml_nvalues = NULL;
mod1.sml_next = &mod2;
mod2.sml_flags = 0;
mod2.sml_desc = slap_schema.si_ad_structuralObjectClass;
mod2.sml_type = mod2.sml_desc->ad_cname;
+ mod1.sml_numvals = 1;
mod2.sml_values = &gcbva[1];
mod2.sml_nvalues = NULL;
mod2.sml_next = NULL;
a = attr_alloc( slap_schema.si_ad_objectClass );
+ a->a_numvals = 2;
a->a_vals = ch_calloc( 3, sizeof( struct berval ) );
ber_dupbv( &a->a_vals[0], &gcbva[0] );
ber_dupbv( &a->a_vals[1], &gcbva[1] );
a = attr_alloc( slap_schema.si_ad_structuralObjectClass );
+ a->a_numvals = 1;
a->a_vals = ch_calloc( 2, sizeof( struct berval ) );
ber_dupbv( &a->a_vals[0], &gcbva[1] );
ber_dupbv( &a->a_vals[1], &gcbva[2] );
mod[0].sml_type = mod[0].sml_desc->ad_cname;
mod[0].sml_values = NULL;
mod[0].sml_nvalues = NULL;
+ mod[0].sml_numvals = 0;
mod[0].sml_next = &mod[1];
mod[1].sml_op = LDAP_MOD_ADD;
mod[1].sml_type = mod[0].sml_desc->ad_cname;
mod[1].sml_values = NULL;
mod[1].sml_nvalues = NULL;
+ mod[1].sml_numvals = 0;
mod[1].sml_next = NULL;
ldap_pvt_thread_mutex_lock( &si->si_cookieState->cs_mutex );
si->si_cookieState->cs_vals[j].bv_val, len ) > 0 ) {
ber_bvarray_add_x( &mod[0].sml_values,
&si->si_cookieState->cs_vals[j], op->o_tmpmemctx );
+ mod[0].sml_numvals++;
ber_bvarray_add_x( &mod[1].sml_values,
&syncCookie->ctxcsn[i], op->o_tmpmemctx );
+ mod[1].sml_numvals++;
if ( BER_BVISNULL( &first ))
first = syncCookie->ctxcsn[i];
}
if ( j == si->si_cookieState->cs_num ) {
ber_bvarray_add_x( &mod[1].sml_values,
&syncCookie->ctxcsn[i], op->o_tmpmemctx );
+ mod[1].sml_numvals++;
if ( BER_BVISNULL( &first ))
first = syncCookie->ctxcsn[i];
}
mod->sml_flags = 0;
mod->sml_desc = old->a_desc;
mod->sml_type = mod->sml_desc->ad_cname;
+ mod->sml_numvals = no;
mod->sml_values = ch_malloc( ( no + 1 ) * sizeof(struct berval) );
if ( old->a_vals != old->a_nvals ) {
mod->sml_nvalues = ch_malloc( ( no + 1 ) * sizeof(struct berval) );
mod->sml_flags = 0;
mod->sml_desc = old->a_desc;
mod->sml_type = mod->sml_desc->ad_cname;
+ mod->sml_numvals = nn;
mod->sml_values = ch_malloc( ( nn + 1 ) * sizeof(struct berval) );
if ( old->a_vals != old->a_nvals ) {
mod->sml_nvalues = ch_malloc( ( nn + 1 ) * sizeof(struct berval) );
oldRDN.bv_len -= oldVal.bv_len + 2;
slap_bv2ad( &oldRDN, &ad, &rs->sr_text );
a = attr_find( dni->new_entry->e_attrs, ad );
- if ( !a || value_find_ex( ad,
+ if ( !a || attr_valfind( a,
SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH |
SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
- SLAP_MR_VALUE_OF_SYNTAX, a->a_nvals,
- &oldVal, op->o_tmpmemctx ) != LDAP_SUCCESS )
+ SLAP_MR_VALUE_OF_SYNTAX,
+ &oldVal, NULL, op->o_tmpmemctx ) != LDAP_SUCCESS )
{
dni->delOldRDN = 1;
}
mod->sml_flags = 0;
mod->sml_desc = old->a_desc;
mod->sml_type = mod->sml_desc->ad_cname;
+ mod->sml_numvals = 0;
mod->sml_values = NULL;
mod->sml_nvalues = NULL;
*modtail = mod;
} else if ( rs->sr_type == REP_SEARCH ) {
if ( !( si->si_refreshDelete & NP_DELETE_ONE ) ) {
- char buf[sizeof("rid=000 not")];
-
a = attr_find( rs->sr_entry->e_attrs, slap_schema.si_ad_entryUUID );
if ( a ) {
syncuuid_cmp );
}
- if ( slap_debug & LDAP_DEBUG_SYNC ) {
- sprintf( buf, "%s %s", si->si_ridtxt,
+ if ( LogTest( LDAP_DEBUG_SYNC ) ) {
+ char buf[sizeof("rid=999 not")];
+
+ snprintf( buf, sizeof(buf), "%s %s", si->si_ridtxt,
present_uuid ? "got" : "not" );
- }
- Debug( LDAP_DEBUG_SYNC, "nonpresent_callback: %s UUID %s, dn %s\n",
- buf, a ? a->a_vals[0].bv_val : "<missing>", rs->sr_entry->e_name.bv_val );
+ Debug( LDAP_DEBUG_SYNC, "nonpresent_callback: %s UUID %s, dn %s\n",
+ buf, a ? a->a_vals[0].bv_val : "<missing>", rs->sr_entry->e_name.bv_val );
+ }
if ( a == NULL ) return 0;
}
return -1;
}
si->si_rid = tmp;
- sprintf( si->si_ridtxt, IDSTR "=%d", si->si_rid );
+ sprintf( si->si_ridtxt, IDSTR "=%03d", si->si_rid );
gots |= GOT_ID;
} else if ( !strncasecmp( c->argv[ i ], PROVIDERSTR "=",
STRLENOF( PROVIDERSTR "=" ) ) )
ptr = buf;
assert( si->si_rid >= 0 && si->si_rid <= SLAP_SYNC_SID_MAX );
- ptr += snprintf( ptr, WHATSLEFT, IDSTR "=%d " PROVIDERSTR "=%s",
+ ptr += snprintf( ptr, WHATSLEFT, IDSTR "=%03d " PROVIDERSTR "=%s",
si->si_rid, si->si_bindconf.sb_uri.bv_val );
if ( ptr - buf >= sizeof( buf ) ) return;
if ( !BER_BVISNULL( &bc ) ) {