#define LDAP_CONTROL_SYNC_DONE "1.3.6.1.4.1.4203.666.5.8"
#define LDAP_SYNC_INFO "1.3.6.1.4.1.4203.666.10.2"
-#define LDAP_SYNC_NEW_COOKIE 0
-#define LDAP_SYNC_STATE_MODE_DONE 1
-#define LDAP_SYNC_LOG_MODE_DONE 2
-#define LDAP_SYNC_REFRESH_DONE 3
+#define LDAP_SYNC_REFRESH_PRESENTS 0
+#define LDAP_SYNC_REFRESH_DELETES 1
+
+#define LDAP_TAG_SYNC_NEW_COOKIE ((ber_tag_t) 0x80U)
+#define LDAP_TAG_SYNC_REFRESH_DELETE ((ber_tag_t) 0xa1U)
+#define LDAP_TAG_SYNC_REFRESH_PRESENT ((ber_tag_t) 0xa2U)
+#define LDAP_TAG_SYNC_ID_SET ((ber_tag_t) 0xa3U)
+
+#define LDAP_TAG_SYNC_COOKIE ((ber_tag_t) 0x04U)
+#define LDAP_TAG_REFRESHDELETES ((ber_tag_t) 0x01U)
+#define LDAP_TAG_REFRESHDONE ((ber_tag_t) 0x01U)
+#define LDAP_TAG_RELOAD_HINT ((ber_tag_t) 0x01U)
#define LDAP_SYNC_STATE_MODE 0
#define LDAP_SYNC_LOG_MODE 1
#define LDAP_TAG_SASL_RES_CREDS ((ber_tag_t) 0x87U) /* context specific + primitive */
-#define LDAP_SYNC_TAG_COOKIE ((ber_tag_t) 0x04U) /* octet string */
-
-
/* possible operations a client can invoke */
#define LDAP_REQ_BIND ((ber_tag_t) 0x60U) /* application + constructed */
#define LDAP_REQ_UNBIND ((ber_tag_t) 0x42U) /* application + primitive */
);
#define bdb_psearch(op, rs, sop, e, ps_type) bdb_do_search(op, rs, sop, e, ps_type)
-#define bdb_send_ldap_intermediate BDB_SYMBOL(send_ldap_intermediate)
-
-int
-bdb_send_ldap_intermediate(
- Operation *op,
- SlapReply *rs,
- int state,
- struct berval *cookie );
-
/*
* trans.c
*/
if ( slog_found ) {
if ( ps_list->o_sync_slog_omitcsn.bv_len != 0 ) {
mr = slap_schema.si_ad_entryCSN->ad_type->sat_ordering;
- if ( sop->o_sync_state.ctxcsn && sop->o_sync_state.ctxcsn->bv_val != NULL ) {
+ if ( sop->o_sync_state.ctxcsn &&
+ sop->o_sync_state.ctxcsn->bv_val != NULL ) {
value_match( &match, slap_schema.si_ad_entryCSN, mr,
SLAP_MR_VALUE_OF_ATTRIBUTE_SYNTAX,
- sop->o_sync_state.ctxcsn, &ps_list->o_sync_slog_omitcsn,
+ sop->o_sync_state.ctxcsn,
+ &ps_list->o_sync_slog_omitcsn,
&text );
} else {
match = -1;
}
if ( match >= 0 ) {
- rs->sr_err = LDAP_SUCCESS;
- rs->sr_rspoid = LDAP_SYNC_INFO;
- rs->sr_ctrls = NULL;
- bdb_send_ldap_intermediate( sop, rs,
- LDAP_SYNC_STATE_MODE_DONE, NULL );
sync_send_present_mode = 0;
}
} else {
- rs->sr_err = LDAP_SUCCESS;
- rs->sr_rspoid = LDAP_SYNC_INFO;
- rs->sr_ctrls = NULL;
- bdb_send_ldap_intermediate( sop, rs,
- LDAP_SYNC_STATE_MODE_DONE, NULL );
sync_send_present_mode = 0;
}
} else if ( sop->o_sync_slog_size >= 0 ) {
}
} else {
if ( sop->o_sync_mode & SLAP_SYNC_REFRESH ) {
- struct berval cookie;
- slap_compose_sync_cookie( sop, &cookie,
- search_context_csn,
- sop->o_sync_state.sid );
rs->sr_err = slap_build_sync_state_ctrl( sop,
rs, e, entry_sync_state, ctrls,
- num_ctrls++, 0, &cookie );
+ num_ctrls++, 0, NULL );
+
if ( rs->sr_err != LDAP_SUCCESS ) goto done;
rs->sr_ctrls = ctrls;
}
}
- if ( cookie.bv_val )
- ch_free( cookie.bv_val );
ch_free( ctrls[num_ctrls-1]->ldctl_value.bv_val );
ch_free( ctrls[--num_ctrls] );
ctrls[num_ctrls] = NULL;
rs->sr_err = LDAP_SUCCESS;
rs->sr_rspoid = LDAP_SYNC_INFO;
rs->sr_ctrls = NULL;
- if ( sync_send_present_mode ) {
+
+ if ( sop->o_sync_mode & SLAP_SYNC_PERSIST ) {
struct berval cookie;
slap_compose_sync_cookie( sop, &cookie,
search_context_csn,
sop->o_sync_state.sid );
- bdb_send_ldap_intermediate( sop, rs,
- LDAP_SYNC_STATE_MODE_DONE, &cookie );
- if ( cookie.bv_val )
- ch_free( cookie.bv_val );
- }
- if ( !sync_send_present_mode && !no_sync_state_change ) {
- int slog_found = 0;
- ldap_pvt_thread_mutex_lock( &bdb->bi_pslist_mutex );
- LDAP_LIST_FOREACH( ps_list, &bdb->bi_psearch_list, o_ps_link ) {
- if ( ps_list->o_sync_slog_size > 0 ) {
- if ( ps_list->o_sync_state.sid == sop->o_sync_state.sid ) {
- slog_found = 1;
- break;
+ if ( sync_send_present_mode ) {
+ slap_send_syncinfo( sop, rs,
+ LDAP_TAG_SYNC_REFRESH_PRESENT, &cookie, 1, NULL, 0 );
+ } else {
+ if ( !no_sync_state_change ) {
+ int slog_found = 0;
+ ldap_pvt_thread_mutex_lock( &bdb->bi_pslist_mutex );
+ LDAP_LIST_FOREACH( ps_list, &bdb->bi_psearch_list, o_ps_link ) {
+ if ( ps_list->o_sync_slog_size > 0 ) {
+ if ( ps_list->o_sync_state.sid == sop->o_sync_state.sid ) {
+ slog_found = 1;
+ break;
+ }
+ }
+ }
+
+ if ( slog_found ) {
+ slap_send_session_log( op, ps_list, rs );
}
+ ldap_pvt_thread_mutex_unlock( &bdb->bi_pslist_mutex );
}
+ slap_send_syncinfo( sop, rs,
+ LDAP_TAG_SYNC_REFRESH_DELETE, &cookie, 1, NULL, 0 );
}
- if ( slog_found ) {
- slap_send_session_log( op, ps_list, rs );
- }
- ldap_pvt_thread_mutex_unlock( &bdb->bi_pslist_mutex );
- }
-
- if ( sop->o_sync_mode & SLAP_SYNC_PERSIST ) {
- /* refreshAndPersist mode */
- struct berval cookie;
- slap_compose_sync_cookie( sop, &cookie,
- search_context_csn,
- sop->o_sync_state.sid );
- bdb_send_ldap_intermediate( sop, rs,
- LDAP_SYNC_LOG_MODE_DONE, &cookie );
if ( cookie.bv_val ) {
ch_free( cookie.bv_val );
}
slap_compose_sync_cookie( sop, &cookie,
search_context_csn,
sop->o_sync_state.sid );
- slap_build_sync_done_ctrl( sop, rs, ctrls,
- num_ctrls++, 1, &cookie );
+
+ if ( sync_send_present_mode ) {
+ slap_build_sync_done_ctrl( sop, rs, ctrls,
+ num_ctrls++, 1, &cookie, LDAP_SYNC_REFRESH_PRESENTS );
+ } else {
+ if ( !no_sync_state_change ) {
+ int slog_found = 0;
+ ldap_pvt_thread_mutex_lock( &bdb->bi_pslist_mutex );
+ LDAP_LIST_FOREACH( ps_list, &bdb->bi_psearch_list,
+ o_ps_link ) {
+ if ( ps_list->o_sync_slog_size > 0 ) {
+ if ( ps_list->o_sync_state.sid ==
+ sop->o_sync_state.sid ) {
+ slog_found = 1;
+ break;
+ }
+ }
+ }
+
+ if ( slog_found ) {
+ slap_send_session_log( op, ps_list, rs );
+ }
+ ldap_pvt_thread_mutex_unlock( &bdb->bi_pslist_mutex );
+ }
+ slap_build_sync_done_ctrl( sop, rs, ctrls,
+ num_ctrls++, 1, &cookie, LDAP_SYNC_REFRESH_DELETES );
+ }
+
rs->sr_ctrls = ctrls;
rs->sr_ref = rs->sr_v2ref;
rs->sr_err = (rs->sr_v2ref == NULL) ? LDAP_SUCCESS : LDAP_REFERRAL;
(void) ber_free_buf( ber );
}
#endif
-
-int
-bdb_send_ldap_intermediate(
- Operation *op,
- SlapReply *rs,
- int state,
- struct berval *cookie )
-{
- BerElementBuffer berbuf;
- BerElement *ber = (BerElement *)&berbuf;
- struct berval rspdata;
-
- int ret;
-
- ber_init2( ber, NULL, LBER_USE_DER );
-
- if ( cookie == NULL ) {
- ber_printf( ber, "{eN}", state );
- } else {
- ber_printf( ber, "{eON}", state, cookie );
- }
-
- ret = ber_flatten2( ber, &rspdata, 0 );
-
- if ( ret < 0 ) {
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, RESULTS,
- "bdb_send_ldap_intermediate: ber_flatten2 failed\n",
- 0, 0, 0 );
-#else
- Debug( LDAP_DEBUG_TRACE,
- "bdb_send_ldap_intermediate: ber_flatten2 failed\n",
- 0, 0, 0 );
-#endif
- send_ldap_error( op, rs, LDAP_OTHER, "internal error" );
- return ret;
- }
-
- rs->sr_rspdata = &rspdata;
- send_ldap_intermediate( op, rs );
- rs->sr_rspdata = NULL;
- ber_free_buf( ber );
-
- return LDAP_SUCCESS;
-}
si->si_slimit = -1;
si->si_syncUUID_ndn.bv_val = NULL;
si->si_syncUUID_ndn.bv_len = 0;
- si->si_sync_mode = LDAP_SYNC_STATE_MODE;
si->si_presentlist = NULL;
LDAP_LIST_INIT( &si->si_nonpresentlist );
tag = ber_peek_tag( ber, &len );
- if ( tag == LDAP_SYNC_TAG_COOKIE ) {
+ if ( tag == LDAP_TAG_SYNC_COOKIE ) {
struct berval tmp_bv;
- if (( ber_scanf( ber, /*{*/ "o}", &tmp_bv )) == LBER_ERROR ) {
+ if (( ber_scanf( ber, /*{*/ "o", &tmp_bv )) == LBER_ERROR ) {
rs->sr_text = "LDAP Sync control : cookie decoding error";
return LDAP_PROTOCOL_ERROR;
}
ber_bvarray_add( &op->o_sync_state.octet_str, &tmp_bv );
slap_parse_sync_cookie( &op->o_sync_state );
- } else {
- if (( ber_scanf( ber, /*{*/ "}")) == LBER_ERROR ) {
- rs->sr_text = "LDAP Sync control : decoding error";
+ }
+ if ( tag == LDAP_TAG_RELOAD_HINT ) {
+ if (( ber_scanf( ber, /*{*/ "b", &op->o_sync_rhint )) == LBER_ERROR ) {
+ rs->sr_text = "LDAP Sync control : rhint decoding error";
return LDAP_PROTOCOL_ERROR;
}
}
+ if (( ber_scanf( ber, /*{*/ "}")) == LBER_ERROR ) {
+ rs->sr_text = "LDAP Sync control : decoding error";
+ return LDAP_PROTOCOL_ERROR;
+ }
(void) ber_free( ber, 1 );
LDAPControl **ctrls,
int num_ctrls,
int send_cookie,
- struct berval *csn)
+ struct berval *cookie)
{
Attribute* a;
int ret;
}
}
- if ( send_cookie && csn ) {
+ if ( send_cookie && cookie ) {
ber_printf( ber, "{eOON}",
- entry_sync_state, &entryuuid_bv, csn );
+ entry_sync_state, &entryuuid_bv, cookie );
} else {
ber_printf( ber, "{eON}",
entry_sync_state, &entryuuid_bv );
Operation *op,
SlapReply *rs,
LDAPControl **ctrls,
- int num_ctrls,
- int send_cookie,
- struct berval *csn )
+ int num_ctrls,
+ int send_cookie,
+ struct berval *cookie,
+ int refreshDeletes )
{
int ret;
BerElementBuffer berbuf;
ctrls[num_ctrls] = ch_malloc ( sizeof ( LDAPControl ) );
- if ( send_cookie && csn ) {
- ber_printf( ber, "{ON}", csn );
- } else {
- ber_printf( ber, "{N}" );
+ ber_printf( ber, "{" );
+ if ( send_cookie && cookie ) {
+ ber_printf( ber, "O", cookie );
+ }
+ if ( refreshDeletes == LDAP_SYNC_REFRESH_DELETES ) {
+ ber_printf( ber, "b", refreshDeletes );
}
+ ber_printf( ber, "N}" );
ctrls[num_ctrls]->ldctl_oid = LDAP_CONTROL_SYNC_DONE;
ctrls[num_ctrls]->ldctl_iscritical = op->o_sync;
LDAPControl **ctrls,
int num_ctrls,
int send_cookie,
- struct berval *csn)
+ struct berval *cookie)
{
Attribute* a;
int ret;
ber_dupbv( &entryuuid_bv, &slog_e->sl_uuid );
- if ( send_cookie && csn ) {
+ if ( send_cookie && cookie ) {
ber_printf( ber, "{eOON}",
- entry_sync_state, &entryuuid_bv, csn );
+ entry_sync_state, &entryuuid_bv, cookie );
} else {
ber_printf( ber, "{eON}",
entry_sync_state, &entryuuid_bv );
return LDAP_SUCCESS;
}
+int
+slap_send_syncinfo(
+ Operation *op,
+ SlapReply *rs,
+ int type,
+ struct berval *cookie,
+ int refreshDone,
+ BerVarray syncUUIDs,
+ int refreshDeletes )
+{
+ BerElementBuffer berbuf;
+ BerElement *ber = (BerElement *)&berbuf;
+ struct berval rspdata;
+
+ int ret;
+
+ ber_init2( ber, NULL, LBER_USE_DER );
+
+ if ( type ) {
+ switch ( type ) {
+ case LDAP_TAG_SYNC_NEW_COOKIE:
+ ber_printf( ber, "tO", type, cookie );
+ break;
+ case LDAP_TAG_SYNC_REFRESH_DELETE:
+ case LDAP_TAG_SYNC_REFRESH_PRESENT:
+ ber_printf( ber, "t{", type );
+ if ( cookie ) {
+ ber_printf( ber, "O", cookie );
+ }
+ if ( refreshDone == 0 ) {
+ ber_printf( ber, "b", refreshDone );
+ }
+ ber_printf( ber, "N}" );
+ break;
+ case LDAP_TAG_SYNC_ID_SET:
+ ber_printf( ber, "t{", type );
+ if ( cookie ) {
+ ber_printf( ber, "O", cookie );
+ }
+ if ( refreshDeletes == 1 ) {
+ ber_printf( ber, "b", refreshDeletes );
+ }
+ ber_printf( ber, "[W]", syncUUIDs );
+ ber_printf( ber, "N}" );
+ break;
+ default:
+#ifdef NEW_LOGGING
+ LDAP_LOG ( OPERATION, RESULTS,
+ "slap_send_syncinfo: invalid syncinfo type (%d)\n",
+ type, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE,
+ "slap_send_syncinfo: invalid syncinfo type (%d)\n",
+ type, 0, 0 );
+#endif
+ return LDAP_OTHER;
+ }
+ }
+
+ ret = ber_flatten2( ber, &rspdata, 0 );
+
+ if ( ret < 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG ( OPERATION, RESULTS,
+ "slap_send_syncinfo: ber_flatten2 failed\n",
+ 0, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE,
+ "slap_send_syncinfo: ber_flatten2 failed\n",
+ 0, 0, 0 );
+#endif
+ send_ldap_error( op, rs, LDAP_OTHER, "internal error" );
+ return ret;
+ }
+
+ rs->sr_rspdata = &rspdata;
+ send_ldap_intermediate( op, rs );
+ rs->sr_rspdata = NULL;
+ ber_free_buf( ber );
+
+ return LDAP_SUCCESS;
+}
+
void
slap_compose_sync_cookie(
Operation *op,
int, int, struct berval * ));
LDAP_SLAPD_F (int) slap_build_sync_done_ctrl LDAP_P((
Operation *, SlapReply *, LDAPControl **,
- int, int, struct berval * ));
+ int, int, struct berval *, int ));
LDAP_SLAPD_F (int) slap_build_sync_state_ctrl_from_slog LDAP_P((
Operation *, SlapReply *, struct slog_entry *, int,
LDAPControl **, int, int, struct berval * ));
+LDAP_SLAPD_F (int) slap_send_syncinfo LDAP_P((
+ Operation *, SlapReply *, int,
+ struct berval *, int, BerVarray, int ));
LDAP_SLAPD_F (void) slap_compose_sync_cookie LDAP_P((
Operation *, struct berval *, struct berval *, int ));
LDAP_SLAPD_F (void) slap_sync_cookie_free LDAP_P((
LDAP_SLAPD_F (int) syncrepl_entry LDAP_P((
syncinfo_t *, Operation*, Entry*,
Modifications*,int, struct berval*,
- struct sync_cookie *, int ));
+ struct sync_cookie * ));
LDAP_SLAPD_F (void) syncrepl_updateCookie LDAP_P((
syncinfo_t *, Operation *, struct berval *,
struct sync_cookie * ));
* syncinfo structure for syncrepl
*/
typedef struct syncinfo_s {
-// struct slap_conn *si_conn;
struct slap_backend_db *si_be;
-// struct slap_entry *si_e;
-// void *si_ctx;
unsigned int si_id;
char *si_provideruri;
BerVarray si_provideruri_bv;
char **si_attrs;
int si_type;
time_t si_interval;
-// struct sync_cookie *si_syncCookie;
struct sync_cookie si_syncCookie;
int si_manageDSAit;
int si_slimit;
int si_tlimit;
-// struct berval *si_syncUUID;
-// struct berval *si_syncUUID_ndn;
struct berval si_syncUUID_ndn;
Avlnode *si_presentlist;
- int si_sync_mode;
LDAP *si_ld;
LDAP_LIST_HEAD(np, nonpresent_entry) si_nonpresentlist;
} syncinfo_t;
#define SLAP_SYNC_PERSIST (0x2)
#define SLAP_SYNC_REFRESH_AND_PERSIST (0x3)
struct sync_cookie o_sync_state;
+ int o_sync_rhint;
struct berval o_sync_cid;
int o_sync_slog_size;
struct berval o_sync_csn;
static const struct berval slap_syncrepl_bvc = BER_BVC(SYNCREPL_STR);
static const struct berval slap_syncrepl_cn_bvc = BER_BVC(CN_STR SYNCREPL_STR);
+static void avl_ber_bvfree( void * );
+
static void
syncrepl_del_nonpresent( Operation *, syncinfo_t * );
struct berval syncrepl_cn_bv;
struct sync_cookie syncCookie = { NULL, -1, NULL };
- si->si_sync_mode = LDAP_SYNC_STATE_MODE;
-
/* Init connection to master */
rc = ldap_initialize( &si->si_ld, si->si_provideruri );
char *retoid = NULL;
struct berval *retdata = NULL;
- int sync_info_arrived = 0;
Entry *entry = NULL;
int syncstate;
int rc;
int err;
ber_len_t len;
- int syncinfo_arrived = 0;
slap_callback cb;
struct timeval *tout_p = NULL;
struct timeval tout = { 0, 0 };
+ int refreshDeletes = 0;
+ int refreshDone = 1;
+ BerVarray syncUUIDs;
+ ber_tag_t si_tag;
+
if ( slapd_abrupt_shutdown ) {
rc = -2;
goto done;
rctrlp = *rctrls;
ber_init2( ber, &rctrlp->ldctl_value, LBER_USE_DER );
ber_scanf( ber, "{em", &syncstate, &syncUUID );
- if ( ber_peek_tag( ber, &len ) == LDAP_SYNC_TAG_COOKIE ) {
+ if ( ber_peek_tag( ber, &len ) == LDAP_TAG_SYNC_COOKIE ) {
ber_scanf( ber, "m}", &cookie );
if ( cookie.bv_val ) {
struct berval tmp_bv;
entry = syncrepl_message_to_entry( si, op, msg,
&modlist, syncstate );
rc_efree = syncrepl_entry( si, op, entry, modlist, syncstate,
- &syncUUID, &syncCookie_req, !syncinfo_arrived );
+ &syncUUID, &syncCookie_req );
if ( syncCookie.octet_str && syncCookie.octet_str[0].bv_val ) {
syncrepl_updateCookie( si, op, psub, &syncCookie );
}
ber_init2( ber, &rctrlp->ldctl_value, LBER_USE_DER );
ber_scanf( ber, "{" /*"}"*/);
- if ( ber_peek_tag( ber, &len ) == LDAP_SYNC_TAG_COOKIE )
+ if ( ber_peek_tag( ber, &len ) == LDAP_TAG_SYNC_COOKIE )
{
ber_scanf( ber, "m", &cookie );
if ( cookie.bv_val ) {
syncCookie.octet_str[0].bv_val )
slap_parse_sync_cookie( &syncCookie );
}
+ if ( ber_peek_tag( ber, &len ) == LDAP_TAG_REFRESHDELETES )
+ {
+ ber_scanf( ber, "b", &refreshDeletes );
+ }
+ ber_scanf( ber, "}" );
}
if ( syncCookie_req.ctxcsn == NULL ) {
match = -1;
* 1) err code : LDAP_BUSY ...
* 2) on err policy : stop service, stop sync, retry
*/
- if ( si->si_sync_mode == LDAP_SYNC_STATE_MODE && match
- < 0 )
- {
+ if ( refreshDeletes == 0 && match < 0 ) {
syncrepl_del_nonpresent( op, si );
+ } else {
+ avl_free( si->si_presentlist, avl_ber_bvfree );
+ si->si_presentlist = NULL;
}
}
rc = -2;
rc = ldap_parse_intermediate( si->si_ld, msg,
&retoid, &retdata, NULL, 0 );
if ( !rc && !strcmp( retoid, LDAP_SYNC_INFO ) ) {
- sync_info_arrived = 1;
+ int si_refreshDelete = 0;
+ int si_refreshPresent = 0;
ber_init2( ber, retdata, LBER_USE_DER );
- ber_scanf( ber, "{e" /*"}"*/, &syncstate );
- if ( ber_peek_tag( ber, &len )
- == LDAP_SYNC_TAG_COOKIE ) {
- ber_scanf( ber, /*"{"*/ "m}", &cookie );
- if ( cookie.bv_val ) {
- struct berval tmp_bv;
- ber_dupbv( &tmp_bv, &cookie );
- ber_bvarray_add( &syncCookie.octet_str, &tmp_bv);
+ switch ( si_tag = ber_peek_tag( ber, &len )) {
+ ber_tag_t tag;
+ case LDAP_TAG_SYNC_NEW_COOKIE:
+ ber_scanf( ber, "tm", &tag, &cookie );
+ break;
+ case LDAP_TAG_SYNC_REFRESH_DELETE:
+ si_refreshDelete = 1;
+ case LDAP_TAG_SYNC_REFRESH_PRESENT:
+ si_refreshPresent = 1;
+ ber_scanf( ber, "t{", &tag );
+ if ( ber_peek_tag( ber, &len ) == LDAP_TAG_SYNC_COOKIE )
+ {
+ ber_scanf( ber, "m", &tag, &cookie );
}
- if ( syncCookie.octet_str &&
- syncCookie.octet_str[0].bv_val )
- slap_parse_sync_cookie( &syncCookie );
+ if ( ber_peek_tag( ber, &len ) ==
+ LDAP_TAG_REFRESHDONE )
+ {
+ ber_scanf( ber, "b", &refreshDone );
+ }
+ ber_scanf( ber, "}" );
+ break;
+ case LDAP_TAG_SYNC_ID_SET:
+ /* FIXME : to be supported */
+ ber_scanf( ber, "t{", &tag );
+ if ( ber_peek_tag( ber, &len ) == LDAP_TAG_SYNC_COOKIE )
+ {
+ ber_scanf( ber, "m", &tag, &cookie );
+ }
+ if ( ber_peek_tag( ber, &len ) ==
+ LDAP_TAG_REFRESHDELETES )
+ {
+ ber_scanf( ber, "b", &refreshDeletes );
+ }
+ ber_scanf( ber, "[W]", &syncUUIDs );
+ ber_scanf( ber, "}" );
+ break;
+ default:
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, ERR,
+ "do_syncrep2 : unknown syncinfo tag (%d)\n",
+ si_tag, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "do_syncrep2 : unknown syncinfo tag (%d)\n",
+ si_tag, 0, 0 );
+#endif
+ ldap_memfree( retoid );
+ ber_bvfree( retdata );
+ continue;
}
if ( syncCookie_req.ctxcsn == NULL ) {
syncrepl_updateCookie( si, op, psub, &syncCookie);
}
- if ( syncstate == LDAP_SYNC_STATE_MODE_DONE ) {
+ if ( si_refreshPresent == 1 ) {
if ( match < 0 ) {
syncrepl_del_nonpresent( op, si );
}
- si->si_sync_mode = LDAP_SYNC_LOG_MODE;
- } else if ( syncstate == LDAP_SYNC_LOG_MODE_DONE ) {
- si->si_sync_mode = LDAP_SYNC_PERSIST_MODE;
- } else if ( syncstate == LDAP_SYNC_REFRESH_DONE ) {
- si->si_sync_mode = LDAP_SYNC_PERSIST_MODE;
- } else if ( syncstate != LDAP_SYNC_NEW_COOKIE ||
- syncstate != LDAP_SYNC_LOG_MODE_DONE )
- {
-#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, ERR,
- "do_syncrep2 : unknown sync info\n", 0, 0, 0 );
-#else
- Debug( LDAP_DEBUG_ANY,
- "do_syncrep2 : unknown sync info\n", 0, 0, 0 );
-#endif
- }
+ }
ldap_memfree( retoid );
ber_bvfree( retdata );
Modifications* modlist,
int syncstate,
struct berval* syncUUID,
- struct sync_cookie* syncCookie_req,
- int refresh
+ struct sync_cookie* syncCookie_req
)
{
Backend *be = op->o_bd;
int ret = LDAP_SUCCESS;
const char *text;
- if ( refresh && si->si_sync_mode == LDAP_SYNC_STATE_MODE &&
- ( syncstate == LDAP_SYNC_PRESENT || syncstate == LDAP_SYNC_ADD ))
+ if (( syncstate == LDAP_SYNC_PRESENT || syncstate == LDAP_SYNC_ADD ))
{
syncuuid_bv = ber_dupbv( NULL, syncUUID );
avl_insert( &si->si_presentlist, (caddr_t) syncuuid_bv,
return;
}
-void
-avl_ber_bvfree( void *bv )
-{
- if( bv == NULL ) {
- return;
- }
- if ( ((struct berval *)bv)->bv_val != NULL ) {
- ch_free ( ((struct berval *)bv)->bv_val );
- }
- ch_free ( (char *) bv );
-}
-
static int
dn_callback(
Operation* op,
return e;
}
+
+static void
+avl_ber_bvfree( void *bv )
+{
+ if( bv == NULL ) {
+ return;
+ }
+ if ( ((struct berval *)bv)->bv_val != NULL ) {
+ ch_free ( ((struct berval *)bv)->bv_val );
+ }
+ ch_free ( (char *) bv );
+}
+
#! /bin/sh
# $OpenLDAP$
+echo "temporarily disabled"
+exit 0
+
echo "running defines.sh"
. $SRCDIR/scripts/defines.sh