]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-ldap/chain.c
Fix corrupted CSN issue
[openldap] / servers / slapd / back-ldap / chain.c
index 509a65b187cc4093d3ec0f807c8bcb0390688ef9..4b6a24ab57fa96b211f65204f585348de73681c4 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2003-2007 The OpenLDAP Foundation.
+ * Copyright 2003-2009 The OpenLDAP Foundation.
  * Portions Copyright 2003 Howard Chu.
  * All rights reserved.
  *
@@ -63,6 +63,7 @@ typedef enum {
        LDAP_CH_RES,
        LDAP_CH_ERR
 } ldap_chain_status_t;
+
 static BackendInfo     *lback;
 
 typedef struct ldap_chain_t {
@@ -596,6 +597,8 @@ ldap_chain_search(
        struct berval   odn = op->o_req_dn,
                        ondn = op->o_req_ndn;
        slap_response   *save_response = op->o_callback->sc_response;
+       Entry           *save_entry = rs->sr_entry;
+       slap_mask_t     save_flags = rs->sr_flags;
 
        int             rc = LDAP_OTHER,
                        first_rc = -1;
@@ -726,9 +729,6 @@ cleanup:;
                ldap_memfree( li.li_uri );
                li.li_uri = NULL;
 
-               op->o_tmpfree( op->o_req_dn.bv_val, op->o_tmpmemctx );
-               op->o_tmpfree( op->o_req_ndn.bv_val, op->o_tmpmemctx );
-
                if ( temporary ) {
                        lip->li_uri = NULL;
                        lip->li_bvuri = NULL;
@@ -763,7 +763,8 @@ further_cleanup:;
        op->o_req_ndn = ondn;
        op->o_callback->sc_response = save_response;
        rs->sr_type = REP_SEARCHREF;
-       rs->sr_entry = NULL;
+       rs->sr_entry = save_entry;
+       rs->sr_flags = save_flags;
 
        if ( rc != LDAP_SUCCESS ) {
                /* couldn't chase any of the referrals */
@@ -1099,7 +1100,7 @@ static ConfigOCs chainocs[] = {
                "NAME 'olcChainDatabase' "
                "DESC 'Chain remote server configuration' "
                "AUXILIARY )",
-               Cft_Misc, chaincfg, chain_ldadd },
+               Cft_Misc, olcDatabaseDummy, chain_ldadd },
        { NULL, 0, NULL }
 };
 
@@ -1190,6 +1191,8 @@ chain_ldadd( CfEntryInfo *p, Entry *e, ConfigArgs *ca )
                }
        }
 
+       ca->ca_private = on;
+
 done:;
        if ( rc != LDAP_SUCCESS ) {
                (void)ldap_chain_db_destroy_one( ca->be, NULL );
@@ -1513,17 +1516,11 @@ ldap_chain_db_init(
        ldap_chain_t    *lc = NULL;
 
        if ( lback == NULL ) {
-               static BackendInfo      lback2;
-
                lback = backend_info( "ldap" );
 
                if ( lback == NULL ) {
                        return 1;
                }
-
-               lback2 = *lback;
-               lback2.bi_type = ldapchain.on_bi.bi_type;
-               lback = &lback2;
        }
 
        lc = ch_malloc( sizeof( ldap_chain_t ) );
@@ -2065,7 +2062,8 @@ ldap_chain_parse_ctrl(
 int
 chain_initialize( void )
 {
-       int     rc;
+       int rc;
+       const char *text;
 
        /* Make sure we don't exceed the bits reserved for userland */
        config_check_userland( CH_LAST );