si->si_bindmethod = LDAP_AUTH_SIMPLE;
gots |= GOT_METHOD;
} else if ( !strcasecmp( val, SASLSTR )) {
+#ifdef HAVE_CYRUS_SASL
si->si_bindmethod = LDAP_AUTH_SASL;
gots |= GOT_METHOD;
+#else /* HAVE_CYRUS_SASL */
+ fprintf( stderr, "Error: parse_syncrepl_line: "
+ "not compiled with SASL support\n" );
+ return 1;
+#endif /* HAVE_CYRUS_SASL */
} else {
si->si_bindmethod = -1;
}
sizeof("refreshAndPersist")-1 ))
{
si->si_type = LDAP_SYNC_REFRESH_AND_PERSIST;
- si->si_interval = 0;
+ si->si_interval = 60;
} else {
fprintf( stderr, "Error: parse_syncrepl_line: "
"unknown sync type \"%s\"\n", val);
} else if ( !strncasecmp( cargv[ i ],
INTERVALSTR, sizeof( INTERVALSTR ) - 1 ) )
{
+ char *hstr;
+ char *mstr;
+ char *dstr;
val = cargv[ i ] + sizeof( INTERVALSTR );
- if ( si->si_type == LDAP_SYNC_REFRESH_AND_PERSIST ) {
- si->si_interval = 0;
- } else {
- char *dstr;
- char *hstr;
- char *mstr;
- dstr = val;
- hstr = strchr( dstr, ':' );
- if ( hstr == NULL ) {
- fprintf( stderr, "Error: parse_syncrepl_line: "
- "invalid interval \"%s\"\n", val );
- return 1;
- }
- *hstr++ = '\0';
- mstr = strchr( hstr, ':' );
- if ( mstr == NULL ) {
- fprintf( stderr, "Error: parse_syncrepl_line: "
- "invalid interval \"%s\"\n", val );
- return 1;
- }
- *mstr++ = '\0';
- si->si_interval = (( atoi( dstr ) * 24 + atoi( hstr )) * 60
- + atoi( mstr )) * 60;
+ dstr = val;
+ hstr = strchr( dstr, ':' );
+ if ( hstr == NULL ) {
+ fprintf( stderr, "Error: parse_syncrepl_line: "
+ "invalid interval \"%s\"\n", val );
+ return 1;
+ }
+ *hstr++ = '\0';
+ mstr = strchr( hstr, ':' );
+ if ( mstr == NULL ) {
+ fprintf( stderr, "Error: parse_syncrepl_line: "
+ "invalid interval \"%s\"\n", val );
+ return 1;
}
+ *mstr++ = '\0';
+ si->si_interval = (( atoi( dstr ) * 24 + atoi( hstr )) * 60
+ + atoi( mstr )) * 60;
+
if ( si->si_interval < 0 ) {
fprintf( stderr, "Error: parse_syncrepl_line: "
"invalid interval \"%ld\"\n",
"do_syncrepl: ldap_initialize failed (%s)\n",
si->si_provideruri, 0, 0 );
#endif
- return NULL;
+ goto done;
}
op.o_protocol = LDAP_VERSION3;
si->si_tls == SYNCINFO_TLS_CRITICAL ? "Error" : "Warning",
rc, 0 );
#endif
- if( si->si_tls == SYNCINFO_TLS_CRITICAL ) return NULL;
+ if( si->si_tls == SYNCINFO_TLS_CRITICAL ) goto done;
}
}
"ldap_sasl_interactive_bind_s failed (%d)\n",
rc, 0, 0 );
#endif
- return NULL;
+ goto done;
}
#else /* HAVE_CYRUS_SASL */
+ /* Should never get here, we trapped this at config time */
fprintf( stderr, "not compiled with SASL support\n" );
return NULL;
#endif
Debug( LDAP_DEBUG_ANY, "do_syncrepl: "
"ldap_bind_s failed (%d)\n", rc, 0, 0 );
#endif
- return NULL;
+ goto done;
}
}
Debug( LDAP_DEBUG_ANY, "do_syncrepl: "
"ldap_search_ext: %s (%d)\n", ldap_err2string( rc ), rc, 0 );
#endif
- return NULL;
+ goto done;
}
if ( abs(si->si_type) == LDAP_SYNC_REFRESH_AND_PERSIST ){
}
}
ldap_msgfree( res );
+ res = NULL;
}
if ( rc == -1 ) {
done:
#if defined( LDAP_SLAPI )
- if ( op.o_pb ) slapi_pblock_destroy( op.o_pb );
- slapi_x_free_object_extensions( SLAPI_X_EXT_OPERATION, &op );
+ if ( op.o_pb ) {
+ slapi_pblock_destroy( op.o_pb );
+ slapi_x_free_object_extensions( SLAPI_X_EXT_OPERATION, &op );
+ }
#endif /* defined( LDAP_SLAPI ) */
if ( syncCookie.bv_val )
if ( res ) ldap_msgfree( res );
- ldap_unbind( ld );
+ if ( ld ) ldap_unbind( ld );
- ber_bvarray_free_x( si->si_syncCookie, op.o_tmpmemctx );
- si->si_syncCookie = NULL;
+ if ( si->si_syncCookie ) {
+ ber_bvarray_free_x( si->si_syncCookie, op.o_tmpmemctx );
+ si->si_syncCookie = NULL;
+ }
ldap_pvt_thread_mutex_lock( &syncrepl_rq.rq_mutex );
ldap_pvt_runqueue_stoptask( &syncrepl_rq, rtask );
- if ( si->si_type == LDAP_SYNC_REFRESH_ONLY ) {
- ldap_pvt_runqueue_resched( &syncrepl_rq, rtask );
- } else {
- ldap_pvt_runqueue_remove( &syncrepl_rq, rtask );
- }
+ ldap_pvt_runqueue_resched( &syncrepl_rq, rtask );
ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex );
return NULL;
struct berval *syncuuid_bv = NULL;
SlapReply rs = {REP_RESULT};
+ Filter f;
+ AttributeAssertion ava;
int rc = LDAP_SUCCESS;
int ret = LDAP_SUCCESS;
si->si_e = e;
si->si_syncUUID_ndn = NULL;
- op->ors_filter = str2filter_x( op, op->ors_filterstr.bv_val );
+ f.f_choice = LDAP_FILTER_EQUALITY;
+ f.f_ava = &ava;
+ ava.aa_desc = slap_schema.si_ad_entryUUID;
+ ava.aa_value = *syncUUID;
+ op->ors_filter = &f;
op->ors_scope = LDAP_SCOPE_SUBTREE;
/* get syncrepl cookie of shadow replica from subentry */
rc = be->be_search( op, &rs );
- if ( op->ors_filter ) filter_free_x( op, op->ors_filter );
if ( op->ors_filterstr.bv_val ) {
sl_free( op->ors_filterstr.bv_val, op->o_tmpmemctx );
}