Commit a8467b8b authored by Ondřej Kuzník's avatar Ondřej Kuzník Committed by Quanah Gibson-Mount
Browse files

ITS#9761 Fix olcSyncrepl position based insertion

parent edc0cd59
...@@ -7118,7 +7118,7 @@ add_syncrepl( ...@@ -7118,7 +7118,7 @@ add_syncrepl(
ConfigArgs *c ) ConfigArgs *c )
{ {
syncinfo_t *si; syncinfo_t *si;
int rc = 0; int i, rc = 0;
if ( !( c->be->be_search && c->be->be_add && c->be->be_modify && c->be->be_delete ) ) { if ( !( c->be->be_search && c->be->be_add && c->be->be_modify && c->be->be_delete ) ) {
snprintf( c->cr_msg, sizeof(c->cr_msg), "database %s does not support " snprintf( c->cr_msg, sizeof(c->cr_msg), "database %s does not support "
...@@ -7255,13 +7255,17 @@ add_syncrepl( ...@@ -7255,13 +7255,17 @@ add_syncrepl(
BER_BVISNULL( &si->si_bindconf.sb_uri ) ? BER_BVISNULL( &si->si_bindconf.sb_uri ) ?
"(null)" : si->si_bindconf.sb_uri.bv_val ); "(null)" : si->si_bindconf.sb_uri.bv_val );
if ( c->be->be_syncinfo ) { if ( c->be->be_syncinfo ) {
syncinfo_t *sip; syncinfo_t **sip;
si->si_cookieState = c->be->be_syncinfo->si_cookieState; si->si_cookieState = c->be->be_syncinfo->si_cookieState;
/* add new syncrepl to end of list (same order as when deleting) */ for ( i = 0, sip = &c->be->be_syncinfo;
for ( sip = c->be->be_syncinfo; sip->si_next; sip = sip->si_next ); (*sip)->si_next && ( c->valx < 0 || i < c->valx );
sip->si_next = si; sip = &(*sip)->si_next, i++ )
/* advance to the desired position */ ;
si->si_next = *sip;
*sip = si;
} else { } else {
si->si_cookieState = ch_calloc( 1, sizeof( cookie_state )); si->si_cookieState = ch_calloc( 1, sizeof( cookie_state ));
ldap_pvt_thread_mutex_init( &si->si_cookieState->cs_mutex ); ldap_pvt_thread_mutex_init( &si->si_cookieState->cs_mutex );
...@@ -7270,10 +7274,10 @@ add_syncrepl( ...@@ -7270,10 +7274,10 @@ add_syncrepl(
ldap_pvt_thread_cond_init( &si->si_cookieState->cs_cond ); ldap_pvt_thread_cond_init( &si->si_cookieState->cs_cond );
c->be->be_syncinfo = si; c->be->be_syncinfo = si;
si->si_next = NULL;
} }
si->si_cookieState->cs_ref++; si->si_cookieState->cs_ref++;
si->si_next = NULL;
syncrepl_monitor_init(); syncrepl_monitor_init();
return 0; return 0;
......
...@@ -302,6 +302,14 @@ olcSyncrepl: {0}rid=001 provider=$URI1 binddn="cn=config" ...@@ -302,6 +302,14 @@ olcSyncrepl: {0}rid=001 provider=$URI1 binddn="cn=config"
bindmethod=simple credentials=$CONFIGPW searchbase="cn=schema,cn=config" bindmethod=simple credentials=$CONFIGPW searchbase="cn=schema,cn=config"
$SYNCTYPE retry="3 5 300 5" timeout=3 $SYNCTYPE retry="3 5 300 5" timeout=3
suffixmassage="cn=schema,cn=config,cn=consumer" suffixmassage="cn=schema,cn=config,cn=consumer"
# a dummy stanza we add to the beginning and remove again
olcSyncrepl: {0}rid=006 provider=$URI6 binddn="cn=config"
bindmethod=simple credentials=$CONFIGPW searchbase="cn=schema,cn=config"
$SYNCTYPE retry="3 5 300 5" timeout=3
suffixmassage="cn=schema,cn=config,cn=consumer"
-
delete: olcSyncrepl
olcSyncrepl: {0}
- -
add: olcMultiProvider add: olcMultiProvider
olcMultiProvider: TRUE olcMultiProvider: TRUE
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment