]> git.sur5r.net Git - openldap/commitdiff
Revert ITS#3353 patch, it needs to be reworked.
authorHoward Chu <hyc@openldap.org>
Wed, 6 Oct 2004 05:51:38 +0000 (05:51 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 6 Oct 2004 05:51:38 +0000 (05:51 +0000)
72 files changed:
servers/slapd/add.c
servers/slapd/back-bdb/cache.c
servers/slapd/back-bdb/compare.c
servers/slapd/back-bdb/delete.c
servers/slapd/back-bdb/init.c
servers/slapd/back-bdb/modify.c
servers/slapd/back-bdb/modrdn.c
servers/slapd/back-bdb/referral.c
servers/slapd/back-bdb/search.c
servers/slapd/back-dnssrv/referral.c
servers/slapd/back-dnssrv/search.c
servers/slapd/back-ldap/init.c
servers/slapd/back-ldbm/add.c
servers/slapd/back-ldbm/compare.c
servers/slapd/back-ldbm/dbcache.c
servers/slapd/back-ldbm/delete.c
servers/slapd/back-ldbm/id2entry.c
servers/slapd/back-ldbm/modify.c
servers/slapd/back-ldbm/modrdn.c
servers/slapd/back-ldbm/referral.c
servers/slapd/back-ldbm/search.c
servers/slapd/back-meta/init.c
servers/slapd/back-monitor/conn.c
servers/slapd/back-monitor/init.c
servers/slapd/back-monitor/operation.c
servers/slapd/back-monitor/sent.c
servers/slapd/back-monitor/thread.c
servers/slapd/back-monitor/time.c
servers/slapd/back-perl/add.c
servers/slapd/back-relay/op.c
servers/slapd/back-shell/add.c
servers/slapd/back-sql/add.c
servers/slapd/back-sql/entry-id.c
servers/slapd/backend.c
servers/slapd/backglue.c
servers/slapd/bind.c
servers/slapd/compare.c
servers/slapd/config.c
servers/slapd/connection.c
servers/slapd/controls.c
servers/slapd/daemon.c
servers/slapd/delete.c
servers/slapd/extended.c
servers/slapd/frontend.c
servers/slapd/init.c
servers/slapd/kerberos.c
servers/slapd/main.c
servers/slapd/modify.c
servers/slapd/modrdn.c
servers/slapd/operation.c
servers/slapd/overlays/lastmod.c
servers/slapd/overlays/pcache.c
servers/slapd/overlays/ppolicy.c
servers/slapd/passwd.c
servers/slapd/proto-slap.h
servers/slapd/repl.c
servers/slapd/result.c
servers/slapd/root_dse.c
servers/slapd/sasl.c
servers/slapd/schema.c
servers/slapd/schema_check.c
servers/slapd/schema_init.c
servers/slapd/schema_prep.c
servers/slapd/schemaparse.c
servers/slapd/search.c
servers/slapd/slap.h
servers/slapd/slapadd.c
servers/slapd/slapcommon.c
servers/slapd/slapi/slapi_ops.c
servers/slapd/slapi/slapi_utils.c
servers/slapd/starttls.c
servers/slapd/syncrepl.c

index 51666859a4a702dedbe8f8254faca1391d1d90af..a1e99928704aeae848f2a9a38d3b6121816fad39 100644 (file)
@@ -203,14 +203,14 @@ fe_op_add( Operation *op, SlapReply *rs )
         */
        op->o_bd = select_backend( &e->e_nname, manageDSAit, 0 );
        if ( op->o_bd == NULL ) {
-               rs->sr_ref = referral_rewrite( SLAPD_GLOBAL(default_referral),
+               rs->sr_ref = referral_rewrite( default_referral,
                        NULL, &e->e_name, LDAP_SCOPE_DEFAULT );
-               if ( !rs->sr_ref ) rs->sr_ref = SLAPD_GLOBAL(default_referral);
+               if ( !rs->sr_ref ) rs->sr_ref = default_referral;
                if ( rs->sr_ref ) {
                        rs->sr_err = LDAP_REFERRAL;
                        send_ldap_result( op, rs );
 
-                       if ( rs->sr_ref != SLAPD_GLOBAL(default_referral) ) {
+                       if ( rs->sr_ref != default_referral ) {
                                ber_bvarray_free( rs->sr_ref );
                        }
                } else {
@@ -329,17 +329,17 @@ fe_op_add( Operation *op, SlapReply *rs )
 #endif /* LDAP_SLAPI */
 
                        defref = op->o_bd->be_update_refs
-                               ? op->o_bd->be_update_refs : SLAPD_GLOBAL(default_referral);
+                               ? op->o_bd->be_update_refs : default_referral;
 
                        if ( defref != NULL ) {
                                rs->sr_ref = referral_rewrite( defref,
                                        NULL, &e->e_name, LDAP_SCOPE_DEFAULT );
                                if ( rs->sr_ref == NULL ) rs->sr_ref = defref;
                                rs->sr_err = LDAP_REFERRAL;
-                               if (!rs->sr_ref) rs->sr_ref = SLAPD_GLOBAL(default_referral);
+                               if (!rs->sr_ref) rs->sr_ref = default_referral;
                                send_ldap_result( op, rs );
 
-                               if ( rs->sr_ref != SLAPD_GLOBAL(default_referral) ) {
+                               if ( rs->sr_ref != default_referral ) {
                                        ber_bvarray_free( rs->sr_ref );
                                }
                        } else {
index 141fe32829563a0291e92ff740ce33672a4af2b2..95efcc21bb50e441013bb5ad3940cc6c8a40d44e 100644 (file)
@@ -1166,7 +1166,7 @@ bdb_txn_get( Operation *op, DB_ENV *env, DB_TXN **txn )
 
        if ( ldap_pvt_thread_pool_getkey( ctx, ((char *)env)+1, &data, NULL ) ) {
                for ( i=0, rc=1; rc != 0 && i<4; i++ ) {
-                       rc = TXN_BEGIN( env, NULL, txn, 0 );
+                       rc = TXN_BEGIN( env, NULL, txn, DB_TXN_NOT_DURABLE );
                        if (rc) ldap_pvt_thread_yield();
                }
                if ( rc != 0) {
index f595658e1b2dde4b2f52e1556afc16ae7ac5f68b..7a3b279bf00611581a4fe4e254bf948fc2079d0a 100644 (file)
@@ -74,7 +74,7 @@ dn2entry_retry:
                        e = NULL;
 
                } else {
-                       rs->sr_ref = referral_rewrite( SLAPD_GLOBAL(default_referral),
+                       rs->sr_ref = referral_rewrite( default_referral,
                                NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
                }
 
index 6a38c76fb529d9966070a448964377ff66b788e3..80dfedaa74eb4fb0c90dd102d2ef342ba665d1df 100644 (file)
@@ -165,7 +165,7 @@ retry:      /* transaction retry */
                                        ber_bvarray_add( &deref, &tmpbv );
                                }
                        } else {
-                               deref = SLAPD_GLOBAL(default_referral);
+                               deref = default_referral;
                        }
                        rs->sr_ref = referral_rewrite( deref, NULL, &op->o_req_dn,
                                        LDAP_SCOPE_DEFAULT );
@@ -174,10 +174,10 @@ retry:    /* transaction retry */
                rs->sr_err = LDAP_REFERRAL;
                send_ldap_result( op, rs );
 
-               if ( rs->sr_ref != SLAPD_GLOBAL(default_referral) ) {
+               if ( rs->sr_ref != default_referral ) {
                        ber_bvarray_free( rs->sr_ref );
                }
-               if ( deref != SLAPD_GLOBAL(default_referral) ) {
+               if ( deref != default_referral ) {
                        ber_bvarray_free( deref );
                }
                free( (char *)rs->sr_matched );
index 5f7b81433a650d78269c93a4ca95198538bd367c..7c634390b759b3d18edc5043f7ae8a2665d5f7ec 100644 (file)
@@ -177,7 +177,7 @@ bdb_db_open( BackendDB *be )
        bdb->bi_dbenv->set_lk_detect( bdb->bi_dbenv, bdb->bi_lock_detect );
 
        /* One long-lived TXN per thread, two TXNs per write op */
-       bdb->bi_dbenv->set_tx_max( bdb->bi_dbenv, SLAPD_GLOBAL(connection_pool_max) * 3 );
+       bdb->bi_dbenv->set_tx_max( bdb->bi_dbenv, connection_pool_max * 3 );
 
        if ( bdb->bi_idl_cache_max_size ) {
                bdb->bi_idl_tree = NULL;
index 047f21f3f3accad68e34f865d63ef1c745290756..f5c77763c39601c343f852076df80f5595f5b9ea 100644 (file)
@@ -399,7 +399,7 @@ retry:      /* transaction retry */
                                        ber_bvarray_add( &deref, &tmpbv );
                 }
                        } else {
-                               deref = SLAPD_GLOBAL(default_referral);
+                               deref = default_referral;
                        }
                        rs->sr_ref = referral_rewrite( deref, NULL, &op->o_req_dn,
                                        LDAP_SCOPE_DEFAULT );
@@ -408,10 +408,10 @@ retry:    /* transaction retry */
                rs->sr_err = LDAP_REFERRAL;
                send_ldap_result( op, rs );
 
-               if ( rs->sr_ref != SLAPD_GLOBAL(default_referral) ) {
+               if ( rs->sr_ref != default_referral ) {
                        ber_bvarray_free( rs->sr_ref );
                }
-               if ( deref != SLAPD_GLOBAL(default_referral) ) {
+               if ( deref != default_referral ) {
                        ber_bvarray_free( deref );
                }
                free( (char *)rs->sr_matched );
index 1856ed401cc481b61bf8d177804e2d75a02f1aeb..d234353ae341366291fe95faf08b88a241b70391 100644 (file)
@@ -188,7 +188,7 @@ retry:      /* transaction retry */
                                        ber_bvarray_add( &deref, &tmpbv );
                 }
                        } else {
-                               deref = SLAPD_GLOBAL(default_referral);
+                               deref = default_referral;
                        }
                        rs->sr_ref = referral_rewrite( deref, NULL, &op->o_req_dn,
                                        LDAP_SCOPE_DEFAULT );
@@ -198,7 +198,7 @@ retry:      /* transaction retry */
                send_ldap_result( op, rs );
 
                ber_bvarray_free( rs->sr_ref );
-               if ( deref != SLAPD_GLOBAL(default_referral) ) {
+               if ( deref != default_referral ) {
                        ber_bvarray_free( deref );
                }
                free( (char *)rs->sr_matched );
index 9cc054063d6afe4008f16d99fa9872e08d89ff65..9b8d434deb8a1786ce41a75325bbb5fe16e616b3 100644 (file)
@@ -94,9 +94,9 @@ dn2entry_retry:
 
                        bdb_cache_return_entry_r (bdb->bi_dbenv, &bdb->bi_cache, e, &lock);
                        e = NULL;
-               } else if ( SLAPD_GLOBAL(default_referral) != NULL ) {
+               } else if ( default_referral != NULL ) {
                        rc = LDAP_OTHER;
-                       rs->sr_ref = referral_rewrite( SLAPD_GLOBAL(default_referral),
+                       rs->sr_ref = referral_rewrite( default_referral,
                                NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
                }
 
index 7c109ce390bacb49b80aac3f9aa5e77a985c92c2..39f84b4e0c490020c47d32d3ad65d983a710f45f 100644 (file)
@@ -612,7 +612,7 @@ dn2entry_retry:
                        }
 
                } else {
-                       rs->sr_ref = referral_rewrite( SLAPD_GLOBAL(default_referral),
+                       rs->sr_ref = referral_rewrite( default_referral,
                                NULL, &sop->o_req_dn, sop->oq_search.rs_scope );
                }
 
index a4823cbc74e9daad7334143335d0850e36b24801..1d5ba88edb9df55153619465eaba25c91316c25a 100644 (file)
@@ -57,7 +57,7 @@ dnssrv_back_referrals(
 
        if( ldap_dn2domain( op->o_req_dn.bv_val, &domain ) || domain == NULL ) {
                rs->sr_err = LDAP_REFERRAL;
-               rs->sr_ref = SLAPD_GLOBAL(default_referral);
+               rs->sr_ref = default_referral;
                send_ldap_result( op, rs );
                return LDAP_REFERRAL;
        }
index 267e00da35421e7f7543baf6ae6c670a2a9578ef..40c03230f0bcb9b181dbd4b7b910a6a4f31d1dc9 100644 (file)
@@ -59,7 +59,7 @@ dnssrv_back_search(
 
        if( ldap_dn2domain( op->o_req_dn.bv_val, &domain ) || domain == NULL ) {
                rs->sr_err = LDAP_REFERRAL;
-               rs->sr_ref = SLAPD_GLOBAL(default_referral);
+               rs->sr_ref = default_referral;
                send_ldap_result( op, rs );
                rs->sr_ref = NULL;
                goto done;
index d2ff930d72fae58bdc650464e06c6337a85cfa2b..13a4fc57fcc184e1338ac2554f728c11e5959fc8 100644 (file)
@@ -46,12 +46,12 @@ int init_module(int argc, char *argv[]) {
 
 #endif /* SLAPD_LDAP */
 
-int
+static int
 ldap_back_open(
        BackendInfo *bi
 )
 {
-       bi->bi_controls = SLAPD_GLOBAL(known_controls);
+       bi->bi_controls = slap_known_controls;
        return 0;
 }
 
index 1f99585dff8bc72c1c782846b3fa60ca77c31ade..9bb32cd762d2c5bb639b4e1e1d0010c35c25e45f 100644 (file)
@@ -109,7 +109,7 @@ ldbm_back_add(
                                cache_return_entry_r( &li->li_cache, matched );
 
                        } else {
-                               rs->sr_ref = referral_rewrite( SLAPD_GLOBAL(default_referral),
+                               rs->sr_ref = referral_rewrite( default_referral,
                                        NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
                        }
 
index 8afc624a6a255267ccef0fa426f93a8f22f95152..936d26c244b243d1b69e87d767122bb98a5f6c5d 100644 (file)
@@ -48,7 +48,7 @@ ldbm_back_compare(
                                : NULL;
                        cache_return_entry_r( &li->li_cache, matched );
                } else {
-                       rs->sr_ref = referral_rewrite( SLAPD_GLOBAL(default_referral),
+                       rs->sr_ref = referral_rewrite( default_referral,
                                NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
                }
 
index 93bd7ced40c4aef5e7a750cc47718544488662a3..e8cce87234e3c5b952bc047e503992f510561df8 100644 (file)
@@ -333,7 +333,7 @@ ldbm_cache_sync_daemon(
 
                sleep( li->li_dbsyncfreq );
 
-               while (i && ldap_pvt_thread_pool_backload(&SLAPD_GLOBAL(connection_pool)) != 0) {
+               while (i && ldap_pvt_thread_pool_backload(&connection_pool) != 0) {
                        Debug( LDAP_DEBUG_TRACE, "delay syncing %s\n", li->li_directory, 0, 0 );
                        sleep(li->li_dbsyncwaitinterval);
                        i--;
index aceed450dea4017ac859cfd502e63baad7d4ecf9..81358859bf89d13d9410f24774a950cb738dcd55 100644 (file)
@@ -70,7 +70,7 @@ ldbm_back_delete(
                                        ber_bvarray_add( &deref, &tmpbv );
                                }
                        } else {
-                               deref = SLAPD_GLOBAL(default_referral);
+                               deref = default_referral;
                        }
                        rs->sr_ref = referral_rewrite( deref, NULL, &op->o_req_dn,
                                                        LDAP_SCOPE_DEFAULT );
@@ -82,7 +82,7 @@ ldbm_back_delete(
                send_ldap_result( op, rs );
 
                if ( rs->sr_ref ) ber_bvarray_free( rs->sr_ref );
-               if ( deref != SLAPD_GLOBAL(default_referral) ) {
+               if ( deref != default_referral ) {
                        ber_bvarray_free( deref );
                }
                free( (char *)rs->sr_matched );
index 9a7d9b6d22d75db875a149ecc2d8feb24f3cb54d..f63de5be9278b5024df06dd8ec2b6fc8873057d6 100644 (file)
@@ -61,7 +61,7 @@ id2entry_add( Backend *be, Entry *e )
 #endif
        key.dsize = sizeof(ID);
 
-       ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(entry2str_mutex) );
+       ldap_pvt_thread_mutex_lock( &entry2str_mutex );
        data.dptr = entry2str( e, &len );
        data.dsize = len + 1;
 
@@ -69,7 +69,7 @@ id2entry_add( Backend *be, Entry *e )
        flags = LDBM_REPLACE;
        rc = ldbm_cache_store( db, key, data, flags );
 
-       ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(entry2str_mutex) );
+       ldap_pvt_thread_mutex_unlock( &entry2str_mutex );
 
        ldbm_cache_close( be, db );
 
index 31a498fd5280dffd6b8f2c16d1a92fb640096530..4754cf3c09d6529c5e96959944fae236f9693775 100644 (file)
@@ -265,7 +265,7 @@ ldbm_back_modify(
                                        ber_bvarray_add( &deref, &tmpbv );
                                }
                        } else {
-                               deref = SLAPD_GLOBAL(default_referral);
+                               deref = default_referral;
                        }
                        rs->sr_ref = referral_rewrite( deref, NULL, &op->o_req_dn,
                                                LDAP_SCOPE_DEFAULT );
@@ -276,7 +276,7 @@ ldbm_back_modify(
                send_ldap_result( op, rs );
 
                if ( rs->sr_ref ) ber_bvarray_free( rs->sr_ref );
-               if ( deref != SLAPD_GLOBAL(default_referral) ) {
+               if ( deref != default_referral ) {
                        ber_bvarray_free( deref );
                }
                free( (char *)rs->sr_matched );
index c05d6741bd91fc98b9440501b0daf36d12a6e478..5a6229f1bf7e46ddf2a03cd3bf6b15e9c7fa3a80 100644 (file)
@@ -93,7 +93,7 @@ ldbm_back_modrdn(
                                        ber_bvarray_add( &deref, &tmpbv );
                                }
                        } else {
-                               deref = SLAPD_GLOBAL(default_referral);
+                               deref = default_referral;
                        }
                        rs->sr_ref = referral_rewrite( deref, NULL, &op->o_req_dn,
                                                LDAP_SCOPE_DEFAULT );
@@ -105,7 +105,7 @@ ldbm_back_modrdn(
                send_ldap_result( op, rs );
 
                if ( rs->sr_ref ) ber_bvarray_free( rs->sr_ref );
-               if ( deref != SLAPD_GLOBAL(default_referral) ) {
+               if ( deref != default_referral ) {
                        ber_bvarray_free( deref );
                }
                free( (char *)rs->sr_matched );
index 838426549ed192f795c0190d0029e74af852cf53..8f01f958dccb582a30391f52ebf2ace22f05afc1 100644 (file)
@@ -62,9 +62,9 @@ ldbm_back_referrals(
 
                        cache_return_entry_r( &li->li_cache, matched );
 
-               } else if ( SLAPD_GLOBAL(default_referral) != NULL ) {
+               } else if ( default_referral != NULL ) {
                        rs->sr_err = LDAP_OTHER;
-                       rs->sr_ref = referral_rewrite( SLAPD_GLOBAL(default_referral),
+                       rs->sr_ref = referral_rewrite( default_referral,
                                NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
                }
 
index bd3a0377385e51ae6d8388bcda9e92fad0fa97aa..2b093706156433ac3046bbe5dcdc1e8b7270334c 100644 (file)
@@ -102,7 +102,7 @@ ldbm_back_search(
                        }
 
                } else {
-                       rs->sr_ref = referral_rewrite( SLAPD_GLOBAL(default_referral),
+                       rs->sr_ref = referral_rewrite( default_referral,
                                NULL, &op->o_req_dn, op->ors_scope );
                }
 
index 4607cb76d644df9cf88fb6394a6be68b5b686e0a..3b3decd93fbd2a3762e9075ece47e0e9cc897795 100644 (file)
@@ -47,7 +47,7 @@ meta_back_open(
        BackendInfo *bi
 )
 {
-       bi->bi_controls = SLAPD_GLOBAL(known_controls);
+       bi->bi_controls = slap_known_controls;
        return 0;
 }
 
index e14fb0524286c789e511dea13b040b1bbede4a4d..ce61417eb480e0046aa1c9981130670b45fa6f40 100644 (file)
@@ -252,7 +252,7 @@ conn_create(
        assert( ep != NULL );
 
 #ifndef HAVE_GMTIME_R
-       ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(gmtime_mutex) );
+       ldap_pvt_thread_mutex_lock( &gmtime_mutex );
 #endif
 #ifdef HACK_LOCAL_TIME
 # ifdef HAVE_LOCALTIME_R
@@ -280,7 +280,7 @@ conn_create(
 # endif /* HAVE_GMTIME_R */
 #endif /* !HACK_LOCAL_TIME */
 #ifndef HAVE_GMTIME_R
-       ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(gmtime_mutex) );
+       ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
 #endif
 
        snprintf( buf, sizeof( buf ),
@@ -314,7 +314,7 @@ conn_create(
        }
 
 #ifndef HAVE_GMTIME_R
-       ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(gmtime_mutex) );
+       ldap_pvt_thread_mutex_lock( &gmtime_mutex );
 #endif
 
 #ifdef HAVE_GMTIME_R
@@ -332,7 +332,7 @@ conn_create(
        lutil_gentime( buf3, sizeof( buf3 ), ltm );
 
 #ifndef HAVE_GMTIME_R
-       ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(gmtime_mutex) );
+       ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
 #endif /* HAVE_GMTIME_R */
 
        /* monitored info */
index 2fbee60ac09acad6fd09a3fa59154a67aaecadaf..c06e4d9eb1b88a7c198abd118ae548bd0c4d3736 100644 (file)
@@ -618,25 +618,25 @@ monitor_back_db_open(
         * Start
         */
 #ifndef HAVE_GMTIME_R
-       ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(gmtime_mutex) );
+       ldap_pvt_thread_mutex_lock( &gmtime_mutex );
 #endif
 #ifdef HACK_LOCAL_TIME
 # ifdef HAVE_LOCALTIME_R
-       tms = localtime_r( &SLAPD_GLOBAL(starttime), &tm_buf );
+       tms = localtime_r( &starttime, &tm_buf );
 # else
-       tms = localtime( &SLAPD_GLOBAL(starttime) );
+       tms = localtime( &starttime );
 # endif /* HAVE_LOCALTIME_R */
        lutil_localtime( tmbuf, sizeof(tmbuf), tms, -timezone );
 #else /* !HACK_LOCAL_TIME */
 # ifdef HAVE_GMTIME_R
-       tms = gmtime_r( &SLAPD_GLOBAL(starttime), &tm_buf );
+       tms = gmtime_r( &starttime, &tm_buf );
 # else
-       tms = gmtime( &SLAPD_GLOBAL(starttime) );
+       tms = gmtime( &starttime );
 # endif /* HAVE_GMTIME_R */
        lutil_gentime( tmbuf, sizeof(tmbuf), tms );
 #endif /* !HACK_LOCAL_TIME */
 #ifndef HAVE_GMTIME_R
-       ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(gmtime_mutex) );
+       ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
 #endif
 
        mi->mi_startTime.bv_val = tmbuf;
index 4f27f339849800f3a7e3a7257b25e769e199c9be..96c635bdba3dd117d7eb2910d7d55fac718d0887 100644 (file)
@@ -175,21 +175,21 @@ monitor_subsys_ops_update(
                ldap_pvt_mp_init( nInitiated );
                ldap_pvt_mp_init( nCompleted );
 
-               ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(counters).sc_ops_mutex );
+               ldap_pvt_thread_mutex_lock( &slap_counters.sc_ops_mutex );
                for ( i = 0; i < SLAP_OP_LAST; i++ ) {
-                       ldap_pvt_mp_add( nInitiated, SLAPD_GLOBAL(counters).sc_ops_initiated_[ i ] );
-                       ldap_pvt_mp_add( nCompleted, SLAPD_GLOBAL(counters).sc_ops_completed_[ i ] );
+                       ldap_pvt_mp_add( nInitiated, slap_counters.sc_ops_initiated_[ i ] );
+                       ldap_pvt_mp_add( nCompleted, slap_counters.sc_ops_completed_[ i ] );
                }
-               ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(counters).sc_ops_mutex );
+               ldap_pvt_thread_mutex_unlock( &slap_counters.sc_ops_mutex );
                
        } else {
                for ( i = 0; i < SLAP_OP_LAST; i++ ) {
                        if ( dn_match( &rdn, &monitor_op[ i ].nrdn ) )
                        {
-                               ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(counters).sc_ops_mutex );
-                               ldap_pvt_mp_init_set( nInitiated, SLAPD_GLOBAL(counters).sc_ops_initiated_[ i ] );
-                               ldap_pvt_mp_init_set( nCompleted, SLAPD_GLOBAL(counters).sc_ops_completed_[ i ] );
-                               ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(counters).sc_ops_mutex );
+                               ldap_pvt_thread_mutex_lock( &slap_counters.sc_ops_mutex );
+                               ldap_pvt_mp_init_set( nInitiated, slap_counters.sc_ops_initiated_[ i ] );
+                               ldap_pvt_mp_init_set( nCompleted, slap_counters.sc_ops_completed_[ i ] );
+                               ldap_pvt_thread_mutex_unlock( &slap_counters.sc_ops_mutex );
                                break;
                        }
                }
index d59767d4448ad227c617d31a010d8995c47c74c6..9f3df46618db6f7d9b543989ff866b835709a3b4 100644 (file)
@@ -171,28 +171,28 @@ monitor_subsys_sent_update(
                return 0;
        }
 
-       ldap_pvt_thread_mutex_lock(&SLAPD_GLOBAL(counters).sc_sent_mutex);
+       ldap_pvt_thread_mutex_lock(&slap_counters.sc_sent_mutex);
        switch ( i ) {
        case MONITOR_SENT_ENTRIES:
-               ldap_pvt_mp_init_set( n, SLAPD_GLOBAL(counters).sc_entries );
+               ldap_pvt_mp_init_set( n, slap_counters.sc_entries );
                break;
 
        case MONITOR_SENT_REFERRALS:
-               ldap_pvt_mp_init_set( n, SLAPD_GLOBAL(counters).sc_refs );
+               ldap_pvt_mp_init_set( n, slap_counters.sc_refs );
                break;
 
        case MONITOR_SENT_PDU:
-               ldap_pvt_mp_init_set( n, SLAPD_GLOBAL(counters).sc_pdu );
+               ldap_pvt_mp_init_set( n, slap_counters.sc_pdu );
                break;
 
        case MONITOR_SENT_BYTES:
-               ldap_pvt_mp_init_set( n, SLAPD_GLOBAL(counters).sc_bytes );
+               ldap_pvt_mp_init_set( n, slap_counters.sc_bytes );
                break;
 
        default:
                assert(0);
        }
-       ldap_pvt_thread_mutex_unlock(&SLAPD_GLOBAL(counters).sc_sent_mutex);
+       ldap_pvt_thread_mutex_unlock(&slap_counters.sc_sent_mutex);
        
        a = attr_find( e->e_attrs, mi->mi_ad_monitorCounter );
        assert( a );
index e9185b5a69c60cad4d2db2fd979ea346e4d0fb26..ca9663199854983f312450282e93a654932b1dc9 100644 (file)
@@ -73,7 +73,7 @@ monitor_subsys_thread_init(
                        mi->mi_oc_monitoredObject->soc_cname.bv_val,
                        mi->mi_oc_monitoredObject->soc_cname.bv_val,
                        mi->mi_ad_monitoredInfo->ad_cname.bv_val,
-                       SLAPD_GLOBAL(connection_pool_max),
+                       connection_pool_max,
                        mi->mi_creatorsName.bv_val,
                        mi->mi_creatorsName.bv_val,
                        mi->mi_startTime.bv_val,
@@ -189,7 +189,7 @@ monitor_subsys_thread_update(
        }
 
        snprintf( buf, sizeof( buf ), "%d", 
-                       ldap_pvt_thread_pool_backload( &SLAPD_GLOBAL(connection_pool) ) );
+                       ldap_pvt_thread_pool_backload( &connection_pool ) );
        len = strlen( buf );
        if ( len > a->a_vals[ 0 ].bv_len ) {
                a->a_vals[ 0 ].bv_val = ber_memrealloc( a->a_vals[ 0 ].bv_val, len + 1 );
index ed4cba40a2047f839b67e3f44289ed168fc106a8..2c894dd393e08a5e32ea5da4e0e4cf8c55bd35b9 100644 (file)
@@ -193,7 +193,7 @@ monitor_subsys_time_update(
                currtime = slap_get_time();
 
 #ifndef HAVE_GMTIME_R
-               ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(gmtime_mutex) );
+               ldap_pvt_thread_mutex_lock( &gmtime_mutex );
 #endif
 #ifdef HACK_LOCAL_TIME
 # ifdef HAVE_LOCALTIME_R
@@ -211,7 +211,7 @@ monitor_subsys_time_update(
                lutil_gentime( tmbuf, sizeof( tmbuf ), tm );
 #endif /* !HACK_LOCAL_TIME */
 #ifndef HAVE_GMTIME_R
-               ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(gmtime_mutex) );
+               ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
 #endif
 
                len = strlen( tmbuf );
index 11942e6e41111fb751bec2d0291d528469181023..8a89f8948dfbcc55eb80e9ee3391ae939a116021 100644 (file)
@@ -27,7 +27,7 @@ perl_back_add(
        int count;
 
        ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );
-       ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(entry2str_mutex) );
+       ldap_pvt_thread_mutex_lock( &entry2str_mutex );
 
        {
                dSP; ENTER; SAVETMPS;
@@ -55,7 +55,7 @@ perl_back_add(
                PUTBACK; FREETMPS; LEAVE;
        }
 
-       ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(entry2str_mutex) );
+       ldap_pvt_thread_mutex_unlock( &entry2str_mutex );
        ldap_pvt_thread_mutex_unlock( &perl_interpreter_mutex );        
 
        send_ldap_result( op, rs );
index dca3de486fba2c82ae7cb80267125b32e2f88b58..881e77a8301c0a394edfdf8eaee2c7387afc9f56 100644 (file)
@@ -66,17 +66,17 @@ relay_back_select_backend( struct slap_op *op, struct slap_rep *rs, int err )
        }
 
        if ( bd == NULL ) {
-               if ( SLAPD_GLOBAL(default_referral) ) {
-                       rs->sr_ref = referral_rewrite( SLAPD_GLOBAL(default_referral),
+               if ( default_referral ) {
+                       rs->sr_ref = referral_rewrite( default_referral,
                                NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
                        if ( !rs->sr_ref ) {
-                               rs->sr_ref = SLAPD_GLOBAL(default_referral);
+                               rs->sr_ref = default_referral;
                        }
 
                        rs->sr_err = LDAP_REFERRAL;
                        send_ldap_result( op, rs );
 
-                       if ( rs->sr_ref != SLAPD_GLOBAL(default_referral) ) {
+                       if ( rs->sr_ref != default_referral ) {
                                ber_bvarray_free( rs->sr_ref );
                        }
 
index 33bd70797ff20e7cb384e716f1cf84b4ac114f5e..d1d02296bcfdea920ddca21f342ea6f9b763c5cd 100644 (file)
@@ -71,9 +71,9 @@ shell_back_add(
        fprintf( wfp, "ADD\n" );
        fprintf( wfp, "msgid: %ld\n", (long) op->o_msgid );
        print_suffixes( wfp, op->o_bd );
-       ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(entry2str_mutex) );
+       ldap_pvt_thread_mutex_lock( &entry2str_mutex );
        fprintf( wfp, "%s", entry2str( op->oq_add.rs_e, &len ) );
-       ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(entry2str_mutex) );
+       ldap_pvt_thread_mutex_unlock( &entry2str_mutex );
        fclose( wfp );
 
        /* read in the result and send it along */
index 2b3f8232fb4b92deaf17983fe50a214caea471d2..19fd90ef7209772a5648f74d471f10c73c5b7fbe 100644 (file)
@@ -889,7 +889,7 @@ backsql_add( Operation *op, SlapReply *rs )
                        op->oq_add.rs_e->e_name.bv_val, 0, 0 );
 
        /* check schema */
-       if ( SLAPD_GLOBAL(schemachecking) ) {
+       if ( global_schemacheck ) {
                char            textbuf[ SLAP_TEXT_BUFLEN ] = { '\0' };
 
                rs->sr_err = entry_schema_check( op->o_bd, op->oq_add.rs_e,
index 638b754075b32921beb9f2862f4c3649a5b0a00d..1153bd0ec7ee7bd352f22b8a0644d59a57f968f1 100644 (file)
@@ -565,7 +565,7 @@ next:;
                                bsi, 0, AVL_INORDER );
        }
 
-       if ( SLAPD_GLOBAL(schemachecking) ) {
+       if ( global_schemacheck ) {
                const char      *text = NULL;
                char            textbuf[ 1024 ];
                size_t          textlen = sizeof( textbuf );
index 14df526356644d3c7056e8974e9a88b8655fdaee..4c1d58a1be798124732d0e880fb9d9e766896890 100644 (file)
@@ -344,9 +344,9 @@ int backend_startup(Backend *be)
                }
        }
 
-       ldap_pvt_thread_mutex_init( &SLAPD_GLOBAL(runqueue).rq_mutex );
-       LDAP_STAILQ_INIT( &SLAPD_GLOBAL(runqueue).task_list );
-       LDAP_STAILQ_INIT( &SLAPD_GLOBAL(runqueue).run_list );
+       ldap_pvt_thread_mutex_init( &syncrepl_rq.rq_mutex );
+       LDAP_STAILQ_INIT( &syncrepl_rq.task_list );
+       LDAP_STAILQ_INIT( &syncrepl_rq.run_list );
 
        /* open each backend database */
        for( i = 0; i < nBackendDB; i++ ) {
@@ -378,10 +378,10 @@ int backend_startup(Backend *be)
                        LDAP_STAILQ_FOREACH( si, &backendDB[i].be_syncinfo, si_next ) {
                                si->si_be = &backendDB[i];
                                init_syncrepl( si );
-                               ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(runqueue).rq_mutex );
-                               ldap_pvt_runqueue_insert( &SLAPD_GLOBAL(runqueue),
+                               ldap_pvt_thread_mutex_lock( &syncrepl_rq.rq_mutex );
+                               ldap_pvt_runqueue_insert( &syncrepl_rq,
                                                si->si_interval, do_syncrepl, (void *) si );
-                               ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(runqueue).rq_mutex );
+                               ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex );
                        }
                }
        }
@@ -782,7 +782,7 @@ be_isroot_pw( Operation *op )
        }
 
 #if defined( SLAPD_CRYPT ) || defined( SLAPD_SPASSWD )
-       ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(passwd_mutex) );
+       ldap_pvt_thread_mutex_lock( &passwd_mutex );
 #ifdef SLAPD_SPASSWD
        lutil_passwd_sasl_conn = op->o_conn->c_sasl_authctx;
 #endif
@@ -794,7 +794,7 @@ be_isroot_pw( Operation *op )
 #ifdef SLAPD_SPASSWD
        lutil_passwd_sasl_conn = NULL;
 #endif
-       ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(passwd_mutex) );
+       ldap_pvt_thread_mutex_unlock( &passwd_mutex );
 #endif
 
        return result == 0;
@@ -1109,7 +1109,7 @@ backend_check_restrictions(
                                return rs->sr_err;
                        }
 
-                       if( !( SLAPD_GLOBAL(allows) & SLAP_ALLOW_UPDATE_ANON ) &&
+                       if( !( global_allows & SLAP_ALLOW_UPDATE_ANON ) &&
                                op->o_ndn.bv_len == 0 )
                        {
                                rs->sr_text = "modifications require authentication";
index ad3f34a917f0fdc99fe7200080951146a1cfb972..f65ee40f477a2e8eece49722a5d3c4b9bc896ae1 100644 (file)
@@ -577,7 +577,7 @@ int
 glue_sub_init( )
 {
        int i, j;
-       int cont = SLAPD_GLOBAL(num_subordinates);
+       int cont = num_subordinates;
        BackendDB *b1, *be;
        BackendInfo *bi = NULL;
        glueinfo *gi;
index f06652000d868260c87f720719983f587cacc7eb..836e9d4ce51056a8e5101bc5244769160b59df8a 100644 (file)
@@ -183,7 +183,7 @@ do_bind(
                        "requested protocol version not supported" );
                goto cleanup;
 
-       } else if (!( SLAPD_GLOBAL(allows) & SLAP_ALLOW_BIND_V2 ) &&
+       } else if (!( global_allows & SLAP_ALLOW_BIND_V2 ) &&
                version < LDAP_VERSION3 )
        {
                send_ldap_error( op, rs, LDAP_PROTOCOL_ERROR,
@@ -298,7 +298,7 @@ fe_op_bind( Operation *op, SlapReply *rs )
                        }
 
                        if( !BER_BVISEMPTY( &op->o_conn->c_dn ) ) {
-                               ber_len_t max = SLAPD_GLOBAL(sockbuf_max_incoming_auth);
+                               ber_len_t max = sockbuf_max_incoming_auth;
                                ber_sockbuf_ctrl( op->o_conn->c_sb,
                                        LBER_SB_OPT_SET_MAX_INCOMING, &max );
                        }
@@ -373,20 +373,20 @@ fe_op_bind( Operation *op, SlapReply *rs )
                        rs->sr_err = LDAP_SUCCESS;
 
                        if( !BER_BVISEMPTY( &op->orb_cred ) &&
-                               !( SLAPD_GLOBAL(allows) & SLAP_ALLOW_BIND_ANON_CRED ))
+                               !( global_allows & SLAP_ALLOW_BIND_ANON_CRED ))
                        {
                                /* cred is not empty, disallow */
                                rs->sr_err = LDAP_INVALID_CREDENTIALS;
 
                        } else if ( !BER_BVISEMPTY( &op->o_req_ndn ) &&
-                               !( SLAPD_GLOBAL(allows) & SLAP_ALLOW_BIND_ANON_DN ))
+                               !( global_allows & SLAP_ALLOW_BIND_ANON_DN ))
                        {
                                /* DN is not empty, disallow */
                                rs->sr_err = LDAP_UNWILLING_TO_PERFORM;
                                rs->sr_text =
                                        "unauthenticated bind (DN with no password) disallowed";
 
-                       } else if ( SLAPD_GLOBAL(disallows) & SLAP_DISALLOW_BIND_ANON ) {
+                       } else if ( global_disallows & SLAP_DISALLOW_BIND_ANON ) {
                                /* disallow */
                                rs->sr_err = LDAP_INAPPROPRIATE_AUTH;
                                rs->sr_text = "anonymous bind disallowed";
@@ -404,7 +404,7 @@ fe_op_bind( Operation *op, SlapReply *rs )
                                op->o_protocol, 0, 0 );
                        goto cleanup;
 
-               } else if ( SLAPD_GLOBAL(disallows) & SLAP_DISALLOW_BIND_SIMPLE ) {
+               } else if ( global_disallows & SLAP_DISALLOW_BIND_SIMPLE ) {
                        /* disallow simple authentication */
                        rs->sr_err = LDAP_UNWILLING_TO_PERFORM;
                        rs->sr_text = "unwilling to perform simple authentication";
@@ -418,7 +418,7 @@ fe_op_bind( Operation *op, SlapReply *rs )
 
 #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
        } else if ( op->orb_method == LDAP_AUTH_KRBV41 ) {
-               if ( SLAPD_GLOBAL(disallows) & SLAP_DISALLOW_BIND_KRBV4 ) {
+               if ( global_disallows & SLAP_DISALLOW_BIND_KRBV4 ) {
                        /* disallow krbv4 authentication */
                        rs->sr_err = LDAP_UNWILLING_TO_PERFORM;
                        rs->sr_text = "unwilling to perform Kerberos V4 bind";
@@ -533,7 +533,7 @@ fe_op_bind( Operation *op, SlapReply *rs )
                                op->o_tmpfree( op->o_req_ndn.bv_val, op->o_tmpmemctx );
                                BER_BVZERO( &op->o_req_ndn );
                                if ( !BER_BVISEMPTY( &op->o_conn->c_dn ) ) {
-                                       ber_len_t max = SLAPD_GLOBAL(sockbuf_max_incoming_auth);
+                                       ber_len_t max = sockbuf_max_incoming_auth;
                                        ber_sockbuf_ctrl( op->o_conn->c_sb,
                                                LBER_SB_OPT_SET_MAX_INCOMING, &max );
                                }
@@ -572,7 +572,7 @@ fe_op_bind( Operation *op, SlapReply *rs )
                        ber_dupbv( &op->o_conn->c_ndn, &op->o_req_ndn );
 
                        if( !BER_BVISEMPTY( &op->o_conn->c_dn ) ) {
-                               ber_len_t max = SLAPD_GLOBAL(sockbuf_max_incoming_auth);
+                               ber_len_t max = sockbuf_max_incoming_auth;
                                ber_sockbuf_ctrl( op->o_conn->c_sb,
                                        LBER_SB_OPT_SET_MAX_INCOMING, &max );
                        }
index 66d0d85c146b9adfc16ec7796c6a553139b97b07..506e34736b544fe232de94023956b90d182bdfc8 100644 (file)
@@ -203,14 +203,14 @@ fe_op_compare( Operation *op, SlapReply *rs )
         */
        op->o_bd = select_backend( &op->o_req_ndn, manageDSAit, 0 );
        if ( op->o_bd == NULL ) {
-               rs->sr_ref = referral_rewrite( SLAPD_GLOBAL(default_referral),
+               rs->sr_ref = referral_rewrite( default_referral,
                        NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
 
                rs->sr_err = LDAP_REFERRAL;
-               if (!rs->sr_ref) rs->sr_ref = SLAPD_GLOBAL(default_referral);
+               if (!rs->sr_ref) rs->sr_ref = default_referral;
                send_ldap_result( op, rs );
 
-               if (rs->sr_ref != SLAPD_GLOBAL(default_referral)) ber_bvarray_free( rs->sr_ref );
+               if (rs->sr_ref != default_referral) ber_bvarray_free( rs->sr_ref );
                rs->sr_err = 0;
                goto cleanup;
        }
index 9b4877058c39a8656d0a621ba0d2faecf701ce43..5a03edbf9e5a6e6b46d773ef6c4244e6356c1c2d 100644 (file)
@@ -33,7 +33,6 @@
 #include <ac/signal.h>
 #include <ac/socket.h>
 #include <ac/errno.h>
-#include <ac/unistd.h>
 
 #include "slap.h"
 #ifdef LDAP_SLAPI
 /*
  * defaults for various global variables
  */
+slap_mask_t            global_allows = 0;
+slap_mask_t            global_disallows = 0;
+char           *replogfile;
+int            global_gentlehup = 0;
+int            global_idletimeout = 0;
+char   *global_host = NULL;
+char   *global_realm = NULL;
+char           *ldap_srvtab = "";
+char           **default_passwd_hash = NULL;
 int            cargc = 0, cargv_size = 0;
 char   **cargv;
+struct berval default_search_base = BER_BVNULL;
+struct berval default_search_nbase = BER_BVNULL;
+unsigned               num_subordinates = 0;
+
+ber_len_t sockbuf_max_incoming = SLAP_SB_MAX_INCOMING_DEFAULT;
+ber_len_t sockbuf_max_incoming_auth= SLAP_SB_MAX_INCOMING_AUTH;
+
+int    slap_conn_max_pending = SLAP_CONN_MAX_PENDING_DEFAULT;
+int    slap_conn_max_pending_auth = SLAP_CONN_MAX_PENDING_AUTH;
+
+char   *slapd_pid_file  = NULL;
+char   *slapd_args_file = NULL;
 
 char   *strtok_quote_ptr;
 
+int use_reverse_lookup = 0;
+
+#ifdef LDAP_SLAPI
+int slapi_plugins_used = 0;
+#endif
+
 static char *fp_getline(FILE *fp, int *lineno);
 static void fp_getline_init(int *lineno);
 static int fp_parse_line(int lineno, char *line);
@@ -61,64 +87,6 @@ static int load_ucdata(char *path);
 static int add_syncrepl LDAP_P(( Backend *, char **, int ));
 static int parse_syncrepl_line LDAP_P(( char **, int, syncinfo_t *));
 
-Global slap_Configuration;
-extern BackendDB slap_frontendDB, *frontendDB;
-
-void config_init(void) {
-       /* system config defaults */
-       Global *g = &slap_Configuration;
-       memset(g, 0, sizeof(slap_Configuration));
-
-       /* because we need frontendDB* before frontend_init, paint it black */
-       frontendDB = &slap_frontendDB;
-       memset(frontendDB, 0, sizeof(frontendDB));
-
-       g->schemachecking = 1;
-
-       g->connection_pool_max = SLAP_MAX_WORKER_THREADS;
-
-       g->sockbuf_max_incoming = SLAP_SB_MAX_INCOMING_DEFAULT;
-       g->sockbuf_max_incoming_auth= SLAP_SB_MAX_INCOMING_AUTH;
-
-       g->conn_max_pending = SLAP_CONN_MAX_PENDING_DEFAULT;
-       g->conn_max_pending_auth = SLAP_CONN_MAX_PENDING_AUTH;
-
-       g->local_ssf = LDAP_PVT_SASL_LOCAL_SSF;
-
-       /* XXX scope issue */
-#ifdef notdef
-#ifdef LDAP_DEBUG
-       g->syslog = LDAP_DEBUG_STATS;
-#endif
-
-#ifdef LOG_DEBUG
-       g->syslog_level = LOG_DEBUG;
-#endif
-#endif
-
-#ifdef HAVE_SYSCONF
-        g->dtblsize = sysconf( _SC_OPEN_MAX );
-#elif HAVE_GETDTABLESIZE
-        g->dtblsize = getdtablesize();
-#else
-        g->dtblsize = FD_SETSIZE;
-#endif
-
-#ifdef FD_SETSIZE
-        if(g->dtblsize > FD_SETSIZE) g->dtblsize = FD_SETSIZE;
-#endif  /* !FD_SETSIZE */
-
-       g->index_substr_if_minlen = SLAP_INDEX_SUBSTR_IF_MINLEN_DEFAULT;
-       g->index_substr_if_maxlen = SLAP_INDEX_SUBSTR_IF_MAXLEN_DEFAULT;
-       g->index_substr_any_len = SLAP_INDEX_SUBSTR_ANY_LEN_DEFAULT;
-       g->index_substr_any_step = SLAP_INDEX_SUBSTR_ANY_STEP_DEFAULT;
-
-       /* XXX when doing mutex, we may have to know slapMode */
-
-       frontendDB->be_private = g;
-}
-
-
 int
 read_config( const char *fname, int depth )
 {
@@ -241,7 +209,7 @@ read_config( const char *fname, int depth )
                                return( 1 );
                        }
 
-                       SLAPD_GLOBAL(local_ssf) = ssf;
+                       local_ssf = ssf;
 
                /* set thread concurrency */
                } else if ( strcasecmp( cargv[0], "concurrency" ) == 0 ) {
@@ -271,7 +239,6 @@ read_config( const char *fname, int depth )
                        }
 
                        ldap_pvt_thread_set_concurrency( c );
-                       SLAPD_GLOBAL(conf_concurrency) = c;
 
                /* set substring initial/final index minimum length */
                } else if ( strcasecmp( cargv[0], "index_substr_if_minlen" ) == 0 ) {
@@ -283,14 +250,14 @@ read_config( const char *fname, int depth )
                                return( 1 );
                        }
                        min = atoi( cargv[1] );
-                       if( min < 1 || min > SLAPD_GLOBAL(index_substr_if_maxlen) ) {
+                       if( min < 1 || min > index_substr_if_maxlen ) {
                                Debug( LDAP_DEBUG_ANY,
                                "%s: line %d: invalid min value (%ld) in "
                                "\"index_substr_if_minlen <length>\" line.\n",
                                fname, lineno, min );
                                return( 1 );
                        }
-                       SLAPD_GLOBAL(index_substr_if_minlen) = min;
+                       index_substr_if_minlen = min;
 
                /* set substring initial/final index maximum length */
                } else if ( strcasecmp( cargv[0], "index_substr_if_maxlen" ) == 0 ) {
@@ -302,14 +269,14 @@ read_config( const char *fname, int depth )
                                return( 1 );
                        }
                        max = atol( cargv[1] );
-                       if( max < 1 || max < SLAPD_GLOBAL(index_substr_if_minlen) ) {
+                       if( max < 1 || max < index_substr_if_minlen ) {
                                Debug( LDAP_DEBUG_ANY,
                                "%s: line %d: invalid max value (%ld) in "
                                "\"index_substr_maxlen <length>\" line.\n",
                                fname, lineno, max );
                                return( 1 );
                        }
-                       SLAPD_GLOBAL(index_substr_if_maxlen) = max;
+                       index_substr_if_maxlen = max;
 
                /* set substring any index len */
                } else if ( strcasecmp( cargv[0], "index_substr_any_len" ) == 0 ) {
@@ -328,7 +295,7 @@ read_config( const char *fname, int depth )
                                fname, lineno, len );
                                return( 1 );
                        }
-                       SLAPD_GLOBAL(index_substr_any_len) = len;
+                       index_substr_any_len = len;
 
                /* set substring any index step */
                } else if ( strcasecmp( cargv[0], "index_substr_any_step" ) == 0 ) {
@@ -347,7 +314,7 @@ read_config( const char *fname, int depth )
                                fname, lineno, step );
                                return( 1 );
                        }
-                       SLAPD_GLOBAL(index_substr_any_step) = step;
+                       index_substr_any_step = step;
 
                /* set sockbuf max */
                } else if ( strcasecmp( cargv[0], "sockbuf_max_incoming" ) == 0 ) {
@@ -371,7 +338,7 @@ read_config( const char *fname, int depth )
                                return( 1 );
                        }
 
-                       SLAPD_GLOBAL(sockbuf_max_incoming) = max;
+                       sockbuf_max_incoming = max;
 
                /* set sockbuf max authenticated */
                } else if ( strcasecmp( cargv[0], "sockbuf_max_incoming_auth" ) == 0 ) {
@@ -395,7 +362,7 @@ read_config( const char *fname, int depth )
                                return( 1 );
                        }
 
-                       SLAPD_GLOBAL(sockbuf_max_incoming_auth) = max;
+                       sockbuf_max_incoming_auth = max;
 
                /* set conn pending max */
                } else if ( strcasecmp( cargv[0], "conn_max_pending" ) == 0 ) {
@@ -419,7 +386,7 @@ read_config( const char *fname, int depth )
                                return( 1 );
                        }
 
-                       SLAPD_GLOBAL(conn_max_pending) = max;
+                       slap_conn_max_pending = max;
 
                /* set conn pending max authenticated */
                } else if ( strcasecmp( cargv[0], "conn_max_pending_auth" ) == 0 ) {
@@ -443,7 +410,7 @@ read_config( const char *fname, int depth )
                                return( 1 );
                        }
 
-                       SLAPD_GLOBAL(conn_max_pending_auth) = max;
+                       slap_conn_max_pending_auth = max;
 
                /* default search base */
                } else if ( strcasecmp( cargv[0], "defaultSearchBase" ) == 0 ) {
@@ -470,14 +437,14 @@ read_config( const char *fname, int depth )
                                return 1;
                        }
 
-                       if ( SLAPD_GLOBAL(default_search_nbase).bv_len ) {
+                       if ( default_search_nbase.bv_len ) {
                                Debug( LDAP_DEBUG_ANY, "%s: line %d: "
                                        "default search base \"%s\" already defined "
                                        "(discarding old)\n",
-                                       fname, lineno, SLAPD_GLOBAL(default_search_base).bv_val );
+                                       fname, lineno, default_search_base.bv_val );
 
-                               free( SLAPD_GLOBAL(default_search_base).bv_val );
-                               free( SLAPD_GLOBAL(default_search_nbase).bv_val );
+                               free( default_search_base.bv_val );
+                               free( default_search_nbase.bv_val );
                        }
 
                        if ( load_ucdata( NULL ) < 0 ) return 1;
@@ -489,8 +456,8 @@ read_config( const char *fname, int depth )
                                dn.bv_len = strlen( dn.bv_val );
 
                                rc = dnPrettyNormal( NULL, &dn,
-                                       &SLAPD_GLOBAL(default_search_base),
-                                       &SLAPD_GLOBAL(default_search_nbase), NULL );
+                                       &default_search_base,
+                                       &default_search_nbase, NULL );
 
                                if( rc != LDAP_SUCCESS ) {
                                        Debug( LDAP_DEBUG_ANY,
@@ -527,10 +494,10 @@ read_config( const char *fname, int depth )
                                return( 1 );
                        }
 
-                       ldap_pvt_thread_pool_maxthreads( &SLAPD_GLOBAL(connection_pool), c );
+                       ldap_pvt_thread_pool_maxthreads( &connection_pool, c );
 
                        /* save for later use */
-                       SLAPD_GLOBAL(connection_pool_max) = c;
+                       connection_pool_max = c;
 
                /* get pid file name */
                } else if ( strcasecmp( cargv[0], "pidfile" ) == 0 ) {
@@ -542,7 +509,7 @@ read_config( const char *fname, int depth )
                                return( 1 );
                        }
 
-                       SLAPD_GLOBAL(pid_file) = ch_strdup( cargv[1] );
+                       slapd_pid_file = ch_strdup( cargv[1] );
 
                /* get args file name */
                } else if ( strcasecmp( cargv[0], "argsfile" ) == 0 ) {
@@ -554,7 +521,7 @@ read_config( const char *fname, int depth )
                                return( 1 );
                        }
 
-                       SLAPD_GLOBAL(args_file) = ch_strdup( cargv[1] );
+                       slapd_args_file = ch_strdup( cargv[1] );
 
                } else if ( strcasecmp( cargv[0], "replica-pidfile" ) == 0 ) {
                        /* ignore */ ;
@@ -571,7 +538,7 @@ read_config( const char *fname, int depth )
 
                                return( 1 );
                        }
-                       if ( SLAPD_GLOBAL(default_passwd_hash) != NULL ) {
+                       if ( default_passwd_hash != NULL ) {
                                Debug( LDAP_DEBUG_ANY,
                                        "%s: line %d: already set default password_hash!\n",
                                        fname, lineno, 0 );
@@ -585,10 +552,10 @@ read_config( const char *fname, int depth )
                                                "%s: line %d: password scheme \"%s\" not available\n",
                                                fname, lineno, cargv[i] );
                                } else {
-                                       ldap_charray_add( &SLAPD_GLOBAL(default_passwd_hash), cargv[i] );
+                                       ldap_charray_add( &default_passwd_hash, cargv[i] );
                                }
                        }
-                       if( !SLAPD_GLOBAL(default_passwd_hash) ) {
+                       if( !default_passwd_hash ) {
                                Debug( LDAP_DEBUG_ANY,
                                        "%s: line %d: no valid hashes found\n",
                                        fname, lineno, 0 );
@@ -606,7 +573,6 @@ read_config( const char *fname, int depth )
                        }
 
                        lutil_salt_format( cargv[1] );
-                       SLAPD_GLOBAL(conf_salt_format) = ch_strdup(cargv[1]);
 
 #ifdef SLAP_AUTH_REWRITE
                /* use authid rewrite instead of sasl regexp */
@@ -802,7 +768,7 @@ read_config( const char *fname, int depth )
 
                        } else {
                                SLAP_DBFLAGS(be) |= SLAP_DBFLAG_GLUE_SUBORDINATE;
-                               SLAPD_GLOBAL(num_subordinates)++;
+                               num_subordinates++;
                        }
 
                /* add an overlay to this backend */
@@ -891,11 +857,11 @@ read_config( const char *fname, int depth )
                                free( ndn.bv_val );
                                return( 1 );
 
-                       } else if( pdn.bv_len == 0 && SLAPD_GLOBAL(default_search_nbase).bv_len ) {
+                       } else if( pdn.bv_len == 0 && default_search_nbase.bv_len ) {
                                        Debug( LDAP_DEBUG_ANY, "%s: line %d: "
                                                "suffix DN empty and default "
                                                "search base provided \"%s\" (assuming okay)\n",
-                                       fname, lineno, SLAPD_GLOBAL(default_search_base).bv_val );
+                                       fname, lineno, default_search_base.bv_val );
                        }
 
                        ber_bvarray_add( &be->be_suffix, &pdn );
@@ -1169,7 +1135,7 @@ restrict_unknown:;
                                }
                        }
 
-                       SLAPD_GLOBAL(allows) |= allows;
+                       global_allows |= allows;
 
                /* disallow these features */
                } else if ( strcasecmp( cargv[0], "disallows" ) == 0 ||
@@ -1217,7 +1183,7 @@ restrict_unknown:;
                                }
                        }
 
-                       SLAPD_GLOBAL(disallows) |= disallows;
+                       global_disallows |= disallows;
 
                /* require these features */
                } else if ( strcasecmp( cargv[0], "requires" ) == 0 ||
@@ -1376,7 +1342,7 @@ restrict_unknown:;
 
                        vals[0].bv_val = cargv[1];
                        vals[0].bv_len = strlen( vals[0].bv_val );
-                       if( value_add( &SLAPD_GLOBAL(default_referral), vals ) )
+                       if( value_add( &default_referral, vals ) )
                                return LDAP_OTHER;
 
                /* start of a new database definition */
@@ -1472,16 +1438,16 @@ restrict_unknown:;
                                Debug( LDAP_DEBUG_ANY,
                                        "%s: line %d: schema checking disabled! your mileage may vary!\n",
                                    fname, lineno, 0 );
-                               SLAPD_GLOBAL(schemachecking) = 0;
+                               global_schemacheck = 0;
                        } else {
-                               SLAPD_GLOBAL(schemachecking) = 1;
+                               global_schemacheck = 1;
                        }
 
                /* specify access control info */
                } else if ( strcasecmp( cargv[0], "access" ) == 0 ) {
                        parse_acl( be, fname, lineno, cargc, cargv );
 
-               /* debug level to log things to ldap_syslog */
+               /* debug level to log things to syslog */
                } else if ( strcasecmp( cargv[0], "loglevel" ) == 0 ) {
                        if ( cargc < 2 ) {
                                Debug( LDAP_DEBUG_ANY,
@@ -1766,7 +1732,7 @@ restrict_unknown:;
                        if ( be ) {
                                be->be_replogfile = ch_strdup( cargv[1] );
                        } else {
-                               frontendDB->be_replogfile = ch_strdup( cargv[1] );
+                               replogfile = ch_strdup( cargv[1] );
                        }
 
                /* file from which to read additional rootdse attrs */
@@ -1824,9 +1790,9 @@ restrict_unknown:;
                                return( 1 );
                        }
                        if ( strcasecmp( cargv[1], "off" ) == 0 ) {
-                               SLAPD_GLOBAL(gentlehup) = 0;
+                               global_gentlehup = 0;
                        } else {
-                               SLAPD_GLOBAL(gentlehup) = 1;
+                               global_gentlehup = 1;
                        }
 #endif
 
@@ -1851,7 +1817,7 @@ restrict_unknown:;
                                return( 1 );
                        }
 
-                       SLAPD_GLOBAL(idletimeout) = i;
+                       global_idletimeout = i;
 
                /* include another config file */
                } else if ( strcasecmp( cargv[0], "include" ) == 0 ) {
@@ -1881,7 +1847,7 @@ restrict_unknown:;
 
                                return( 1 );
                        }
-                       SLAPD_GLOBAL(ldap_srvtab) = ch_strdup( cargv[1] );
+                       ldap_srvtab = ch_strdup( cargv[1] );
 
 #ifdef SLAPD_MODULES
                 } else if (strcasecmp( cargv[0], "moduleload") == 0 ) {
@@ -1986,9 +1952,9 @@ restrict_unknown:;
                        }
 
                        if ( !strcasecmp( cargv[1], "on" ) ) {
-                               SLAPD_GLOBAL(use_reverse_lookup) = 1;
+                               use_reverse_lookup = 1;
                        } else if ( !strcasecmp( cargv[1], "off" ) ) {
-                               SLAPD_GLOBAL(use_reverse_lookup) = 0;
+                               use_reverse_lookup = 0;
                        } else {
                                Debug( LDAP_DEBUG_ANY,
 "%s: line %d: reverse-lookup: must be \"on\" (default) or \"off\"\n",
@@ -2027,7 +1993,7 @@ restrict_unknown:;
                                                "config read failed.\n", fname, lineno, 0 );
                                return( 1 );
                        }
