int si_syncdata;
int si_logstate;
int si_conn_setup;
+#ifdef HAVE_TLS
+ int si_check_tls;
+#endif
Avlnode *si_presentlist;
LDAP *si_ld;
LDAP_LIST_HEAD(np, nonpresent_entry) si_nonpresentlist;
}
op->o_protocol = LDAP_VERSION3;
- ldap_set_option( si->si_ld, LDAP_OPT_PROTOCOL_VERSION, &op->o_protocol );
+ ldap_set_option( si->si_ld, LDAP_OPT_PROTOCOL_VERSION,
+ (const void *)&op->o_protocol );
+
+#ifdef HAVE_TLS
+ if ( si->si_check_tls ) {
+ si->si_check_tls = 0;
+ rc = bindconf_tls_set( &si->si_bindconf, si->si_ld );
+ } else if ( si->si_bindconf.sb_tls_ctx ) {
+ rc = ldap_set_option( si->si_ld, LDAP_OPT_X_TLS_CTX,
+ si->si_bindconf.sb_tls_ctx );
+ }
+ if ( rc ) {
+ Debug( LDAP_DEBUG_ANY,
+ "do_syncrep1: TLS context initialization failed\n", 0, 0, 0 );
+ return rc;
+ }
+#endif
/* Bind to master */
op->o_req_dn = *np_prev->npe_name;
op->o_req_ndn = *np_prev->npe_nname;
rc = op->o_bd->be_delete( op, &rs_delete );
+ Debug( LDAP_DEBUG_SYNC,
+ "syncrepl_del_nonpresent: be_delete %s (%d)\n",
+ op->o_req_dn.bv_val, rc, 0 );
if ( rs_delete.sr_err == LDAP_NOT_ALLOWED_ON_NONLEAF ) {
Modifications mod1, mod2;
void
syncinfo_free( syncinfo_t *sie )
{
+ if ( sie->si_ld ) {
+ if ( sie->si_conn_setup ) {
+ ber_socket_t s;
+ ldap_get_option( sie->si_ld, LDAP_OPT_DESC, &s );
+ connection_client_stop( s );
+ sie->si_conn_setup = 0;
+ }
+ ldap_unbind_ext( sie->si_ld, NULL, NULL );
+ }
+
/* re-fetch it, in case it was already removed */
sie->si_re = ldap_pvt_runqueue_find( &slapd_rq, do_syncrepl, sie );
if ( sie->si_re ) {
if ( sie->si_presentlist ) {
avl_free( sie->si_presentlist, avl_ber_bvfree );
}
- if ( sie->si_ld ) {
- ldap_unbind_ext( sie->si_ld, NULL, NULL );
- }
while ( !LDAP_LIST_EMPTY( &sie->si_nonpresentlist )) {
struct nonpresent_entry* npe;
npe = LDAP_LIST_FIRST( &sie->si_nonpresentlist );
{ BER_BVC("one"), LDAP_SCOPE_ONELEVEL },
{ BER_BVC("onelevel"), LDAP_SCOPE_ONELEVEL }, /* OpenLDAP extension */
{ BER_BVC("children"), LDAP_SCOPE_SUBORDINATE },
+ { BER_BVC("subord"), LDAP_SCOPE_SUBORDINATE },
{ BER_BVC("subordinate"), LDAP_SCOPE_SUBORDINATE },
{ BER_BVC("sub"), LDAP_SCOPE_SUBTREE },
{ BER_BVC("subtree"), LDAP_SCOPE_SUBTREE }, /* OpenLDAP extension */
} else if ( strchr( val, ':' ) != NULL ) {
char *next, *ptr = val;
unsigned dd, hh, mm, ss;
+
+ /* NOTE: the test for ptr[ 0 ] == '-'
+ * should go before the call to strtoul() */
dd = strtoul( ptr, &next, 10 );
- if ( next == ptr || next[0] != ':' ) {
+ if ( ptr[ 0 ] == '-' || next == ptr || next[0] != ':' ) {
snprintf( c->msg, sizeof( c->msg ),
"Error: parse_syncrepl_line: "
"invalid interval \"%s\", unable to parse days", val );
}
ptr = next + 1;
hh = strtoul( ptr, &next, 10 );
- if ( next == ptr || next[0] != ':' || hh > 24 ) {
+ if ( ptr[ 0 ] == '-' || next == ptr || next[0] != ':' || hh > 24 ) {
snprintf( c->msg, sizeof( c->msg ),
"Error: parse_syncrepl_line: "
"invalid interval \"%s\", unable to parse hours", val );
}
ptr = next + 1;
mm = strtoul( ptr, &next, 10 );
- if ( next == ptr || next[0] != ':' || mm > 60 ) {
+ if ( ptr[ 0 ] == '-' || next == ptr || next[0] != ':' || mm > 60 ) {
snprintf( c->msg, sizeof( c->msg ),
"Error: parse_syncrepl_line: "
"invalid interval \"%s\", unable to parse minutes", val );
}
ptr = next + 1;
ss = strtoul( ptr, &next, 10 );
- if ( next == ptr || next[0] != '\0' || ss > 60 ) {
+ if ( ptr[ 0 ] == '-' || next == ptr || next[0] != '\0' || ss > 60 ) {
snprintf( c->msg, sizeof( c->msg ),
"Error: parse_syncrepl_line: "
"invalid interval \"%s\", unable to parse seconds", val );
si->si_slimit = 0;
si->si_conn_setup = 0;
+#ifdef HAVE_TLS
+ si->si_check_tls = 1;
+#endif
+
si->si_presentlist = NULL;
LDAP_LIST_INIT( &si->si_nonpresentlist );
ldap_pvt_thread_mutex_init( &si->si_mutex );
}
return 1;
} else if ( c->op == LDAP_MOD_DELETE ) {
- struct re_s *re;
-
if ( c->be->be_syncinfo ) {
syncinfo_free( c->be->be_syncinfo );
c->be->be_syncinfo = NULL;