From 090ac0a7721ed24760673c964e8b9cdddd096094 Mon Sep 17 00:00:00 2001 From: Jong Hyuk Choi Date: Wed, 27 Aug 2003 22:16:04 +0000 Subject: [PATCH] unifdef LDAP_SYNC and LDAP_SYNCREPL --- clients/tools/ldapsearch.c | 27 ---- include/ldap.h | 10 -- libraries/libldap/error.c | 2 - servers/slapd/add.c | 22 +-- servers/slapd/back-bdb/add.c | 24 +-- servers/slapd/back-bdb/back-bdb.h | 6 - servers/slapd/back-bdb/cache.c | 4 - servers/slapd/back-bdb/ctxcsn.c | 2 - servers/slapd/back-bdb/delete.c | 29 +--- servers/slapd/back-bdb/init.c | 7 - servers/slapd/back-bdb/modify.c | 36 +---- servers/slapd/back-bdb/modrdn.c | 45 +----- servers/slapd/back-bdb/passwd.c | 4 - servers/slapd/back-bdb/proto-bdb.h | 8 - servers/slapd/back-bdb/search.c | 223 +++++----------------------- servers/slapd/back-ldbm/add.c | 48 ------ servers/slapd/back-ldbm/back-ldbm.h | 2 - servers/slapd/back-ldbm/bind.c | 48 ------ servers/slapd/back-ldbm/delete.c | 9 +- servers/slapd/back-ldbm/modify.c | 17 +-- servers/slapd/back-ldbm/modrdn.c | 13 +- servers/slapd/back-ldbm/passwd.c | 6 +- servers/slapd/back-ldbm/search.c | 14 -- servers/slapd/backend.c | 22 +-- servers/slapd/cancel.c | 2 - servers/slapd/config.c | 6 - servers/slapd/connection.c | 2 - servers/slapd/controls.c | 6 - servers/slapd/ctxcsn.c | 3 - servers/slapd/daemon.c | 6 - servers/slapd/delete.c | 21 +-- servers/slapd/modify.c | 48 +----- servers/slapd/modrdn.c | 17 +-- servers/slapd/operation.c | 2 - servers/slapd/passwd.c | 4 +- servers/slapd/proto-slap.h | 6 - servers/slapd/schema_check.c | 16 +- servers/slapd/schema_prep.c | 9 +- servers/slapd/search.c | 7 +- servers/slapd/slap.h | 27 ---- servers/slapd/syncrepl.c | 3 - servers/slapd/tools/mimic.c | 4 - 42 files changed, 86 insertions(+), 731 deletions(-) diff --git a/clients/tools/ldapsearch.c b/clients/tools/ldapsearch.c index e98d368923..31be49d5f0 100644 --- a/clients/tools/ldapsearch.c +++ b/clients/tools/ldapsearch.c @@ -75,10 +75,8 @@ usage( void ) #ifdef LDAP_CONTROL_SUBENTRIES fprintf( stderr, _(" [!]subentries[=true|false] (subentries)\n")); #endif -#ifdef LDAP_SYNC fprintf( stderr, _(" [!]sync=ro[/] (LDAP Sync refreshOnly)\n")); fprintf( stderr, _(" rp[/][/] (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")); @@ -153,11 +151,9 @@ static char *vrFilter = NULL; 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; @@ -313,7 +309,6 @@ handle_private_option( int i ) if( crit ) subentries *= -1; #endif -#ifdef LDAP_SYNC } else if ( strcasecmp( control, "sync" ) == 0 ) { char *cookiep; char *slimitp; @@ -357,7 +352,6 @@ handle_private_option( int i ) exit( EXIT_FAILURE ); } if ( crit ) ldapsync *= -1; -#endif } else { fprintf( stderr, _("Invalid control name: %s\n"), control ); @@ -447,10 +441,8 @@ main( int argc, char **argv ) LDAP *ld = NULL; BerElement *seber = NULL, *vrber = NULL, *prber = NULL; -#ifdef LDAP_SYNC BerElement *syncber = NULL; struct berval *syncbvalp = NULL; -#endif tool_init(); @@ -555,9 +547,7 @@ getNextPage: #ifdef LDAP_CONTROL_PAGEDRESULTS || pageSize #endif -#ifdef LDAP_SYNC || ldapsync -#endif || subentries || valuesReturnFilter ) { int err; @@ -597,7 +587,6 @@ getNextPage: } #endif -#ifdef LDAP_SYNC if ( ldapsync ) { if (( syncber = ber_alloc_t(LBER_USE_DER)) == NULL ) { return EXIT_FAILURE; @@ -625,7 +614,6 @@ getNextPage: c[i].ldctl_iscritical = ldapsync < 0; i++; } -#endif if ( valuesReturnFilter ) { if (( vrber = ber_alloc_t(LBER_USE_DER)) == NULL ) { @@ -831,12 +819,10 @@ static int dosearch( 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 ) ); @@ -894,10 +880,8 @@ static int dosearch( 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: @@ -919,14 +903,12 @@ static int dosearch( 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: @@ -937,19 +919,14 @@ static int dosearch( } #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 ); @@ -966,10 +943,8 @@ static int dosearch( ldap_memfree( retoid ); ber_bvfree( retdata ); goto done; -#endif } -#ifdef LDAP_SYNC if ( ldapsync && sync_slimit != -1 && nresponses_psearch >= sync_slimit ) { BerElement *msgidber = NULL; @@ -981,8 +956,6 @@ static int dosearch( msgidvalp, NULL, NULL, &cancel_msgid); nresponses_psearch = -1; } -#endif - } ldap_msgfree( res ); diff --git a/include/ldap.h b/include/ldap.h index 2fa360a33c..8a54468ad5 100644 --- a/include/ldap.h +++ b/include/ldap.h @@ -201,9 +201,6 @@ typedef struct ldapcontrol { #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" @@ -222,7 +219,6 @@ typedef struct ldapcontrol { #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" @@ -297,9 +293,7 @@ typedef struct ldapcontrol { #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 */ @@ -476,14 +470,12 @@ typedef struct ldapcontrol { #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 @@ -496,11 +488,9 @@ typedef struct ldapcontrol { #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. diff --git a/libraries/libldap/error.c b/libraries/libldap/error.c index ac8e182416..e4359eca4f 100644 --- a/libraries/libldap/error.c +++ b/libraries/libldap/error.c @@ -99,14 +99,12 @@ static struct ldaperror ldap_builtin_errlist[] = { {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")}, diff --git a/servers/slapd/add.c b/servers/slapd/add.c index e5bf5b6729..79e726be22 100644 --- a/servers/slapd/add.c +++ b/servers/slapd/add.c @@ -243,13 +243,11 @@ do_add( Operation *op, SlapReply *rs ) 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; @@ -311,7 +309,7 @@ do_add( Operation *op, SlapReply *rs ) e = NULL; } -#if defined(LDAP_SYNCREPL) || !defined(SLAPD_MULTIMASTER) +#ifndef SLAPD_MULTIMASTER } else { BerVarray defref = NULL; #ifdef LDAP_SLAPI @@ -326,12 +324,9 @@ do_add( Operation *op, SlapReply *rs ) } #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; } @@ -376,9 +371,7 @@ do_add( Operation *op, SlapReply *rs ) done: -#ifdef LDAP_SYNC slap_graduate_commit_csn( op ); -#endif if( modlist != NULL ) { slap_mods_free( modlist ); @@ -409,10 +402,7 @@ slap_mods2entry( 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 ); diff --git a/servers/slapd/back-bdb/add.c b/servers/slapd/back-bdb/add.c index 9877210970..af30412f1f 100644 --- a/servers/slapd/back-bdb/add.c +++ b/servers/slapd/back-bdb/add.c @@ -35,13 +35,11 @@ bdb_add(Operation *op, SlapReply *rs ) 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 ); @@ -317,11 +315,7 @@ retry: /* transaction retry */ 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 ); @@ -470,11 +464,7 @@ retry: /* transaction retry */ 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 : @@ -483,7 +473,6 @@ retry: /* transaction retry */ goto retry; } } -#endif if ( op->o_noop ) { if (( rs->sr_err=TXN_ABORT( ltid )) != 0 ) { @@ -504,9 +493,7 @@ retry: /* transaction retry */ } 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; @@ -517,18 +504,13 @@ retry: /* transaction retry */ 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"; @@ -566,13 +548,11 @@ retry: /* transaction retry */ 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(); diff --git a/servers/slapd/back-bdb/back-bdb.h b/servers/slapd/back-bdb/back-bdb.h index d8880b3147..93356b13b5 100644 --- a/servers/slapd/back-bdb/back-bdb.h +++ b/servers/slapd/back-bdb/back-bdb.h @@ -14,9 +14,7 @@ LDAP_BEGIN_DECL -#ifdef LDAP_SYNCREPL #define BDB_SUBENTRIES 1 -#endif #define DN_BASE_PREFIX SLAP_INDEX_EQUALITY_PREFIX #define DN_ONE_PREFIX '%' @@ -158,9 +156,7 @@ struct bdb_info { 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; @@ -223,11 +219,9 @@ struct bdb_op_info { #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 diff --git a/servers/slapd/back-bdb/cache.c b/servers/slapd/back-bdb/cache.c index a55dcf0870..c9f17b6493 100644 --- a/servers/slapd/back-bdb/cache.c +++ b/servers/slapd/back-bdb/cache.c @@ -34,11 +34,7 @@ bdb_cache_entryinfo_new( ) } /* 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, diff --git a/servers/slapd/back-bdb/ctxcsn.c b/servers/slapd/back-bdb/ctxcsn.c index 44f3d003ec..7ca71a0f01 100644 --- a/servers/slapd/back-bdb/ctxcsn.c +++ b/servers/slapd/back-bdb/ctxcsn.c @@ -30,7 +30,6 @@ #include "back-bdb.h" #include "external.h" -#ifdef LDAP_SYNC int bdb_csn_commit( Operation *op, @@ -201,4 +200,3 @@ rewind : slap_rewind_commit_csn( op ); return BDB_CSN_RETRY; } -#endif diff --git a/servers/slapd/back-bdb/delete.c b/servers/slapd/back-bdb/delete.c index db013e6a85..2c7316f3d3 100644 --- a/servers/slapd/back-bdb/delete.c +++ b/servers/slapd/back-bdb/delete.c @@ -35,13 +35,11 @@ bdb_delete( Operation *op, SlapReply *rs ) 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 ); @@ -230,11 +228,8 @@ retry: /* transaction retry */ } } -#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); @@ -253,12 +248,8 @@ retry: /* transaction retry */ 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 ); } @@ -460,11 +451,7 @@ retry: /* transaction retry */ 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 : @@ -473,7 +460,6 @@ retry: /* transaction retry */ goto retry; } } -#endif if( op->o_noop ) { if ( ( rs->sr_err = TXN_ABORT( ltid ) ) != 0 ) { @@ -483,25 +469,18 @@ retry: /* transaction retry */ 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 ); } @@ -540,13 +519,11 @@ retry: /* transaction retry */ 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(); diff --git a/servers/slapd/back-bdb/init.c b/servers/slapd/back-bdb/init.c index 0ab747ac7c..7d57e497d0 100644 --- a/servers/slapd/back-bdb/init.c +++ b/servers/slapd/back-bdb/init.c @@ -91,9 +91,7 @@ bdb_db_init( BackendDB *be ) 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 ); @@ -674,13 +672,8 @@ bdb_initialize( 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; diff --git a/servers/slapd/back-bdb/modify.c b/servers/slapd/back-bdb/modify.c index a7ed134aef..5f6d87e26e 100644 --- a/servers/slapd/back-bdb/modify.c +++ b/servers/slapd/back-bdb/modify.c @@ -328,14 +328,12 @@ bdb_modify( Operation *op, SlapReply *rs ) 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 ); @@ -356,7 +354,6 @@ retry: /* transaction retry */ "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 ); @@ -364,7 +361,6 @@ retry: /* transaction retry */ pm_list = LDAP_LIST_NEXT ( pm_list, ps_link ); ch_free( pm_prev ); } -#endif rs->sr_err = TXN_ABORT( ltid ); ltid = NULL; @@ -437,11 +433,8 @@ retry: /* transaction retry */ 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 ) @@ -451,12 +444,8 @@ retry: /* transaction retry */ 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 ); } @@ -500,13 +489,11 @@ retry: /* transaction retry */ 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, @@ -575,11 +562,7 @@ retry: /* transaction retry */ 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 : @@ -588,7 +571,6 @@ retry: /* transaction retry */ goto retry; } } -#endif if( op->o_noop ) { if ( ( rs->sr_err = TXN_ABORT( ltid ) ) != 0 ) { @@ -598,24 +580,18 @@ retry: /* transaction retry */ 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 ); } @@ -655,7 +631,6 @@ retry: /* transaction retry */ 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 ) { @@ -671,7 +646,6 @@ return_results: ch_free( pm_prev ); } } -#endif if( rs->sr_err == LDAP_SUCCESS && bdb->bi_txn_cp ) { ldap_pvt_thread_yield(); @@ -681,7 +655,6 @@ return_results: 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 ); @@ -689,7 +662,6 @@ done: pm_list = LDAP_LIST_NEXT ( pm_list, ps_link ); ch_free( pm_prev ); } -#endif TXN_ABORT( ltid ); op->o_private = NULL; } diff --git a/servers/slapd/back-bdb/modrdn.c b/servers/slapd/back-bdb/modrdn.c index b158ed7f42..35fa4e966e 100644 --- a/servers/slapd/back-bdb/modrdn.c +++ b/servers/slapd/back-bdb/modrdn.c @@ -53,14 +53,12 @@ bdb_modrdn( Operation *op, SlapReply *rs ) 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", @@ -92,7 +90,6 @@ retry: /* transaction retry */ 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 ); @@ -100,7 +97,6 @@ retry: /* transaction retry */ pm_list = LDAP_LIST_NEXT ( pm_list, ps_link ); ch_free( pm_prev ); } -#endif rs->sr_err = TXN_ABORT( ltid ); ltid = NULL; @@ -164,11 +160,8 @@ retry: /* transaction retry */ } 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 ) @@ -178,12 +171,8 @@ retry: /* transaction retry */ 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 ); } @@ -855,13 +844,11 @@ retry: /* transaction retry */ 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, @@ -915,11 +902,7 @@ retry: /* transaction retry */ 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 : @@ -928,7 +911,6 @@ retry: /* transaction retry */ goto retry; } } -#endif if( op->o_noop ) { if(( rs->sr_err=TXN_ABORT( ltid )) != 0 ) { @@ -947,25 +929,18 @@ retry: /* transaction retry */ 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"; @@ -1003,7 +978,6 @@ retry: /* transaction retry */ 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 ) { @@ -1019,7 +993,6 @@ return_results: ch_free( pm_prev ); } } -#endif if( rs->sr_err == LDAP_SUCCESS && bdb->bi_txn_cp ) { ldap_pvt_thread_yield(); @@ -1064,15 +1037,13 @@ 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_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; } diff --git a/servers/slapd/back-bdb/passwd.c b/servers/slapd/back-bdb/passwd.c index 528f3c4cb4..c75aba915d 100644 --- a/servers/slapd/back-bdb/passwd.c +++ b/servers/slapd/back-bdb/passwd.c @@ -173,12 +173,8 @@ retry: /* transaction retry */ 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; diff --git a/servers/slapd/back-bdb/proto-bdb.h b/servers/slapd/back-bdb/proto-bdb.h index a61522506a..18a5e304d7 100644 --- a/servers/slapd/back-bdb/proto-bdb.h +++ b/servers/slapd/back-bdb/proto-bdb.h @@ -477,7 +477,6 @@ void bdb_cache_delete_cleanup( ); 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, @@ -486,7 +485,6 @@ int bdb_cache_entry_db_relock( int rw, int tryOnly, DB_LOCK *lock ); -#endif #ifdef BDB_REUSE_LOCKERS @@ -507,8 +505,6 @@ int bdb_locker_id( Operation *op, DB_ENV *env, int *locker ); * 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) @@ -524,10 +520,7 @@ int bdb_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) @@ -558,7 +551,6 @@ bdb_send_ldap_intermediate( SlapReply *rs, int state, struct berval *cookie ); -#endif /* * trans.c diff --git a/servers/slapd/back-bdb/search.c b/servers/slapd/back-bdb/search.c index ed3606fe32..5fc72c5818 100644 --- a/servers/slapd/back-bdb/search.c +++ b/servers/slapd/back-bdb/search.c @@ -280,18 +280,11 @@ nextido: 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) @@ -359,11 +352,6 @@ int bdb_search( Operation *op, SlapReply *rs ) 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; @@ -379,7 +367,6 @@ int bdb_search( Operation *op, SlapReply *rs ) 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; @@ -401,7 +388,6 @@ int bdb_search( Operation *op, SlapReply *rs ) int entry_sync_state = -1; AttributeName null_attr; int no_sync_state_change = 0; -#endif struct slap_limits_set *limit = NULL; int isroot = 0; @@ -416,7 +402,6 @@ int bdb_search( Operation *op, SlapReply *rs ) #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 ) { @@ -439,19 +424,15 @@ int bdb_search( Operation *op, SlapReply *rs ) 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; } @@ -680,17 +661,13 @@ dn2entry_retry: } 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 ); } @@ -723,12 +700,9 @@ ctxcsn_retry : } 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 ) { @@ -740,7 +714,6 @@ ctxcsn_retry : search_context_csn = NULL; } } -#endif /* select candidates */ if ( sop->oq_search.rs_scope == LDAP_SCOPE_BASE ) { @@ -752,16 +725,13 @@ ctxcsn_retry : 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 ); @@ -779,7 +749,6 @@ ctxcsn_retry : candidates[0] = 1; candidates[1] = ps_e->e_id; } -#endif if ( candidates[0] == 0 ) { #ifdef NEW_LOGGING @@ -844,7 +813,6 @@ ctxcsn_retry : } #endif -#ifdef LDAP_SYNC if ( (sop->o_sync_mode & SLAP_SYNC_REFRESH) || IS_PSEARCH ) { MatchingRule *mr; @@ -899,7 +867,6 @@ ctxcsn_retry : csnfge.f_next = sop->oq_search.rs_filter; } } -#endif for ( id = bdb_idl_first( candidates, &cursor ); id != NOID; @@ -934,9 +901,7 @@ loop_begin: } -#ifdef LDAP_SYNC if (!IS_PSEARCH) { -#endif id2entry_retry: /* get the entry with reader lock */ ei = NULL; @@ -976,11 +941,9 @@ id2entry_retry: goto loop_continue; } -#ifdef LDAP_SYNC } else { e = ps_e; } -#endif rs->sr_entry = e; #ifdef BDB_SUBENTRIES @@ -1117,14 +1080,11 @@ id2entry_retry: 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 ); @@ -1157,24 +1117,19 @@ id2entry_retry: 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; @@ -1203,7 +1158,6 @@ id2entry_retry: result = 0; } else #endif -#ifdef LDAP_SYNC if (IS_PSEARCH) { int premodify_found = 0; int entry_sync_state; @@ -1283,9 +1237,7 @@ id2entry_retry: 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 ); @@ -1333,43 +1285,39 @@ loop_continue: } 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; @@ -1667,8 +1615,6 @@ done: } #endif -#ifdef LDAP_SYNC -#if 1 int bdb_build_sync_state_ctrl( Operation *op, @@ -1734,102 +1680,6 @@ bdb_build_sync_state_ctrl( 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( @@ -1921,4 +1771,3 @@ bdb_send_ldap_intermediate( return LDAP_SUCCESS; } -#endif diff --git a/servers/slapd/back-ldbm/add.c b/servers/slapd/back-ldbm/add.c index 8e6b560302..7406a93d7e 100644 --- a/servers/slapd/back-ldbm/add.c +++ b/servers/slapd/back-ldbm/add.c @@ -51,11 +51,7 @@ ldbm_back_add( #endif send_ldap_result( op, rs ); -#ifdef LDAP_SYNCREPL return rs->sr_err; -#else - return( -1 ); -#endif } #ifdef LDBM_SUBENTRIES @@ -77,11 +73,7 @@ ldbm_back_add( 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 */ @@ -92,11 +84,7 @@ ldbm_back_add( 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 } /* @@ -147,11 +135,7 @@ ldbm_back_add( 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, @@ -173,11 +157,7 @@ ldbm_back_add( 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 @@ -214,11 +194,7 @@ ldbm_back_add( 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 ) ) { @@ -244,11 +220,7 @@ ldbm_back_add( 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 @@ -291,17 +263,9 @@ ldbm_back_add( 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 @@ -318,11 +282,7 @@ ldbm_back_add( send_ldap_error( op, rs, LDAP_NO_SUCH_OBJECT, NULL ); -#ifdef LDAP_SYNCREPL return LDAP_NO_SUCH_OBJECT; -#else - return -1; -#endif } } @@ -362,11 +322,7 @@ ldbm_back_add( send_ldap_error( op, rs, LDAP_OTHER, "next_id add failed" ); -#ifdef LDAP_SYNCREPL return LDAP_OTHER; -#else - return( -1 ); -#endif } /* @@ -394,11 +350,7 @@ ldbm_back_add( 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; diff --git a/servers/slapd/back-ldbm/back-ldbm.h b/servers/slapd/back-ldbm/back-ldbm.h index 0b206a6e4e..669f80793d 100644 --- a/servers/slapd/back-ldbm/back-ldbm.h +++ b/servers/slapd/back-ldbm/back-ldbm.h @@ -12,9 +12,7 @@ LDAP_BEGIN_DECL -#ifdef LDAP_SYNCREPL #define LDBM_SUBENTRIES 1 -#endif #define DEFAULT_CACHE_SIZE 1000 diff --git a/servers/slapd/back-ldbm/bind.c b/servers/slapd/back-ldbm/bind.c index 5474baf0bf..73ab8217d1 100644 --- a/servers/slapd/back-ldbm/bind.c +++ b/servers/slapd/back-ldbm/bind.c @@ -81,11 +81,7 @@ ldbm_back_bind( 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 ); @@ -103,11 +99,7 @@ ldbm_back_bind( #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 @@ -126,11 +118,7 @@ ldbm_back_bind( 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; } @@ -158,11 +146,7 @@ ldbm_back_bind( ber_bvarray_free( rs->sr_ref ); -#ifdef LDAP_SYNCREPL rc = rs->sr_err; -#else - rc = 1; -#endif goto return_results; } @@ -172,11 +156,7 @@ ldbm_back_bind( 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; } @@ -184,22 +164,14 @@ ldbm_back_bind( 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; } @@ -210,11 +182,7 @@ ldbm_back_bind( 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; } @@ -223,11 +191,7 @@ ldbm_back_bind( { send_ldap_error( op, rs, LDAP_INSUFFICIENT_ACCESS, NULL ); -#ifdef LDAP_SYNCREPL rc = LDAP_INSUFFICIENT_ACCESS; -#else - rc = 1; -#endif goto return_results; } @@ -243,11 +207,7 @@ ldbm_back_bind( 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 */ @@ -259,11 +219,7 @@ ldbm_back_bind( 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; } } @@ -281,11 +237,7 @@ ldbm_back_bind( 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; } diff --git a/servers/slapd/back-ldbm/delete.c b/servers/slapd/back-ldbm/delete.c index 2cf8bfa912..73ce466683 100644 --- a/servers/slapd/back-ldbm/delete.c +++ b/servers/slapd/back-ldbm/delete.c @@ -42,11 +42,8 @@ ldbm_back_delete( /* 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 ); @@ -63,12 +60,8 @@ ldbm_back_delete( 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 ); } diff --git a/servers/slapd/back-ldbm/modify.c b/servers/slapd/back-ldbm/modify.c index a729fc3172..1e78935a79 100644 --- a/servers/slapd/back-ldbm/modify.c +++ b/servers/slapd/back-ldbm/modify.c @@ -314,11 +314,8 @@ ldbm_back_modify( /* 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 ) @@ -326,12 +323,8 @@ ldbm_back_modify( : 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 ); } @@ -342,11 +335,7 @@ ldbm_back_modify( 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 ) ) @@ -403,9 +392,5 @@ ldbm_back_modify( 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 } diff --git a/servers/slapd/back-ldbm/modrdn.c b/servers/slapd/back-ldbm/modrdn.c index b739afc618..7200a7bc48 100644 --- a/servers/slapd/back-ldbm/modrdn.c +++ b/servers/slapd/back-ldbm/modrdn.c @@ -83,11 +83,8 @@ ldbm_back_modrdn( 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 ) @@ -95,12 +92,8 @@ ldbm_back_modrdn( : 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 ); } @@ -112,11 +105,7 @@ ldbm_back_modrdn( 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 */ diff --git a/servers/slapd/back-ldbm/passwd.c b/servers/slapd/back-ldbm/passwd.c index 5e7bde2932..18e8920f25 100644 --- a/servers/slapd/back-ldbm/passwd.c +++ b/servers/slapd/back-ldbm/passwd.c @@ -103,12 +103,8 @@ ldbm_back_exop_passwd( 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; diff --git a/servers/slapd/back-ldbm/search.c b/servers/slapd/back-ldbm/search.c index 8c09b37331..5b822d5c74 100644 --- a/servers/slapd/back-ldbm/search.c +++ b/servers/slapd/back-ldbm/search.c @@ -115,11 +115,7 @@ ldbm_back_search( 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 ) ) { @@ -163,11 +159,7 @@ ldbm_back_search( } ber_memfree( matched_dn.bv_val ); -#ifdef LDAP_SYNCREPL return LDAP_OTHER; -#else - return 1; -#endif } if ( is_entry_alias( e ) ) { @@ -205,11 +197,7 @@ searchit: rs->sr_err = LDAP_SUCCESS; send_ldap_result( op, rs ); -#ifdef LDAP_SYNCREPL rc = LDAP_OTHER; -#else - rc = 1; -#endif goto done; } @@ -454,11 +442,9 @@ searchit: 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 ); diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c index b6d80bec5c..be24c8189b 100644 --- a/servers/slapd/backend.c +++ b/servers/slapd/backend.c @@ -128,18 +128,14 @@ BackendInfo *backendInfo = NULL; 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 */ @@ -248,9 +244,7 @@ int backend_startup(Backend *be) int i; int rc = 0; -#ifdef LDAP_SYNCREPL init_syncrepl(); -#endif if( ! ( nBackendDB > 0 ) ) { /* no databases */ @@ -268,9 +262,7 @@ int backend_startup(Backend *be) 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", @@ -338,20 +330,16 @@ int backend_startup(Backend *be) } } -#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( @@ -369,7 +357,6 @@ int backend_startup(Backend *be) } } -#ifdef LDAP_SYNCREPL if ( backendDB[i].syncinfo != NULL ) { syncinfo_t *si = ( syncinfo_t * ) backendDB[i].syncinfo; si->be = &backendDB[i]; @@ -378,7 +365,6 @@ int backend_startup(Backend *be) do_syncrepl, (void *) backendDB[i].syncinfo ); ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex ); } -#endif } return rc; @@ -461,9 +447,7 @@ int backend_destroy(void) 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++ ) { @@ -544,16 +528,12 @@ backend_db_init( 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; diff --git a/servers/slapd/cancel.c b/servers/slapd/cancel.c index a5ef060282..0916bcac98 100644 --- a/servers/slapd/cancel.c +++ b/servers/slapd/cancel.c @@ -78,7 +78,6 @@ int cancel_extop( Operation *op, SlapReply *rs ) } if ( !found ) { -#ifdef LDAP_SYNC for ( i = 0; i < nbackends; i++ ) { op->o_bd = &backends[i]; if( !op->o_bd->be_cancel ) continue; @@ -91,7 +90,6 @@ int cancel_extop( Operation *op, SlapReply *rs ) } 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; diff --git a/servers/slapd/config.c b/servers/slapd/config.c index c619eb5156..5f072309db 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -80,10 +80,8 @@ static int fp_parse_line(int lineno, char *line); 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 ) @@ -1747,12 +1745,10 @@ 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 ) { @@ -2733,7 +2729,6 @@ config_destroy( ) acl_destroy( global_acl, NULL ); } -#ifdef LDAP_SYNCREPL static void add_syncrepl( Backend *be, @@ -3046,4 +3041,3 @@ parse_syncrepl_line( return 0; } -#endif /* LDAP_SYNCREPL */ diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index 2f4d897850..fc693bdedb 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -1085,14 +1085,12 @@ operations_error: 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: diff --git a/servers/slapd/controls.c b/servers/slapd/controls.c index 8a022a0dd4..e24ce18023 100644 --- a/servers/slapd/controls.c +++ b/servers/slapd/controls.c @@ -32,9 +32,7 @@ static SLAP_CTRL_PARSE_FN parseDomainScope; #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 */ @@ -98,11 +96,9 @@ static struct slap_control control_defs[] = { { 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) }, @@ -1093,7 +1089,6 @@ static int parseDomainScope ( } #endif -#ifdef LDAP_SYNC static int parseLdupSync ( Operation *op, SlapReply *rs, @@ -1179,4 +1174,3 @@ static int parseLdupSync ( return LDAP_SUCCESS; } -#endif diff --git a/servers/slapd/ctxcsn.c b/servers/slapd/ctxcsn.c index 1f9f1c08be..381784396f 100644 --- a/servers/slapd/ctxcsn.c +++ b/servers/slapd/ctxcsn.c @@ -33,8 +33,6 @@ #include "slap.h" #include "lutil_ldap.h" -#ifdef LDAP_SYNC - struct berval * slap_get_commit_csn( Operation *op ) { @@ -315,4 +313,3 @@ slap_get_csn( return LDAP_SUCCESS; } -#endif diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index 6db9fa7222..042fa24b01 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -20,9 +20,7 @@ #include "lutil.h" #include "slap.h" -#ifdef LDAP_SYNCREPL #include "ldap_rq.h" -#endif #ifdef HAVE_TCPD #include @@ -1256,11 +1254,9 @@ slapd_daemon_task( 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 ) && @@ -1349,7 +1345,6 @@ slapd_daemon_task( 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 ) { @@ -1377,7 +1372,6 @@ slapd_daemon_task( tvp = &tv; } } -#endif for ( l = 0; slap_listeners[l] != NULL; l++ ) { if ( slap_listeners[l]->sl_sd == AC_SOCKET_INVALID || diff --git a/servers/slapd/delete.c b/servers/slapd/delete.c index 6b4791e883..7c46560c4e 100644 --- a/servers/slapd/delete.c +++ b/servers/slapd/delete.c @@ -25,9 +25,7 @@ #include "ldap_pvt.h" #include "slap.h" -#ifdef LDAP_SYNC #include "lutil.h" -#endif #ifdef LDAP_SLAPI #include "slapi.h" @@ -194,22 +192,18 @@ do_delete( 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 @@ -219,15 +213,12 @@ do_delete( 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; } @@ -266,9 +257,7 @@ do_delete( 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 ); diff --git a/servers/slapd/modify.c b/servers/slapd/modify.c index decaa9f684..95af77aa0d 100644 --- a/servers/slapd/modify.c +++ b/servers/slapd/modify.c @@ -445,13 +445,11 @@ do_modify( /* 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; @@ -492,16 +490,13 @@ do_modify( 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; } @@ -543,9 +538,7 @@ do_modify( 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 ); @@ -773,19 +766,12 @@ int slap_mods_opattrs( 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(); @@ -793,11 +779,7 @@ int slap_mods_opattrs( 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 ); @@ -842,17 +824,10 @@ int slap_mods_opattrs( 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; @@ -869,9 +844,7 @@ int slap_mods_opattrs( mod->sml_nvalues = NULL; *modtail = mod; modtail = &mod->sml_next; -#ifdef LDAP_SYNCREPL } -#endif mod = (Modifications *) ch_malloc( sizeof( Modifications ) ); mod->sml_op = mop; @@ -906,12 +879,7 @@ int slap_mods_opattrs( } } -#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; diff --git a/servers/slapd/modrdn.c b/servers/slapd/modrdn.c index 4f8551a53e..f780dd3aa2 100644 --- a/servers/slapd/modrdn.c +++ b/servers/slapd/modrdn.c @@ -353,13 +353,11 @@ do_modrdn( 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; @@ -370,15 +368,12 @@ do_modrdn( ) { 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; } @@ -417,9 +412,7 @@ do_modrdn( 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 ); diff --git a/servers/slapd/operation.c b/servers/slapd/operation.c index 34050fd5fb..4efd292a80 100644 --- a/servers/slapd/operation.c +++ b/servers/slapd/operation.c @@ -65,11 +65,9 @@ slap_op_free( Operation *op ) 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 ) { diff --git a/servers/slapd/passwd.c b/servers/slapd/passwd.c index edb34415e4..d1f7cdcd32 100644 --- a/servers/slapd/passwd.c +++ b/servers/slapd/passwd.c @@ -52,16 +52,14 @@ int passwd_extop( 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 ); diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 162dc8ddc8..1acac49d95 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -358,13 +358,11 @@ LDAP_SLAPD_F (ContentRule *) cr_bvfind LDAP_P(( * 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 @@ -734,12 +732,10 @@ LDAP_SLAPD_F (int) is_entry_objectclass LDAP_P(( (((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 ); @@ -1159,7 +1155,6 @@ LDAP_SLAPD_F (int) do_extended LDAP_P((Operation *op, SlapReply *rs)); * syncrepl */ -#ifdef LDAP_SYNCREPL LDAP_SLAPD_V (struct runqueue_s) syncrepl_rq; LDAP_SLAPD_F (void) init_syncrepl LDAP_P(()); @@ -1179,7 +1174,6 @@ LDAP_SLAPD_F (char **) str2clist LDAP_P(( char ***, char *, const char * )); LDAP_SLAPD_F (void) syncrepl_add_glue LDAP_P(( syncinfo_t *, LDAP *, Operation*, Entry*, Modifications*, int, struct berval*, struct berval* )); -#endif LDAP_END_DECL diff --git a/servers/slapd/schema_check.c b/servers/slapd/schema_check.c index 446202e86c..2aeafa3abd 100644 --- a/servers/slapd/schema_check.c +++ b/servers/slapd/schema_check.c @@ -214,25 +214,17 @@ entry_schema_check( 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 ) { @@ -241,12 +233,6 @@ entry_schema_check( } 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 */ diff --git a/servers/slapd/schema_prep.c b/servers/slapd/schema_prep.c index a9ddbd09e8..e29fb64f41 100644 --- a/servers/slapd/schema_prep.c +++ b/servers/slapd/schema_prep.c @@ -224,7 +224,6 @@ static struct slap_schema_oc_map { 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' " @@ -238,8 +237,6 @@ static struct slap_schema_oc_map { "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' " @@ -247,7 +244,6 @@ static struct slap_schema_oc_map { "MAY contextCSN )", 0, SLAP_OC_OPERATIONAL|SLAP_OC_HIDE, offsetof(struct slap_internal_schema, si_oc_syncProviderSubentry) }, -#endif { NULL, NULL, NULL, 0, 0 } }; @@ -423,7 +419,6 @@ static struct slap_schema_ad_map { 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' " @@ -435,8 +430,7 @@ static struct slap_schema_ad_map { 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' " @@ -448,7 +442,6 @@ static struct slap_schema_ad_map { 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' " diff --git a/servers/slapd/search.c b/servers/slapd/search.c index ea93719e23..71c8960611 100644 --- a/servers/slapd/search.c +++ b/servers/slapd/search.c @@ -337,12 +337,9 @@ do_search( /* 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 { @@ -399,10 +396,8 @@ do_search( 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 ); diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index bf68342038..948145c3d7 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -76,9 +76,7 @@ LDAP_BEGIN_DECL #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) @@ -644,14 +642,9 @@ typedef struct slap_object_class { #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 @@ -720,11 +713,9 @@ struct slap_internal_schema { 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; @@ -749,11 +740,9 @@ struct slap_internal_schema { 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; @@ -1286,7 +1275,6 @@ typedef BackendDB Backend; #define nbackends nBackendDB #define backends backendDB -#ifdef LDAP_SYNCREPL struct nonpresent_entry { struct berval *dn; struct berval *ndn; @@ -1342,8 +1330,6 @@ typedef struct syncinfo_s { LDAP_LIST_HEAD(np, nonpresent_entry) nonpresentlist; } syncinfo_t; -#endif /* LDAP_SYNCREPL */ - struct slap_backend_db { BackendInfo *bd_info; /* pointer to shared backend info */ @@ -1491,15 +1477,11 @@ struct slap_backend_db { 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; @@ -1807,7 +1789,6 @@ typedef struct slap_paged_state { } PagedResultsState; -#ifdef LDAP_SYNC #define LDAP_PSEARCH_BY_ADD 0x01 #define LDAP_PSEARCH_BY_DELETE 0x02 #define LDAP_PSEARCH_BY_PREMODIFY 0x03 @@ -1828,8 +1809,6 @@ struct slap_csn_entry { long state; LDAP_TAILQ_ENTRY (slap_csn_entry) csn_link; }; -#endif - /* * represents an operation pending from an ldap client @@ -1954,7 +1933,6 @@ typedef struct slap_op { #define get_pagedresults(op) (0) #endif -#ifdef LDAP_SYNC char o_sync; char o_sync_mode; #define SLAP_SYNC_NONE (0x0) @@ -1966,7 +1944,6 @@ typedef struct slap_op { 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; @@ -1992,9 +1969,7 @@ typedef struct slap_op { #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 */ @@ -2200,9 +2175,7 @@ enum { #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 diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index 9b6975e7be..79cd3de82b 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -33,8 +33,6 @@ #include "slap.h" #include "lutil_ldap.h" -#ifdef LDAP_SYNCREPL - #include "ldap_rq.h" static void @@ -1696,4 +1694,3 @@ str2clist( char ***out, char *in, const char *brkstr ) free( str ); return( *out ); } -#endif diff --git a/servers/slapd/tools/mimic.c b/servers/slapd/tools/mimic.c index 3c2431f339..483550ab6e 100644 --- a/servers/slapd/tools/mimic.c +++ b/servers/slapd/tools/mimic.c @@ -13,9 +13,7 @@ #include "../slap.h" -#ifdef LDAP_SYNCREPL #include "ldap_rq.h" -#endif /* needed by WIN32 and back-monitor */ time_t starttime; @@ -262,7 +260,6 @@ int root_dse_info( Connection *conn, Entry **entry, const char **text ) return -1; } -#ifdef LDAP_SYNCREPL struct runqueue_s syncrepl_rq; void init_syncrepl( ) @@ -308,4 +305,3 @@ Entry *slap_create_context_csn_entry( Backend *be, struct berval *context_csn ) return NULL; } #endif -#endif -- 2.39.5