si->si_retrynum = NULL;
si->si_syncCookie.ctxcsn = NULL;
si->si_syncCookie.octet_str = NULL;
- si->si_syncCookie.sid = -1;
si->si_manageDSAit = 0;
si->si_tlimit = 0;
si->si_slimit = 0;
Operation *op,
struct berval *cookie,
struct berval *csn,
- int sid,
int rid )
{
char cookiestr[ LDAP_LUTIL_CSNSTR_BUFSIZE + 20 ];
if ( csn->bv_val == NULL ) {
- if ( sid == -1 ) {
- if ( rid == -1 ) {
- cookiestr[0] = '\0';
- } else {
- snprintf( cookiestr, LDAP_LUTIL_CSNSTR_BUFSIZE + 20,
- "rid=%03d", rid );
- }
+ if ( rid == -1 ) {
+ cookiestr[0] = '\0';
} else {
- if ( rid == -1 ) {
- snprintf( cookiestr, LDAP_LUTIL_CSNSTR_BUFSIZE + 20,
- "sid=%03d", sid );
- } else {
- snprintf( cookiestr, LDAP_LUTIL_CSNSTR_BUFSIZE + 20,
- "sid=%03d,rid=%03d", sid, rid );
- }
+ snprintf( cookiestr, LDAP_LUTIL_CSNSTR_BUFSIZE + 20,
+ "rid=%03d", rid );
}
} else {
- if ( sid == -1 ) {
- if ( rid == -1 ) {
- snprintf( cookiestr, LDAP_LUTIL_CSNSTR_BUFSIZE + 20,
- "csn=%s", csn->bv_val );
- } else {
- snprintf( cookiestr, LDAP_LUTIL_CSNSTR_BUFSIZE + 20,
- "csn=%s,rid=%03d", csn->bv_val, rid );
- }
+ if ( rid == -1 ) {
+ snprintf( cookiestr, LDAP_LUTIL_CSNSTR_BUFSIZE + 20,
+ "csn=%s", csn->bv_val );
} else {
- if ( rid == -1 ) {
- snprintf( cookiestr, LDAP_LUTIL_CSNSTR_BUFSIZE + 20,
- "csn=%s,sid=%03d", csn->bv_val, sid );
- } else {
- snprintf( cookiestr, LDAP_LUTIL_CSNSTR_BUFSIZE + 20,
- "csn=%s,sid=%03d,rid=%03d", csn->bv_val, sid, rid );
- }
+ snprintf( cookiestr, LDAP_LUTIL_CSNSTR_BUFSIZE + 20,
+ "csn=%s,rid=%03d", csn->bv_val, rid );
}
}
ber_str2bv( cookiestr, strlen(cookiestr), 1, cookie );
char *csn_str;
int csn_str_len;
int valid = 0;
- char *sid_ptr;
- char *sid_str;
char *rid_ptr;
char *rid_str;
char *cval;
cookie->ctxcsn = NULL;
}
- if (( sid_ptr = strstr( cookie->octet_str->bv_val, "sid=" )) != NULL ) {
- sid_str = SLAP_STRNDUP( sid_ptr,
- SLAP_SYNC_SID_SIZE + sizeof("sid=") - 1 );
- if ( (cval = strchr( sid_str, ',' )) != NULL ) {
- *cval = '\0';
- }
- cookie->sid = atoi( sid_str + sizeof("sid=") - 1 );
- ch_free( sid_str );
- } else {
- cookie->sid = -1;
- }
-
if (( rid_ptr = strstr( cookie->octet_str->bv_val, "rid=" )) != NULL ) {
rid_str = SLAP_STRNDUP( rid_ptr,
SLAP_SYNC_RID_SIZE + sizeof("rid=") - 1 );
ch_calloc( 1, sizeof( struct sync_cookie ));
}
- new->sid = src->sid;
new->rid = src->rid;
if ( src->ctxcsn ) {
struct berval s_base; /* ndn of search base */
ID s_eid; /* entryID of search base */
Operation *s_op; /* search op */
- int s_sid;
int s_rid;
struct berval s_filterstr;
int s_flags; /* search status */
} slog_entry;
typedef struct sessionlog {
- struct sessionlog *sl_next;
- int sl_sid;
struct berval sl_mincsn;
int sl_num;
int sl_size;
}
ctrls[1] = NULL;
- slap_compose_sync_cookie( op, &cookie, &opc->sctxcsn,
- so->s_sid, so->s_rid );
+ slap_compose_sync_cookie( op, &cookie, &opc->sctxcsn, so->s_rid );
e_uuid.e_attrs = &a_uuid;
a_uuid.a_desc = slap_schema.si_ad_entryUUID;
sessionlog *sl;
slog_entry *se;
- for ( sl = si->si_logs; sl; sl=sl->sl_next ) {
+ for ( sl = si->si_logs; sl; ) {
/* Allocate a record. UUIDs are not NUL-terminated. */
se = ch_malloc( sizeof( slog_entry ) + opc->suuid.bv_len +
csn->bv_len + 1 );
slap_compose_sync_cookie( op, &cookie,
&op->ors_filter->f_and->f_ava->aa_value,
- srs->sr_state.sid, srs->sr_state.rid );
+ srs->sr_state.rid );
/* Is this a regular refresh? */
if ( !ss->ss_so ) {
sop = ch_malloc( sizeof( syncops ));
*sop = so;
ldap_pvt_thread_mutex_init( &sop->s_mutex );
- sop->s_sid = srs->sr_state.sid;
sop->s_rid = srs->sr_state.rid;
sop->s_inuse = 1;
goto shortcut;
}
/* Do we have a sessionlog for this search? */
- for ( sl=si->si_logs; sl; sl=sl->sl_next )
- if ( sl->sl_sid == srs->sr_state.sid ) break;
+ sl=si->si_logs;
if ( sl ) {
ldap_pvt_thread_mutex_lock( &sl->sl_mutex );
if ( ber_bvcmp( srs->sr_state.ctxcsn, &sl->sl_mincsn ) >= 0 ) {
} else if ( strcasecmp( argv[0], "syncprov-sessionlog" ) == 0 ) {
sessionlog *sl;
- int sid, size;
- if ( argc != 3 ) {
+ int size;
+ if ( argc != 2 ) {
fprintf( stderr, "%s: line %d: wrong number of arguments in "
- "\"syncprov-sessionlog <sid> <size>\"\n", fname, lineno );
- return -1;
- }
- sid = atoi( argv[1] );
- if ( sid < 0 || sid > 999 ) {
- fprintf( stderr,
- "%s: line %d: session log id %d is out of range [0..999]\n",
- fname, lineno, sid );
+ "\"syncprov-sessionlog <size>\"\n", fname, lineno );
return -1;
}
- size = atoi( argv[2] );
+ size = atoi( argv[1] );
if ( size < 0 ) {
fprintf( stderr,
"%s: line %d: session log size %d is negative\n",
fname, lineno, size );
return -1;
}
- for ( sl = si->si_logs; sl; sl=sl->sl_next ) {
- if ( sl->sl_sid == sid ) {
- sl->sl_size = size;
- break;
- }
- }
+ sl = si->si_logs;
if ( !sl ) {
sl = ch_malloc( sizeof( sessionlog ) + LDAP_LUTIL_CSNSTR_BUFSIZE );
sl->sl_mincsn.bv_val = (char *)(sl+1);
sl->sl_mincsn.bv_len = 0;
- sl->sl_sid = sid;
- sl->sl_size = size;
sl->sl_num = 0;
sl->sl_head = sl->sl_tail = NULL;
- sl->sl_next = si->si_logs;
ldap_pvt_thread_mutex_init( &sl->sl_mutex );
si->si_logs = sl;
}
+ sl->sl_size = size;
return 0;
}
* ldapsync.c
*/
LDAP_SLAPD_F (void) slap_compose_sync_cookie LDAP_P((
- Operation *, struct berval *, struct berval *, int, int ));
+ Operation *, struct berval *, struct berval *, int ));
LDAP_SLAPD_F (void) slap_sync_cookie_free LDAP_P((
struct sync_cookie *, int free_cookie ));
LDAP_SLAPD_F (int) slap_parse_sync_cookie LDAP_P((
struct sync_cookie {
struct berval *ctxcsn;
- long sid;
struct berval *octet_str;
long rid;
LDAP_STAILQ_ENTRY(sync_cookie) sc_next;
}
}
- slap_compose_sync_cookie( NULL, &mc, &maxcsn, -1, -1 );
+ slap_compose_sync_cookie( NULL, &mc, &maxcsn, -1 );
if ( SLAP_LASTMOD(be) && replica_promotion ) {
if ( provider_subentry || update_ctxcsn == SLAP_TOOL_CTXCSN_BATCH ||
ber_bvarray_free( si->si_syncCookie.octet_str );
si->si_syncCookie.octet_str = NULL;
ber_bvarray_free_x( cookie, op->o_tmpmemctx );
- if ( sc->sid != -1 ) {
- /* command line cookie wins */
- si->si_syncCookie.sid = sc->sid;
- }
if ( sc->ctxcsn != NULL ) {
/* command line cookie wins */
if ( si->si_syncCookie.ctxcsn ) {
sc = NULL;
slap_compose_sync_cookie( NULL, &newcookie,
&si->si_syncCookie.ctxcsn[0],
- si->si_syncCookie.sid, si->si_syncCookie.rid );
+ si->si_syncCookie.rid );
ber_bvarray_add( &si->si_syncCookie.octet_str, &newcookie );
}
int syncstate;
struct berval syncUUID = BER_BVNULL;
- struct sync_cookie syncCookie = { NULL, -1, NULL };
- struct sync_cookie syncCookie_req = { NULL, -1, NULL };
+ struct sync_cookie syncCookie = { NULL };
+ struct sync_cookie syncCookie_req = { NULL };
struct berval cookie = BER_BVNULL;
int rc, err, i;