-                       SLAPD_GLOBAL(slapi_plugins_used)++;
+                       slapi_plugins_used++;
 
 #else /* !defined( LDAP_SLAPI ) */
                        Debug( LDAP_DEBUG_ANY, "%s: line %d: SLAPI "
@@ -2345,15 +2311,14 @@ config_destroy( )
                        free( frontendDB->be_schemadn.bv_val );
                if ( frontendDB->be_acl )
                        acl_destroy( frontendDB->be_acl, NULL );
-               /* globals are part of frontendDB */
-               if ( SLAPD_GLOBAL(args_file) )
-                       free ( SLAPD_GLOBAL(args_file) );
-               if ( SLAPD_GLOBAL(pid_file) )
-                       free ( SLAPD_GLOBAL(pid_file) );
-               if ( SLAPD_GLOBAL(default_passwd_hash) )
-                       ldap_charray_free( SLAPD_GLOBAL(default_passwd_hash) );
        }
        free( line );
+       if ( slapd_args_file )
+               free ( slapd_args_file );
+       if ( slapd_pid_file )
+               free ( slapd_pid_file );
+       if ( default_passwd_hash )
+               ldap_charray_free( default_passwd_hash );
 }
 
 static int
index 2cea2a8f56f7569a08ec35572dd3bde4e43b840b..44c4e9faf75e9fa8d837fa590c31dedafe7ec5a9 100644 (file)
@@ -107,19 +107,19 @@ int connections_init(void)
        ldap_pvt_thread_mutex_init( &connections_mutex );
        ldap_pvt_thread_mutex_init( &conn_nextid_mutex );
 
