BackendDB *si_wbe;
struct re_s *si_re;
int si_rid;
- char si_ridtxt[8];
+ char si_ridtxt[ STRLENOF("rid=999") + 1 ];
slap_bindconf si_bindconf;
struct berval si_base;
struct berval si_logbase;
static AttributeDescription *sync_descs[4];
+static const char *
+syncrepl_state2str( int state )
+{
+ switch ( state ) {
+ case LDAP_SYNC_PRESENT:
+ return "PRESENT";
+
+ case LDAP_SYNC_ADD:
+ return "ADD";
+
+ case LDAP_SYNC_MODIFY:
+ return "MODIFY";
+
+ case LDAP_SYNC_DELETE:
+ return "DELETE";
+ }
+
+ return "UNKNOWN";
+}
+
static void
init_syncrepl(syncinfo_t *si)
{
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;
/* we can't work without the control */
rctrlp = NULL;
if ( rctrls ) {
+ LDAPControl **next;
/* NOTE: make sure we use the right one;
* a better approach would be to run thru
* the whole list and take care of all */
- rctrlp = ldap_find_control( LDAP_CONTROL_SYNC_STATE, rctrls );
+ rctrlp = ldap_control_find( LDAP_CONTROL_SYNC_STATE, rctrls, &next );
+ if ( next && ldap_control_find( LDAP_CONTROL_SYNC_STATE, next, NULL ) )
+ {
+ Debug( LDAP_DEBUG_ANY, "do_syncrep2: %s "
+ "got search entry with multiple "
+ "Sync State control\n", si->si_ridtxt, 0, 0 );
+ rc = -1;
+ goto done;
+ }
}
if ( rctrlp == NULL ) {
Debug( LDAP_DEBUG_ANY, "do_syncrep2: %s "
* (happens with back-sql...) */
if ( BER_BVISEMPTY( &syncUUID ) ) {
Debug( LDAP_DEBUG_ANY, "do_syncrep2: %s "
- "got empty syncUUID\n", si->si_ridtxt, 0, 0 );
+ "got empty syncUUID with LDAP_SYNC_%s\n",
+ si->si_ridtxt,
+ syncrepl_state2str( syncstate ), 0 );
ldap_controls_free( rctrls );
rc = -1;
goto done;
}
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 );
default:
Debug( LDAP_DEBUG_ANY, "do_syncrep2: %s "
- "unknown message\n", si->si_ridtxt, 0, 0 );
+ "unknown message (0x%02lx)\n",
+ si->si_ridtxt,
+ (unsigned long)ldap_msgtype( msg ), 0 );
break;
}
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;
slap_callback cb = { NULL, NULL, NULL, NULL };
struct berval *syncuuid_bv = NULL;
struct berval syncUUID_strrep = BER_BVNULL;
- struct berval uuid_bv = BER_BVNULL;
SlapReply rs_search = {REP_RESULT};
SlapReply rs_delete = {REP_RESULT};
SlapReply rs_add = {REP_RESULT};
SlapReply rs_modify = {REP_RESULT};
Filter f = {0};
-#ifdef LDAP_COMP_MATCH
- AttributeAssertion ava = { NULL, BER_BVNULL, NULL };
-#else
- AttributeAssertion ava = { NULL, BER_BVNULL };
-#endif
+ AttributeAssertion ava = ATTRIBUTEASSERTION_INIT;
int rc = LDAP_SUCCESS;
struct berval pdn = BER_BVNULL;
dninfo dni = {0};
int retry = 1;
+ int freecsn = 1;
- switch( syncstate ) {
- case LDAP_SYNC_PRESENT:
- Debug( LDAP_DEBUG_SYNC, "syncrepl_entry: %s %s\n",
- si->si_ridtxt,
- "LDAP_RES_SEARCH_ENTRY(LDAP_SYNC_PRESENT)", 0 );
- break;
- case LDAP_SYNC_ADD:
- Debug( LDAP_DEBUG_SYNC, "syncrepl_entry: %s %s\n",
- si->si_ridtxt,
- "LDAP_RES_SEARCH_ENTRY(LDAP_SYNC_ADD)", 0 );
- break;
- case LDAP_SYNC_DELETE:
- Debug( LDAP_DEBUG_SYNC, "syncrepl_entry: %s %s\n",
- si->si_ridtxt,
- "LDAP_RES_SEARCH_ENTRY(LDAP_SYNC_DELETE)", 0 );
- break;
- case LDAP_SYNC_MODIFY:
- Debug( LDAP_DEBUG_SYNC, "syncrepl_entry: %s %s\n",
- si->si_ridtxt,
- "LDAP_RES_SEARCH_ENTRY(LDAP_SYNC_MODIFY)", 0 );
- break;
- default:
- Debug( LDAP_DEBUG_ANY, "syncrepl_entry: %s %s\n",
- si->si_ridtxt,
- "LDAP_RES_SEARCH_ENTRY(UNKNOWN syncstate)", 0 );
- }
+ Debug( LDAP_DEBUG_SYNC,
+ "syncrepl_entry: %s LDAP_RES_SEARCH_ENTRY(LDAP_SYNC_%s)\n",
+ si->si_ridtxt, syncrepl_state2str( syncstate ), 0 );
if (( syncstate == LDAP_SYNC_PRESENT || syncstate == LDAP_SYNC_ADD ) ) {
if ( !si->si_refreshPresent ) {
si->si_ridtxt, dni.dn.bv_val ? dni.dn.bv_val : "(null)", 0 );
}
+ assert( BER_BVISNULL( &op->o_csn ) );
+
slap_op_time( &op->o_time, &op->o_tincr );
switch ( syncstate ) {
case LDAP_SYNC_ADD:
*/
assert( BER_BVISNULL( &op->o_csn ) );
op->o_csn = a->a_vals[0];
+ freecsn = 0;
}
}
retry_add:;
if ( !BER_BVISNULL( &dni.dn ) ) {
op->o_tmpfree( dni.dn.bv_val, op->o_tmpmemctx );
}
- if ( entry )
+ if ( entry ) {
entry_free( entry );
+ }
+ if ( !BER_BVISNULL( &op->o_csn ) && freecsn ) {
+ op->o_tmpfree( op->o_csn.bv_val, op->o_tmpmemctx );
+ }
BER_BVZERO( &op->o_csn );
return rc;
}
if ( uuids ) {
Filter uf;
-#ifdef LDAP_COMP_MATCH
- AttributeAssertion eq = { NULL, BER_BVNULL, NULL };
-#else
- AttributeAssertion eq = { NULL, BER_BVNULL };
-#endif
+ AttributeAssertion eq = ATTRIBUTEASSERTION_INIT;
int i;
op->ors_attrsonly = 1;
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;
ber_bvfree( np_prev->npe_name );
ber_bvfree( np_prev->npe_nname );
ch_free( np_prev );
+
+ if ( slapd_shutdown ) {
+ break;
+ }
}
slap_graduate_commit_csn( op );
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];
}
modtail = *mret;
if ( old ) {
- int n, o, d, a, *adds, *dels;
+ int n, o, nn, no;
+ struct berval **adds, **dels;
/* count old and new */
for ( o=0; old->a_vals[o].bv_val; o++ ) ;
for ( n=0; new->a_vals[n].bv_val; n++ ) ;
- adds = op->o_tmpalloc( sizeof(int) * n, op->o_tmpmemctx );
- dels = op->o_tmpalloc( sizeof(int) * o, op->o_tmpmemctx );
- d = 0;
- a = 0;
- i = 0;
+ /* there MUST be both old and new values */
+ assert( o != 0 );
+ assert( n != 0 );
j = 0;
- while ( i < o && j < n ) {
- int k;
- if ( bvmatch( &old->a_vals[i], &new->a_vals[j] ) ) {
- i++;
- j++;
- continue;
- }
- for ( k = j + 1; k<n; k++ ) {
- if ( bvmatch( &old->a_vals[i], &new->a_vals[k] ) ) {
- break;
- }
- }
- /* an old value was deleted */
- if ( k == n ) {
- dels[d++] = i++;
- continue;
- }
- /* old value still exists, move to next */
- i++;
- for ( k = i; k < o; k++ ) {
- if ( bvmatch( &old->a_vals[k], &new->a_vals[j] ) ) {
+ adds = op->o_tmpalloc( sizeof(struct berval *) * n, op->o_tmpmemctx );
+ dels = op->o_tmpalloc( sizeof(struct berval *) * o, op->o_tmpmemctx );
+
+ for ( i=0; i<o; i++ ) dels[i] = &old->a_vals[i];
+ for ( i=0; i<n; i++ ) adds[i] = &new->a_vals[i];
+
+ nn = n; no = o;
+
+ for ( i=0; i<o; i++ ) {
+ for ( j=0; j<n; j++ ) {
+ if ( !adds[j] )
+ continue;
+ if ( bvmatch( dels[i], adds[j] ) ) {
+ no--;
+ nn--;
+ adds[j] = NULL;
+ dels[i] = NULL;
break;
}
}
- if ( k == o ) {
- adds[a++] = j++;
- }
}
- while ( i < o )
- dels[d++] = i++;
- while ( j < n )
- adds[a++] = j++;
+ i = j;
/* all old values were deleted, just use the replace op */
- if ( d == o ) {
+ if ( no == o ) {
i = j-1;
- } else if ( d ) {
+ } else if ( no ) {
/* delete some values */
mod = ch_malloc( sizeof( Modifications ) );
mod->sml_op = LDAP_MOD_DELETE;
mod->sml_flags = 0;
mod->sml_desc = old->a_desc;
mod->sml_type = mod->sml_desc->ad_cname;
- mod->sml_values = ch_malloc( ( d + 1 ) * sizeof(struct berval) );
+ 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( ( d + 1 ) * sizeof(struct berval) );
+ mod->sml_nvalues = ch_malloc( ( no + 1 ) * sizeof(struct berval) );
} else {
mod->sml_nvalues = NULL;
}
- for ( i = 0; i < d; i++ ) {
- ber_dupbv( &mod->sml_values[i], &old->a_vals[dels[i]] );
+ j = 0;
+ for ( i = 0; i < o; i++ ) {
+ if ( !dels[i] ) continue;
+ ber_dupbv( &mod->sml_values[j], &old->a_vals[i] );
if ( mod->sml_nvalues ) {
- ber_dupbv( &mod->sml_nvalues[i], &old->a_nvals[dels[i]] );
+ ber_dupbv( &mod->sml_nvalues[j], &old->a_nvals[i] );
}
+ j++;
}
- BER_BVZERO( &mod->sml_values[i] );
+ BER_BVZERO( &mod->sml_values[j] );
if ( mod->sml_nvalues ) {
- BER_BVZERO( &mod->sml_nvalues[i] );
+ BER_BVZERO( &mod->sml_nvalues[j] );
}
*modtail = mod;
modtail = &mod->sml_next;
}
op->o_tmpfree( dels, op->o_tmpmemctx );
/* some values were added */
- if ( a && d < o ) {
+ if ( nn && no < o ) {
mod = ch_malloc( sizeof( Modifications ) );
mod->sml_op = LDAP_MOD_ADD;
mod->sml_flags = 0;
mod->sml_desc = old->a_desc;
mod->sml_type = mod->sml_desc->ad_cname;
- mod->sml_values = ch_malloc( ( a + 1 ) * sizeof(struct berval) );
+ 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( ( a + 1 ) * sizeof(struct berval) );
+ mod->sml_nvalues = ch_malloc( ( nn + 1 ) * sizeof(struct berval) );
} else {
mod->sml_nvalues = NULL;
}
- for ( i = 0; i < a; i++ ) {
- ber_dupbv( &mod->sml_values[i], &new->a_vals[adds[i]] );
+ j = 0;
+ for ( i = 0; i < n; i++ ) {
+ if ( !adds[i] ) continue;
+ ber_dupbv( &mod->sml_values[j], &new->a_vals[i] );
if ( mod->sml_nvalues ) {
- ber_dupbv( &mod->sml_nvalues[i], &new->a_nvals[adds[i]] );
+ ber_dupbv( &mod->sml_nvalues[j], &new->a_nvals[i] );
}
+ j++;
}
- BER_BVZERO( &mod->sml_values[i] );
+ BER_BVZERO( &mod->sml_values[j] );
if ( mod->sml_nvalues ) {
- BER_BVZERO( &mod->sml_nvalues[i] );
+ BER_BVZERO( &mod->sml_nvalues[j] );
}
*modtail = mod;
modtail = &mod->sml_next;
if ( dni->new_entry ) {
Modifications **modtail, **ml;
Attribute *old, *new;
- int i, is_ctx;
+ int is_ctx;
is_ctx = dn_match( &rs->sr_entry->e_nname,
&op->o_bd->be_nsuffix[0] );
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;
}
new = attr_find( dni->new_entry->e_attrs,
slap_schema.si_ad_entryCSN );
if ( new && old ) {
- int len = old->a_vals[0].bv_len;
+ int rc, len = old->a_vals[0].bv_len;
if ( len > new->a_vals[0].bv_len )
len = new->a_vals[0].bv_len;
- if ( memcmp( old->a_vals[0].bv_val,
- new->a_vals[0].bv_val, len ) >= 0 ) {
+ rc = memcmp( old->a_vals[0].bv_val,
+ new->a_vals[0].bv_val, len );
+ if ( rc > 0 ) {
Debug( LDAP_DEBUG_SYNC,
"dn_callback : new entry is older than ours "
"%s ours %s, new %s\n",
old->a_vals[0].bv_val,
new->a_vals[0].bv_val );
return LDAP_SUCCESS;
+ } else if ( rc == 0 ) {
+ Debug( LDAP_DEBUG_SYNC,
+ "dn_callback : entries have identical CSN "
+ "%s ours %s, new %s\n",
+ rs->sr_entry->e_name.bv_val,
+ old->a_vals[0].bv_val,
+ new->a_vals[0].bv_val );
+ return LDAP_SUCCESS;
}
}
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;
}
struct berval* normalized,
void *ctx )
{
+#if 0
struct berval *new;
unsigned char nibble;
int i, d = 0;
}
new->bv_val[new->bv_len] = '\0';
+ return new;
+#endif
+
+ struct berval *new;
+ int rc = 0;
+
+ if ( normalized == NULL ) return NULL;
+ if ( normalized->bv_len != 16 ) return NULL;
+
+ if ( uuidstr ) {
+ new = uuidstr;
+
+ } else {
+ new = (struct berval *)slap_sl_malloc( sizeof(struct berval), ctx );
+ if ( new == NULL ) {
+ return NULL;
+ }
+ }
+
+ new->bv_len = 36;
+
+ if ( ( new->bv_val = slap_sl_malloc( new->bv_len + 1, ctx ) ) == NULL ) {
+ rc = 1;
+ goto done;
+ }
+
+ rc = lutil_uuidstr_from_normalized( normalized->bv_val,
+ normalized->bv_len, new->bv_val, new->bv_len + 1 );
+
+done:;
+ if ( rc == -1 ) {
+ if ( new != NULL ) {
+ if ( new->bv_val != NULL ) {
+ slap_sl_free( new->bv_val, ctx );
+ }
+
+ if ( new != uuidstr ) {
+ slap_sl_free( new, ctx );
+ }
+ }
+ new = NULL;
+
+ } else {
+ new->bv_len = rc;
+ }
+
return new;
}
Debug( LDAP_DEBUG_ANY, "%s: %s.\n", c->log, c->cr_msg, 0 );
return -1;
}
- if ( tmp >= 1000 || tmp < 0 ) {
+ if ( tmp > SLAP_SYNC_SID_MAX || tmp < 0 ) {
snprintf( c->cr_msg, sizeof( c->cr_msg ),
"Error: parse_syncrepl_line: "
- "syncrepl id %d is out of range [0..999]", tmp );
+ "syncrepl id %d is out of range [0..4095]", tmp );
Debug( LDAP_DEBUG_ANY, "%s: %s.\n", c->log, c->cr_msg, 0 );
return -1;
}
si->si_bindconf.sb_version = LDAP_VERSION3;
ptr = buf;
+ assert( si->si_rid >= 0 && si->si_rid <= SLAP_SYNC_SID_MAX );
ptr += snprintf( ptr, WHATSLEFT, IDSTR "=%03d " PROVIDERSTR "=%s",
si->si_rid, si->si_bindconf.sb_uri.bv_val );
if ( ptr - buf >= sizeof( buf ) ) return;