len = 0;
} else {
len = snprintf( cookiestr, sizeof( cookiestr ),
- "rid=%03x", rid );
+ "rid=%03d", rid );
if ( sid >= 0 ) {
len += sprintf( cookiestr+len, ",sid=%03x", sid );
}
cookie->bv_val = slap_sl_malloc( len, op ? op->o_tmpmemctx : NULL );
- len = sprintf( cookie->bv_val, "rid=%03x,", rid );
+ len = sprintf( cookie->bv_val, "rid=%03d,", rid );
ptr = cookie->bv_val + len;
if ( sid >= 0 ) {
ptr += sprintf( ptr, "sid=%03x,", sid );
{
char *csn_ptr;
char *csn_str;
- char *rid_ptr;
char *cval;
char *next, *end;
AttributeDescription *ad = slap_schema.si_ad_modifyTimestamp;
for ( next=cookie->octet_str.bv_val; next < end; ) {
if ( !strncmp( next, "rid=", STRLENOF("rid=") )) {
- rid_ptr = next;
- cookie->rid = strtoul( &rid_ptr[ STRLENOF( "rid=" ) ], &next, 10 );
+ char *rid_ptr = next;
+ cookie->rid = strtol( &rid_ptr[ STRLENOF( "rid=" ) ], &next, 10 );
if ( next == rid_ptr ||
next > end ||
- ( *next && *next != ',' ) )
+ ( *next && *next != ',' ) ||
+ cookie->rid < 0 ||
+ cookie->rid > SLAP_SYNC_RID_MAX )
{
return -1;
}
continue;
}
if ( !strncmp( next, "sid=", STRLENOF("sid=") )) {
- rid_ptr = next;
- cookie->sid = strtoul( &rid_ptr[ STRLENOF( "sid=" ) ], &next, 16 );
- if ( next == rid_ptr ||
+ char *sid_ptr = next;
+ sid_ptr = next;
+ cookie->sid = strtol( &sid_ptr[ STRLENOF( "sid=" ) ], &next, 16 );
+ if ( next == sid_ptr ||
next > end ||
- ( *next && *next != ',' ) )
+ ( *next && *next != ',' ) ||
+ cookie->sid < 0 ||
+ cookie->sid > SLAP_SYNC_SID_MAX )
{
return -1;
}
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;
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 );
}
}
} else if ( rs->sr_type == REP_SEARCH ) {
if ( !( si->si_refreshDelete & NP_DELETE_ONE ) ) {
- char buf[sizeof("rid=4096 not")];
-
a = attr_find( rs->sr_entry->e_attrs, slap_schema.si_ad_entryUUID );
if ( a ) {
syncuuid_cmp );
}
- if ( slap_debug & LDAP_DEBUG_SYNC ) {
+ 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 ) ) {