-       connections = (Connection *) ch_calloc( SLAPD_GLOBAL(dtblsize), sizeof(Connection) );
+       connections = (Connection *) ch_calloc( dtblsize, sizeof(Connection) );
 
        if( connections == NULL ) {
                Debug( LDAP_DEBUG_ANY,
                        "connections_init: allocation (%d*%ld) of connection array failed\n",
-                       SLAPD_GLOBAL(dtblsize), (long) sizeof(Connection), 0 );
+                       dtblsize, (long) sizeof(Connection), 0 );
                return -1;
        }
 
        assert( connections[0].c_struct_state == SLAP_C_UNINITIALIZED );
-       assert( connections[SLAPD_GLOBAL(dtblsize)-1].c_struct_state == SLAP_C_UNINITIALIZED );
+       assert( connections[dtblsize-1].c_struct_state == SLAP_C_UNINITIALIZED );
 
-       for (i=0; i<SLAPD_GLOBAL(dtblsize); i++) connections[i].c_conn_idx = i;
+       for (i=0; i<dtblsize; i++) connections[i].c_conn_idx = i;
 
        /*
         * per entry initialization of the Connection array initialization
@@ -144,14 +144,14 @@ int connections_destroy(void)
                return -1;
        }
 
-       for ( i = 0; i < SLAPD_GLOBAL(dtblsize); i++ ) {
+       for ( i = 0; i < dtblsize; i++ ) {
                if( connections[i].c_struct_state != SLAP_C_UNINITIALIZED ) {
                        ber_sockbuf_free( connections[i].c_sb );
                        ldap_pvt_thread_mutex_destroy( &connections[i].c_mutex );
                        ldap_pvt_thread_mutex_destroy( &connections[i].c_write_mutex );
                        ldap_pvt_thread_cond_destroy( &connections[i].c_write_cv );
 #ifdef LDAP_SLAPI
-                       if ( SLAPD_GLOBAL(slapi_plugins_used) ) {
+                       if ( slapi_plugins_used ) {
                                slapi_int_free_object_extensions( SLAPI_X_EXT_CONNECTION, &connections[i] );
                        }
 #endif
@@ -175,13 +175,13 @@ int connections_shutdown(void)
 
        ldap_pvt_thread_mutex_lock( &connections_mutex );
 
-       for ( i = 0; i < SLAPD_GLOBAL(dtblsize); i++ ) {
+       for ( i = 0; i < dtblsize; i++ ) {
                if( connections[i].c_struct_state != SLAP_C_USED ) {
                        continue;
                }
                /* give persistent clients a chance to cleanup */
                if( connections[i].c_conn_state == SLAP_C_CLIENT ) {
-                       ldap_pvt_thread_pool_submit( &SLAPD_GLOBAL(connection_pool),
+                       ldap_pvt_thread_pool_submit( &connection_pool,
                        connections[i].c_clientfunc, connections[i].c_clientarg );
                        continue;
                }
@@ -218,7 +218,7 @@ int connections_timeout_idle(time_t now)
                if( c->c_n_ops_executing ||
                        c->c_conn_state == SLAP_C_CLIENT ) continue;
 
-               if( difftime( c->c_activitytime+SLAPD_GLOBAL(idletimeout), now) < 0 ) {
+               if( difftime( c->c_activitytime+global_idletimeout, now) < 0 ) {
                        /* close it */
                        connection_closing( c );
                        connection_close( c );
@@ -256,7 +256,7 @@ static Connection* connection_get( ber_socket_t s )
        {
                ber_socket_t i, sd;
 
-               for(i=0; i<SLAPD_GLOBAL(dtblsize); i++) {
+               for(i=0; i<dtblsize; i++) {
                        if( connections[i].c_struct_state == SLAP_C_UNINITIALIZED ) {
                                assert( connections[i].c_conn_state == SLAP_C_INVALID );
                                assert( connections[i].c_sb == 0 );
@@ -315,7 +315,7 @@ static Connection* connection_get( ber_socket_t s )
                assert( sd != AC_SOCKET_INVALID );
 
 #ifndef SLAPD_MONITOR
-               if ( SLAPD_GLOBAL(idletimeout) > 0 )
+               if ( global_idletimeout > 0 )
 #endif /* ! SLAPD_MONITOR */
                {
                        c->c_activitytime = slap_get_time();
@@ -360,7 +360,7 @@ long connection_init(
 
        assert( s >= 0 );
 #ifndef HAVE_WINSOCK
-       assert( s < SLAPD_GLOBAL(dtblsize) );
+       assert( s < dtblsize );
 #endif
 
        ldap_pvt_thread_mutex_lock( &connections_mutex );
@@ -373,7 +373,7 @@ long connection_init(
                ber_socket_t i;
                c = NULL;
 
-               for( i=0; i < SLAPD_GLOBAL(dtblsize); i++) {
+               for( i=0; i < dtblsize; i++) {
                        ber_socket_t    sd;
 
                        if( connections[i].c_struct_state == SLAP_C_UNINITIALIZED ) {
@@ -406,7 +406,7 @@ long connection_init(
                if( c == NULL ) {
                        Debug( LDAP_DEBUG_ANY,
                                "connection_init(%d): connection table full "
-                               "(%d/%d)\n", s, i, SLAPD_GLOBAL(dtblsize));
+                               "(%d/%d)\n", s, i, dtblsize);
                        ldap_pvt_thread_mutex_unlock( &connections_mutex );
                        return -1;
                }
@@ -445,7 +445,7 @@ long connection_init(
                c->c_sb = ber_sockbuf_alloc( );
 
                {
-                       ber_len_t max = SLAPD_GLOBAL(sockbuf_max_incoming);
+                       ber_len_t max = sockbuf_max_incoming;
                        ber_sockbuf_ctrl( c->c_sb, LBER_SB_OPT_SET_MAX_INCOMING, &max );
                }
 
@@ -457,7 +457,7 @@ long connection_init(
                ldap_pvt_thread_cond_init( &c->c_write_cv );
 
 #ifdef LDAP_SLAPI
-               if ( SLAPD_GLOBAL(slapi_plugins_used) ) {
+               if ( slapi_plugins_used ) {
                        slapi_int_create_object_extensions( SLAPI_X_EXT_CONNECTION, c );
                }
 #endif
@@ -513,7 +513,7 @@ long connection_init(
        c->c_protocol = 0;
 
 #ifndef SLAPD_MONITOR
-       if ( SLAPD_GLOBAL(idletimeout) > 0 )
+       if ( global_idletimeout > 0 )
 #endif /* ! SLAPD_MONITOR */
        {
                c->c_activitytime = c->c_starttime = slap_get_time();
@@ -592,7 +592,7 @@ void connection2anonymous( Connection *c )
        assert( c != NULL );
 
        {
-               ber_len_t max = SLAPD_GLOBAL(sockbuf_max_incoming);
+               ber_len_t max = sockbuf_max_incoming;
                ber_sockbuf_ctrl( c->c_sb, LBER_SB_OPT_SET_MAX_INCOMING, &max );
        }
 
@@ -676,7 +676,7 @@ connection_destroy( Connection *c )
        c->c_sb = ber_sockbuf_alloc( );
 
        {
-               ber_len_t max = SLAPD_GLOBAL(sockbuf_max_incoming);
+               ber_len_t max = sockbuf_max_incoming;
                ber_sockbuf_ctrl( c->c_sb, LBER_SB_OPT_SET_MAX_INCOMING, &max );
        }
 
@@ -685,7 +685,7 @@ connection_destroy( Connection *c )
 
 #ifdef LDAP_SLAPI
        /* call destructors, then constructors; avoids unnecessary allocation */
-       if ( SLAPD_GLOBAL(slapi_plugins_used) ) {
+       if ( slapi_plugins_used ) {
                slapi_int_clear_object_extensions( SLAPI_X_EXT_CONNECTION, c );
        }
 #endif
@@ -809,7 +809,7 @@ Connection* connection_next( Connection *c, ber_socket_t *index )
 {
        assert( connections != NULL );
        assert( index != NULL );
-       assert( *index <= SLAPD_GLOBAL(dtblsize) );
+       assert( *index <= dtblsize );
 
        if( c != NULL ) {
                ldap_pvt_thread_mutex_unlock( &c->c_mutex );
@@ -817,7 +817,7 @@ Connection* connection_next( Connection *c, ber_socket_t *index )
 
        c = NULL;
 
-       for(; *index < SLAPD_GLOBAL(dtblsize); (*index)++) {
+       for(; *index < dtblsize; (*index)++) {
                if( connections[*index].c_struct_state == SLAP_C_UNINITIALIZED ) {
                        assert( connections[*index].c_conn_state == SLAP_C_INVALID );
 #ifndef HAVE_WINSOCK
@@ -865,16 +865,16 @@ void connection_done( Connection *c )
 /* FIXME: returns 0 in case of failure */
 #define INCR_OP_INITIATED(index) \
        do { \
-               ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(counters).sc_ops_mutex ); \
-               ldap_pvt_mp_add_ulong(SLAPD_GLOBAL(counters).sc_ops_initiated_[(index)], 1); \
-               ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(counters).sc_ops_mutex ); \
+               ldap_pvt_thread_mutex_lock( &slap_counters.sc_ops_mutex ); \
+               ldap_pvt_mp_add_ulong(slap_counters.sc_ops_initiated_[(index)], 1); \
+               ldap_pvt_thread_mutex_unlock( &slap_counters.sc_ops_mutex ); \
        } while (0)
 #define INCR_OP_COMPLETED(index) \
        do { \
-               ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(counters).sc_ops_mutex ); \
-               ldap_pvt_mp_add_ulong(SLAPD_GLOBAL(counters).sc_ops_completed, 1); \
-               ldap_pvt_mp_add_ulong(SLAPD_GLOBAL(counters).sc_ops_completed_[(index)], 1); \
-               ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(counters).sc_ops_mutex ); \
+               ldap_pvt_thread_mutex_lock( &slap_counters.sc_ops_mutex ); \
+               ldap_pvt_mp_add_ulong(slap_counters.sc_ops_completed, 1); \
+               ldap_pvt_mp_add_ulong(slap_counters.sc_ops_completed_[(index)], 1); \
+               ldap_pvt_thread_mutex_unlock( &slap_counters.sc_ops_mutex ); \
        } while (0)
 #else /* !SLAPD_MONITOR */
 #define INCR_OP_INITIATED(index) 
@@ -896,10 +896,10 @@ connection_operation( void *ctx, void *arg_v )
        void *memctx_null = NULL;
        ber_len_t memsiz;
 
-       ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(counters).sc_ops_mutex );
+       ldap_pvt_thread_mutex_lock( &slap_counters.sc_ops_mutex );
        /* FIXME: returns 0 in case of failure */
-       ldap_pvt_mp_add_ulong(SLAPD_GLOBAL(counters).sc_ops_initiated, 1);
-       ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(counters).sc_ops_mutex );
+       ldap_pvt_mp_add_ulong(slap_counters.sc_ops_initiated, 1);
+       ldap_pvt_thread_mutex_unlock( &slap_counters.sc_ops_mutex );
 
        op->o_threadctx = ctx;
 
@@ -1053,7 +1053,7 @@ operations_error:
                assert( 0 );
        }
 #endif /* SLAPD_MONITOR */
-       ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(counters).sc_ops_mutex );
+       ldap_pvt_thread_mutex_unlock( &slap_counters.sc_ops_mutex );
 
        if ( op->o_cancel == SLAP_CANCEL_REQ ) {
                op->o_cancel = LDAP_TOO_LATE;
@@ -1190,7 +1190,7 @@ int connection_read(ber_socket_t s)
 
        if ( c->c_conn_state == SLAP_C_CLIENT ) {
                slapd_clr_read( s, 0 );
-               ldap_pvt_thread_pool_submit( &SLAPD_GLOBAL(connection_pool),
+               ldap_pvt_thread_pool_submit( &connection_pool,
                        c->c_clientfunc, c->c_clientarg );
                connection_return( c );
                ldap_pvt_thread_mutex_unlock( &connections_mutex );
@@ -1203,7 +1203,7 @@ int connection_read(ber_socket_t s)
 
 #ifdef HAVE_TLS
        if ( c->c_is_tls && c->c_needs_tls_accept ) {
-               rc = ldap_pvt_tls_accept( c->c_sb, SLAPD_GLOBAL(tls_ctx) );
+               rc = ldap_pvt_tls_accept( c->c_sb, slap_tls_ctx );
                if ( rc < 0 ) {
 #if 0 /* required by next #if 0 */
                        struct timeval tv;
@@ -1490,7 +1490,7 @@ connection_input(
                defer = "closing";
        } else if (tag != LDAP_REQ_ABANDON && conn->c_writewaiter) {
                defer = "awaiting write";
-       } else if (conn->c_n_ops_executing >= SLAPD_GLOBAL(connection_pool_max)/2) {
+       } else if (conn->c_n_ops_executing >= connection_pool_max/2) {
                defer = "too many executing";
        } else if (conn->c_conn_state == SLAP_C_BINDING) {
                defer = "binding";
@@ -1500,8 +1500,8 @@ connection_input(
 
        if( defer ) {
                int max = conn->c_dn.bv_len
-                       ? SLAPD_GLOBAL(conn_max_pending_auth)
-                       : SLAPD_GLOBAL(conn_max_pending);
+                       ? slap_conn_max_pending_auth
+                       : slap_conn_max_pending;
 
                Debug( LDAP_DEBUG_ANY,
                        "connection_input: conn=%lu deferring operation: %s\n",
@@ -1577,7 +1577,7 @@ connection_resched( Connection *conn )
        }
 
        while ((op = LDAP_STAILQ_FIRST( &conn->c_pending_ops )) != NULL) {
-               if ( conn->c_n_ops_executing > SLAPD_GLOBAL(connection_pool_max)/2 ) {
+               if ( conn->c_n_ops_executing > connection_pool_max/2 ) {
                        break;
                }
                LDAP_STAILQ_REMOVE_HEAD( &conn->c_pending_ops, o_next );
@@ -1642,7 +1642,7 @@ static int connection_op_activate( Operation *op )
 
        LDAP_STAILQ_INSERT_TAIL( &op->o_conn->c_ops, op, o_next );
 
-       status = ldap_pvt_thread_pool_submit( &SLAPD_GLOBAL(connection_pool),
+       status = ldap_pvt_thread_pool_submit( &connection_pool,
                connection_operation, (void *) op );
 
        if ( status != 0 ) {
index f0087be0561a879844f964dfb2034db118ef805d..bdf2666ed95bf197d3fbfeb075889c1879f61494 100644 (file)
@@ -68,8 +68,9 @@ static LDAP_SLIST_HEAD(ControlsList, slap_control) controls_list
        = LDAP_SLIST_HEAD_INITIALIZER(&controls_list);
 
 /*
- * all known request control OIDs should be added to global known_controls
+ * all known request control OIDs should be added to this list
  */
+char **slap_known_controls = NULL;
 
 static char *proxy_authz_extops[] = {
        LDAP_EXOP_MODIFY_PASSWD,
@@ -171,28 +172,28 @@ register_supported_control(const char *controloid,
        }
        sc->sc_parse = controlparsefn;
 
-       /* Update SLAPD_GLOBAL(known_controls), too. */
-       if ( SLAPD_GLOBAL(known_controls) == NULL ) {
-               SLAPD_GLOBAL(known_controls) = (char **)SLAP_MALLOC( 2 * sizeof(char *) );
-               if ( SLAPD_GLOBAL(known_controls) == NULL ) {
+       /* Update slap_known_controls, too. */
+       if ( slap_known_controls == NULL ) {
+               slap_known_controls = (char **)SLAP_MALLOC( 2 * sizeof(char *) );
+               if ( slap_known_controls == NULL ) {
                        if ( sc->sc_extendedops != NULL ) {
                                ldap_charray_free( sc->sc_extendedops );
                        }
                        ch_free( sc );
                        return LDAP_NO_MEMORY;
                }
-               SLAPD_GLOBAL(known_controls)[0] = ch_strdup( sc->sc_oid );
-               SLAPD_GLOBAL(known_controls)[1] = NULL;
+               slap_known_controls[0] = ch_strdup( sc->sc_oid );
+               slap_known_controls[1] = NULL;
 
        } else {
                char **new_known_controls;
 
-               for ( i = 0; SLAPD_GLOBAL(known_controls)[i] != NULL; i++ ) {
+               for ( i = 0; slap_known_controls[i] != NULL; i++ ) {
                        /* EMPTY */ ;
                }
 
                new_known_controls = (char **)SLAP_REALLOC(
-                       SLAPD_GLOBAL(known_controls), (i + 2) * sizeof(char *) );
+                       slap_known_controls, (i + 2) * sizeof(char *) );
 
                if ( new_known_controls == NULL ) {
                        if ( sc->sc_extendedops != NULL ) {
@@ -201,9 +202,9 @@ register_supported_control(const char *controloid,
                        ch_free( sc );
                        return LDAP_NO_MEMORY;
                }
-               SLAPD_GLOBAL(known_controls) = new_known_controls;
-               SLAPD_GLOBAL(known_controls)[i++] = ch_strdup( sc->sc_oid );
-               SLAPD_GLOBAL(known_controls)[i] = NULL;
+               slap_known_controls = new_known_controls;
+               slap_known_controls[i++] = ch_strdup( sc->sc_oid );
+               slap_known_controls[i] = NULL;
        }
 
        LDAP_SLIST_NEXT( sc, sc_next ) = NULL;
@@ -250,7 +251,7 @@ controls_destroy( void )
                }
                ch_free( sc );
        }
-       ldap_charray_free( SLAPD_GLOBAL(known_controls) );
+       ldap_charray_free( slap_known_controls );
 }
 
 /*
index 17d132c657671a2af171ff812aa80686c9486dc2..b8bd3a62f141a2a6c69b25b1c3d53a09ad83a5dd 100644 (file)
@@ -40,6 +40,8 @@
 
 #include "ldap_rq.h"
 
+#include <valgrind/valgrind.h>
+
 #ifdef HAVE_TCPD
 #include <tcpd.h>
 #define SLAP_STRING_UNKNOWN    STRING_UNKNOWN
@@ -63,6 +65,10 @@ int slap_inet4or6 = AF_INET;
 #endif
 
 /* globals */
+time_t starttime;
+ber_socket_t dtblsize;
+slap_ssf_t local_ssf = LDAP_PVT_SASL_LOCAL_SSF;
+
 Listener **slap_listeners = NULL;
 
 #define SLAPD_LISTEN 10
@@ -79,6 +85,9 @@ static int waking;
 do { if (w) tcp_write( wake_sds[1], "0", 1 ); } while(0)
 #endif
 
+volatile sig_atomic_t slapd_shutdown = 0, slapd_gentle_shutdown = 0;
+volatile sig_atomic_t slapd_abrupt_shutdown = 0;
+
 static struct slap_daemon {
        ldap_pvt_thread_mutex_t sd_mutex;
 
@@ -107,6 +116,7 @@ static struct slap_daemon {
 #define LDAPS_SRVTYPE_PREFIX "service:ldaps://"
 static char** slapd_srvurls = NULL;
 static SLPHandle slapd_hslp = 0;
+int slapd_register_slp = 0;
 
 void slapd_slp_init( const char* urls ) {
        int i;
@@ -278,7 +288,7 @@ void slapd_remove(ber_socket_t s, int wasactive, int wake) {
                        emfile = 0;
        }
        ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex );
-       WAKE_LISTENER(wake || SLAPD_GLOBAL(gentle_shutdown) == 2);
+       WAKE_LISTENER(wake || slapd_gentle_shutdown == 2);
 }
 
 void slapd_clr_write(ber_socket_t s, int wake) {
@@ -723,10 +733,10 @@ static int slap_open_listener(
                        continue;
                }
 #ifndef HAVE_WINSOCK
-               if ( l.sl_sd >= SLAPD_GLOBAL(dtblsize) ) {
+               if ( l.sl_sd >= dtblsize ) {
                        Debug( LDAP_DEBUG_ANY,
                                "daemon: listener descriptor %ld is too great %ld\n",
-                               (long) l.sl_sd, (long) SLAPD_GLOBAL(dtblsize), 0 );
+                               (long) l.sl_sd, (long) dtblsize, 0 );
                        tcp_close( l.sl_sd );
                        sal++;
                        continue;
@@ -886,6 +896,20 @@ int slapd_daemon_init( const char *urls )
                return rc;
        }
 
+#ifdef HAVE_SYSCONF
+       dtblsize = sysconf( _SC_OPEN_MAX );
+#elif HAVE_GETDTABLESIZE
+       dtblsize = getdtablesize();
+#else
+       dtblsize = FD_SETSIZE;
+#endif
+
+#ifdef FD_SETSIZE
+       if(dtblsize > FD_SETSIZE) {
+               dtblsize = FD_SETSIZE;
+       }
+#endif /* !FD_SETSIZE */
+
        /* open a pipe (or something equivalent connected to itself).
         * we write a byte on this fd whenever we catch a signal. The main
         * loop will be select'ing on this socket, and will wake up when
@@ -940,7 +964,7 @@ int slapd_daemon_init( const char *urls )
                i, 0, 0 );
 
 #ifdef HAVE_SLP
-       if( SLAPD_GLOBAL(register_slp) ) {
+       if( slapd_register_slp ) {
                slapd_slp_init( urls );
                slapd_slp_reg();
        }
@@ -961,7 +985,7 @@ slapd_daemon_destroy(void)
        sockdestroy();
 
 #ifdef HAVE_SLP
-       if( SLAPD_GLOBAL(register_slp) ) {
+       if( slapd_register_slp ) {
                slapd_slp_dereg();
                slapd_slp_deinit();
        }
@@ -1010,14 +1034,14 @@ slapd_daemon_task(
 
 #define SLAPD_IDLE_CHECK_LIMIT 4
 
-       if ( SLAPD_GLOBAL(idletimeout) > 0 ) {
+       if ( global_idletimeout > 0 ) {
                last_idle_check = slap_get_time();
                /* Set the select timeout.
                 * Don't just truncate, preserve the fractions of
                 * seconds to prevent sleeping for zero time.
                 */
-               idle.tv_sec = SLAPD_GLOBAL(idletimeout)/SLAPD_IDLE_CHECK_LIMIT;
-               idle.tv_usec = SLAPD_GLOBAL(idletimeout) - idle.tv_sec * SLAPD_IDLE_CHECK_LIMIT;
+               idle.tv_sec = global_idletimeout/SLAPD_IDLE_CHECK_LIMIT;
+               idle.tv_usec = global_idletimeout - idle.tv_sec * SLAPD_IDLE_CHECK_LIMIT;
                idle.tv_usec *= 1000000 / SLAPD_IDLE_CHECK_LIMIT;
        } else {
                idle.tv_sec = 0;
@@ -1089,7 +1113,7 @@ slapd_daemon_task(
 #endif
        /* initialization complete. Here comes the loop. */
 
-       while ( !SLAPD_GLOBAL(shutdown) ) {
+       while ( !slapd_shutdown ) {
                ber_socket_t i;
                int ns;
                int at;
@@ -1111,30 +1135,30 @@ slapd_daemon_task(
                struct re_s*            rtask;
                now = slap_get_time();
 
-               if( ( SLAPD_GLOBAL(idletimeout) > 0 ) &&
+               if( ( global_idletimeout > 0 ) &&
                        difftime( last_idle_check +
-                       SLAPD_GLOBAL(idletimeout)/SLAPD_IDLE_CHECK_LIMIT, now ) < 0 ) {
+                       global_idletimeout/SLAPD_IDLE_CHECK_LIMIT, now ) < 0 ) {
                        connections_timeout_idle( now );
                        last_idle_check = now;
                }
                tv = idle;
 
 #ifdef SIGHUP
-               if( SLAPD_GLOBAL(gentle_shutdown) ) {
+               if( slapd_gentle_shutdown ) {
                        ber_socket_t active;
 
-                       if( SLAPD_GLOBAL(gentle_shutdown) == 1 ) {
+                       if( slapd_gentle_shutdown == 1 ) {
                                Debug( LDAP_DEBUG_ANY, "slapd gentle shutdown\n", 0, 0, 0 );
                                close_listeners( 1 );
                                frontendDB->be_restrictops |= SLAP_RESTRICT_OP_WRITES;
-                               SLAPD_GLOBAL(gentle_shutdown) = 2;
+                               slapd_gentle_shutdown = 2;
                        }
 
                        ldap_pvt_thread_mutex_lock( &slap_daemon.sd_mutex );
                        active = slap_daemon.sd_nactives;
                        ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex );
                        if( active == 0 ) {
-                               SLAPD_GLOBAL(shutdown) = 2;
+                               slapd_shutdown = 2;
                                break;
                        }
                }
@@ -1176,9 +1200,9 @@ slapd_daemon_task(
 #ifndef HAVE_WINSOCK
                nfds = slap_daemon.sd_nfds;
 #else
-               nfds = SLAPD_GLOBAL(dtblsize);
+               nfds = dtblsize;
 #endif
-               if ( SLAPD_GLOBAL(idletimeout) && slap_daemon.sd_nactives )
+               if ( global_idletimeout && slap_daemon.sd_nactives )
                        at = 1;
 
                ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex );
@@ -1192,21 +1216,22 @@ slapd_daemon_task(
                else
                        tvp = NULL;
 
-               ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(runqueue).rq_mutex );
-               rtask = ldap_pvt_runqueue_next_sched( &SLAPD_GLOBAL(runqueue), &cat );
+               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 ) {
-                       if ( ldap_pvt_runqueue_isrunning( &SLAPD_GLOBAL(runqueue), rtask )) {
-                               ldap_pvt_runqueue_resched( &SLAPD_GLOBAL(runqueue), rtask, 0 );
+                       if ( ldap_pvt_runqueue_isrunning( &syncrepl_rq, rtask )) {
+                               ldap_pvt_runqueue_resched( &syncrepl_rq, rtask, 0 );
                        } else {
-                               ldap_pvt_runqueue_runtask( &SLAPD_GLOBAL(runqueue), rtask );
-                               ldap_pvt_runqueue_resched( &SLAPD_GLOBAL(runqueue), rtask, 0 );
-                               ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(runqueue).rq_mutex );
-                               ldap_pvt_thread_pool_submit( &SLAPD_GLOBAL(connection_pool), rtask->routine, (void *) rtask );
-                               ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(runqueue).rq_mutex );
+                               ldap_pvt_runqueue_runtask( &syncrepl_rq, rtask );
+                               ldap_pvt_runqueue_resched( &syncrepl_rq, rtask, 0 );
+                               ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex );
+                               ldap_pvt_thread_pool_submit( &connection_pool,
+                                                                                       rtask->routine, (void *) rtask );
+                               ldap_pvt_thread_mutex_lock( &syncrepl_rq.rq_mutex );
                        }
-                       rtask = ldap_pvt_runqueue_next_sched( &SLAPD_GLOBAL(runqueue), &cat );
+                       rtask = ldap_pvt_runqueue_next_sched( &syncrepl_rq, &cat );
                }
-               ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(runqueue).rq_mutex );
+               ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex );
 
                if ( cat != NULL ) {
                        time_t diff = difftime( cat->tv_sec, now );
@@ -1256,7 +1281,7 @@ slapd_daemon_task(
                                        Debug( LDAP_DEBUG_CONNS,
                                                "daemon: select failed (%d): %s\n",
                                                err, sock_errstr(err), 0 );
-                                       SLAPD_GLOBAL(shutdown) = 2;
+                                       slapd_shutdown = 2;
                                }
                        }
                        continue;
@@ -1270,7 +1295,7 @@ slapd_daemon_task(
                        continue;
 
                default:        /* something happened - deal with it */
-                       if( SLAPD_GLOBAL(shutdown) ) continue;
+                       if( slapd_shutdown ) continue;
 
                        ebadf = 0;
                        Debug( LDAP_DEBUG_CONNS, "daemon: activity on %d descriptors\n",
@@ -1373,10 +1398,10 @@ slapd_daemon_task(
 
 #ifndef HAVE_WINSOCK
                        /* make sure descriptor number isn't too great */
-                       if ( s >= SLAPD_GLOBAL(dtblsize) ) {
+                       if ( s >= dtblsize ) {
                                Debug( LDAP_DEBUG_ANY,
                                        "daemon: %ld beyond descriptor table size %ld\n",
-                                       (long) s, (long) SLAPD_GLOBAL(dtblsize), 0 );
+                                       (long) s, (long) dtblsize, 0 );
 
                                slapd_close(s);
                                ldap_pvt_thread_yield();
@@ -1444,7 +1469,7 @@ slapd_daemon_task(
                                }
 
                                sprintf( peername, "PATH=%s", from.sa_un_addr.sun_path );
-                               ssf = SLAPD_GLOBAL(local_ssf);
+                               ssf = local_ssf;
                                {
                                        uid_t uid;
                                        gid_t gid;
@@ -1502,7 +1527,7 @@ slapd_daemon_task(
 #endif
                        ) {
 #ifdef SLAPD_RLOOKUPS
-                               if ( SLAPD_GLOBAL(use_reverse_lookup) ) {
+                               if ( use_reverse_lookup ) {
                                        char *herr;
                                        if (ldap_pvt_get_hname( (const struct sockaddr *)&from, len, hbuf,
                                                sizeof(hbuf), &herr ) == 0) {
@@ -1662,12 +1687,12 @@ slapd_daemon_task(
                ldap_pvt_thread_yield();
        }
 
-       if( SLAPD_GLOBAL(shutdown) == 1 ) {
+       if( slapd_shutdown == 1 ) {
                Debug( LDAP_DEBUG_TRACE,
                        "daemon: shutdown requested and initiated.\n",
                        0, 0, 0 );
 
-       } else if ( SLAPD_GLOBAL(shutdown) == 2 ) {
+       } else if ( slapd_shutdown == 2 ) {
 #ifdef HAVE_NT_SERVICE_MANAGER
                        Debug( LDAP_DEBUG_TRACE,
                               "daemon: shutdown initiated by Service Manager.\n",
@@ -1683,22 +1708,22 @@ slapd_daemon_task(
                       0, 0, 0 );
        }
 
-       if( SLAPD_GLOBAL(gentle_shutdown) != 2 ) {
+       if( slapd_gentle_shutdown != 2 ) {
                close_listeners ( 0 );
        }
 
        free ( slap_listeners );
        slap_listeners = NULL;
 
-       if( !SLAPD_GLOBAL(gentle_shutdown) ) {
-               SLAPD_GLOBAL(abrupt_shutdown) = 1;
+       if( !slapd_gentle_shutdown ) {
+               slapd_abrupt_shutdown = 1;
                connections_shutdown();
        }
 
        Debug( LDAP_DEBUG_ANY,
            "slapd shutdown: waiting for %d threads to terminate\n",
-           ldap_pvt_thread_pool_backload(&SLAPD_GLOBAL(connection_pool)), 0, 0 );
-       ldap_pvt_thread_pool_destroy(&SLAPD_GLOBAL(connection_pool), 1);
+           ldap_pvt_thread_pool_backload(&connection_pool), 0, 0 );
+       ldap_pvt_thread_pool_destroy(&connection_pool, 1);
 
        return NULL;
 }
@@ -1805,13 +1830,20 @@ slap_sig_shutdown( int sig )
        else
 #endif
 #ifdef SIGHUP
-       if (sig == SIGHUP && SLAPD_GLOBAL(gentlehup) && SLAPD_GLOBAL(gentle_shutdown) == 0)
-               SLAPD_GLOBAL(gentle_shutdown) = 1;
+       if (sig == SIGHUP && global_gentlehup && slapd_gentle_shutdown == 0)
+               slapd_gentle_shutdown = 1;
        else
 #endif
-       SLAPD_GLOBAL(shutdown) = 1;
+       slapd_shutdown = 1;
 
-       WAKE_LISTENER(1);
+       if ( sig == SIGTRAP )
+       {
+               slapd_shutdown = 0;
+               VALGRIND_ATTACH_GDB(1);
+       } else
+       {
+               WAKE_LISTENER(1);
+       }
 
        /* reinstall self */
        (void) SIGNAL_REINSTALL( sig, slap_sig_shutdown );
index 62eee13b3714ad8e70a82574e8b3fb8f4078d6cd..36a838b54a25fe36ff9649b8415b2677d01ca14d 100644 (file)
@@ -117,16 +117,16 @@ fe_op_delete( Operation *op, SlapReply *rs )
         */
        op->o_bd = select_backend( &op->o_req_ndn, manageDSAit, 0 );
        if ( op->o_bd == NULL ) {
-               rs->sr_ref = referral_rewrite( SLAPD_GLOBAL(default_referral),
+               rs->sr_ref = referral_rewrite( default_referral,
                        NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
 
-               if (!rs->sr_ref) rs->sr_ref = SLAPD_GLOBAL(default_referral);
+               if (!rs->sr_ref) rs->sr_ref = default_referral;
                if ( rs->sr_ref != NULL ) {
                        rs->sr_err = LDAP_REFERRAL;
 
                        send_ldap_result( op, rs );
 
-                       if (rs->sr_ref != SLAPD_GLOBAL(default_referral)) ber_bvarray_free( rs->sr_ref );
+                       if (rs->sr_ref != default_referral) ber_bvarray_free( rs->sr_ref );
                } else {
                        send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
                                "no global superior knowledge" );
@@ -244,7 +244,7 @@ fe_op_delete( Operation *op, SlapReply *rs )
 #ifndef SLAPD_MULTIMASTER
                } else {
                        BerVarray defref = op->o_bd->be_update_refs
-                               ? op->o_bd->be_update_refs : SLAPD_GLOBAL(default_referral);
+                               ? op->o_bd->be_update_refs : default_referral;
 
                        if ( defref != NULL ) {
                                rs->sr_ref = referral_rewrite( defref,
index 3bd004c482cfb349f4c016fd51787db9b9c198fa..e77f7c6a4e97c9af9d9d07a6604691147e26d27e 100644 (file)
@@ -295,9 +295,9 @@ done2:;
 
                if( rs->sr_err != SLAPD_ABANDON ) {
                        if ( rs->sr_err == LDAP_REFERRAL && rs->sr_ref == NULL ) {
-                               rs->sr_ref = referral_rewrite( SLAPD_GLOBAL(default_referral),
+                               rs->sr_ref = referral_rewrite( default_referral,
                                        NULL, NULL, LDAP_SCOPE_DEFAULT );
-                               if ( !rs->sr_ref ) rs->sr_ref = SLAPD_GLOBAL(default_referral);
+                               if ( !rs->sr_ref ) rs->sr_ref = default_referral;
                                if ( !rs->sr_ref ) {
                                        rs->sr_err = LDAP_UNWILLING_TO_PERFORM;
                                        rs->sr_text = "referral missing";
@@ -306,7 +306,7 @@ done2:;
 
                        send_ldap_extended( op, rs );
 
-                       if ( rs->sr_ref != SLAPD_GLOBAL(default_referral) ) {
+                       if ( rs->sr_ref != default_referral ) {
                                ber_bvarray_free( rs->sr_ref );
                                rs->sr_ref = NULL;
                        }
index 8999baa6895f9fc566af949ae720a3faa389a6ff..0aedfc0e849eb4348977e879b56e17054ebb58e8 100644 (file)
@@ -80,7 +80,7 @@ frontend_init( void )
        frontendDB->bd_info->bi_type = "frontend";
 
        /* known controls */
-       frontendDB->bd_info->bi_controls = SLAPD_GLOBAL(known_controls);
+       frontendDB->bd_info->bi_controls = slap_known_controls;
 
        /* calls */
        frontendDB->bd_info->bi_op_add = fe_op_add;
index 30e1269bc9a8eb705a96a39ef48db0d0e993d106..b7a3fc3bac0a9d8e2094767c8c043049dba22550 100644 (file)
  */
 int            slap_debug = 0;
 
+#ifdef LDAP_DEBUG
+int            ldap_syslog = LDAP_DEBUG_STATS;
+#else
+int            ldap_syslog;
+#endif
+
+#ifdef LOG_DEBUG
+int            ldap_syslog_level = LOG_DEBUG;
+#endif
+
+BerVarray default_referral = NULL;
+
 struct berval AllUser = BER_BVC( LDAP_ALL_USER_ATTRIBUTES );
 struct berval AllOper = BER_BVC( LDAP_ALL_OPERATIONAL_ATTRIBUTES );
 struct berval NoAttrs = BER_BVC( LDAP_NO_ATTRS );
@@ -51,22 +63,24 @@ struct berval NoAttrs = BER_BVC( LDAP_NO_ATTRS );
 /*
  * global variables that need mutex protection
  */
-#ifdef LDAP_DEBUG
-int ldap_syslog = LDAP_DEBUG_STATS;
-#else
-int ldap_syslog;
+ldap_pvt_thread_pool_t connection_pool;
+int                    connection_pool_max = SLAP_MAX_WORKER_THREADS;
+#ifndef HAVE_GMTIME_R
+ldap_pvt_thread_mutex_t        gmtime_mutex;
 #endif
-
-#ifdef LOG_DEBUG
-int ldap_syslog_level = LOG_DEBUG;
-#else
-int ldap_syslog_level;
+#if defined( SLAPD_CRYPT ) || defined( SLAPD_SPASSWD )
+ldap_pvt_thread_mutex_t        passwd_mutex;
 #endif
 
+slap_counters_t                        slap_counters;
+
 /*
  * these mutexes must be used when calling the entry2str()
  * routine since it returns a pointer to static data.
  */
+ldap_pvt_thread_mutex_t        entry2str_mutex;
+ldap_pvt_thread_mutex_t        replog_mutex;
+
 static const char* slap_name = NULL;
 int slapMode = SLAP_UNDEFINED_MODE;
 
@@ -99,34 +113,34 @@ slap_init( int mode, const char *name )
 
                slap_name = name;
 
-               ldap_pvt_thread_pool_init( &SLAPD_GLOBAL(connection_pool),
-                               SLAPD_GLOBAL(connection_pool_max), 0);
+               ldap_pvt_thread_pool_init( &connection_pool,
+                               connection_pool_max, 0);
 
-               ldap_pvt_thread_mutex_init( &SLAPD_GLOBAL(entry2str_mutex) );
-               ldap_pvt_thread_mutex_init( &SLAPD_GLOBAL(replog_mutex) );
+               ldap_pvt_thread_mutex_init( &entry2str_mutex );
+               ldap_pvt_thread_mutex_init( &replog_mutex );
 
-               ldap_pvt_thread_mutex_init( &SLAPD_GLOBAL(counters).sc_sent_mutex );
-               ldap_pvt_thread_mutex_init( &SLAPD_GLOBAL(counters).sc_ops_mutex );
-               ldap_pvt_mp_init( SLAPD_GLOBAL(counters).sc_bytes );
-               ldap_pvt_mp_init( SLAPD_GLOBAL(counters).sc_pdu );
-               ldap_pvt_mp_init( SLAPD_GLOBAL(counters).sc_entries );
-               ldap_pvt_mp_init( SLAPD_GLOBAL(counters).sc_refs );
+               ldap_pvt_thread_mutex_init( &slap_counters.sc_sent_mutex );
+               ldap_pvt_thread_mutex_init( &slap_counters.sc_ops_mutex );
+               ldap_pvt_mp_init( slap_counters.sc_bytes );
+               ldap_pvt_mp_init( slap_counters.sc_pdu );
+               ldap_pvt_mp_init( slap_counters.sc_entries );
+               ldap_pvt_mp_init( slap_counters.sc_refs );
 
-               ldap_pvt_mp_init( SLAPD_GLOBAL(counters).sc_ops_completed );
-               ldap_pvt_mp_init( SLAPD_GLOBAL(counters).sc_ops_initiated );
+               ldap_pvt_mp_init( slap_counters.sc_ops_completed );
+               ldap_pvt_mp_init( slap_counters.sc_ops_initiated );
 
 #ifdef SLAPD_MONITOR
                for ( i = 0; i < SLAP_OP_LAST; i++ ) {
-                       ldap_pvt_mp_init( SLAPD_GLOBAL(counters).sc_ops_initiated_[ i ] );
-                       ldap_pvt_mp_init( SLAPD_GLOBAL(counters).sc_ops_completed_[ i ] );
+                       ldap_pvt_mp_init( slap_counters.sc_ops_initiated_[ i ] );
+                       ldap_pvt_mp_init( slap_counters.sc_ops_completed_[ i ] );
                }
 #endif /* SLAPD_MONITOR */
 
 #ifndef HAVE_GMTIME_R
-               ldap_pvt_thread_mutex_init( &SLAPD_GLOBAL(gmtime_mutex) );
+               ldap_pvt_thread_mutex_init( &gmtime_mutex );
 #endif
 #if defined( SLAPD_CRYPT ) || defined( SLAPD_SPASSWD )
-               ldap_pvt_thread_mutex_init( &SLAPD_GLOBAL(passwd_mutex) );
+               ldap_pvt_thread_mutex_init( &passwd_mutex );
 #endif
 
                rc = slap_sasl_init();
@@ -205,8 +219,8 @@ int slap_destroy(void)
                "%s destroy: freeing system resources.\n",
                slap_name, 0, 0 );
 
-       if ( SLAPD_GLOBAL(default_referral) ) {
-               ber_bvarray_free( SLAPD_GLOBAL(default_referral) );
+       if ( default_referral ) {
+               ber_bvarray_free( default_referral );
        }
 
        rc = backend_destroy();
@@ -219,19 +233,19 @@ int slap_destroy(void)
        case SLAP_SERVER_MODE:
        case SLAP_TOOL_MODE:
 
-               ldap_pvt_thread_mutex_destroy( &SLAPD_GLOBAL(counters).sc_sent_mutex );
-               ldap_pvt_thread_mutex_destroy( &SLAPD_GLOBAL(counters).sc_ops_mutex );
-               ldap_pvt_mp_clear( SLAPD_GLOBAL(counters).sc_bytes );
-               ldap_pvt_mp_clear( SLAPD_GLOBAL(counters).sc_pdu );
-               ldap_pvt_mp_clear( SLAPD_GLOBAL(counters).sc_entries );
-               ldap_pvt_mp_clear( SLAPD_GLOBAL(counters).sc_refs );
-               ldap_pvt_mp_clear( SLAPD_GLOBAL(counters).sc_ops_completed );
-               ldap_pvt_mp_clear( SLAPD_GLOBAL(counters).sc_ops_initiated );
+               ldap_pvt_thread_mutex_destroy( &slap_counters.sc_sent_mutex );
+               ldap_pvt_thread_mutex_destroy( &slap_counters.sc_ops_mutex );
+               ldap_pvt_mp_clear( slap_counters.sc_bytes );
+               ldap_pvt_mp_clear( slap_counters.sc_pdu );
+               ldap_pvt_mp_clear( slap_counters.sc_entries );
+               ldap_pvt_mp_clear( slap_counters.sc_refs );
+               ldap_pvt_mp_clear( slap_counters.sc_ops_completed );
+               ldap_pvt_mp_clear( slap_counters.sc_ops_initiated );
 
 #ifdef SLAPD_MONITOR
                for ( i = 0; i < SLAP_OP_LAST; i++ ) {
-                       ldap_pvt_mp_clear( SLAPD_GLOBAL(counters).sc_ops_initiated_[ i ] );
-                       ldap_pvt_mp_clear( SLAPD_GLOBAL(counters).sc_ops_completed_[ i ] );
+                       ldap_pvt_mp_clear( slap_counters.sc_ops_initiated_[ i ] );
+                       ldap_pvt_mp_clear( slap_counters.sc_ops_completed_[ i ] );
                }
 #endif /* SLAPD_MONITOR */
                break;
index b7c6d70917997db89566c495cb8b6163d3b3e824..2fe5afe2f5f1fadbf07522306dae7ef14459af07 100644 (file)
@@ -46,7 +46,7 @@ krbv4_ldap_auth(
 
        strcpy( instance, "*" );
        if ( (err = krb_rd_req( ktxt, LDAP_KRB_PRINCIPAL, instance, 0L, ad,
-           SLAPD_GLOBAL(ldap_srvtab) )) != KSUCCESS ) {
+           ldap_srvtab )) != KSUCCESS ) {
                Debug( LDAP_DEBUG_ANY, "krb_rd_req failed (%s)\n",
                    krb_err_txt[err], 0, 0 );
                return( LDAP_INVALID_CREDENTIALS );
index 0270b05bfa77055f493346cb219eb3d90313e8b0..db8403c843f76130691e3646890113c0bd6942d9 100644 (file)
@@ -133,16 +133,18 @@ static int cnvt_str2int( char *, STRDISP_P, int );
 static int check = CHECK_NONE;
 static int version = 0;
 
+void *slap_tls_ctx;
+
 static int
 slapd_opt_slp( const char *val, void *arg )
 {
 #ifdef HAVE_SLP
        /* NULL is default */
        if ( val == NULL || strcasecmp( val, "on" ) == 0 ) {
-               SLAPD_GLOBAL(register_slp) = 1;
+               slapd_register_slp = 1;
 
        } else if ( strcasecmp( val, "off" ) == 0 ) {
-               SLAPD_GLOBAL(register_slp) = 0;
+               slapd_register_slp = 0;
 
        /* NOTE: add support for URL specification? */
 
@@ -272,8 +274,6 @@ int main( int argc, char **argv )
 
        slap_sl_mem_init();
 
-       config_init();  /* sets frontendDB */
-
        serverName = lutil_progname( "slapd", argc, argv );
 
        if ( strcmp( serverName, "slapd" ) ) {
@@ -354,12 +354,13 @@ int main( int argc, char **argv )
                        break;
 
                case 'c':       /* provide sync cookie, override if exist in replica */
-                       scp = (struct sync_cookie *) ch_calloc( 1, sizeof( struct sync_cookie ));
+                       scp = (struct sync_cookie *) ch_calloc( 1,
+                                                                               sizeof( struct sync_cookie ));
                        ber_str2bv( optarg, strlen( optarg ), 1, &cookie );
                        ber_bvarray_add( &scp->octet_str, &cookie );
                        slap_parse_sync_cookie( scp );
 
-                       LDAP_STAILQ_FOREACH( scp_entry, &SLAPD_GLOBAL(sync_cookie), sc_next ) {
+                       LDAP_STAILQ_FOREACH( scp_entry, &slap_sync_cookie, sc_next ) {
                                if ( scp->rid == scp_entry->rid ) {
                                        Debug( LDAP_DEBUG_ANY,
                                                    "main: duplicated replica id in cookies\n",
@@ -368,7 +369,7 @@ int main( int argc, char **argv )
                                        goto destroy;
                                }
                        }
-                       LDAP_STAILQ_INSERT_TAIL( &SLAPD_GLOBAL(sync_cookie), scp, sc_next );
+                       LDAP_STAILQ_INSERT_TAIL( &slap_sync_cookie, scp, sc_next );
                        break;
 
                case 'd':       /* set debug level and 'do not detach' flag */
@@ -686,7 +687,7 @@ unhandled_option:;
                        goto destroy;
                }
                /* Retrieve slapd's own ctx */
-               ldap_pvt_tls_get_option( NULL, LDAP_OPT_X_TLS_CTX, &SLAPD_GLOBAL(tls_ctx) );
+               ldap_pvt_tls_get_option( NULL, LDAP_OPT_X_TLS_CTX, &slap_tls_ctx );
                /* Restore previous ctx */
                ldap_pvt_tls_set_option( NULL, LDAP_OPT_X_TLS_CTX, def_ctx );
        }
@@ -703,6 +704,7 @@ unhandled_option:;
 #endif
        (void) SIGNAL( SIGINT, slap_sig_shutdown );
        (void) SIGNAL( SIGTERM, slap_sig_shutdown );
+       (void) SIGNAL( SIGTRAP, slap_sig_shutdown );
 #ifdef LDAP_SIGCHLD
        (void) SIGNAL( LDAP_SIGCHLD, wait4child );
 #endif
@@ -723,7 +725,7 @@ unhandled_option:;
         * FIXME: moved here from slapd_daemon_task()
         * because back-monitor db_open() needs it
         */
-       time( &SLAPD_GLOBAL(starttime) );
+       time( &starttime );
 
        if ( slap_startup( NULL )  != 0 ) {
                rc = 1;
@@ -734,21 +736,21 @@ unhandled_option:;
        Debug( LDAP_DEBUG_ANY, "slapd starting\n", 0, 0, 0 );
 
 
-       if ( SLAPD_GLOBAL(pid_file) != NULL ) {
-               FILE *fp = fopen( SLAPD_GLOBAL(pid_file), "w" );
+       if ( slapd_pid_file != NULL ) {
+               FILE *fp = fopen( slapd_pid_file, "w" );
 
                if( fp != NULL ) {
                        fprintf( fp, "%d\n", (int) getpid() );
                        fclose( fp );
 
                } else {
-                       free(SLAPD_GLOBAL(pid_file));
-                       SLAPD_GLOBAL(pid_file) = NULL;
+                       free(slapd_pid_file);
+                       slapd_pid_file = NULL;
                }
        }
 
-       if ( SLAPD_GLOBAL(args_file) != NULL ) {
-               FILE *fp = fopen( SLAPD_GLOBAL(args_file), "w" );
+       if ( slapd_args_file != NULL ) {
+               FILE *fp = fopen( slapd_args_file, "w" );
 
                if( fp != NULL ) {
                        for ( i = 0; i < g_argc; i++ ) {
@@ -757,8 +759,8 @@ unhandled_option:;
                        fprintf( fp, "\n" );
                        fclose( fp );
                } else {
-                       free(SLAPD_GLOBAL(args_file));
-                       SLAPD_GLOBAL(args_file) = NULL;
+                       free(slapd_args_file);
+                       slapd_args_file = NULL;
                }
        }
 
@@ -783,9 +785,9 @@ destroy:
        /* remember an error during destroy */
        rc |= slap_destroy();
 
-       while ( !LDAP_STAILQ_EMPTY( &SLAPD_GLOBAL(sync_cookie) )) {
-               scp = LDAP_STAILQ_FIRST( &SLAPD_GLOBAL(sync_cookie) );
-               LDAP_STAILQ_REMOVE_HEAD( &SLAPD_GLOBAL(sync_cookie), sc_next );
+       while ( !LDAP_STAILQ_EMPTY( &slap_sync_cookie )) {
+               scp = LDAP_STAILQ_FIRST( &slap_sync_cookie );
+               LDAP_STAILQ_REMOVE_HEAD( &slap_sync_cookie, sc_next );
                ch_free( scp );
        }
 
@@ -825,11 +827,11 @@ stop:
        ldap_pvt_tls_destroy();
 #endif
 
-       if ( SLAPD_GLOBAL(pid_file) != NULL ) {
-               unlink( SLAPD_GLOBAL(pid_file) );
+       if ( slapd_pid_file != NULL ) {
+               unlink( slapd_pid_file );
        }
-       if ( SLAPD_GLOBAL(args_file) != NULL ) {
-               unlink( SLAPD_GLOBAL(args_file) );
+       if ( slapd_args_file != NULL ) {
+               unlink( slapd_args_file );
        }
 
        config_destroy();
index 83a382347430372763b7d50e3e614fe3b0fe38c7..9158546c1a387b30235cf5c4371ccd0d0c54da6d 100644 (file)
@@ -299,15 +299,15 @@ fe_op_modify( Operation *op, SlapReply *rs )
         */
        op->o_bd = select_backend( &op->o_req_ndn, manageDSAit, 0 );
        if ( op->o_bd == NULL ) {
-               rs->sr_ref = referral_rewrite( SLAPD_GLOBAL(default_referral),
+               rs->sr_ref = referral_rewrite( default_referral,
                        NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
-               if (!rs->sr_ref) rs->sr_ref = SLAPD_GLOBAL(default_referral);
+               if (!rs->sr_ref) rs->sr_ref = default_referral;
 
                if (rs->sr_ref != NULL ) {
                        rs->sr_err = LDAP_REFERRAL;
                        send_ldap_result( op, rs );
 
-                       if (rs->sr_ref != SLAPD_GLOBAL(default_referral)) ber_bvarray_free( rs->sr_ref );
+                       if (rs->sr_ref != default_referral) ber_bvarray_free( rs->sr_ref );
                } else {
                        send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
                                "no global superior knowledge" );
@@ -448,7 +448,7 @@ fe_op_modify( Operation *op, SlapReply *rs )
                /* send a referral */
                } else {
                        BerVarray defref = op->o_bd->be_update_refs
-                               ? op->o_bd->be_update_refs : SLAPD_GLOBAL(default_referral);
+                               ? op->o_bd->be_update_refs : default_referral;
                        if ( defref != NULL ) {
                                rs->sr_ref = referral_rewrite( defref,
                                        NULL, &op->o_req_dn,
@@ -779,7 +779,7 @@ int slap_mods_opattrs(
 #ifdef HAVE_GMTIME_R
                ltm = gmtime_r( &now, &ltm_buf );
 #else
-               ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(gmtime_mutex) );
+               ldap_pvt_thread_mutex_lock( &gmtime_mutex );
                ltm = gmtime( &now );
 #endif /* HAVE_GMTIME_R */
                lutil_gentime( timebuf, sizeof(timebuf), ltm );
@@ -787,7 +787,7 @@ int slap_mods_opattrs(
                slap_get_csn( op, csnbuf, sizeof(csnbuf), &csn, manage_ctxcsn );
 
 #ifndef HAVE_GMTIME_R
-               ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(gmtime_mutex) );
+               ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
 #endif
 
                timestamp.bv_val = timebuf;
@@ -805,7 +805,7 @@ int slap_mods_opattrs(
        if( op->o_tag == LDAP_REQ_ADD ) {
                struct berval tmpval;
 
-               if( SLAPD_GLOBAL(schemachecking) ) {
+               if( global_schemacheck ) {
                        int rc = mods_structural_class( mods, &tmpval,
                                text, textbuf, textlen );
                        if( rc != LDAP_SUCCESS ) return rc;
index 3efcfcc6081fe5c20413b841b3b7f6c3d8f2398c..1cfd67326178960f2053ea48c742b6c71564cab6 100644 (file)
@@ -231,15 +231,15 @@ fe_op_modrdn( Operation *op, SlapReply *rs )
         */
        op->o_bd = select_backend( &op->o_req_ndn, manageDSAit, 0 );
        if ( op->o_bd == NULL ) {
-               rs->sr_ref = referral_rewrite( SLAPD_GLOBAL(default_referral),
+               rs->sr_ref = referral_rewrite( default_referral,
                        NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
-               if (!rs->sr_ref) rs->sr_ref = SLAPD_GLOBAL(default_referral);
+               if (!rs->sr_ref) rs->sr_ref = default_referral;
 
                if ( rs->sr_ref != NULL ) {
                        rs->sr_err = LDAP_REFERRAL;
                        send_ldap_result( op, rs );
 
-                       if (rs->sr_ref != SLAPD_GLOBAL(default_referral)) ber_bvarray_free( rs->sr_ref );
+                       if (rs->sr_ref != default_referral) ber_bvarray_free( rs->sr_ref );
                } else {
                        send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
                                "no global superior knowledge" );
@@ -366,7 +366,7 @@ fe_op_modrdn( Operation *op, SlapReply *rs )
 #ifndef SLAPD_MULTIMASTER
                } else {
                        BerVarray defref = op->o_bd->be_update_refs
-                               ? op->o_bd->be_update_refs : SLAPD_GLOBAL(default_referral);
+                               ? op->o_bd->be_update_refs : default_referral;
 
                        if ( defref != NULL ) {
                                rs->sr_ref = referral_rewrite( defref,
index 8ddd897755ea1f0bb9074224ee9a28d36c26ca21..27ec820fac32f2215de249a76bf0c04c7a1f5bb9 100644 (file)
@@ -155,7 +155,7 @@ slap_op_alloc(
        op->o_sync_slog_list.stqh_last = &LDAP_STAILQ_FIRST( &op->o_sync_slog_list );
 
 #if defined( LDAP_SLAPI )
-       if ( SLAPD_GLOBAL(slapi_plugins_used) ) {
+       if ( slapi_plugins_used ) {
                op->o_pb = slapi_pblock_new();
                slapi_int_create_object_extensions( SLAPI_X_EXT_OPERATION, op );
        }
index 6c832f41aae43d8637b546d654acdbdad7889850..1485713472f6fd4484d09fb7335682f5e0281a81 100644 (file)
@@ -355,16 +355,16 @@ lastmod_op_func( Operation *op, SlapReply *rs )
 
 return_referral:;
        op->o_bd->bd_info = (BackendInfo *)on->on_info;
-       rs->sr_ref = referral_rewrite( SLAPD_GLOBAL(default_referral),
+       rs->sr_ref = referral_rewrite( default_referral,
                        NULL, &op->o_req_dn, op->ors_scope );
 
        if ( !rs->sr_ref ) {
-               rs->sr_ref = SLAPD_GLOBAL( default_referral );
+               rs->sr_ref = default_referral;
        }
        rs->sr_err = LDAP_REFERRAL;
        send_ldap_result( op, rs );
 
-       if ( rs->sr_ref != SLAPD_GLOBAL( default_referral )) {
+       if ( rs->sr_ref != default_referral ) {
                ber_bvarray_free( rs->sr_ref );
        }
        rs->sr_ref = NULL;
@@ -400,14 +400,14 @@ best_guess( Operation *op,
                currtime = op->o_time;
 
 #ifndef HAVE_GMTIME_R
-               ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL( gmtime_mutex ));
+               ldap_pvt_thread_mutex_lock( &gmtime_mutex );
                tm = gmtime( &currtime );
 #else /* HAVE_GMTIME_R */
                tm = gmtime_r( &currtime, &tm_buf );
 #endif /* HAVE_GMTIME_R */
                lutil_gentime( tmbuf, sizeof( tmbuf ), tm );
 #ifndef HAVE_GMTIME_R
-               ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(gmtime_mutex) );
+               ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
 #endif
 
                ber_str2bv( tmbuf, 0, 1, bv_modifyTimestamp );
@@ -874,14 +874,14 @@ lastmod_db_open(
         * Start
         */
 #ifndef HAVE_GMTIME_R
-       ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL( gmtime_mutex ));
-       tms = gmtime( &SLAPD_GLOBAL( starttime ));
+       ldap_pvt_thread_mutex_lock( &gmtime_mutex );
+       tms = gmtime( &starttime );
 #else /* HAVE_GMTIME_R */
-       tms = gmtime_r( &SLAPD_GLOBAL( starttime ), &tm_buf );
+       tms = gmtime_r( &starttime, &tm_buf );
 #endif /* HAVE_GMTIME_R */
        lutil_gentime( tmbuf, sizeof(tmbuf), tms );
 #ifndef HAVE_GMTIME_R
-       ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL( gmtime_mutex ));
+       ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
 #endif
 
        if ( BER_BVISNULL( &lmi->lmi_rdnvalue ) ) {
index 3f4ffd31b9009199287611e9fcc0c1c8ce1b2583..3b667e5380175c13fbb37fbde40bbba5ca7500de 100644 (file)
@@ -1123,12 +1123,12 @@ proxy_cache_response(
                         * wake it back up
                         */
                        if ( cm->cc_paused ) {
-                               ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(runqueue).rq_mutex );
+                               ldap_pvt_thread_mutex_lock( &syncrepl_rq.rq_mutex );
                                if ( cm->cc_paused ) {
                                        cm->cc_paused = 0;
-                                       ldap_pvt_runqueue_resched( &SLAPD_GLOBAL(runqueue), cm->cc_arg, 0 );
+                                       ldap_pvt_runqueue_resched( &syncrepl_rq, cm->cc_arg, 0 );
                                }
-                               ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(runqueue).rq_mutex );
+                               ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex );
                        }
                }
 
@@ -1464,15 +1464,15 @@ consistency_check(
                }
                ldap_pvt_thread_mutex_unlock(&cm->remove_mutex);
        }
-       ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(runqueue).rq_mutex );
-       if ( ldap_pvt_runqueue_isrunning( &SLAPD_GLOBAL(runqueue), rtask )) {
-               ldap_pvt_runqueue_stoptask( &SLAPD_GLOBAL(runqueue), rtask );
+       ldap_pvt_thread_mutex_lock( &syncrepl_rq.rq_mutex );
+       if ( ldap_pvt_runqueue_isrunning( &syncrepl_rq, rtask )) {
+               ldap_pvt_runqueue_stoptask( &syncrepl_rq, rtask );
        }
        /* If there were no queries, defer processing for a while */
        cm->cc_paused = pause;
-       ldap_pvt_runqueue_resched( &SLAPD_GLOBAL(runqueue), rtask, pause );
+       ldap_pvt_runqueue_resched( &syncrepl_rq, rtask, pause );
 
-       ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(runqueue).rq_mutex );
+       ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex );
        return NULL;
 }
 
@@ -1730,10 +1730,10 @@ proxy_cache_open(
 
        /* There is no runqueue in TOOL mode */
        if ( slapMode & SLAP_SERVER_MODE ) {
-               ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(runqueue).rq_mutex );
-               ldap_pvt_runqueue_insert( &SLAPD_GLOBAL(runqueue), cm->cc_period,
+               ldap_pvt_thread_mutex_lock( &syncrepl_rq.rq_mutex );
+               ldap_pvt_runqueue_insert( &syncrepl_rq, cm->cc_period,
                        consistency_check, on );
-               ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(runqueue).rq_mutex );
+               ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex );
 
                /* Cached database must have the rootdn */
                if ( BER_BVISNULL( &cm->db.be_rootndn )
index 514a49f68cd1d72dc782addaa9db4190b4cff7a8..958da9ee6b6327487bd80fcf8de0e04c0a447f70 100644 (file)
@@ -710,10 +710,10 @@ ppolicy_bind_resp( Operation *op, SlapReply *rs )
        }
 
        now = slap_get_time(); /* stored for later consideration */
-       ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(gmtime_mutex ));
+       ldap_pvt_thread_mutex_lock( &gmtime_mutex );
        tm = gmtime(&now);
        lutil_gentime( nowstr, sizeof(nowstr), tm );
-       ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(gmtime_mutex ));
+       ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
 
        if ( rs->sr_err == LDAP_INVALID_CREDENTIALS ) {
                int i = 0, fc = 0;
@@ -1125,10 +1125,10 @@ ppolicy_add(
                        struct tm *ltm;
                        time_t now = slap_get_time();
 
-                       ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(gmtime_mutex ));
+                       ldap_pvt_thread_mutex_lock( &gmtime_mutex );
                        ltm = gmtime( &now );
                        lutil_gentime( timebuf, sizeof(timebuf), ltm );
-                       ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(gmtime_mutex ));
+                       ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
 
                        timestamp.bv_val = timebuf;
                        timestamp.bv_len = strlen(timebuf);
@@ -1445,10 +1445,10 @@ do_modify:
                 * up to date.
                 */
 
-               ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(gmtime_mutex ));
+               ldap_pvt_thread_mutex_lock( &gmtime_mutex );
                ltm = gmtime( &now );
                lutil_gentime( timebuf, sizeof(timebuf), ltm );
-               ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(gmtime_mutex ));
+               ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
 
                timestamp.bv_val = timebuf;
                timestamp.bv_len = strlen(timebuf);
@@ -1676,8 +1676,8 @@ ppolicy_db_init(
 
        on->on_bi.bi_private = ch_calloc( sizeof(pp_info), 1 );
 
-       if ( SLAPD_GLOBAL(dtblsize) && !pwcons )
-               pwcons = ch_calloc(sizeof(pw_conn), SLAPD_GLOBAL(dtblsize) );
+       if ( dtblsize && !pwcons )
+               pwcons = ch_calloc(sizeof(pw_conn), dtblsize );
 
        return 0;
 }
index c0adac5763db8a9bb91d6bf0141461384cd01c18..d848e7a6cc2e4f7491bea1daf914d253899cc744 100644 (file)
@@ -119,7 +119,7 @@ int passwd_extop(
        if(!( !SLAP_SHADOW( op->o_bd ) || be_isupdate( op ))) {
                /* we SHOULD return a referral in this case */
                BerVarray defref = op->o_bd->be_update_refs
-                       ? op->o_bd->be_update_refs : SLAPD_GLOBAL(default_referral)
+                       ? op->o_bd->be_update_refs : default_referral
 
                if( defref != NULL ) {
                        rs->sr_ref = referral_rewrite( op->o_bd->be_update_refs,
@@ -173,9 +173,9 @@ int passwd_extop(
        ml = ch_malloc( sizeof(Modifications) );
        if ( !qpw->rs_modtail ) qpw->rs_modtail = &ml->sml_next;
 
-       if ( SLAPD_GLOBAL(default_passwd_hash) ) {
-               for ( nhash = 0; SLAPD_GLOBAL(default_passwd_hash)[nhash]; nhash++ );
-               hashes = SLAPD_GLOBAL(default_passwd_hash);
+       if ( default_passwd_hash ) {
+               for ( nhash = 0; default_passwd_hash[nhash]; nhash++ );
+               hashes = default_passwd_hash;
        } else {
                nhash = 1;
                hashes = (char **)defhash;
@@ -395,7 +395,7 @@ slap_passwd_check(
        struct berval *bv;
 
 #if defined( SLAPD_CRYPT ) || defined( SLAPD_SPASSWD )
-       ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(passwd_mutex) );
+       ldap_pvt_thread_mutex_lock( &passwd_mutex );
 #ifdef SLAPD_SPASSWD
        lutil_passwd_sasl_conn = conn->c_sasl_authctx;
 #endif
@@ -412,7 +412,7 @@ slap_passwd_check(
 #ifdef SLAPD_SPASSWD
        lutil_passwd_sasl_conn = NULL;
 #endif
-       ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(passwd_mutex) );
+       ldap_pvt_thread_mutex_unlock( &passwd_mutex );
 #endif
 
        return result;
@@ -445,13 +445,13 @@ slap_passwd_hash_type(
        assert( hash );
 
 #if defined( SLAPD_CRYPT ) || defined( SLAPD_SPASSWD )
-       ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(passwd_mutex) );
+       ldap_pvt_thread_mutex_lock( &passwd_mutex );
 #endif
 
        lutil_passwd_hash( cred , hash, new, text );
        
 #if defined( SLAPD_CRYPT ) || defined( SLAPD_SPASSWD )
-       ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(passwd_mutex) );
+       ldap_pvt_thread_mutex_unlock( &passwd_mutex );
 #endif
 
 }
@@ -462,8 +462,8 @@ slap_passwd_hash(
        const char **text )
 {
        char *hash = NULL;
-       if ( SLAPD_GLOBAL(default_passwd_hash) ) {
-               hash = SLAPD_GLOBAL(default_passwd_hash)[0];
+       if ( default_passwd_hash ) {
+               hash = default_passwd_hash[0];
        }
        if ( !hash ) {
                hash = (char *)defhash[0];
index 8e09977b87720eada118df85dcd6740e6971913a..244d4ccd86bd63ed70a61a4210558cd8bddd21d4 100644 (file)
@@ -376,6 +376,10 @@ LDAP_SLAPD_F (char **) slap_str2clist LDAP_P((
                                                char ***,
                                                char *,
                                                const char * ));
+#ifdef LDAP_SLAPI
+LDAP_SLAPD_V (int) slapi_plugins_used;
+#endif
+
 /*
  * connection.c
  */
@@ -470,6 +474,11 @@ LDAP_SLAPD_F (void) slapd_clr_write LDAP_P((ber_socket_t s, int wake));
 LDAP_SLAPD_F (void) slapd_set_read LDAP_P((ber_socket_t s, int wake));
 LDAP_SLAPD_F (void) slapd_clr_read LDAP_P((ber_socket_t s, int wake));
 
+LDAP_SLAPD_V (volatile sig_atomic_t) slapd_abrupt_shutdown;
+LDAP_SLAPD_V (volatile sig_atomic_t) slapd_shutdown;
+LDAP_SLAPD_V (int) slapd_register_slp;
+LDAP_SLAPD_V (slap_ssf_t) local_ssf;
+
 /*
  * dn.c
  */
@@ -655,6 +664,8 @@ LDAP_SLAPD_V( const struct berval ) slap_empty_bv;
 LDAP_SLAPD_V( const struct berval ) slap_unknown_bv;
 LDAP_SLAPD_V( const struct berval ) slap_true_bv;
 LDAP_SLAPD_V( const struct berval ) slap_false_bv;
+LDAP_SLAPD_V( struct slap_sync_cookie_s ) slap_sync_cookie;
+LDAP_SLAPD_V( void * ) slap_tls_ctx;
 
 /*
  * index.c
@@ -664,19 +675,19 @@ LDAP_SLAPD_F (int) slap_str2index LDAP_P(( const char *str, slap_mask_t *idx ));
 /*
  * init.c
  */
-LDAP_SLAPD_V( int ) ldap_syslog;
-LDAP_SLAPD_V( int ) ldap_syslog_level;
-
 LDAP_SLAPD_F (int)     slap_init LDAP_P((int mode, const char* name));
 LDAP_SLAPD_F (int)     slap_startup LDAP_P(( Backend *be ));
 LDAP_SLAPD_F (int)     slap_shutdown LDAP_P(( Backend *be ));
 LDAP_SLAPD_F (int)     slap_destroy LDAP_P((void));
 
+LDAP_SLAPD_V (char **) slap_known_controls;
+
 /*
  * kerberos.c
  */
 #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
-LDAP_SLAPD_F (int)     krbv4_ldap_auth();
+LDAP_SLAPD_V (char *)  ldap_srvtab;
+LDAP_SLAPD_V (int)     krbv4_ldap_auth();
 #endif
 
 /*
@@ -1136,6 +1147,7 @@ LDAP_SLAPD_F( int ) mods_structural_class(
 /*
  * schema_init.c
  */
+LDAP_SLAPD_V( int ) schema_init_done;
 LDAP_SLAPD_F (int) slap_schema_init LDAP_P((void));
 LDAP_SLAPD_F (void) schema_destroy LDAP_P(( void ));
 
@@ -1208,6 +1220,8 @@ LDAP_SLAPD_F (Filter *) str2filter_x LDAP_P(( Operation *op, const char *str ));
  * syncrepl.c
  */
 
+LDAP_SLAPD_V (struct runqueue_s) syncrepl_rq;
+
 LDAP_SLAPD_F (void) init_syncrepl LDAP_P((syncinfo_t *));
 LDAP_SLAPD_F (void*) do_syncrepl LDAP_P((void *, void *));
 LDAP_SLAPD_F (int) syncrepl_message_to_entry LDAP_P((
@@ -1294,13 +1308,62 @@ LDAP_SLAPD_F (int) value_add_one LDAP_P((
 /*
  * Other...
  */
+LDAP_SLAPD_V(unsigned) num_subordinates;
+
+LDAP_SLAPD_V (unsigned int) index_substr_if_minlen;
+LDAP_SLAPD_V (unsigned int) index_substr_if_maxlen;
+LDAP_SLAPD_V (unsigned int) index_substr_any_len;
+LDAP_SLAPD_V (unsigned int) index_substr_any_step;
+
+LDAP_SLAPD_V (ber_len_t) sockbuf_max_incoming;
+LDAP_SLAPD_V (ber_len_t) sockbuf_max_incoming_auth;
+LDAP_SLAPD_V (int)             slap_conn_max_pending;
+LDAP_SLAPD_V (int)             slap_conn_max_pending_auth;
+
+LDAP_SLAPD_V (slap_mask_t)     global_allows;
+LDAP_SLAPD_V (slap_mask_t)     global_disallows;
+
+LDAP_SLAPD_V (BerVarray)       default_referral;
+LDAP_SLAPD_V (char *)          replogfile;
 LDAP_SLAPD_V (const char)      Versionstr[];
 
+LDAP_SLAPD_V (int)             global_gentlehup;
+LDAP_SLAPD_V (int)             global_idletimeout;
+LDAP_SLAPD_V (int)             global_schemacheck;
+LDAP_SLAPD_V (char *)  global_host;
+LDAP_SLAPD_V (char *)  global_realm;
+LDAP_SLAPD_V (char **) default_passwd_hash;
 LDAP_SLAPD_V (int)             lber_debug;
+LDAP_SLAPD_V (int)             ldap_syslog;
+LDAP_SLAPD_V (struct berval)   default_search_base;
+LDAP_SLAPD_V (struct berval)   default_search_nbase;
+
+LDAP_SLAPD_V (slap_counters_t) slap_counters;
+
+LDAP_SLAPD_V (char *)          slapd_pid_file;
+LDAP_SLAPD_V (char *)          slapd_args_file;
+LDAP_SLAPD_V (time_t)          starttime;
 
 /* use time(3) -- no mutex */
 #define slap_get_time()        time( NULL )
 
+LDAP_SLAPD_V (ldap_pvt_thread_pool_t)  connection_pool;
+LDAP_SLAPD_V (int)                     connection_pool_max;
+
+LDAP_SLAPD_V (ldap_pvt_thread_mutex_t) entry2str_mutex;
+LDAP_SLAPD_V (ldap_pvt_thread_mutex_t) replog_mutex;
+
+#if defined( SLAPD_CRYPT ) || defined( SLAPD_SPASSWD )
+LDAP_SLAPD_V (ldap_pvt_thread_mutex_t) passwd_mutex;
+#endif
+#ifndef HAVE_GMTIME_R
+LDAP_SLAPD_V (ldap_pvt_thread_mutex_t) gmtime_mutex;
+#endif
+
+LDAP_SLAPD_V (ber_socket_t)    dtblsize;
+
+LDAP_SLAPD_V (int)             use_reverse_lookup;
+
 LDAP_SLAPD_V (struct berval)   AllUser;
 LDAP_SLAPD_V (struct berval)   AllOper;
 LDAP_SLAPD_V (struct berval)   NoAttrs;
index 8ebc23ac7597bee43a012d1655ac886321538dfa..f8ac323a8443fbfe353312c30bb181384500803b 100644 (file)
@@ -135,14 +135,14 @@ replog( Operation *op )
        int     subsets = 0;
        long now = slap_get_time();
 
-       if ( op->o_bd->be_replogfile == NULL && frontendDB->be_replogfile == NULL ) {
+       if ( op->o_bd->be_replogfile == NULL && replogfile == NULL ) {
                return;
        }
 
-       ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(replog_mutex) );
+       ldap_pvt_thread_mutex_lock( &replog_mutex );
        if ( (fp = lock_fopen( op->o_bd->be_replogfile ? op->o_bd->be_replogfile :
-           frontendDB->be_replogfile, "a", &lfp )) == NULL ) {
-               ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(replog_mutex) );
+           replogfile, "a", &lfp )) == NULL ) {
+               ldap_pvt_thread_mutex_unlock( &replog_mutex );
                return;
        }
 
@@ -183,7 +183,7 @@ replog( Operation *op )
                /* if no replicas matched, drop the log 
                 * (should we log it anyway?) */
                lock_fclose( fp, lfp );
-               ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(replog_mutex) );
+               ldap_pvt_thread_mutex_unlock( &replog_mutex );
 
                return;
        }
@@ -231,7 +231,7 @@ replog( Operation *op )
        }
 
        lock_fclose( fp, lfp );
-       ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(replog_mutex) );
+       ldap_pvt_thread_mutex_unlock( &replog_mutex );
 }
 
 static void
index a9fae8697ea4af01c53655364ce2ae2ebc8c99f0..fe2f6e0c2f5384b601850964193395f226085577 100644 (file)
@@ -447,10 +447,10 @@ send_ldap_response(
        }
 #endif /* LDAP_SLAPI */
 
-       ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(counters).sc_sent_mutex );
-       ldap_pvt_mp_add_ulong( SLAPD_GLOBAL(counters).sc_pdu, 1 );
-       ldap_pvt_mp_add_ulong( SLAPD_GLOBAL(counters).sc_bytes, bytes );
-       ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(counters).sc_sent_mutex );
+       ldap_pvt_thread_mutex_lock( &slap_counters.sc_sent_mutex );
+       ldap_pvt_mp_add_ulong( slap_counters.sc_pdu, 1 );
+       ldap_pvt_mp_add_ulong( slap_counters.sc_bytes, bytes );
+       ldap_pvt_thread_mutex_unlock( &slap_counters.sc_sent_mutex );
 
 cleanup:;
        /* Tell caller that we did this for real, as opposed to being
@@ -1175,11 +1175,11 @@ slap_send_search_entry( Operation *op, SlapReply *rs )
                }
                rs->sr_nentries++;
 
-               ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(counters).sc_sent_mutex );
-               ldap_pvt_mp_add_ulong( SLAPD_GLOBAL(counters).sc_bytes, bytes );
-               ldap_pvt_mp_add_ulong( SLAPD_GLOBAL(counters).sc_entries, 1 );
-               ldap_pvt_mp_add_ulong( SLAPD_GLOBAL(counters).sc_pdu, 1 );
-               ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(counters).sc_sent_mutex );
+               ldap_pvt_thread_mutex_lock( &slap_counters.sc_sent_mutex );
+               ldap_pvt_mp_add_ulong( slap_counters.sc_bytes, bytes );
+               ldap_pvt_mp_add_ulong( slap_counters.sc_entries, 1 );
+               ldap_pvt_mp_add_ulong( slap_counters.sc_pdu, 1 );
+               ldap_pvt_thread_mutex_unlock( &slap_counters.sc_sent_mutex );
        }
 
        Statslog( LDAP_DEBUG_STATS2, "%s ENTRY dn=\"%s\"\n",
@@ -1364,11 +1364,11 @@ slap_send_search_reference( Operation *op, SlapReply *rs )
        bytes = send_ldap_ber( op->o_conn, ber );
        ber_free_buf( ber );
 
-       ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(counters).sc_sent_mutex );
-       ldap_pvt_mp_add_ulong( SLAPD_GLOBAL(counters).sc_bytes, bytes );
-       ldap_pvt_mp_add_ulong( SLAPD_GLOBAL(counters).sc_refs, 1 );
-       ldap_pvt_mp_add_ulong( SLAPD_GLOBAL(counters).sc_pdu, 1 );
-       ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(counters).sc_sent_mutex );
+       ldap_pvt_thread_mutex_lock( &slap_counters.sc_sent_mutex );
+       ldap_pvt_mp_add_ulong( slap_counters.sc_bytes, bytes );
+       ldap_pvt_mp_add_ulong( slap_counters.sc_refs, 1 );
+       ldap_pvt_mp_add_ulong( slap_counters.sc_pdu, 1 );
+       ldap_pvt_thread_mutex_unlock( &slap_counters.sc_sent_mutex );
 #ifdef LDAP_CONNECTIONLESS
        }
 #endif
index 96450daa39db0b243d133681a8f5d290f15c2ad2..642decbc88d850bc63855f95d17e01595b4f307c 100644 (file)
@@ -169,7 +169,7 @@ root_dse_info(
        /* supportedLDAPVersion */
        for ( i=LDAP_VERSION_MIN; i<=LDAP_VERSION_MAX; i++ ) {
                char buf[BUFSIZ];
-               if (!( SLAPD_GLOBAL(allows) & SLAP_ALLOW_BIND_V2 ) &&
+               if (!( global_allows & SLAP_ALLOW_BIND_V2 ) &&
                        ( i < LDAP_VERSION3 ) )
                {
                        /* version 2 and lower are disallowed */
@@ -197,8 +197,8 @@ root_dse_info(
                ldap_charray_free( supportedSASLMechanisms );
        }
 
-       if ( SLAPD_GLOBAL(default_referral) != NULL ) {
-               if( attr_merge( e, ad_ref, SLAPD_GLOBAL(default_referral), NULL /* FIXME */ ) ) {
+       if ( default_referral != NULL ) {
+               if( attr_merge( e, ad_ref, default_referral, NULL /* FIXME */ ) ) {
                        return LDAP_OTHER;
                }
        }
index 557fa439b340833e827b4bf23966b16cc56c9c68..3363294e01de7847447f477120b7e32c6d51f070 100644 (file)
@@ -116,7 +116,7 @@ int slap_sasl_config( int cargc, char **cargv, char *line,
                                return( 1 );
                        }
 
-                       if ( SLAPD_GLOBAL(host) != NULL ) {
+                       if ( global_host != NULL ) {
                                Debug( LDAP_DEBUG_ANY,
                                        "%s: line %d: already set sasl-host!\n",
                                        fname, lineno, 0 );
@@ -124,7 +124,7 @@ int slap_sasl_config( int cargc, char **cargv, char *line,
                                return 1;
 
                        } else {
-                               SLAPD_GLOBAL(host) = ch_strdup( cargv[1] );
+                               global_host = ch_strdup( cargv[1] );
                        }
 
                /* set SASL realm */
@@ -137,7 +137,7 @@ int slap_sasl_config( int cargc, char **cargv, char *line,
                                return( 1 );
                        }
 
-                       if ( SLAPD_GLOBAL(realm) != NULL ) {
+                       if ( global_realm != NULL ) {
                                Debug( LDAP_DEBUG_ANY,
                                        "%s: line %d: already set sasl-realm!\n",
                                        fname, lineno, 0 );
@@ -145,7 +145,7 @@ int slap_sasl_config( int cargc, char **cargv, char *line,
                                return 1;
 
                        } else {
-                               SLAPD_GLOBAL(realm) = ch_strdup( cargv[1] );
+                               global_realm = ch_strdup( cargv[1] );
                        }
 
                /* SASL security properties */
@@ -969,8 +969,8 @@ int slap_sasl_destroy( void )
 #ifdef HAVE_CYRUS_SASL
        sasl_done();
 #endif
-       free( SLAPD_GLOBAL(host) );
-       SLAPD_GLOBAL(host) = NULL;
+       free( global_host );
+       global_host = NULL;
 
        return 0;
 }
@@ -1029,8 +1029,8 @@ int slap_sasl_open( Connection *conn, int reopen )
 
        conn->c_sasl_layers = 0;
 
-       if( SLAPD_GLOBAL(host) == NULL ) {
-               SLAPD_GLOBAL(host) = ldap_pvt_get_fqdn( NULL );
+       if( global_host == NULL ) {
+               global_host = ldap_pvt_get_fqdn( NULL );
        }
 
        /* create new SASL context */
@@ -1061,7 +1061,7 @@ int slap_sasl_open( Connection *conn, int reopen )
                        *p = ';';
                }
        }
-       sc = sasl_server_new( "ldap", SLAPD_GLOBAL(host), SLAPD_GLOBAL(realm),
+       sc = sasl_server_new( "ldap", global_host, global_realm,
                iplocalport, ipremoteport, session_callbacks, SASL_SUCCESS_DATA, &ctx );
        if ( iplocalport != NULL ) {
                ch_free( iplocalport );
@@ -1070,7 +1070,7 @@ int slap_sasl_open( Connection *conn, int reopen )
                ch_free( ipremoteport );
        }
 #else
-       sc = sasl_server_new( "ldap", SLAPD_GLOBAL(host), SLAPD_GLOBAL(realm),
+       sc = sasl_server_new( "ldap", global_host, global_realm,
                session_callbacks, SASL_SECURITY_LAYER, &ctx );
 #endif
 
index e9de67d7822fb6261858270d318485e1453bf2a9..69d243b04d5dc4fb540fc7483b212111b121f6eb 100644 (file)
@@ -135,14 +135,14 @@ schema_info( Entry **entry, const char **text )
                 */
 
 #ifdef HAVE_GMTIME_R
-               ltm = gmtime_r( &SLAPD_GLOBAL(starttime), &ltm_buf );
+               ltm = gmtime_r( &starttime, &ltm_buf );
 #else
-               ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(gmtime_mutex) );
-               ltm = gmtime( &SLAPD_GLOBAL(starttime) );
+               ldap_pvt_thread_mutex_lock( &gmtime_mutex );
+               ltm = gmtime( &starttime );
 #endif /* HAVE_GMTIME_R */
                lutil_gentime( timebuf, sizeof(timebuf), ltm );
 #ifndef HAVE_GMTIME_R
-               ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(gmtime_mutex) );
+               ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
 #endif
 
                vals[0].bv_val = timebuf;
index 9648849c2166afe8583362d73d8be62b1f98f013..0da634d81246dd7093d3a421630c2f87efd27117 100644 (file)
@@ -112,7 +112,7 @@ entry_schema_check(
        }
 
        /* it's a REALLY bad idea to disable schema checks */
-       if( !SLAPD_GLOBAL(schemachecking) ) return LDAP_SUCCESS;
+       if( !global_schemacheck ) return LDAP_SUCCESS;
 
        /* find the structural object class attribute */
        asc = attr_find( e->e_attrs, ad_structuralObjectClass );
@@ -384,7 +384,7 @@ entry_schema_check(
                                                        }
                                                }
                                        }
-                               } else if ( SLAPD_GLOBAL(disallows) & SLAP_DISALLOW_AUX_WO_CR ) {
+                               } else if ( global_disallows & SLAP_DISALLOW_AUX_WO_CR ) {
                                        k = -1;
                                } else {
                                        k = 0;  
index 373ff96906504bdef4e66c9f7bd5d9e3b3f16ff3..7c85723617cbafa10933add9b659fca59180cc29 100644 (file)
 #define IA5StringApproxIndexer                 approxIndexer
 #define IA5StringApproxFilter                  approxFilter
 
+unsigned int index_substr_if_minlen = SLAP_INDEX_SUBSTR_IF_MINLEN_DEFAULT;
+unsigned int index_substr_if_maxlen = SLAP_INDEX_SUBSTR_IF_MAXLEN_DEFAULT;
+unsigned int index_substr_any_len = SLAP_INDEX_SUBSTR_ANY_LEN_DEFAULT;
+unsigned int index_substr_any_step = SLAP_INDEX_SUBSTR_ANY_STEP_DEFAULT;
+
 static int
 inValidate(
        Syntax *syntax,
@@ -406,26 +411,26 @@ octetStringSubstringsIndexer(
        for( i=0; values[i].bv_val != NULL; i++ ) {
                /* count number of indices to generate */
                if( flags & SLAP_INDEX_SUBSTR_INITIAL ) {
-                       if( values[i].bv_len >= SLAPD_GLOBAL(index_substr_if_maxlen) ) {
-                               nkeys += SLAPD_GLOBAL(index_substr_if_maxlen) -
-                                       (SLAPD_GLOBAL(index_substr_if_minlen) - 1);
-                       } else if( values[i].bv_len >= SLAPD_GLOBAL(index_substr_if_minlen) ) {
-                               nkeys += values[i].bv_len - (SLAPD_GLOBAL(index_substr_if_minlen) - 1);
+                       if( values[i].bv_len >= index_substr_if_maxlen ) {
+                               nkeys += index_substr_if_maxlen -
+                                       (index_substr_if_minlen - 1);
+                       } else if( values[i].bv_len >= index_substr_if_minlen ) {
+                               nkeys += values[i].bv_len - (index_substr_if_minlen - 1);
                        }
                }
 
                if( flags & SLAP_INDEX_SUBSTR_ANY ) {
-                       if( values[i].bv_len >= SLAPD_GLOBAL(index_substr_any_len) ) {
-                               nkeys += values[i].bv_len - (SLAPD_GLOBAL(index_substr_any_len) - 1);
+                       if( values[i].bv_len >= index_substr_any_len ) {
+                               nkeys += values[i].bv_len - (index_substr_any_len - 1);
                        }
                }
 
                if( flags & SLAP_INDEX_SUBSTR_FINAL ) {
-                       if( values[i].bv_len >= SLAPD_GLOBAL(index_substr_if_maxlen) ) {
-                               nkeys += SLAPD_GLOBAL(index_substr_if_maxlen) -
-                                       (SLAPD_GLOBAL(index_substr_if_minlen) - 1);
-                       } else if( values[i].bv_len >= SLAPD_GLOBAL(index_substr_if_minlen) ) {
-                               nkeys += values[i].bv_len - (SLAPD_GLOBAL(index_substr_if_minlen) - 1);
+                       if( values[i].bv_len >= index_substr_if_maxlen ) {
+                               nkeys += index_substr_if_maxlen -
+                                       (index_substr_if_minlen - 1);
+                       } else if( values[i].bv_len >= index_substr_if_minlen ) {
+                               nkeys += values[i].bv_len - (index_substr_if_minlen - 1);
                        }
                }
        }
@@ -446,25 +451,25 @@ octetStringSubstringsIndexer(
                ber_len_t j,max;
 
                if( ( flags & SLAP_INDEX_SUBSTR_ANY ) &&
-                       ( values[i].bv_len >= SLAPD_GLOBAL(index_substr_any_len) ) )
+                       ( values[i].bv_len >= index_substr_any_len ) )
                {
                        char pre = SLAP_INDEX_SUBSTR_PREFIX;
-                       max = values[i].bv_len - (SLAPD_GLOBAL(index_substr_any_len) - 1);
+                       max = values[i].bv_len - (index_substr_any_len - 1);
 
                        for( j=0; j<max; j++ ) {
                                hashDigestify( &HASHcontext, HASHdigest, prefix, pre,
-                                       syntax, mr, (unsigned char *)&values[i].bv_val[j], SLAPD_GLOBAL(index_substr_any_len));
+                                       syntax, mr, (unsigned char *)&values[i].bv_val[j], index_substr_any_len);
                                ber_dupbv_x( &keys[nkeys++], &digest, ctx );
                        }
                }
 
                /* skip if too short */ 
-               if( values[i].bv_len < SLAPD_GLOBAL(index_substr_if_minlen) ) continue;
+               if( values[i].bv_len < index_substr_if_minlen ) continue;
 
-               max = SLAPD_GLOBAL(index_substr_if_maxlen) < values[i].bv_len
-                       ? SLAPD_GLOBAL(index_substr_if_maxlen) : values[i].bv_len;
+               max = index_substr_if_maxlen < values[i].bv_len
+                       ? index_substr_if_maxlen : values[i].bv_len;
 
-               for( j=SLAPD_GLOBAL(index_substr_if_minlen); j<=max; j++ ) {
+               for( j=index_substr_if_minlen; j<=max; j++ ) {
                        char pre;
 
                        if( flags & SLAP_INDEX_SUBSTR_INITIAL ) {
@@ -520,36 +525,36 @@ octetStringSubstringsFilter (
 
        if( flags & SLAP_INDEX_SUBSTR_INITIAL &&
                sa->sa_initial.bv_val != NULL &&
-               sa->sa_initial.bv_len >= SLAPD_GLOBAL(index_substr_if_minlen) )
+               sa->sa_initial.bv_len >= index_substr_if_minlen )
        {
                nkeys++;
-               if ( sa->sa_initial.bv_len > SLAPD_GLOBAL(index_substr_if_maxlen) &&
+               if ( sa->sa_initial.bv_len > index_substr_if_maxlen &&
                        ( flags & SLAP_INDEX_SUBSTR_ANY ))
                {
-                       nkeys += (sa->sa_initial.bv_len - SLAPD_GLOBAL(index_substr_if_maxlen)) / SLAPD_GLOBAL(index_substr_any_step);
+                       nkeys += (sa->sa_initial.bv_len - index_substr_if_maxlen) / index_substr_any_step;
                }
        }
 
        if( flags & SLAP_INDEX_SUBSTR_ANY && sa->sa_any != NULL ) {
                ber_len_t i;
                for( i=0; sa->sa_any[i].bv_val != NULL; i++ ) {
-                       if( sa->sa_any[i].bv_len >= SLAPD_GLOBAL(index_substr_any_len) ) {
+                       if( sa->sa_any[i].bv_len >= index_substr_any_len ) {
                                /* don't bother accounting with stepping */
                                nkeys += sa->sa_any[i].bv_len -
-                                       ( SLAPD_GLOBAL(index_substr_any_len) - 1 );
+                                       ( index_substr_any_len - 1 );
                        }
                }
        }
 
        if( flags & SLAP_INDEX_SUBSTR_FINAL &&
                sa->sa_final.bv_val != NULL &&
-               sa->sa_final.bv_len >= SLAPD_GLOBAL(index_substr_if_minlen) )
+               sa->sa_final.bv_len >= index_substr_if_minlen )
        {
                nkeys++;
-               if ( sa->sa_final.bv_len > SLAPD_GLOBAL(index_substr_if_maxlen) &&
+               if ( sa->sa_final.bv_len > index_substr_if_maxlen &&
                        ( flags & SLAP_INDEX_SUBSTR_ANY ))
                {
-                       nkeys += (sa->sa_final.bv_len - SLAPD_GLOBAL(index_substr_if_maxlen)) / SLAPD_GLOBAL(index_substr_any_step);
+                       nkeys += (sa->sa_final.bv_len - index_substr_if_maxlen) / index_substr_any_step;
                }
        }
 
@@ -569,13 +574,13 @@ octetStringSubstringsFilter (
 
        if( flags & SLAP_INDEX_SUBSTR_INITIAL &&
                sa->sa_initial.bv_val != NULL &&
-               sa->sa_initial.bv_len >= SLAPD_GLOBAL(index_substr_if_minlen) )
+               sa->sa_initial.bv_len >= index_substr_if_minlen )
        {
                pre = SLAP_INDEX_SUBSTR_INITIAL_PREFIX;
                value = &sa->sa_initial;
 
-               klen = SLAPD_GLOBAL(index_substr_if_maxlen) < value->bv_len
-                       ? SLAPD_GLOBAL(index_substr_if_maxlen) : value->bv_len;
+               klen = index_substr_if_maxlen < value->bv_len
+                       ? index_substr_if_maxlen : value->bv_len;
 
                hashDigestify( &HASHcontext, HASHdigest, prefix, pre,
                        syntax, mr, (unsigned char *)value->bv_val, klen );
@@ -584,14 +589,14 @@ octetStringSubstringsFilter (
                /* If initial is too long and we have subany indexed, use it
                 * to match the excess...
                 */
-               if (value->bv_len > SLAPD_GLOBAL(index_substr_if_maxlen) && (flags & SLAP_INDEX_SUBSTR_ANY))
+               if (value->bv_len > index_substr_if_maxlen && (flags & SLAP_INDEX_SUBSTR_ANY))
                {
                        ber_len_t j;
                        pre = SLAP_INDEX_SUBSTR_PREFIX;
-                       for ( j=SLAPD_GLOBAL(index_substr_if_maxlen)-1; j <= value->bv_len - SLAPD_GLOBAL(index_substr_any_len); j+=SLAPD_GLOBAL(index_substr_any_step) )
+                       for ( j=index_substr_if_maxlen-1; j <= value->bv_len - index_substr_any_len; j+=index_substr_any_step )
                        {
                                hashDigestify( &HASHcontext, HASHdigest, prefix, pre,
-                                       syntax, mr, (unsigned char *)&value->bv_val[j], SLAPD_GLOBAL(index_substr_any_len) );
+                                       syntax, mr, (unsigned char *)&value->bv_val[j], index_substr_any_len );
                                ber_dupbv_x( &keys[nkeys++], &digest, ctx );
                        }
                }
@@ -600,18 +605,18 @@ octetStringSubstringsFilter (
        if( flags & SLAP_INDEX_SUBSTR_ANY && sa->sa_any != NULL ) {
                ber_len_t i, j;
                pre = SLAP_INDEX_SUBSTR_PREFIX;
-               klen = SLAPD_GLOBAL(index_substr_any_len);
+               klen = index_substr_any_len;
 
                for( i=0; sa->sa_any[i].bv_val != NULL; i++ ) {
-                       if( sa->sa_any[i].bv_len < SLAPD_GLOBAL(index_substr_any_len) ) {
+                       if( sa->sa_any[i].bv_len < index_substr_any_len ) {
                                continue;
                        }
 
                        value = &sa->sa_any[i];
 
                        for(j=0;
-                               j <= value->bv_len - SLAPD_GLOBAL(index_substr_any_len);
-                               j += SLAPD_GLOBAL(index_substr_any_step) )
+                               j <= value->bv_len - index_substr_any_len;
+                               j += index_substr_any_step )
                        {
                                hashDigestify( &HASHcontext, HASHdigest, prefix, pre,
                                        syntax, mr, (unsigned char *)&value->bv_val[j], klen ); 
@@ -622,13 +627,13 @@ octetStringSubstringsFilter (
 
        if( flags & SLAP_INDEX_SUBSTR_FINAL &&
                sa->sa_final.bv_val != NULL &&
-               sa->sa_final.bv_len >= SLAPD_GLOBAL(index_substr_if_minlen) )
+               sa->sa_final.bv_len >= index_substr_if_minlen )
        {
                pre = SLAP_INDEX_SUBSTR_FINAL_PREFIX;
                value = &sa->sa_final;
 
-               klen = SLAPD_GLOBAL(index_substr_if_maxlen) < value->bv_len
-                       ? SLAPD_GLOBAL(index_substr_if_maxlen) : value->bv_len;
+               klen = index_substr_if_maxlen < value->bv_len
+                       ? index_substr_if_maxlen : value->bv_len;
 
                hashDigestify( &HASHcontext, HASHdigest, prefix, pre,
                        syntax, mr, (unsigned char *)&value->bv_val[value->bv_len-klen], klen );
@@ -637,14 +642,14 @@ octetStringSubstringsFilter (
                /* If final is too long and we have subany indexed, use it
                 * to match the excess...
                 */
-               if (value->bv_len > SLAPD_GLOBAL(index_substr_if_maxlen) && (flags & SLAP_INDEX_SUBSTR_ANY))
+               if (value->bv_len > index_substr_if_maxlen && (flags & SLAP_INDEX_SUBSTR_ANY))
                {
                        ber_len_t j;
                        pre = SLAP_INDEX_SUBSTR_PREFIX;
-                       for ( j=0; j <= value->bv_len - SLAPD_GLOBAL(index_substr_if_maxlen); j+=SLAPD_GLOBAL(index_substr_any_step) )
+                       for ( j=0; j <= value->bv_len - index_substr_if_maxlen; j+=index_substr_any_step )
                        {
                                hashDigestify( &HASHcontext, HASHdigest, prefix, pre,
-                                       syntax, mr, (unsigned char *)&value->bv_val[j], SLAPD_GLOBAL(index_substr_any_len) );
+                                       syntax, mr, (unsigned char *)&value->bv_val[j], index_substr_any_len );
                                ber_dupbv_x( &keys[nkeys++], &digest, ctx );
                        }
                }
@@ -3615,7 +3620,7 @@ slap_schema_init( void )
        int             i;
 
        /* we should only be called once (from main) */
-       assert( SLAPD_GLOBAL(schema_init_done) == 0 );
+       assert( schema_init_done == 0 );
 
        for ( i=0; syntax_defs[i].sd_desc != NULL; i++ ) {
                res = register_syntax( &syntax_defs[i] );
@@ -3648,7 +3653,7 @@ slap_schema_init( void )
        }
 
        res = slap_schema_load();
-       SLAPD_GLOBAL(schema_init_done) = 1;
+       schema_init_done = 1;
        return res;
 }
 
index 56bef5e6f8db01379f898007c2a8367333caa6e8..e81009a57b8da271d0d1c40acd35736cb770d82b 100644 (file)
@@ -26,6 +26,8 @@
 
 #define OCDEBUG 0
 
+int schema_init_done = 0;
+
 struct slap_internal_schema slap_schema;
 
 static int
@@ -1256,7 +1258,7 @@ int
 slap_schema_check( void )
 {
        /* we should only be called once after schema_init() was called */
-       assert( SLAPD_GLOBAL(schema_init_done) == 1 );
+       assert( schema_init_done == 1 );
 
        /*
         * cycle thru attributeTypes to build matchingRuleUse
@@ -1265,7 +1267,7 @@ slap_schema_check( void )
                return LDAP_OTHER;
        }
 
-       ++SLAPD_GLOBAL(schema_init_done);
+       ++schema_init_done;
        return LDAP_SUCCESS;
 }
 
index 6205f382fba2aa653325b7a9e5600601449b7fd9..630d7c3289ff541de33d4082f1e919a83c392417 100644 (file)
@@ -25,6 +25,8 @@
 #include "slap.h"
 #include "ldap_schema.h"
 
+int    global_schemacheck = 1; /* schemacheck ON is default */
+
 static void            oc_usage(void); 
 static void            at_usage(void);
 
index e1b43f3ef9ad2fea2175449936a335e7292fba35..9c8043e5c688f598813fee52cdfa775d8351fdfa 100644 (file)
@@ -335,12 +335,12 @@ fe_op_search( Operation *op, SlapReply *rs )
                break;
        }
 
-       if( BER_BVISEMPTY( &op->o_req_ndn ) && !BER_BVISEMPTY( &SLAPD_GLOBAL(default_search_nbase) ) ) {
+       if( BER_BVISEMPTY( &op->o_req_ndn ) && !BER_BVISEMPTY( &default_search_nbase ) ) {
                slap_sl_free( op->o_req_dn.bv_val, op->o_tmpmemctx );
                slap_sl_free( op->o_req_ndn.bv_val, op->o_tmpmemctx );
 
-               ber_dupbv_x( &op->o_req_dn, &SLAPD_GLOBAL(default_search_base), op->o_tmpmemctx );
-               ber_dupbv_x( &op->o_req_ndn, &SLAPD_GLOBAL(default_search_nbase), op->o_tmpmemctx );
+               ber_dupbv_x( &op->o_req_dn, &default_search_base, op->o_tmpmemctx );
+               ber_dupbv_x( &op->o_req_ndn, &default_search_nbase, op->o_tmpmemctx );
        }
 
        /*
@@ -363,14 +363,14 @@ fe_op_search( Operation *op, SlapReply *rs )
 
        op->o_bd = select_backend( &op->o_req_ndn, be_manageDSAit, 1 );
        if ( op->o_bd == NULL ) {
-               rs->sr_ref = referral_rewrite( SLAPD_GLOBAL(default_referral),
+               rs->sr_ref = referral_rewrite( default_referral,
                        NULL, &op->o_req_dn, op->ors_scope );
 
-               if (!rs->sr_ref) rs->sr_ref = SLAPD_GLOBAL(default_referral);
+               if (!rs->sr_ref) rs->sr_ref = default_referral;
                rs->sr_err = LDAP_REFERRAL;
                send_ldap_result( op, rs );
 
-               if (rs->sr_ref != SLAPD_GLOBAL(default_referral))
+               if (rs->sr_ref != default_referral)
                ber_bvarray_free( rs->sr_ref );
                rs->sr_ref = NULL;
                goto return_results;
index 5922bcf6cd562680e89c710eb5d792186f7a6d5f..6b762c6bbcc7b3697a40a59a7ce3ead68a00dad9 100644 (file)
@@ -55,7 +55,6 @@
 #include "ldap_pvt.h"
 #include "ldap_pvt_thread.h"
 #include "ldap_queue.h"
-#include "ldap_rq.h"
 
 LDAP_BEGIN_DECL
 
@@ -2364,15 +2363,13 @@ typedef struct slap_conn {
 
 } Connection;
 
-#define SLAPD_GLOBAL(x) (((Global*)frontendDB->be_private)->x)
-
 #if defined(LDAP_SYSLOG) && defined(LDAP_DEBUG)
 #define Statslog( level, fmt, connid, opid, arg1, arg2, arg3 ) \
        do { \
                if ( ldap_debug & (level) ) \
                        fprintf( stderr, (fmt), (connid), (opid), (arg1), (arg2), (arg3) );\
                if ( ldap_syslog & (level) ) \
-                       syslog( (ldap_syslog_level), (fmt), (connid), (opid), (arg1), \
+                       syslog( ldap_syslog_level, (fmt), (connid), (opid), (arg1), \
                                (arg2), (arg3) ); \
        } while (0)
 #define StatslogTest( level ) ((ldap_debug | ldap_syslog) & (level))
@@ -2638,63 +2635,6 @@ typedef struct asntype_to_matchingrule_table {
 } AsnTypetoMatchingRuleTable;
 
 #endif
-
-typedef struct global_configuration {
-       unsigned num_subordinates;
-       ber_len_t sockbuf_max_incoming;
-       ber_len_t sockbuf_max_incoming_auth;
-       int conn_max_pending;
-       int conn_max_pending_auth;
-       slap_mask_t allows;
-       slap_mask_t disallows;
-       int gentlehup;
-       int idletimeout;
-       int schemachecking;
-       char *host;
-       char *realm;
-       char **default_passwd_hash;
-       BerVarray default_referral;
-       struct berval default_search_base;
-       struct berval default_search_nbase;
-       char **known_controls;
-       int schema_init_done;
-       char *pid_file;
-       char *args_file;
-       time_t starttime;
-       char *ldap_srvtab;
-       int connection_pool_max;
-       slap_ssf_t local_ssf;
-       ber_socket_t dtblsize;
-       unsigned int index_substr_if_minlen;
-       unsigned int index_substr_if_maxlen;
-       unsigned int index_substr_any_len;
-       unsigned int index_substr_any_step;
-       int use_reverse_lookup; /* but ignored if !SLAPD_RLOOKUPS */
-       int slapi_plugins_used; /* but ignored if !LDAP_SLAPI */
-
-       volatile sig_atomic_t abrupt_shutdown;
-       volatile sig_atomic_t gentle_shutdown;
-       volatile sig_atomic_t shutdown;
-       struct slap_sync_cookie_s sync_cookie;
-       void *tls_ctx;
-       runqueue_t runqueue;
-       slap_counters_t counters;
-       ldap_pvt_thread_pool_t connection_pool;
-       ldap_pvt_thread_mutex_t entry2str_mutex;
-       ldap_pvt_thread_mutex_t replog_mutex;
-#ifndef HAVE_GMTIME_R
-       ldap_pvt_thread_mutex_t gmtime_mutex;
-#endif
-#if defined( SLAPD_CRYPT ) || defined( SLAPD_SPASSWD )
-       ldap_pvt_thread_mutex_t passwd_mutex;
-#endif
-
-       /* --- these are just copies */
-       int conf_debug;
-       int conf_concurrency;
-       char *conf_salt_format;
-} Global;
-
 LDAP_END_DECL
 
 #include "proto-slap.h"
index 9596a077ed18f7fc5539000ef25385e395c1437c..2d648278161dd4b3fb3950d685b9ee61366a8347 100644 (file)
@@ -156,7 +156,7 @@ slapadd( int argc, char **argv )
                        break;
                }
 
-               if( SLAPD_GLOBAL(schemachecking) ) {
+               if( global_schemacheck ) {
                        Attribute *sc = attr_find( e->e_attrs,
                                slap_schema.si_ad_structuralObjectClass );
                        Attribute *oc = attr_find( e->e_attrs,
index 2d9023df27b8f68bd7dad96e319aab16d41ebac4..6da5f8091508a705413c4b303c45cd819cc349ff 100644 (file)
@@ -121,8 +121,6 @@ slap_tool_init(
        free( leakfilename );
 #endif
 
-       config_init();  /* sets frontendDB */
-
        switch( tool ) {
        case SLAPADD:
                options = "b:cd:f:i:l:n:prtuvWw";
index 72d303debc7929ba8069068d95646a42d5e9fc72..c8e978380300b5fc1139e78deb5e7b70c02ca0bb 100644 (file)
@@ -125,7 +125,7 @@ slapi_int_init_connection(
        int OpType ) 
 { 
        Connection *pConn;
-       ber_len_t max = SLAPD_GLOBAL(sockbuf_max_incoming);
+       ber_len_t max = sockbuf_max_incoming;
 
        pConn = (Connection *) slapi_ch_calloc(1, sizeof(Connection));
        if (pConn == NULL) {
@@ -1180,12 +1180,12 @@ slapi_search_internal(
                }
        }
 
-       if ( !op->o_req_ndn.bv_len && !BER_BVISNULL( &SLAPD_GLOBAL(default_search_nbase) ) ) {
+       if ( !op->o_req_ndn.bv_len && default_search_nbase.bv_len ) {
                slapi_ch_free( (void **)&op->o_req_dn.bv_val );
                slapi_ch_free( (void **)&op->o_req_ndn.bv_val );
 
-               ber_dupbv( &op->o_req_dn, &SLAPD_GLOBAL(default_search_base) );
-               ber_dupbv( &op->o_req_ndn, &SLAPD_GLOBAL(default_search_nbase) );
+               ber_dupbv( &op->o_req_dn, &default_search_base );
+               ber_dupbv( &op->o_req_ndn, &default_search_nbase );
        }
 
        if ( slapi_control_present( controls,
index bfaf8587550a9d53a54985d990eec6971c25cef6..7209e43e986fe93c58060b9e272ded20b73a4d50 100644 (file)
@@ -134,9 +134,9 @@ slapi_entry2str(
 #ifdef LDAP_SLAPI
        char            *ret;
 
-       ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(entry2str_mutex) );
+       ldap_pvt_thread_mutex_lock( &entry2str_mutex );
        ret = entry2str( e, len );
-       ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(entry2str_mutex) );
+       ldap_pvt_thread_mutex_unlock( &entry2str_mutex );
 
        return ret;
 #else /* LDAP_SLAPI */
index 7ab7328012bb2a3966fe2c2f08c2233175f67df2..b953e3e3e59fe20c058dae833126a2dfa11d3702 100644 (file)
@@ -55,7 +55,7 @@ starttls_extop ( Operation *op, SlapReply *rs )
                goto done;
        }
 
-       if ( !( SLAPD_GLOBAL(disallows) & SLAP_DISALLOW_TLS_2_ANON ) &&
+       if ( !( global_disallows & SLAP_DISALLOW_TLS_2_ANON ) &&
                ( op->o_conn->c_dn.bv_len != 0 ) )
        {
                Statslog( LDAP_DEBUG_STATS,
@@ -66,7 +66,7 @@ starttls_extop ( Operation *op, SlapReply *rs )
                connection2anonymous( op->o_conn );
        }
 
-       if ( ( SLAPD_GLOBAL(disallows) & SLAP_DISALLOW_TLS_AUTHC ) &&
+       if ( ( global_disallows & SLAP_DISALLOW_TLS_AUTHC ) &&
                ( op->o_conn->c_dn.bv_len != 0 ) )
        {
                rs->sr_text = "cannot start TLS after authentication";
@@ -75,8 +75,8 @@ starttls_extop ( Operation *op, SlapReply *rs )
        }
 
        /* fail if TLS could not be initialized */
-       if ( SLAPD_GLOBAL(tls_ctx) == NULL ) {
-               if (SLAPD_GLOBAL(default_referral) != NULL) {
+       if ( slap_tls_ctx == NULL ) {
+               if (default_referral != NULL) {
                        /* caller will put the referral in the result */
                        rc = LDAP_REFERRAL;
                        goto done;
index c94e4e58a05f4b1450de4dbf61015b21cb39d661..2389fcb1b5374f9ea4455cab98c84208a7ec14d8 100644 (file)
@@ -50,6 +50,8 @@ static int null_callback( struct slap_op *, struct slap_rep * );
 
 static AttributeDescription *sync_descs[4];
 
+struct runqueue_s syncrepl_rq;
+
 void
 init_syncrepl(syncinfo_t *si)
 {
@@ -404,7 +406,7 @@ do_syncrep1(
        build_new_dn( &op->o_req_ndn, psub, &syncrepl_cn_bv, op->o_tmpmemctx );
        op->o_req_dn = op->o_req_ndn;
 
-       LDAP_STAILQ_FOREACH( sc, &SLAPD_GLOBAL(sync_cookie), sc_next ) {
+       LDAP_STAILQ_FOREACH( sc, &slap_sync_cookie, sc_next ) {
                if ( si->si_rid == sc->rid ) {
                        cmdline_cookie_found = 1;
                        break;
@@ -416,7 +418,7 @@ do_syncrep1(
                BerVarray cookie = NULL;
                struct berval cookie_bv;
 
-               LDAP_STAILQ_REMOVE( &SLAPD_GLOBAL(sync_cookie), sc, sync_cookie, sc_next );
+               LDAP_STAILQ_REMOVE( &slap_sync_cookie, sc, sync_cookie, sc_next );
                slap_sync_cookie_free( &si->si_syncCookie, 0 );
 
                /* read stored cookie if it exists */
@@ -550,7 +552,7 @@ do_syncrep2(
        BerVarray syncUUIDs = NULL;
        ber_tag_t si_tag;
 
-       if ( SLAPD_GLOBAL(shutdown) ) {
+       if ( slapd_shutdown ) {
                rc = -2;
                goto done;
        }
@@ -573,7 +575,7 @@ do_syncrep2(
        while (( rc = ldap_result( si->si_ld, LDAP_RES_ANY, LDAP_MSG_ONE,
                tout_p, &res )) > 0 )
        {
-               if ( SLAPD_GLOBAL(shutdown) ) {
+               if ( slapd_shutdown ) {
                        rc = -2;
                        goto done;
                }
@@ -888,7 +890,7 @@ do_syncrepl(
                return NULL;
        }
 
-       if ( SLAPD_GLOBAL(shutdown) && si->si_ld ) {
+       if ( slapd_shutdown && si->si_ld ) {
                ldap_get_option( si->si_ld, LDAP_OPT_DESC, &s );
                connection_client_stop( s );
                ldap_unbind( si->si_ld );
@@ -950,10 +952,10 @@ do_syncrepl(
         * 3) for Refresh and Success, reschedule to run
         * 4) for Persist and Success, reschedule to defer
         */
-       ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(runqueue).rq_mutex );
+       ldap_pvt_thread_mutex_lock( &syncrepl_rq.rq_mutex );
 
-       if ( ldap_pvt_runqueue_isrunning( &SLAPD_GLOBAL(runqueue), rtask )) {
-               ldap_pvt_runqueue_stoptask( &SLAPD_GLOBAL(runqueue), rtask );
+       if ( ldap_pvt_runqueue_isrunning( &syncrepl_rq, rtask )) {
+               ldap_pvt_runqueue_stoptask( &syncrepl_rq, rtask );
        }
 
        if ( dostop ) {
@@ -965,7 +967,7 @@ do_syncrepl(
                        defer = 0;
                }
                rtask->interval.tv_sec = si->si_interval;
-               ldap_pvt_runqueue_resched( &SLAPD_GLOBAL(runqueue), rtask, defer );
+               ldap_pvt_runqueue_resched( &syncrepl_rq, rtask, defer );
                if ( si->si_retrynum ) {
                        for ( i = 0; si->si_retrynum_init[i] != -2; i++ ) {
                                si->si_retrynum[i] = si->si_retrynum_init[i];
@@ -979,19 +981,19 @@ do_syncrepl(
                }
 
                if ( !si->si_retrynum || si->si_retrynum[i] == -2 ) {
-                       ldap_pvt_runqueue_remove( &SLAPD_GLOBAL(runqueue), rtask );
+                       ldap_pvt_runqueue_remove( &syncrepl_rq, rtask );
                        LDAP_STAILQ_REMOVE( &be->be_syncinfo, si, syncinfo_s, si_next );
                        syncinfo_free( si );
                } else if ( si->si_retrynum[i] >= -1 ) {
                        if ( si->si_retrynum[i] > 0 )
                                si->si_retrynum[i]--;
                        rtask->interval.tv_sec = si->si_retryinterval[i];
-                       ldap_pvt_runqueue_resched( &SLAPD_GLOBAL(runqueue), rtask, 0 );
+                       ldap_pvt_runqueue_resched( &syncrepl_rq, rtask, 0 );
                        slap_wake_listener();
                }
        }
        
-       ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(runqueue).rq_mutex );
+       ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex );
 
        return NULL;
 }