#ifdef LDAP_CONTROL_SUBENTRIES
fprintf( stderr, _(" [!]subentries[=true|false] (subentries)\n"));
#endif
-#ifdef LDAP_SYNC
fprintf( stderr, _(" [!]sync=ro[/<cookie>] (LDAP Sync refreshOnly)\n"));
fprintf( stderr, _(" rp[/<cookie>][/<slimit>] (LDAP Sync refreshAndPersist)\n"));
-#endif
fprintf( stderr, _(" -F prefix URL prefix for files (default: %s)\n"), def_urlpre);
fprintf( stderr, _(" -l limit time limit (in seconds) for search\n"));
fprintf( stderr, _(" -L print responses in LDIFv1 format\n"));
static int domainScope = 0;
#endif
-#ifdef LDAP_SYNC
static int ldapsync = 0;
static struct berval sync_cookie = { 0, NULL };
static int sync_slimit = -1;
-#endif
#ifdef LDAP_CONTROL_PAGEDRESULTS
static int pagedResults = 0;
if( crit ) subentries *= -1;
#endif
-#ifdef LDAP_SYNC
} else if ( strcasecmp( control, "sync" ) == 0 ) {
char *cookiep;
char *slimitp;
exit( EXIT_FAILURE );
}
if ( crit ) ldapsync *= -1;
-#endif
} else {
fprintf( stderr, _("Invalid control name: %s\n"), control );
LDAP *ld = NULL;
BerElement *seber = NULL, *vrber = NULL, *prber = NULL;
-#ifdef LDAP_SYNC
BerElement *syncber = NULL;
struct berval *syncbvalp = NULL;
-#endif
tool_init();
#ifdef LDAP_CONTROL_PAGEDRESULTS
|| pageSize
#endif
-#ifdef LDAP_SYNC
|| ldapsync
-#endif
|| subentries || valuesReturnFilter )
{
int err;
}
#endif
-#ifdef LDAP_SYNC
if ( ldapsync ) {
if (( syncber = ber_alloc_t(LBER_USE_DER)) == NULL ) {
return EXIT_FAILURE;
c[i].ldctl_iscritical = ldapsync < 0;
i++;
}
-#endif
if ( valuesReturnFilter ) {
if (( vrber = ber_alloc_t(LBER_USE_DER)) == NULL ) {
int npartial;
LDAPMessage *res, *msg;
ber_int_t msgid;
-#ifdef LDAP_SYNC
char *retoid = NULL;
struct berval *retdata = NULL;
int nresponses_psearch = -1;
int cancel_msgid = -1;
-#endif
if( filtpatt != NULL ) {
filter = malloc( strlen( filtpatt ) + strlen( value ) );
msg = ldap_next_message( ld, msg ) )
{
if ( nresponses++ ) putchar('\n');
-#if LDAP_SYNC
if ( nresponses_psearch >= 0 )
nresponses_psearch++;
-#endif
switch( ldap_msgtype( msg ) ) {
case LDAP_RES_SEARCH_ENTRY:
goto done;
}
-#ifdef LDAP_SYNC
if ( cancel_msgid != -1 &&
cancel_msgid == ldap_msgid( msg ) ) {
printf(_("Cancelled \n"));
printf(_("cancel_msgid = %d\n"), cancel_msgid);
goto done;
}
-#endif
break;
case LDAP_RES_SEARCH_RESULT:
}
#endif
-#ifdef LDAP_SYNC
if ( ldapsync == LDAP_SYNC_REFRESH_AND_PERSIST ) {
break;
}
-#endif
goto done;
case LDAP_RES_INTERMEDIATE:
npartial++;
-#ifndef LDAP_SYNC
- print_partial( ld, msg );
-#else
ldap_parse_intermediate( ld, msg,
&retoid, &retdata, NULL, 0 );
ldap_memfree( retoid );
ber_bvfree( retdata );
goto done;
-#endif
}
-#ifdef LDAP_SYNC
if ( ldapsync && sync_slimit != -1 &&
nresponses_psearch >= sync_slimit ) {
BerElement *msgidber = NULL;
msgidvalp, NULL, NULL, &cancel_msgid);
nresponses_psearch = -1;
}
-#endif
-
}
ldap_msgfree( res );
#define LDAP_CONTROL_PAGEDRESULTS "1.2.840.113556.1.4.319"
-#define LDAP_SYNC 2
-#ifdef LDAP_SYNC
-#define LDAP_SYNCREPL 1
#define LDAP_CONTROL_SYNC "1.3.6.1.4.1.4203.666.5.6"
#define LDAP_CONTROL_SYNC_STATE "1.3.6.1.4.1.4203.666.5.7"
#define LDAP_CONTROL_SYNC_DONE "1.3.6.1.4.1.4203.666.5.8"
#define LDAP_SYNC_ADD 1
#define LDAP_SYNC_MODIFY 2
#define LDAP_SYNC_DELETE 3
-#endif
#define LDAP_CONTROL_SORTREQUEST "1.2.840.113556.1.4.473"
#define LDAP_CONTROL_SORTRESPONSE "1.2.840.113556.1.4.474"
#define LDAP_TAG_SASL_RES_CREDS ((ber_tag_t) 0x87U) /* context specific + primitive */
-#ifdef LDAP_SYNC
#define LDAP_SYNC_TAG_COOKIE ((ber_tag_t) 0x04U) /* octet string */
-#endif
/* possible operations a client can invoke */
#define LDAP_CLIENT_LOOP 0x60 /* draft-ietf-ldap-c-api-xx */
#define LDAP_REFERRAL_LIMIT_EXCEEDED 0x61 /* draft-ietf-ldap-c-api-xx */
-#ifdef LDAP_SYNC
#define LDAP_SYNC_RESOURCES_EXHAUSTED 0x100
#define LDAP_SYNC_SECURITY_VIOLATION 0x101
#define LDAP_SYNC_INVALID_COOKIE 0x102
#define LDAP_SYNC_UNSUPPORTED_SCHEME 0x103
#define LDAP_SYNC_CLIENT_DISCONNECT 0x104
#define LDAP_SYNC_RELOAD_REQUIRED 0x105
-#endif
#define LDAP_ASSERTION_FAILED 0x10f
#endif
/* LDAP SYNC request type */
-#ifdef LDAP_SYNC
#define LDAP_SYNC_NONE 0x00
#define LDAP_SYNC_REFRESH_ONLY 0x01
#define LDAP_SYNC_REFRESH_AND_PERSIST 0x03
-#endif
/*
* This structure represents both ldap messages and ldap responses.
{LDAP_ASSERTION_FAILED, N_("Assertion Failed")},
-#ifdef LDAP_SYNC
{LDAP_SYNC_RESOURCES_EXHAUSTED, N_("Content Sync Resource Exhausted")},
{LDAP_SYNC_SECURITY_VIOLATION, N_("Content Sync Security Violation")},
{LDAP_SYNC_INVALID_COOKIE, N_("Content Sync Invalid Cookie")},
{LDAP_SYNC_UNSUPPORTED_SCHEME, N_("Content Sync Unsupported Scheme")},
{LDAP_SYNC_CLIENT_DISCONNECT, N_("Content Sync Client Disconnect")},
{LDAP_SYNC_RELOAD_REQUIRED, N_("Content Sync Reload Required")},
-#endif
#ifdef LDAP_EXOP_X_CANCEL
{LDAP_CANCELLED, N_("Cancelled")},
if ( op->o_bd->be_add ) {
/* do the update here */
int repl_user = be_isupdate(op->o_bd, &op->o_ndn );
-#if defined(LDAP_SYNCREPL) && !defined(SLAPD_MULTIMASTER)
+#ifndef SLAPD_MULTIMASTER
if ( !op->o_bd->syncinfo &&
( !op->o_bd->be_update_ndn.bv_len || repl_user ))
-#elif defined(LDAP_SYNCREPL) && defined(SLAPD_MULTIMASTER)
- if ( !op->o_bd->syncinfo ) /* LDAP_SYNCREPL overrides MM */
-#elif !defined(LDAP_SYNCREPL) && !defined(SLAPD_MULTIMASTER)
- if ( !op->o_bd->be_update_ndn.bv_len || repl_user )
+#else
+ if ( !op->o_bd->syncinfo )
#endif
{
int update = op->o_bd->be_update_ndn.bv_len;
e = NULL;
}
-#if defined(LDAP_SYNCREPL) || !defined(SLAPD_MULTIMASTER)
+#ifndef SLAPD_MULTIMASTER
} else {
BerVarray defref = NULL;
#ifdef LDAP_SLAPI
}
#endif /* LDAP_SLAPI */
-#ifdef LDAP_SYNCREPL
if ( op->o_bd->syncinfo ) {
defref = op->o_bd->syncinfo->provideruri_bv;
- } else
-#endif
- {
+ } else {
defref = op->o_bd->be_update_refs
? op->o_bd->be_update_refs : default_referral;
}
done:
-#ifdef LDAP_SYNC
slap_graduate_commit_csn( op );
-#endif
if( modlist != NULL ) {
slap_mods_free( modlist );
for( ; mods != NULL; mods = mods->sml_next ) {
Attribute *attr;
-#ifdef LDAP_SYNCREPL
- if ( !repl_user )
-#endif
- {
+ if ( !repl_user ) {
assert( mods->sml_op == LDAP_MOD_ADD );
}
assert( mods->sml_desc != NULL );
int num_retries = 0;
-#ifdef LDAP_SYNC
Operation* ps_list;
int rc;
EntryInfo *suffix_ei;
Entry *ctxcsn_e;
int ctxcsn_added = 0;
-#endif
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ARGS, "==> bdb_add: %s\n", op->oq_add.rs_e->e_name.bv_val, 0, 0 );
rs->sr_text = "no write access to parent";
goto return_results;
}
-#ifdef LDAP_SYNCREPL
} else if ( !is_entry_glue( op->oq_add.rs_e )) {
-#else
- } else {
-#endif
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, DETAIL1, "bdb_add: %s denied\n",
pdn.bv_len == 0 ? "suffix" : "entry at root", 0, 0 );
goto return_results;
}
-#ifdef LDAP_SYNCREPL
- if ( !op->o_bd->syncinfo )
-#endif
-#ifdef LDAP_SYNC
- {
+ if ( !op->o_bd->syncinfo ) {
rc = bdb_csn_commit( op, rs, ltid, ei, &suffix_ei, &ctxcsn_e, &ctxcsn_added, locker );
switch ( rc ) {
case BDB_CSN_ABORT :
goto retry;
}
}
-#endif
if ( op->o_noop ) {
if (( rs->sr_err=TXN_ABORT( ltid )) != 0 ) {
} else {
struct berval nrdn;
-#ifdef LDAP_SYNC
struct berval ctx_nrdn;
-#endif
if (pdn.bv_len) {
nrdn.bv_val = op->ora_e->e_nname.bv_val;
bdb_cache_add( bdb, ei, op->oq_add.rs_e, &nrdn, locker );
-#ifdef LDAP_SYNCREPL
- if ( !op->o_bd->syncinfo )
-#endif
-#ifdef LDAP_SYNC
- {
+ if ( !op->o_bd->syncinfo ) {
if ( ctxcsn_added ) {
ctx_nrdn.bv_val = "cn=ldapsync";
ctx_nrdn.bv_len = strlen( ctx_nrdn.bv_val );
bdb_cache_add( bdb, suffix_ei, ctxcsn_e, &ctx_nrdn, locker );
}
}
-#endif
if(( rs->sr_err=TXN_COMMIT( ltid, 0 )) != 0 ) {
rs->sr_text = "txn_commit failed";
return_results:
send_ldap_result( op, rs );
-#ifdef LDAP_SYNC
if ( rs->sr_err == LDAP_SUCCESS && !noop ) {
LDAP_LIST_FOREACH ( ps_list, &bdb->bi_psearch_list, o_ps_link ) {
bdb_psearch( op, rs, ps_list, op->oq_add.rs_e, LDAP_PSEARCH_BY_ADD );
}
}
-#endif
if( rs->sr_err == LDAP_SUCCESS && bdb->bi_txn_cp ) {
ldap_pvt_thread_yield();
LDAP_BEGIN_DECL
-#ifdef LDAP_SYNCREPL
#define BDB_SUBENTRIES 1
-#endif
#define DN_BASE_PREFIX SLAP_INDEX_EQUALITY_PREFIX
#define DN_ONE_PREFIX '%'
ID bi_lastid;
ldap_pvt_thread_mutex_t bi_lastid_mutex;
-#ifdef LDAP_SYNC
LDAP_LIST_HEAD(pl, slap_op) bi_psearch_list;
-#endif
#ifdef SLAP_IDL_CACHE
int bi_idl_cache_max_size;
int bi_idl_cache_size;
#define BDB_REUSE_LOCKERS
-#ifdef LDAP_SYNC
#define BDB_CSN_COMMIT 0
#define BDB_CSN_ABORT 1
#define BDB_CSN_RETRY 2
-#endif
LDAP_END_DECL
}
/* Atomically release and reacquire a lock */
-#if LDAP_SYNC
int
-#else
-static int
-#endif
bdb_cache_entry_db_relock(
DB_ENV *env,
u_int32_t locker,
#include "back-bdb.h"
#include "external.h"
-#ifdef LDAP_SYNC
int
bdb_csn_commit(
Operation *op,
slap_rewind_commit_csn( op );
return BDB_CSN_RETRY;
}
-#endif
int num_retries = 0;
-#ifdef LDAP_SYNC
Operation* ps_list;
int rc;
EntryInfo *suffix_ei;
Entry *ctxcsn_e;
int ctxcsn_added = 0;
-#endif
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ARGS, "==> bdb_delete: %s\n", op->o_req_dn.bv_val, 0, 0 );
}
}
-#ifdef LDAP_SYNCREPL /* FIXME : dn2entry() should return non-glue entry */
+ /* FIXME : dn2entry() should return non-glue entry */
if ( e == NULL || ( !manageDSAit && is_entry_glue( e ))) {
-#else
- if ( e == NULL ) {
-#endif
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ARGS,
"<=- bdb_delete: no such object %s\n", op->o_req_dn.bv_val, 0, 0);
matched = NULL;
} else {
-#ifdef LDAP_SYNCREPL
BerVarray deref = op->o_bd->syncinfo ?
op->o_bd->syncinfo->provideruri_bv : default_referral;
-#else
- BerVarray deref = default_referral;
-#endif
rs->sr_ref = referral_rewrite( deref, NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
}
ldap_pvt_thread_mutex_unlock( &bdb->bi_lastid_mutex );
#endif
-#ifdef LDAP_SYNCREPL
- if ( !op->o_bd->syncinfo )
-#endif
-#ifdef LDAP_SYNC
- {
+ if ( !op->o_bd->syncinfo ) {
rc = bdb_csn_commit( op, rs, ltid, ei, &suffix_ei, &ctxcsn_e, &ctxcsn_added, locker );
switch ( rc ) {
case BDB_CSN_ABORT :
goto retry;
}
}
-#endif
if( op->o_noop ) {
if ( ( rs->sr_err = TXN_ABORT( ltid ) ) != 0 ) {
rs->sr_err = LDAP_SUCCESS;
}
} else {
-#ifdef LDAP_SYNC
struct berval ctx_nrdn;
-#endif
bdb_cache_delete( &bdb->bi_cache, e, bdb->bi_dbenv,
locker, &lock );
-#ifdef LDAP_SYNCREPL
- if ( !op->o_bd->syncinfo )
-#endif
-#ifdef LDAP_SYNC
- {
+ if ( !op->o_bd->syncinfo ) {
if ( ctxcsn_added ) {
ctx_nrdn.bv_val = "cn=ldapsync";
ctx_nrdn.bv_len = strlen( ctx_nrdn.bv_val );
bdb_cache_add( bdb, suffix_ei, ctxcsn_e, &ctx_nrdn, locker );
}
}
-#endif
rs->sr_err = TXN_COMMIT( ltid, 0 );
}
return_results:
send_ldap_result( op, rs );
-#ifdef LDAP_SYNC
if ( rs->sr_err == LDAP_SUCCESS && !noop ) {
LDAP_LIST_FOREACH( ps_list, &bdb->bi_psearch_list, o_ps_link ) {
bdb_psearch( op, rs, ps_list, e, LDAP_PSEARCH_BY_DELETE );
}
}
-#endif
if(rs->sr_err == LDAP_SUCCESS && bdb->bi_txn_cp ) {
ldap_pvt_thread_yield();
bdb->bi_search_stack_depth = DEFAULT_SEARCH_STACK_DEPTH;
bdb->bi_search_stack = NULL;
-#ifdef LDAP_SYNC
LDAP_LIST_INIT (&bdb->bi_psearch_list);
-#endif
ldap_pvt_thread_mutex_init( &bdb->bi_lastid_mutex );
ldap_pvt_thread_mutex_init( &bdb->bi_cache.lru_mutex );
bi->bi_op_unbind = 0;
-#ifdef LDAP_SYNC
bi->bi_op_abandon = bdb_abandon;
bi->bi_op_cancel = bdb_cancel;
-#else
- bi->bi_op_abandon = 0;
- bi->bi_op_cancel = 0;
-#endif
bi->bi_extended = bdb_extended;
int num_retries = 0;
-#ifdef LDAP_SYNC
Operation* ps_list;
struct psid_entry *pm_list, *pm_prev;
int rc;
EntryInfo *suffix_ei;
Entry *ctxcsn_e;
int ctxcsn_added = 0;
-#endif
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ENTRY, "bdb_modify: %s\n", op->o_req_dn.bv_val, 0, 0 );
"bdb_modify: retrying...\n", 0, 0, 0);
#endif
-#ifdef LDAP_SYNC
pm_list = LDAP_LIST_FIRST(&op->o_pm_list);
while ( pm_list != NULL ) {
LDAP_LIST_REMOVE ( pm_list, ps_link );
pm_list = LDAP_LIST_NEXT ( pm_list, ps_link );
ch_free( pm_prev );
}
-#endif
rs->sr_err = TXN_ABORT( ltid );
ltid = NULL;
e = ei->bei_e;
/* acquire and lock entry */
-#ifdef LDAP_SYNCREPL /* FIXME: dn2entry() should return non-glue entry */
+ /* FIXME: dn2entry() should return non-glue entry */
if (( rs->sr_err == DB_NOTFOUND ) || ( !manageDSAit && e && is_entry_glue( e ))) {
-#else
- if ( rs->sr_err == DB_NOTFOUND ) {
-#endif
if ( e != NULL ) {
rs->sr_matched = ch_strdup( e->e_dn );
rs->sr_ref = is_entry_referral( e )
e = NULL;
} else {
-#ifdef LDAP_SYNCREPL
BerVarray deref = op->o_bd->syncinfo ?
op->o_bd->syncinfo->provideruri_bv : default_referral;
-#else
- BerVarray deref = default_referral;
-#endif
rs->sr_ref = referral_rewrite( deref, NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
}
goto return_results;
}
-#ifdef LDAP_SYNC
if ( rs->sr_err == LDAP_SUCCESS && !op->o_noop ) {
LDAP_LIST_FOREACH ( ps_list, &bdb->bi_psearch_list, o_ps_link ) {
bdb_psearch(op, rs, ps_list, e, LDAP_PSEARCH_BY_PREMODIFY );
}
}
-#endif
/* nested transaction */
rs->sr_err = TXN_BEGIN( bdb->bi_dbenv, ltid, <2,
goto return_results;
}
-#ifdef LDAP_SYNCREPL
- if ( !op->o_bd->syncinfo )
-#endif
-#ifdef LDAP_SYNC
- {
+ if ( !op->o_bd->syncinfo ) {
rc = bdb_csn_commit( op, rs, ltid, ei, &suffix_ei, &ctxcsn_e, &ctxcsn_added, locker );
switch ( rc ) {
case BDB_CSN_ABORT :
goto retry;
}
}
-#endif
if( op->o_noop ) {
if ( ( rs->sr_err = TXN_ABORT( ltid ) ) != 0 ) {
rs->sr_err = LDAP_SUCCESS;
}
} else {
-#ifdef LDAP_SYNC
struct berval ctx_nrdn;
EntryInfo *ctx_ei;
-#endif
+
bdb_cache_modify( e, dummy.e_attrs, bdb->bi_dbenv, locker, &lock );
-#ifdef LDAP_SYNCREPL
- if ( !op->o_bd->syncinfo )
-#endif
-#ifdef LDAP_SYNC
- {
+ if ( !op->o_bd->syncinfo ) {
if ( ctxcsn_added ) {
ctx_nrdn.bv_val = "cn=ldapsync";
ctx_nrdn.bv_len = strlen( ctx_nrdn.bv_val );
bdb_cache_add( bdb, suffix_ei, ctxcsn_e, &ctx_nrdn, locker );
}
}
-#endif
rs->sr_err = TXN_COMMIT( ltid, 0 );
}
return_results:
send_ldap_result( op, rs );
-#ifdef LDAP_SYNC
if ( rs->sr_err == LDAP_SUCCESS && !op->o_noop ) {
/* Loop through in-scope entries for each psearch spec */
LDAP_LIST_FOREACH ( ps_list, &bdb->bi_psearch_list, o_ps_link ) {
ch_free( pm_prev );
}
}
-#endif
if( rs->sr_err == LDAP_SUCCESS && bdb->bi_txn_cp ) {
ldap_pvt_thread_yield();
done:
if( ltid != NULL ) {
-#ifdef LDAP_SYNC
pm_list = LDAP_LIST_FIRST(&op->o_pm_list);
while ( pm_list != NULL ) {
LDAP_LIST_REMOVE ( pm_list, ps_link );
pm_list = LDAP_LIST_NEXT ( pm_list, ps_link );
ch_free( pm_prev );
}
-#endif
TXN_ABORT( ltid );
op->o_private = NULL;
}
int num_retries = 0;
-#ifdef LDAP_SYNC
Operation *ps_list;
struct psid_entry *pm_list, *pm_prev;
int rc;
EntryInfo *suffix_ei;
Entry *ctxcsn_e;
int ctxcsn_added = 0;
-#endif
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ENTRY, "==>bdb_modrdn(%s,%s,%s)\n",
Debug( LDAP_DEBUG_TRACE, "==>bdb_modrdn: retrying...\n", 0, 0, 0 );
#endif
-#ifdef LDAP_SYNC
pm_list = LDAP_LIST_FIRST(&op->o_pm_list);
while ( pm_list != NULL ) {
LDAP_LIST_REMOVE ( pm_list, ps_link );
pm_list = LDAP_LIST_NEXT ( pm_list, ps_link );
ch_free( pm_prev );
}
-#endif
rs->sr_err = TXN_ABORT( ltid );
ltid = NULL;
}
e = ei->bei_e;
-#ifdef LDAP_SYNCREPL /* FIXME: dn2entry() should return non-glue entry */
+ /* FIXME: dn2entry() should return non-glue entry */
if (( rs->sr_err == DB_NOTFOUND ) || ( !manageDSAit && e && is_entry_glue( e ))) {
-#else
- if ( rs->sr_err == DB_NOTFOUND ) {
-#endif
if( e != NULL ) {
rs->sr_matched = ch_strdup( e->e_dn );
rs->sr_ref = is_entry_referral( e )
e = NULL;
} else {
-#ifdef LDAP_SYNCREPL
BerVarray deref = op->o_bd->syncinfo ?
op->o_bd->syncinfo->provideruri_bv : default_referral;
-#else
- BerVarray deref = default_referral;
-#endif
rs->sr_ref = referral_rewrite( deref, NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
}
goto return_results;
}
-#ifdef LDAP_SYNC
if ( rs->sr_err == LDAP_SUCCESS && !op->o_noop ) {
LDAP_LIST_FOREACH ( ps_list, &bdb->bi_psearch_list, o_ps_link ) {
bdb_psearch( op, rs, ps_list, e, LDAP_PSEARCH_BY_PREMODIFY );
}
}
-#endif
/* modify entry */
rs->sr_err = bdb_modify_internal( op, lt2, &mod[0], e,
goto return_results;
}
-#ifdef LDAP_SYNCREPL
- if ( !op->o_bd->syncinfo )
-#endif
-#ifdef LDAP_SYNC
- {
+ if ( !op->o_bd->syncinfo ) {
rc = bdb_csn_commit( op, rs, ltid, ei, &suffix_ei, &ctxcsn_e, &ctxcsn_added, locker );
switch ( rc ) {
case BDB_CSN_ABORT :
goto retry;
}
}
-#endif
if( op->o_noop ) {
if(( rs->sr_err=TXN_ABORT( ltid )) != 0 ) {
if(( rs->sr_err=TXN_PREPARE( ltid, gid )) != 0 ) {
rs->sr_text = "txn_prepare failed";
} else {
-#ifdef LDAP_SYNC
struct berval ctx_nrdn;
-#endif
bdb_cache_modrdn( save, &op->orr_nnewrdn, e, neip,
bdb->bi_dbenv, locker, &lock );
-#ifdef LDAP_SYNCREPL
- if ( !op->o_bd->syncinfo )
-#endif
-#ifdef LDAP_SYNC
- {
+ if ( !op->o_bd->syncinfo ) {
if ( ctxcsn_added ) {
ctx_nrdn.bv_val = "cn=ldapsync";
ctx_nrdn.bv_len = strlen( ctx_nrdn.bv_val );
bdb_cache_add( bdb, suffix_ei, ctxcsn_e, &ctx_nrdn, locker );
}
}
-#endif
if(( rs->sr_err=TXN_COMMIT( ltid, 0 )) != 0 ) {
rs->sr_text = "txn_commit failed";
return_results:
send_ldap_result( op, rs );
-#ifdef LDAP_SYNC
if ( rs->sr_err == LDAP_SUCCESS && !op->o_noop ) {
/* Loop through in-scope entries for each psearch spec */
LDAP_LIST_FOREACH ( ps_list, &bdb->bi_psearch_list, o_ps_link ) {
ch_free( pm_prev );
}
}
-#endif
if( rs->sr_err == LDAP_SUCCESS && bdb->bi_txn_cp ) {
ldap_pvt_thread_yield();
}
if( ltid != NULL ) {
-#ifdef LDAP_SYNC
- pm_list = LDAP_LIST_FIRST(&op->o_pm_list);
- while ( pm_list != NULL ) {
- LDAP_LIST_REMOVE ( pm_list, ps_link );
+ pm_list = LDAP_LIST_FIRST(&op->o_pm_list);
+ while ( pm_list != NULL ) {
+ LDAP_LIST_REMOVE ( pm_list, ps_link );
pm_prev = pm_list;
- pm_list = LDAP_LIST_NEXT ( pm_list, ps_link );
+ pm_list = LDAP_LIST_NEXT ( pm_list, ps_link );
ch_free( pm_prev );
- }
-#endif
+ }
TXN_ABORT( ltid );
op->o_private = NULL;
}
if ( ei ) e = ei->bei_e;
-#ifdef LDAP_SYNCREPL
if ( e == NULL || is_entry_glue( e )) {
/* FIXME: dn2entry() should return non-glue entry */
-#else
- if ( e == NULL ) {
-#endif
rs->sr_text = "could not locate authorization entry";
rc = LDAP_NO_SUCH_OBJECT;
goto done;
);
void bdb_cache_release_all( Cache *cache );
-#ifdef LDAP_SYNC
#define bdb_cache_entry_db_relock BDB_SYMBOL(cache_entry_db_relock)
int bdb_cache_entry_db_relock(
DB_ENV *env,
int rw,
int tryOnly,
DB_LOCK *lock );
-#endif
#ifdef BDB_REUSE_LOCKERS
* search.c
*/
-#ifdef LDAP_SYNC
-
#define bdb_abandon BDB_SYMBOL(abandon)
#define bdb_cancel BDB_SYMBOL(cancel)
#define bdb_do_search BDB_SYMBOL(do_search)
int psearch_type
);
#define bdb_psearch(op, rs, sop, e, ps_type) bdb_do_search(op, rs, sop, e, ps_type)
-#endif
-
-#ifdef LDAP_SYNC
#define bdb_build_sync_state_ctrl BDB_SYMBOL(build_sync_state_ctrl)
#define bdb_build_sync_done_ctrl BDB_SYMBOL(build_sync_done_ctrl)
#define bdb_send_ldap_intermediate BDB_SYMBOL(send_ldap_intermediate)
SlapReply *rs,
int state,
struct berval *cookie );
-#endif
/*
* trans.c
static
int is_sync_protocol( Operation *op )
{
-#if !defined(LDAP_SYNC)
- return 0;
-#endif
-
-#ifdef LDAP_SYNC
if ( op->o_sync_mode & SLAP_SYNC_REFRESH_AND_PERSIST )
return 1;
-#endif
return 0;
}
-#if defined(LDAP_SYNC)
#define IS_BDB_REPLACE(type) (( type == LDAP_PSEARCH_BY_DELETE ) || \
( type == LDAP_PSEARCH_BY_SCOPEOUT ))
#define IS_PSEARCH (op != sop)
int
bdb_do_search( Operation *op, SlapReply *rs, Operation *sop,
Entry *ps_e, int ps_type )
-#else
-#define IS_PSEARCH 0
-#define sop op
-int bdb_search( Operation *op, SlapReply *rs )
-#endif
{
struct bdb_info *bdb = (struct bdb_info *) op->o_bd->be_private;
time_t stoptime;
ID lastid = NOID;
AttributeName *attrs;
-#ifdef LDAP_SYNC
Filter contextcsnand, contextcsnle, cookief, csnfnot, csnfeq, csnfand, csnfge;
Filter omitcsnf, omitcsnfle;
AttributeAssertion aa_ge, aa_eq, aa_le;
int entry_sync_state = -1;
AttributeName null_attr;
int no_sync_state_change = 0;
-#endif
struct slap_limits_set *limit = NULL;
int isroot = 0;
#endif
attrs = sop->oq_search.rs_attrs;
-#ifdef LDAP_SYNC
/* psearch needs to be registered before refresh begins */
/* psearch and refresh transmission is serialized in send_ldap_ber() */
if ( !IS_PSEARCH && sop->o_sync_mode & SLAP_SYNC_PERSIST ) {
attrs[0].an_name.bv_len = 0;
attrs[0].an_name.bv_val = NULL;
}
-#endif
manageDSAit = get_manageDSAit( sop );
/* Sync control overrides manageDSAit */
-#ifdef LDAP_SYNC
if ( !IS_PSEARCH && sop->o_sync_mode & SLAP_SYNC_REFRESH ) {
if ( manageDSAit == SLAP_NO_CONTROL )
manageDSAit = SLAP_CRITICAL_CONTROL;
- } else
-#endif
- if ( IS_PSEARCH ) {
+ } else if ( IS_PSEARCH ) {
if ( manageDSAit == SLAP_NO_CONTROL )
manageDSAit = SLAP_CRITICAL_CONTROL;
}
}
e = NULL;
-#ifdef LDAP_SYNC
if ( sop->o_sync_mode != SLAP_SYNC_NONE ) {
-#ifdef LDAP_SYNCREPL
if ( sop->o_bd->syncinfo ) {
char substr[67];
sprintf( substr, "cn=syncrepl%d", sop->o_bd->syncinfo->id );
ber_str2bv( substr, strlen( substr ), 0, &ctxcsn_rdn );
build_new_dn( &ctxcsn_ndn, &op->o_bd->be_nsuffix[0], &ctxcsn_rdn );
- } else
-#endif
- {
+ } else {
ber_str2bv( "cn=ldapsync", strlen("cn=ldapsync"), 0, &ctxcsn_rdn );
build_new_dn( &ctxcsn_ndn, &op->o_bd->be_nsuffix[0], &ctxcsn_rdn );
}
}
if ( ctxcsn_e ) {
-#ifdef LDAP_SYNCREPL
if ( sop->o_bd->syncinfo ) {
csn_a = attr_find( ctxcsn_e->e_attrs, slap_schema.si_ad_syncreplCookie );
- } else
-#endif
- {
+ } else {
csn_a = attr_find( ctxcsn_e->e_attrs, slap_schema.si_ad_contextCSN );
}
if ( csn_a ) {
search_context_csn = NULL;
}
}
-#endif
/* select candidates */
if ( sop->oq_search.rs_scope == LDAP_SCOPE_BASE ) {
rs->sr_err = search_candidates( op, sop, rs, &base, locker, candidates, scopes );
}
-#ifdef LDAP_SYNC
if ( sop->o_sync_mode != SLAP_SYNC_NONE ) {
bdb_cache_entry_db_unlock( bdb->bi_dbenv, &ctxcsn_lock );
}
-#endif
/* start cursor at beginning of candidates.
*/
cursor = 0;
-#ifdef LDAP_SYNC
if (IS_PSEARCH) {
if ( !BDB_IDL_IS_RANGE( candidates ) ) {
cursor = bdb_idl_search( candidates, ps_e->e_id );
candidates[0] = 1;
candidates[1] = ps_e->e_id;
}
-#endif
if ( candidates[0] == 0 ) {
#ifdef NEW_LOGGING
}
#endif
-#ifdef LDAP_SYNC
if ( (sop->o_sync_mode & SLAP_SYNC_REFRESH) || IS_PSEARCH )
{
MatchingRule *mr;
csnfge.f_next = sop->oq_search.rs_filter;
}
}
-#endif
for ( id = bdb_idl_first( candidates, &cursor );
id != NOID;
}
-#ifdef LDAP_SYNC
if (!IS_PSEARCH) {
-#endif
id2entry_retry:
/* get the entry with reader lock */
ei = NULL;
goto loop_continue;
}
-#ifdef LDAP_SYNC
} else {
e = ps_e;
}
-#endif
rs->sr_entry = e;
#ifdef BDB_SUBENTRIES
goto loop_continue;
}
-#ifdef LDAP_SYNCREPL
if ( !manageDSAit && is_entry_glue( e )) {
goto loop_continue;
}
-#endif
/* if it matches the filter and scope, send it */
-#ifdef LDAP_SYNC
if (IS_PSEARCH) {
if (ps_type != LDAP_PSEARCH_BY_SCOPEOUT) {
rs->sr_err = test_filter( sop, rs->sr_entry, &cookief );
entry_sync_state = LDAP_SYNC_PRESENT;
}
}
- } else
-#endif
- {
+ } else {
rs->sr_err = test_filter( sop,
rs->sr_entry, sop->oq_search.rs_filter );
}
-#ifdef LDAP_SYNC
}
-#endif
if ( rs->sr_err == LDAP_COMPARE_TRUE ) {
/* check size limit */
if ( --sop->oq_search.rs_slimit == -1 ) {
-#ifdef LDAP_SYNC
- if (!IS_PSEARCH)
-#endif
- bdb_cache_return_entry_r( bdb->bi_dbenv,
- &bdb->bi_cache, e, &lock );
+ if (!IS_PSEARCH) {
+ bdb_cache_return_entry_r( bdb->bi_dbenv,
+ &bdb->bi_cache, e, &lock );
+ }
e = NULL;
rs->sr_entry = NULL;
rs->sr_err = LDAP_SIZELIMIT_EXCEEDED;
result = 0;
} else
#endif
-#ifdef LDAP_SYNC
if (IS_PSEARCH) {
int premodify_found = 0;
int entry_sync_state;
ch_free( ctrls[--num_ctrls] );
ctrls[num_ctrls] = NULL;
rs->sr_ctrls = NULL;
- } else
-#endif
- {
+ } else {
rs->sr_attrs = sop->oq_search.rs_attrs;
rs->sr_ctrls = NULL;
result = send_search_entry( sop, rs );
}
if (!IS_PSEARCH) {
-#ifdef LDAP_SYNC
- if ( sop->o_sync_mode & SLAP_SYNC_REFRESH ) {
- 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, search_context_csn );
-
- /* If changelog is supported, this is where to process it */
-
- if ( sop->o_sync_mode & SLAP_SYNC_PERSIST ) {
- /* refreshAndPersist mode */
+ if ( sop->o_sync_mode & SLAP_SYNC_REFRESH ) {
+ rs->sr_err = LDAP_SUCCESS;
+ rs->sr_rspoid = LDAP_SYNC_INFO;
+ rs->sr_ctrls = NULL;
bdb_send_ldap_intermediate( sop, rs,
- LDAP_SYNC_LOG_MODE_DONE, search_context_csn );
+ LDAP_SYNC_STATE_MODE_DONE, search_context_csn );
+
+ /* If changelog is supported, this is where to process it */
+
+ if ( sop->o_sync_mode & SLAP_SYNC_PERSIST ) {
+ /* refreshAndPersist mode */
+ bdb_send_ldap_intermediate( sop, rs,
+ LDAP_SYNC_LOG_MODE_DONE, search_context_csn );
+ } else {
+ /* refreshOnly mode */
+ bdb_build_sync_done_ctrl( sop, rs, ctrls,
+ num_ctrls++, 1, search_context_csn );
+ rs->sr_ctrls = ctrls;
+ rs->sr_ref = rs->sr_v2ref;
+ rs->sr_err = (rs->sr_v2ref == NULL) ? LDAP_SUCCESS : LDAP_REFERRAL;
+ send_ldap_result( sop, rs );
+ if ( ctrls[num_ctrls-1]->ldctl_value.bv_val != NULL ) {
+ ch_free( ctrls[num_ctrls-1]->ldctl_value.bv_val );
+ }
+ ch_free( ctrls[--num_ctrls] );
+ ctrls[num_ctrls] = NULL;
+ }
} else {
- /* refreshOnly mode */
- bdb_build_sync_done_ctrl( sop, rs, ctrls,
- num_ctrls++, 1, search_context_csn );
- rs->sr_ctrls = ctrls;
+ rs->sr_ctrls = NULL;
rs->sr_ref = rs->sr_v2ref;
rs->sr_err = (rs->sr_v2ref == NULL) ? LDAP_SUCCESS : LDAP_REFERRAL;
send_ldap_result( sop, rs );
- if ( ctrls[num_ctrls-1]->ldctl_value.bv_val != NULL ) {
- ch_free( ctrls[num_ctrls-1]->ldctl_value.bv_val );
- }
- ch_free( ctrls[--num_ctrls] );
- ctrls[num_ctrls] = NULL;
}
-
- } else
-#endif
- {
- rs->sr_ctrls = NULL;
- rs->sr_ref = rs->sr_v2ref;
- rs->sr_err = (rs->sr_v2ref == NULL) ? LDAP_SUCCESS : LDAP_REFERRAL;
- send_ldap_result( sop, rs );
- }
}
rs->sr_err = LDAP_SUCCESS;
}
#endif
-#ifdef LDAP_SYNC
-#if 1
int
bdb_build_sync_state_ctrl(
Operation *op,
return LDAP_SUCCESS;
}
-#else
-int
-bdb_build_sync_state_ctrl(
- Operation *op,
- SlapReply *rs,
- Entry *e,
- int entry_sync_state,
- LDAPControl **ctrls,
- int num_ctrls,
- int send_cookie,
- struct berval *latest_entrycsn_bv )
-{
- Attribute* a;
- int ret;
- int res;
- const char *text = NULL;
-
- char berbuf[LBER_ELEMENT_SIZEOF];
- BerElement *ber = (BerElement *)berbuf;
-
- struct berval entryuuid_bv = { 0, NULL };
- struct berval entrycsn_bv = { 0, NULL };
-
- ber_init2( ber, 0, LBER_USE_DER );
-
- ctrls[num_ctrls] = ch_malloc ( sizeof ( LDAPControl ) );
-
- for ( a = e->e_attrs; a != NULL; a = a->a_next ) {
- AttributeDescription *desc = a->a_desc;
- if ( desc == slap_schema.si_ad_entryCSN ) {
- ber_dupbv( &entrycsn_bv, &a->a_vals[0] );
- if ( latest_entrycsn_bv->bv_val == NULL ) {
- ber_dupbv( latest_entrycsn_bv, &entrycsn_bv );
- } else {
- res = value_match( &ret, desc,
- desc->ad_type->sat_ordering, 0,
- &entrycsn_bv, latest_entrycsn_bv, &text );
- if ( res != LDAP_SUCCESS ) {
- ret = 0;
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, RESULTS,
- "bdb_search: value_match failed\n",
- 0, 0, 0 );
-#else
- Debug( LDAP_DEBUG_TRACE,
- "bdb_search: value_match failed\n",
- 0, 0, 0 );
-#endif
- }
- if ( ret > 0 ) {
- ch_free( latest_entrycsn_bv->bv_val );
- latest_entrycsn_bv->bv_val = NULL;
- ber_dupbv( latest_entrycsn_bv, &entrycsn_bv );
- }
- }
- } else if ( desc == slap_schema.si_ad_entryUUID ) {
- ber_dupbv( &entryuuid_bv, &a->a_vals[0] );
- }
- }
-
- if ( send_cookie ) {
- ber_printf( ber, "{eOON}",
- entry_sync_state, &entryuuid_bv, &entrycsn_bv );
- } else {
- ber_printf( ber, "{eON}",
- entry_sync_state, &entryuuid_bv );
- }
-
- ch_free( entrycsn_bv.bv_val );
- entrycsn_bv.bv_val = NULL;
- ch_free( entryuuid_bv.bv_val );
- entryuuid_bv.bv_val = NULL;
-
- ctrls[num_ctrls]->ldctl_oid = LDAP_CONTROL_SYNC_STATE;
- ctrls[num_ctrls]->ldctl_iscritical = op->o_sync;
- ret = ber_flatten2( ber, &ctrls[num_ctrls]->ldctl_value, 1 );
-
- ber_free_buf( ber );
-
- if ( ret < 0 ) {
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, RESULTS,
- "bdb_build_sync_ctrl: ber_flatten2 failed\n",
- 0, 0, 0 );
-#else
- Debug( LDAP_DEBUG_TRACE,
- "bdb_build_sync_ctrl: ber_flatten2 failed\n",
- 0, 0, 0 );
-#endif
- send_ldap_error( op, rs, LDAP_OTHER, "internal error" );
- return ret;
- }
-
- return LDAP_SUCCESS;
-}
-#endif
int
bdb_build_sync_done_ctrl(
return LDAP_SUCCESS;
}
-#endif
#endif
send_ldap_result( op, rs );
-#ifdef LDAP_SYNCREPL
return rs->sr_err;
-#else
- return( -1 );
-#endif
}
#ifdef LDBM_SUBENTRIES
send_ldap_error( op, rs, LDAP_INSUFFICIENT_ACCESS,
"no write access to entry" );
-#ifdef LDAP_SYNCREPL
return LDAP_INSUFFICIENT_ACCESS;
-#else
- return -1;
-#endif
}
/* grab giant lock for writing */
ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock);
rs->sr_err = rs->sr_err ? LDAP_OTHER : LDAP_ALREADY_EXISTS;
send_ldap_result( op, rs );
-#ifdef LDAP_SYNCREPL
return rs->sr_err;
-#else
- return( -1 );
-#endif
}
/*
ber_bvarray_free( rs->sr_ref );
free( (char *)rs->sr_matched );
-#ifdef LDAP_SYNCREPL
return rs->sr_err;
-#else
- return -1;
-#endif
}
if ( ! access_allowed( op, p,
send_ldap_error( op, rs, LDAP_INSUFFICIENT_ACCESS,
"no write access to parent" );
-#ifdef LDAP_SYNCREPL
return LDAP_INSUFFICIENT_ACCESS;
-#else
- return -1;
-#endif
}
#ifdef LDBM_SUBENTRIES
send_ldap_error( op, rs, LDAP_ALIAS_PROBLEM,
"parent is an alias" );
-#ifdef LDAP_SYNCREPL
return LDAP_ALIAS_PROBLEM;
-#else
- return -1;
-#endif
}
if ( is_entry_referral( p ) ) {
ber_bvarray_free( rs->sr_ref );
free( (char *)rs->sr_matched );
-#ifdef LDAP_SYNCREPL
return rs->sr_err;
-#else
- return -1;
-#endif
}
#ifdef LDBM_SUBENTRIES
LDAP_INSUFFICIENT_ACCESS,
"no write access to parent" );
-#ifdef LDAP_SYNCREPL
return LDAP_INSUFFICIENT_ACCESS;
-#else
- return -1;
-#endif
}
-#ifdef LDAP_SYNCREPL
} else if ( !is_entry_glue( op->oq_add.rs_e )) {
-#else
- } else {
-#endif
ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock);
#ifdef NEW_LOGGING
send_ldap_error( op, rs,
LDAP_NO_SUCH_OBJECT, NULL );
-#ifdef LDAP_SYNCREPL
return LDAP_NO_SUCH_OBJECT;
-#else
- return -1;
-#endif
}
}
send_ldap_error( op, rs, LDAP_OTHER,
"next_id add failed" );
-#ifdef LDAP_SYNCREPL
return LDAP_OTHER;
-#else
- return( -1 );
-#endif
}
/*
rs->sr_err = rs->sr_err > 0 ? LDAP_ALREADY_EXISTS : LDAP_OTHER;
send_ldap_result( op, rs );
-#ifdef LDAP_SYNCREPL
return rs->sr_err;
-#else
- return( -1 );
-#endif
}
rs->sr_err = -1;
LDAP_BEGIN_DECL
-#ifdef LDAP_SYNCREPL
#define LDBM_SUBENTRIES 1
-#endif
#define DEFAULT_CACHE_SIZE 1000
if ( rs->sr_ref ) ber_bvarray_free( rs->sr_ref );
if ( rs->sr_matched ) free( (char *)rs->sr_matched );
-#ifdef LDAP_SYNCREPL
return rs->sr_err;
-#else
- return( rc );
-#endif
}
ber_dupbv( &op->oq_bind.rb_edn, &e->e_name );
#endif
rs->sr_err = LDAP_INVALID_CREDENTIALS;
send_ldap_result( op, rs );
-#ifdef LDAP_SYNCREPL
rc = LDAP_INVALID_CREDENTIALS;
-#else
- rc = 1;
-#endif
goto return_results;
}
#endif
send_ldap_error( op, rs, LDAP_ALIAS_PROBLEM,
"entry is alias" );
-#ifdef LDAP_SYNCREPL
rc = LDAP_ALIAS_PROBLEM;
-#else
- rc = 1;
-#endif
goto return_results;
}
ber_bvarray_free( rs->sr_ref );
-#ifdef LDAP_SYNCREPL
rc = rs->sr_err;
-#else
- rc = 1;
-#endif
goto return_results;
}
password, NULL, ACL_AUTH, NULL ) )
{
send_ldap_error( op, rs, LDAP_INSUFFICIENT_ACCESS, NULL );
-#ifdef LDAP_SYNCREPL
rc = LDAP_INSUFFICIENT_ACCESS;
-#else
- rc = 1;
-#endif
goto return_results;
}
send_ldap_error( op, rs, LDAP_INAPPROPRIATE_AUTH, NULL );
/* stop front end from sending result */
-#ifdef LDAP_SYNCREPL
rc = LDAP_INAPPROPRIATE_AUTH;
-#else
- rc = 1;
-#endif
goto return_results;
}
if ( slap_passwd_check( op->o_conn, a, &op->oq_bind.rb_cred, &rs->sr_text ) != 0 ) {
send_ldap_error( op, rs, LDAP_INVALID_CREDENTIALS, NULL );
/* stop front end from sending result */
-#ifdef LDAP_SYNCREPL
rc = LDAP_INVALID_CREDENTIALS;
-#else
- rc = 1;
-#endif
goto return_results;
}
case LDAP_AUTH_KRBV41:
if ( krbv4_ldap_auth( op->o_bd, &op->oq_bind.rb_cred, &ad ) != LDAP_SUCCESS ) {
send_ldap_error( op, rs, LDAP_INVALID_CREDENTIALS, NULL );
-#ifdef LDAP_SYNCREPL
rc = LDAP_INVALID_CREDENTIALS;
-#else
- rc = 1;
-#endif
goto return_results;
}
{
send_ldap_error( op, rs, LDAP_INSUFFICIENT_ACCESS,
NULL );
-#ifdef LDAP_SYNCREPL
rc = LDAP_INSUFFICIENT_ACCESS;
-#else
- rc = 1;
-#endif
goto return_results;
}
break;
}
send_ldap_error( op, rs, LDAP_INAPPROPRIATE_AUTH, NULL );
-#ifdef LDAP_SYNCREPL
rc = LDAP_INAPPROPRIATE_AUTH;
-#else
- rc = 1;
-#endif
goto return_results;
} else { /* look for krbname match */
if ( value_find( a->a_desc, a->a_vals, &krbval ) != 0 ) {
send_ldap_error( op, rs,
LDAP_INVALID_CREDENTIALS, NULL );
-#ifdef LDAP_SYNCREPL
rc = LDAP_INVALID_CREDENTIALS;
-#else
- rc = 1;
-#endif
goto return_results;
}
}
default:
send_ldap_error( op, rs, LDAP_STRONG_AUTH_NOT_SUPPORTED,
"authentication method not supported" );
-#ifdef LDAP_SYNCREPL
rc = LDAP_STRONG_AUTH_NOT_SUPPORTED;
-#else
- rc = 1;
-#endif
goto return_results;
}
/* get entry with writer lock */
e = dn2entry_w( op->o_bd, &op->o_req_ndn, &matched );
-#ifdef LDAP_SYNCREPL /* FIXME : dn2entry() should return non-glue entry */
+ /* FIXME : dn2entry() should return non-glue entry */
if ( e == NULL || ( !manageDSAit && is_entry_glue( e ))) {
-#else
- if ( e == NULL ) {
-#endif
#ifdef NEW_LOGGING
LDAP_LOG( BACK_LDBM, INFO,
"ldbm_back_delete: no such object %s\n", op->o_req_dn.bv_val, 0, 0 );
cache_return_entry_r( &li->li_cache, matched );
} else {
-#ifdef LDAP_SYNCREPL
BerVarray deref = op->o_bd->syncinfo ?
op->o_bd->syncinfo->provideruri_bv : default_referral;
-#else
- BerVarray deref = default_referral;
-#endif
rs->sr_ref = referral_rewrite( deref, NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
}
/* acquire and lock entry */
e = dn2entry_w( op->o_bd, &op->o_req_ndn, &matched );
-#ifdef LDAP_SYNCREPL /* FIXME: dn2entry() should return non-glue entry */
+ /* FIXME: dn2entry() should return non-glue entry */
if (( e == NULL ) || ( !manageDSAit && e && is_entry_glue( e ))) {
-#else
- if ( e == NULL ) {
-#endif
if ( matched != NULL ) {
rs->sr_matched = ch_strdup( matched->e_dn );
rs->sr_ref = is_entry_referral( matched )
: NULL;
cache_return_entry_r( &li->li_cache, matched );
} else {
-#ifdef LDAP_SYNCREPL
BerVarray deref = op->o_bd->syncinfo ?
op->o_bd->syncinfo->provideruri_bv : default_referral;
-#else
- BerVarray deref = default_referral;
-#endif
rs->sr_ref = referral_rewrite( deref, NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
}
if ( rs->sr_ref ) ber_bvarray_free( rs->sr_ref );
free( (char *)rs->sr_matched );
-#ifdef LDAP_SYNCREPL
return rs->sr_err;
-#else
- return( -1 );
-#endif
}
if ( !manageDSAit && is_entry_referral( e ) )
error_return:;
cache_return_entry_w( &li->li_cache, e );
ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock);
-#ifdef LDAP_SYNCREPL
return rs->sr_err;
-#else
- return( -1 );
-#endif
}
e = dn2entry_w( op->o_bd, &op->o_req_ndn, &matched );
/* get entry with writer lock */
-#ifdef LDAP_SYNCREPL /* FIXME: dn2entry() should return non-glue entry */
+ /* FIXME: dn2entry() should return non-glue entry */
if (( e == NULL ) || ( !manageDSAit && e && is_entry_glue( e ))) {
-#else
- if ( e == NULL ) {
-#endif
if ( matched != NULL ) {
rs->sr_matched = strdup( matched->e_dn );
rs->sr_ref = is_entry_referral( matched )
: NULL;
cache_return_entry_r( &li->li_cache, matched );
} else {
-#ifdef LDAP_SYNCREPL
BerVarray deref = op->o_bd->syncinfo ?
op->o_bd->syncinfo->provideruri_bv : default_referral;
-#else
- BerVarray deref = default_referral;
-#endif
rs->sr_ref = referral_rewrite( deref, NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
}
if ( rs->sr_ref ) ber_bvarray_free( rs->sr_ref );
free( (char *)rs->sr_matched );
-#ifdef LDAP_SYNCREPL
return rs->sr_err;
-#else
- return( -1 );
-#endif
}
/* check entry for "entry" acl */
e = dn2entry_w( op->o_bd, &ndn, NULL );
-#ifdef LDAP_SYNCREPL
if ( e == NULL || is_entry_glue( e )) {
- /* FIXME : dn2entry() should return non-glue entry */
-#else
- if( e == NULL ) {
-#endif
+ /* FIXME : dn2entry() should return non-glue entry */
ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock);
rs->sr_text = "could not locate authorization entry";
rc = LDAP_NO_SUCH_OBJECT;
ber_bvarray_free( rs->sr_ref );
ber_memfree( matched_dn.bv_val );
-#ifdef LDAP_SYNCREPL
return LDAP_REFERRAL;
-#else
- return 1;
-#endif
}
if (!manageDSAit && is_entry_referral( e ) ) {
}
ber_memfree( matched_dn.bv_val );
-#ifdef LDAP_SYNCREPL
return LDAP_OTHER;
-#else
- return 1;
-#endif
}
if ( is_entry_alias( e ) ) {
rs->sr_err = LDAP_SUCCESS;
send_ldap_result( op, rs );
-#ifdef LDAP_SYNCREPL
rc = LDAP_OTHER;
-#else
- rc = 1;
-#endif
goto done;
}
goto loop_continue;
}
-#ifdef LDAP_SYNCREPL
if ( !manageDSAit && is_entry_glue( e )) {
goto loop_continue;
}
-#endif
/* if it matches the filter and scope, send it */
result = test_filter( op, e, op->oq_search.rs_filter );
int nBackendDB = 0;
BackendDB *backendDB = NULL;
-#ifdef LDAP_SYNCREPL
ldap_pvt_thread_pool_t syncrepl_pool;
int syncrepl_pool_max = SLAP_MAX_SYNCREPL_THREADS;
-#endif
int backend_init(void)
{
int rc = -1;
-#ifdef LDAP_SYNCREPL
ldap_pvt_thread_pool_init( &syncrepl_pool, syncrepl_pool_max, 0 );
-#endif
if((nBackendInfo != 0) || (backendInfo != NULL)) {
/* already initialized */
int i;
int rc = 0;
-#ifdef LDAP_SYNCREPL
init_syncrepl();
-#endif
if( ! ( nBackendDB > 0 ) ) {
/* no databases */
if(be != NULL) {
/* startup a specific backend database */
-#ifdef LDAP_SYNC
LDAP_TAILQ_INIT( &be->be_pending_csn_list );
-#endif
#ifdef NEW_LOGGING
LDAP_LOG( BACKEND, DETAIL1, "backend_startup: starting \"%s\"\n",
}
}
-#ifdef LDAP_SYNCREPL
ldap_pvt_thread_mutex_init( &syncrepl_rq.rq_mutex );
LDAP_STAILQ_INIT( &syncrepl_rq.task_list );
LDAP_STAILQ_INIT( &syncrepl_rq.run_list );
-#endif
/* open each backend database */
for( i = 0; i < nBackendDB; i++ ) {
/* append global access controls */
acl_append( &backendDB[i].be_acl, global_acl );
-#ifdef LDAP_SYNC
LDAP_TAILQ_INIT( &backendDB[i].be_pending_csn_list );
-#endif
if ( backendDB[i].bd_info->bi_db_open ) {
rc = backendDB[i].bd_info->bi_db_open(
}
}
-#ifdef LDAP_SYNCREPL
if ( backendDB[i].syncinfo != NULL ) {
syncinfo_t *si = ( syncinfo_t * ) backendDB[i].syncinfo;
si->be = &backendDB[i];
do_syncrepl, (void *) backendDB[i].syncinfo );
ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex );
}
-#endif
}
return rc;
int i;
BackendDB *bd;
-#ifdef LDAP_SYNCREPL
- ldap_pvt_thread_pool_destroy( &syncrepl_pool, 1 );
-#endif
+ ldap_pvt_thread_pool_destroy( &syncrepl_pool, 1 );
/* destroy each backend database */
for( i = 0, bd = backendDB; i < nBackendDB; i++, bd++ ) {
be->be_requires = global_requires;
be->be_ssf_set = global_ssf_set;
-#ifdef LDAP_SYNC
be->be_context_csn.bv_len = 0;
be->be_context_csn.bv_val = NULL;
ldap_pvt_thread_mutex_init( &be->be_pcl_mutex );
ldap_pvt_thread_mutex_init( &be->be_context_csn_mutex );
-#endif
-#ifdef LDAP_SYNCREPL
be->syncinfo = NULL;
-#endif
/* assign a default depth limit for alias deref */
be->be_max_deref_depth = SLAPD_DEFAULT_MAXDEREFDEPTH;
}
if ( !found ) {
-#ifdef LDAP_SYNC
for ( i = 0; i < nbackends; i++ ) {
op->o_bd = &backends[i];
if( !op->o_bd->be_cancel ) continue;
}
ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
}
-#endif
ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
rs->sr_text = "message ID not found";
return LDAP_NO_SUCH_OPERATION;
static char *strtok_quote(char *line, char *sep);
static int load_ucdata(char *path);
-#ifdef LDAP_SYNCREPL
static void add_syncrepl LDAP_P(( Backend *, char **, int ));
static int parse_syncrepl_line LDAP_P(( char **, int, syncinfo_t *));
-#endif
int
read_config( const char *fname, int depth )
ldap_syslog += atoi( cargv[1] );
}
-#ifdef LDAP_SYNCREPL
/* list of sync replication information in this backend (slave only) */
} else if ( strcasecmp( cargv[0], "syncrepl" ) == 0 ) {
add_syncrepl( be, cargv, cargc );
-#endif
/* list of replicas of the data in this backend (master only) */
} else if ( strcasecmp( cargv[0], "replica" ) == 0 ) {
acl_destroy( global_acl, NULL );
}
-#ifdef LDAP_SYNCREPL
static void
add_syncrepl(
Backend *be,
return 0;
}
-#endif /* LDAP_SYNCREPL */
LDAP_STAILQ_REMOVE( &conn->c_ops, op, slap_op, o_next);
LDAP_STAILQ_NEXT(op, o_next) = NULL;
-#ifdef LDAP_SYNC
if ( op->o_cancel == SLAP_CANCEL_ACK )
goto co_op_free;
if ( ( op->o_sync_mode & SLAP_SYNC_PERSIST ) ) {
sl_mem_detach( ctx, memctx );
goto no_co_op_free;
}
-#endif
co_op_free:
#ifdef LDAP_CONTROL_SUBENTRIES
static SLAP_CTRL_PARSE_FN parseSubentries;
#endif
-#ifdef LDAP_SYNC
static SLAP_CTRL_PARSE_FN parseLdupSync;
-#endif
#undef sc_mask /* avoid conflict with Irix 6.5 <sys/signal.h> */
{ LDAP_CONTROL_NOOP,
SLAP_CTRL_ACCESS, NULL,
parseNoOp, LDAP_SLIST_ENTRY_INITIALIZER(next) },
-#ifdef LDAP_SYNC
{ LDAP_CONTROL_SYNC,
SLAP_CTRL_HIDE|SLAP_CTRL_SEARCH, NULL,
parseLdupSync, LDAP_SLIST_ENTRY_INITIALIZER(next) },
-#endif
{ LDAP_CONTROL_MODIFY_INCREMENT,
SLAP_CTRL_MODIFY, NULL,
parseModifyIncrement, LDAP_SLIST_ENTRY_INITIALIZER(next) },
}
#endif
-#ifdef LDAP_SYNC
static int parseLdupSync (
Operation *op,
SlapReply *rs,
return LDAP_SUCCESS;
}
-#endif
#include "slap.h"
#include "lutil_ldap.h"
-#ifdef LDAP_SYNC
-
struct berval *
slap_get_commit_csn( Operation *op )
{
return LDAP_SUCCESS;
}
-#endif
#include "lutil.h"
#include "slap.h"
-#ifdef LDAP_SYNCREPL
#include "ldap_rq.h"
-#endif
#ifdef HAVE_TCPD
#include <tcpd.h>
struct timeval tv;
struct timeval *tvp;
-#ifdef LDAP_SYNCREPL
struct timeval *cat;
time_t tdelta = 1;
struct re_s* rtask;
-#endif
now = slap_get_time();
if( ( global_idletimeout > 0 ) &&
else
tvp = NULL;
-#ifdef LDAP_SYNCREPL
ldap_pvt_thread_mutex_lock( &syncrepl_rq.rq_mutex );
rtask = ldap_pvt_runqueue_next_sched( &syncrepl_rq, &cat );
while ( cat && cat->tv_sec && cat->tv_sec <= now ) {
tvp = &tv;
}
}
-#endif
for ( l = 0; slap_listeners[l] != NULL; l++ ) {
if ( slap_listeners[l]->sl_sd == AC_SOCKET_INVALID ||
#include "ldap_pvt.h"
#include "slap.h"
-#ifdef LDAP_SYNC
#include "lutil.h"
-#endif
#ifdef LDAP_SLAPI
#include "slapi.h"
if ( op->o_bd->be_delete ) {
/* do the update here */
int repl_user = be_isupdate( op->o_bd, &op->o_ndn );
-#if defined(LDAP_SYNCREPL) && !defined(SLAPD_MULTIMASTER)
+#ifndef SLAPD_MULTIMASTER
if ( !op->o_bd->syncinfo && ( !op->o_bd->be_update_ndn.bv_len || repl_user ))
-#elif defined(LDAP_SYNCREPL) && defined(SLAPD_MULTIMASTER)
- if ( !op->o_bd->syncinfo ) /* LDAP_SYNCREPL overrides MM */
-#elif !defined(LDAP_SYNCREPL) && !defined(SLAPD_MULTIMASTER)
- if ( !op->o_bd->be_update_ndn.bv_len || repl_user )
+#else
+ if ( !op->o_bd->syncinfo )
#endif
{
-#ifdef LDAP_SYNC
if ( !repl_user ) {
struct berval csn = { 0 , NULL };
char csnbuf[ LDAP_LUTIL_CSNSTR_BUFSIZE ];
slap_get_csn( op, csnbuf, sizeof(csnbuf), &csn, 1 );
}
-#endif
if ( (op->o_bd->be_delete)( op, rs ) == 0 ) {
#ifdef SLAPD_MULTIMASTER
replog( op );
}
}
-#if defined(LDAP_SYNCREPL) || !defined(SLAPD_MULTIMASTER)
+#ifndef SLAPD_MULTIMASTER
} else {
BerVarray defref = NULL;
-#ifdef LDAP_SYNCREPL
if ( op->o_bd->syncinfo ) {
defref = op->o_bd->syncinfo->provideruri_bv;
- } else
-#endif
- {
+ } else {
defref = op->o_bd->be_update_refs
? op->o_bd->be_update_refs : default_referral;
}
cleanup:
-#ifdef LDAP_SYNC
slap_graduate_commit_csn( op );
-#endif
op->o_tmpfree( op->o_req_dn.bv_val, op->o_tmpmemctx );
op->o_tmpfree( op->o_req_ndn.bv_val, op->o_tmpmemctx );
/* Multimaster slapd does not have to check for replicator dn
* because it accepts each modify request
*/
-#if defined(LDAP_SYNCREPL) && !defined(SLAPD_MULTIMASTER)
+#ifndef SLAPD_MULTIMASTER
if ( !op->o_bd->syncinfo &&
( !op->o_bd->be_update_ndn.bv_len || repl_user ))
-#elif defined(LDAP_SYNCREPL) && defined(SLAPD_MULTIMASTER)
- if ( !op->o_bd->syncinfo ) /* LDAP_SYNCREPL overrides MM */
-#elif !defined(LDAP_SYNCREPL) && !defined(SLAPD_MULTIMASTER)
- if ( !op->o_bd->be_update_ndn.bv_len || repl_user )
+#else
+ if ( !op->o_bd->syncinfo )
#endif
{
int update = op->o_bd->be_update_ndn.bv_len;
replog( op );
}
-#if defined(LDAP_SYNCREPL) || !defined(SLAPD_MULTIMASTER)
+#ifndef SLAPD_MULTIMASTER
/* send a referral */
} else {
BerVarray defref = NULL;
-#ifdef LDAP_SYNCREPL
if ( op->o_bd->syncinfo ) {
defref = op->o_bd->syncinfo->provideruri_bv;
- } else
-#endif
- {
+ } else {
defref = op->o_bd->be_update_refs
? op->o_bd->be_update_refs : default_referral;
}
cleanup:
-#ifdef LDAP_SYNC
slap_graduate_commit_csn( op );
-#endif
op->o_tmpfree( op->o_req_dn.bv_val, op->o_tmpmemctx );
op->o_tmpfree( op->o_req_ndn.bv_val, op->o_tmpmemctx );
int mop = op->o_tag == LDAP_REQ_ADD
? LDAP_MOD_ADD : LDAP_MOD_REPLACE;
-#ifdef LDAP_SYNCREPL
syncinfo_t *si = op->o_si;
-#endif
assert( modtail != NULL );
assert( *modtail == NULL );
-#ifdef LDAP_SYNCREPL
- if ( SLAP_LASTMOD(op->o_bd) && ( !si || si->lastmod == LASTMOD_GEN ))
-#else
- if ( SLAP_LASTMOD(op->o_bd) )
-#endif
- {
+ if ( SLAP_LASTMOD(op->o_bd) && ( !si || si->lastmod == LASTMOD_GEN )) {
struct tm *ltm;
time_t now = slap_get_time();
ltm = gmtime( &now );
lutil_gentime( timebuf, sizeof(timebuf), ltm );
-#ifdef LDAP_SYNC
slap_get_csn( op, csnbuf, sizeof(csnbuf), &csn, 1 );
-#else
- slap_get_csn( op, csnbuf, sizeof(csnbuf), &csn, 0 );
-#endif
ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
modtail = &mod->sml_next;
}
-#ifdef LDAP_SYNCREPL
- if ( SLAP_LASTMOD(op->o_bd) && ( !si || si->lastmod == LASTMOD_GEN ))
-#else
- if ( SLAP_LASTMOD(op->o_bd) )
-#endif
- {
+ if ( SLAP_LASTMOD(op->o_bd) && ( !si || si->lastmod == LASTMOD_GEN )) {
char uuidbuf[ LDAP_LUTIL_UUIDSTR_BUFSIZE ];
-#ifdef LDAP_SYNCREPL
if ( !si ) {
-#endif
tmpval.bv_len = lutil_uuidstr( uuidbuf, sizeof( uuidbuf ) );
tmpval.bv_val = uuidbuf;
mod->sml_nvalues = NULL;
*modtail = mod;
modtail = &mod->sml_next;
-#ifdef LDAP_SYNCREPL
}
-#endif
mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
mod->sml_op = mop;
}
}
-#ifdef LDAP_SYNCREPL
- if ( SLAP_LASTMOD(op->o_bd) && ( !si || si->lastmod == LASTMOD_GEN ))
-#else
- if ( SLAP_LASTMOD(op->o_bd) )
-#endif
- {
+ if ( SLAP_LASTMOD(op->o_bd) && ( !si || si->lastmod == LASTMOD_GEN )) {
mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
mod->sml_op = mop;
mod->sml_type.bv_val = NULL;
if ( op->o_bd->be_modrdn ) {
/* do the update here */
int repl_user = be_isupdate( op->o_bd, &op->o_ndn );
-#if defined(LDAP_SYNCREPL) && !defined(SLAPD_MULTIMASTER)
+#ifndef SLAPD_MULTIMASTER
if ( !op->o_bd->syncinfo &&
( !op->o_bd->be_update_ndn.bv_len || repl_user ))
-#elif defined(LDAP_SYNCREPL) && defined(SLAPD_MULTIMASTER)
- if ( !op->o_bd->syncinfo ) /* LDAP_SYNCREPL overrides MM */
-#elif !defined(LDAP_SYNCREPL) && !defined(SLAPD_MULTIMASTER)
- if ( !op->o_bd->be_update_ndn.bv_len || repl_user )
+#else
+ if ( !op->o_bd->syncinfo )
#endif
{
op->orr_deleteoldrdn = deloldrdn;
) {
replog( op );
}
-#if defined(LDAP_SYNCREPL) || !defined(SLAPD_MULTIMASTER)
+#ifndef SLAPD_MULTIMASTER
} else {
BerVarray defref = NULL;
-#ifdef LDAP_SYNCREPL
if ( op->o_bd->syncinfo ) {
defref = op->o_bd->syncinfo->provideruri_bv;
- } else
-#endif
- {
+ } else {
defref = op->o_bd->be_update_refs
? op->o_bd->be_update_refs : default_referral;
}
cleanup:
-#ifdef LDAP_SYNC
slap_graduate_commit_csn( op );
-#endif
op->o_tmpfree( op->o_req_dn.bv_val, op->o_tmpmemctx );
op->o_tmpfree( op->o_req_ndn.bv_val, op->o_tmpmemctx );
ber_free( op->o_res_ber, 1 );
}
#endif
-#ifdef LDAP_SYNC
if ( op->o_sync_state.bv_val != NULL ) {
free( op->o_sync_state.bv_val );
}
-#endif
#if defined( LDAP_SLAPI )
if ( op->o_pb != NULL ) {
rs->sr_err = LDAP_OTHER;
#endif
-#if defined(LDAP_SYNCREPL) || !defined(SLAPD_MULTIMASTER)
+#ifndef SLAPD_MULTIMASTER
/* This does not apply to multi-master case */
} else if( op->o_bd->be_update_ndn.bv_len ) {
/* we SHOULD return a referral in this case */
BerVarray defref = NULL;
-#ifdef LDAP_SYNCREPL
if ( op->o_bd->syncinfo ) {
defref = op->o_bd->syncinfo->provideruri_bv;
} else
-#endif
{
defref = referral_rewrite( op->o_bd->be_update_refs,
NULL, NULL, LDAP_SCOPE_DEFAULT );
* ctxcsn.c
*/
-#ifdef LDAP_SYNC
LDAP_SLAPD_F (struct berval *) slap_get_commit_csn LDAP_P(( Operation * ));
LDAP_SLAPD_F (void) slap_rewind_commit_csn LDAP_P(( Operation * ));
LDAP_SLAPD_F (void) slap_graduate_commit_csn LDAP_P(( Operation * ));
LDAP_SLAPD_F (Entry *) slap_create_context_csn_entry LDAP_P(( Backend *, struct berval *));
LDAP_SLAPD_F (int) slap_get_csn LDAP_P(( Operation *, const char *, int, struct berval *, int ));
-#endif
/*
* daemon.c
(((e)->e_ocflags & SLAP_OC__END) \
? (((e)->e_ocflags & SLAP_OC_DYNAMICOBJECT) != 0) \
: is_entry_objectclass((e), slap_schema.si_oc_dynamicObject, 1))
-#ifdef LDAP_SYNCREPL
#define is_entry_glue(e) \
(((e)->e_ocflags & SLAP_OC__END) \
? (((e)->e_ocflags & SLAP_OC_GLUE) != 0) \
: is_entry_objectclass((e), slap_schema.si_oc_glue, 1))
-#endif
LDAP_SLAPD_F (int) oc_schema_info( Entry *e );
* syncrepl
*/
-#ifdef LDAP_SYNCREPL
LDAP_SLAPD_V (struct runqueue_s) syncrepl_rq;
LDAP_SLAPD_F (void) init_syncrepl LDAP_P(());
LDAP_SLAPD_F (void) syncrepl_add_glue LDAP_P(( syncinfo_t *, LDAP *, Operation*, Entry*,
Modifications*, int, struct berval*, struct berval* ));
-#endif
LDAP_END_DECL
aoc->a_vals[0].bv_val );
return LDAP_OBJECT_CLASS_VIOLATION;
-#ifdef LDAP_SYNCREPL
} else if ( sc != slap_schema.si_oc_glue && sc != oc ) {
-#else
- } else if ( sc != oc ) {
-#endif
snprintf( textbuf, textlen,
"structural object class modification "
"from '%s' to '%s' not allowed",
asc->a_vals[0].bv_val, nsc.bv_val );
return LDAP_NO_OBJECT_CLASS_MODS;
- }
-#ifdef LDAP_SYNCREPL
- else if ( sc == slap_schema.si_oc_glue ) {
+ } else if ( sc == slap_schema.si_oc_glue ) {
sc = oc;
}
-#endif
/* naming check */
-#ifdef LDAP_SYNCREPL
if ( !is_entry_objectclass ( e, slap_schema.si_oc_glue, 0 ) ) {
rc = entry_naming_check( e, text, textbuf, textlen );
if( rc != LDAP_SUCCESS ) {
} else {
/* Glue Entry */
}
-#else
- rc = entry_naming_check( e, text, textbuf, textlen );
- if( rc != LDAP_SUCCESS ) {
- return rc;
- }
-#endif
#ifdef SLAP_EXTENDED_SCHEMA
/* find the content rule for the structural class */
dynamicObjectClass, SLAP_OC_DYNAMICOBJECT,
offsetof(struct slap_internal_schema, si_oc_dynamicObject) },
#endif
-#ifdef LDAP_SYNCREPL
{ "glue", "( 1.3.6.1.4.1.4203.666.3.4 "
"NAME 'glue' "
"DESC 'Glue Entry' "
"MAY syncreplCookie )",
0, SLAP_OC_OPERATIONAL|SLAP_OC_HIDE,
offsetof(struct slap_internal_schema, si_oc_syncConsumerSubentry) },
-#endif
-#ifdef LDAP_SYNC
{ "syncProviderSubentry", "( 1.3.6.1.4.1.4203.666.3.6 "
"NAME 'syncProviderSubentry' "
"DESC 'Persistent Info for SyncRepl Producer' "
"MAY contextCSN )",
0, SLAP_OC_OPERATIONAL|SLAP_OC_HIDE,
offsetof(struct slap_internal_schema, si_oc_syncProviderSubentry) },
-#endif
{ NULL, NULL, NULL, 0, 0 }
};
offsetof(struct slap_internal_schema, si_ad_queryid) },
#endif /* LDAP_CACHING */
-#ifdef LDAP_SYNCREPL
{ "syncreplCookie", "( 1.3.6.1.4.1.4203.666.1.23 "
"NAME 'syncreplCookie' "
"DESC 'syncrepl Cookie for shadow copy' "
NULL, NULL,
NULL, NULL, NULL, NULL, NULL,
offsetof(struct slap_internal_schema, si_ad_syncreplCookie) },
-#endif
-#ifdef LDAP_SYNC
+
{ "contextCSN", "( 1.3.6.1.4.1.4203.666.1.25 "
"NAME 'contextCSN' "
"DESC 'the largest committed CSN of a context' "
NULL, NULL,
NULL, NULL, NULL, NULL, NULL,
offsetof(struct slap_internal_schema, si_ad_contextCSN) },
-#endif
/* root DSE attributes */
{ "altServer", "( 1.3.6.1.4.1.1466.101.120.6 NAME 'altServer' "
/* Sync control overrides manageDSAit */
if ( manageDSAit != SLAP_NO_CONTROL ) {
-#ifdef LDAP_SYNC
if ( op->o_sync_mode & SLAP_SYNC_REFRESH ) {
be_manageDSAit = SLAP_NO_CONTROL;
- } else
-#endif
- {
+ } else {
be_manageDSAit = manageDSAit;
}
} else {
return_results:;
-#ifdef LDAP_SYNC
if ( ( op->o_sync_mode & SLAP_SYNC_PERSIST ) )
return rs->sr_err;
-#endif
if( op->o_req_dn.bv_val != NULL) sl_free( op->o_req_dn.bv_val, op->o_tmpmemctx );
if( op->o_req_ndn.bv_val != NULL) sl_free( op->o_req_ndn.bv_val, op->o_tmpmemctx );
#define SLAP_MAX_WORKER_THREADS (16)
-#ifdef LDAP_SYNCREPL
#define SLAP_MAX_SYNCREPL_THREADS (8)
-#endif
#define SLAP_SB_MAX_INCOMING_DEFAULT ((1<<18) - 1)
#define SLAP_SB_MAX_INCOMING_AUTH ((1<<24) - 1)
#define SLAP_OC_SUBENTRY 0x0004
#define SLAP_OC_DYNAMICOBJECT 0x0008
#define SLAP_OC_COLLECTIVEATTRIBUTESUBENTRY 0x0010
-#ifdef LDAP_SYNCREPL
#define SLAP_OC_GLUE 0x0020
#define SLAP_OC__MASK 0x003F
#define SLAP_OC__END 0x0040
-#else
-#define SLAP_OC__MASK 0x001F
-#define SLAP_OC__END 0x0020
-#endif
#define SLAP_OC_OPERATIONAL 0x4000
#ifdef LDAP_DEVEL
#define SLAP_OC_HIDE 0x0000
ObjectClass *si_oc_collectiveAttributeSubentry;
ObjectClass *si_oc_dynamicObject;
-#ifdef LDAP_SYNCREPL
ObjectClass *si_oc_glue;
ObjectClass *si_oc_syncConsumerSubentry;
ObjectClass *si_oc_syncProviderSubentry;
-#endif
/* objectClass attribute descriptions */
AttributeDescription *si_ad_objectClass;
AttributeDescription *si_ad_queryid;
#endif /* LDAP_CACHING */
-#ifdef LDAP_SYNCREPL
AttributeDescription *si_ad_dseType;
AttributeDescription *si_ad_syncreplCookie;
AttributeDescription *si_ad_contextCSN;
-#endif
/* root DSE attribute descriptions */
AttributeDescription *si_ad_altServer;
#define nbackends nBackendDB
#define backends backendDB
-#ifdef LDAP_SYNCREPL
struct nonpresent_entry {
struct berval *dn;
struct berval *ndn;
LDAP_LIST_HEAD(np, nonpresent_entry) nonpresentlist;
} syncinfo_t;
-#endif /* LDAP_SYNCREPL */
-
struct slap_backend_db {
BackendInfo *bd_info; /* pointer to shared backend info */
void *be_private; /* anything the backend database needs */
void *be_pb; /* Netscape plugin */
-#ifdef LDAP_SYNC
LDAP_TAILQ_HEAD( pcl, slap_csn_entry ) be_pending_csn_list;
ldap_pvt_thread_mutex_t be_pcl_mutex;
struct berval be_context_csn;
ldap_pvt_thread_mutex_t be_context_csn_mutex;
-#endif
-#ifdef LDAP_SYNCREPL
syncinfo_t *syncinfo; /* For syncrepl */
-#endif
};
struct slap_conn;
} PagedResultsState;
-#ifdef LDAP_SYNC
#define LDAP_PSEARCH_BY_ADD 0x01
#define LDAP_PSEARCH_BY_DELETE 0x02
#define LDAP_PSEARCH_BY_PREMODIFY 0x03
long state;
LDAP_TAILQ_ENTRY (slap_csn_entry) csn_link;
};
-#endif
-
/*
* represents an operation pending from an ldap client
#define get_pagedresults(op) (0)
#endif
-#ifdef LDAP_SYNC
char o_sync;
char o_sync_mode;
#define SLAP_SYNC_NONE (0x0)
int o_ps_entries;
LDAP_LIST_ENTRY(slap_op) o_ps_link;
LDAP_LIST_HEAD(pe, psid_entry) o_pm_list;
-#endif
AuthorizationInformation o_authz;
#define get_assertion(op) ((op)->o_assertion)
ValuesReturnFilter *o_vrFilter; /* ValuesReturnFilter */
-#ifdef LDAP_SYNCREPL
syncinfo_t* o_si;
-#endif
#ifdef LDAP_SLAPI
void *o_pb; /* NS-SLAPI plugin */
#define SLAP_LDAPDN_PRETTY 0x1
#define SLAP_LDAPDN_MAXLEN 8192
-#ifdef LDAP_SYNC
#define SLAP_SEARCH_MAX_CTRLS 10
-#endif
#ifdef LDAP_DEVEL
#define SLAP_CTRL_HIDE 0x00000000U
#include "slap.h"
#include "lutil_ldap.h"
-#ifdef LDAP_SYNCREPL
-
#include "ldap_rq.h"
static void
free( str );
return( *out );
}
-#endif
#include "../slap.h"
-#ifdef LDAP_SYNCREPL
#include "ldap_rq.h"
-#endif
/* needed by WIN32 and back-monitor */
time_t starttime;
return -1;
}
-#ifdef LDAP_SYNCREPL
struct runqueue_s syncrepl_rq;
void init_syncrepl( )
return NULL;
}
#endif
-#endif