]> git.sur5r.net Git - openldap/commitdiff
fix overlays with private instances of databases (ITS#5736)
authorPierangelo Masarati <ando@openldap.org>
Sun, 12 Oct 2008 20:20:46 +0000 (20:20 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sun, 12 Oct 2008 20:20:46 +0000 (20:20 +0000)
servers/slapd/back-ldap/chain.c
servers/slapd/back-monitor/database.c
servers/slapd/bconfig.c
servers/slapd/config.h
servers/slapd/overlays/pcache.c
servers/slapd/overlays/translucent.c

index 32783ed0a9765a66baea47b8f39e484290920a43..ffdf61fe5ce01cfedc869b2b3256a0c8c624906b 100644 (file)
@@ -63,6 +63,7 @@ typedef enum {
        LDAP_CH_RES,
        LDAP_CH_ERR
 } ldap_chain_status_t;
+
 static BackendInfo     *lback;
 
 typedef struct ldap_chain_t {
@@ -1096,7 +1097,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 }
 };
 
@@ -1187,6 +1188,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 );
@@ -1510,17 +1513,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 ) );
@@ -2062,7 +2059,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 );
index ec98abc7bc910a309d1eb4de972f3f3a67a522d3..eb7c218b48f18aa65a3fa90bddb0034274eec18a 100644 (file)
@@ -160,12 +160,12 @@ monitor_subsys_database_init_one(
                                "monitor_subsys_database_init: "
                                "missing suffix for %s\n",
                                rdnval, 0, 0 );
-                       return -1;
-               }
-               attr_merge( e, slap_schema.si_ad_namingContexts,
+               } else {
+                       attr_merge( e, slap_schema.si_ad_namingContexts,
                                be->be_suffix, be->be_nsuffix );
-               attr_merge( e_database, slap_schema.si_ad_namingContexts,
+                       attr_merge( e_database, slap_schema.si_ad_namingContexts,
                                be->be_suffix, be->be_nsuffix );
+               }
        }
 
        (void)init_readOnly( mi, e, be->be_restrictops );
index 8d00224b0f950b78b41e515e29ece0348b56b5cf..f50fb6d75a64cb75b8bc889fa66fbce01e6fadbc 100644 (file)
@@ -696,6 +696,15 @@ static ConfigTable config_back_cf_table[] = {
                NULL, NULL, NULL, NULL }
 };
 
+/* Need to no-op this keyword for dynamic config */
+ConfigTable olcDatabaseDummy[] = {
+       { "", "", 0, 0, 0, ARG_IGNORED,
+               NULL, "( OLcfgGlAt:13 NAME 'olcDatabase' "
+                       "DESC 'The backend type for a database instance' "
+                       "SUP olcBackend SINGLE-VALUE X-ORDERED 'SIBLINGS' )", NULL, NULL },
+       { NULL, NULL, 0, 0, 0, ARG_IGNORED }
+};
+
 /* Routines to check if a child can be added to this type */
 static ConfigLDAPadd cfAddSchema, cfAddInclude, cfAddDatabase,
        cfAddBackend, cfAddModule, cfAddOverlay;
@@ -6475,6 +6484,9 @@ config_back_initialize( BackendInfo *bi )
        i = config_register_schema( ct, cf_ocs );
        if ( i ) return i;
 
+       i = slap_str2ad( "olcDatabase", &olcDatabaseDummy[0].ad, &text );
+       if ( i ) return i;
+
        /* setup olcRootPW to be base64-encoded when written in LDIF form;
         * basically, we don't care if it fails */
        i = slap_str2ad( "olcRootPW", &ad, &text );
index 8da8b6e1bbc52a95c6c2b4b9d64221e43dbc67d1..7d91c7c2ff4e4809c0bcb6297d43d728691fefde 100644 (file)
@@ -201,6 +201,8 @@ int config_shadow( ConfigArgs *c, int flag );
 extern slap_verbmasks *slap_ldap_response_code;
 extern int slap_ldap_response_code_register( struct berval *bv, int err );
 
+extern ConfigTable olcDatabaseDummy[];
+
 LDAP_END_DECL
 
 #endif /* CONFIG_H */
index 450290fcc3ecbaa9eda4eae7257a14fefb0ae179..40ac4b99eda15cf777c7af3ff817b039da75a909 100644 (file)
@@ -2655,15 +2655,6 @@ static ConfigTable pccfg[] = {
        { NULL, NULL, 0, 0, 0, ARG_IGNORED }
 };
 
-/* Need to no-op this keyword for dynamic config */
-static ConfigTable pcdummy[] = {
-       { "", "", 0, 0, 0, ARG_IGNORED,
-               NULL, "( OLcfgGlAt:13 NAME 'olcDatabase' "
-                       "DESC 'The backend type for a database instance' "
-                       "SUP olcBackend SINGLE-VALUE X-ORDERED 'SIBLINGS' )", NULL, NULL },
-       { NULL, NULL, 0, 0, 0, ARG_IGNORED }
-};
-
 static ConfigOCs pcocs[] = {
        { "( OLcfgOvOc:2.1 "
                "NAME 'olcPcacheConfig' "
@@ -2675,7 +2666,7 @@ static ConfigOCs pcocs[] = {
        { "( OLcfgOvOc:2.2 "
                "NAME 'olcPcacheDatabase' "
                "DESC 'Cache database configuration' "
-               "AUXILIARY )", Cft_Misc, pcdummy, pc_ldadd },
+               "AUXILIARY )", Cft_Misc, olcDatabaseDummy, pc_ldadd },
        { NULL, 0, NULL }
 };
 
@@ -3995,11 +3986,6 @@ pcache_initialize()
        code = config_register_schema( pccfg, pcocs );
        if ( code ) return code;
 
-       {
-               const char *text;
-               code = slap_str2ad( "olcDatabase", &pcdummy[0].ad, &text );
-               if ( code ) return code;
-       }
        return overlay_register( &pcache );
 }
 
index 75b2d2012e759242951ccd6b9a27bfc526b7f047..70d763f11e6a60acf709818afca989eaa46847bb 100644 (file)
@@ -95,14 +95,6 @@ static ConfigTable translucentcfg[] = {
        { NULL, NULL, 0, 0, 0, ARG_IGNORED }
 };
 
-static ConfigTable transdummy[] = {
-       { "", "", 0, 0, 0, ARG_IGNORED,
-               NULL, "( OLcfgGlAt:13 NAME 'olcDatabase' "
-                       "DESC 'The backend type for a database instance' "
-                       "SUP olcBackend SINGLE-VALUE X-ORDERED 'SIBLINGS' )", NULL, NULL },
-       { NULL, NULL, 0, 0, 0, ARG_IGNORED }
-};
-
 static ConfigOCs translucentocs[] = {
        { "( OLcfgOvOc:14.1 "
          "NAME 'olcTranslucentConfig' "
@@ -115,7 +107,7 @@ static ConfigOCs translucentocs[] = {
        { "( OLcfgOvOc:14.2 "
          "NAME 'olcTranslucentDatabase' "
          "DESC 'Translucent target database configuration' "
-         "AUXILIARY )", Cft_Misc, transdummy, translucent_ldadd },
+         "AUXILIARY )", Cft_Misc, olcDatabaseDummy, translucent_ldadd },
        { NULL, 0, NULL }
 };
 /* for translucent_init() */