]> git.sur5r.net Git - openldap/commitdiff
Kludge to allow reading undefined attrs in DNs at startup
authorHoward Chu <hyc@openldap.org>
Sat, 29 Apr 2006 02:15:53 +0000 (02:15 +0000)
committerHoward Chu <hyc@openldap.org>
Sat, 29 Apr 2006 02:15:53 +0000 (02:15 +0000)
servers/slapd/bconfig.c
servers/slapd/dn.c

index aa6b5ace24ce13011ea908b2b959cab419b315d9..09e21cdff879cc6e0c9b06af8f8e84eb8ab52303 100644 (file)
@@ -40,6 +40,8 @@
 static struct berval config_rdn = BER_BVC("cn=config");
 static struct berval schema_rdn = BER_BVC("cn=schema");
 
+extern int slap_DN_strict;     /* dn.c */
+
 #ifdef SLAPD_MODULES
 typedef struct modpath_s {
        struct modpath_s *mp_next;
@@ -3010,6 +3012,7 @@ config_setup_ldif( BackendDB *be, const char *dir, int readit ) {
 
        if ( readit ) {
                void *thrctx = ldap_pvt_thread_pool_context();
+               int prev_DN_strict;
 
                op = (Operation *) &opbuf;
                connection_fake_init( &conn, op, thrctx );
@@ -3040,8 +3043,16 @@ config_setup_ldif( BackendDB *be, const char *dir, int readit ) {
                cb.sc_private = &sc;
 
                op->o_bd = &cfb->cb_db;
+               
+               /* Allow unknown attrs in DNs */
+               prev_DN_strict = slap_DN_strict;
+               slap_DN_strict = 0;
+
                rc = op->o_bd->be_search( op, &rs );
 
+               /* Restore normal DN validation */
+               slap_DN_strict = prev_DN_strict;
+
                ldap_pvt_thread_pool_context_reset( thrctx );
        }
 
index 83d042d9b4d338e117d22e22ecbe3dce413e6519..be7b0aea0fa6d5c72cb7d1448a75125c0da4389c 100644 (file)
@@ -53,6 +53,8 @@
 
 #define        AVA_PRIVATE( ava ) ( ( AttributeDescription * )(ava)->la_private )
 
+int slap_DN_strict = SLAP_AD_NOINSERT;
+
 static int
 LDAPRDN_validate( LDAPRDN rdn )
 {
@@ -75,7 +77,7 @@ LDAPRDN_validate( LDAPRDN rdn )
                        if ( rc != LDAP_SUCCESS ) {
                                rc = slap_bv2undef_ad( &ava->la_attr,
                                        &ad, &text,
-                                       SLAP_AD_PROXIED|SLAP_AD_NOINSERT );
+                                       SLAP_AD_PROXIED|slap_DN_strict );
                                if ( rc != LDAP_SUCCESS ) {
                                        return LDAP_INVALID_SYNTAX;
                                }
@@ -139,7 +141,7 @@ LDAPDN_validate( LDAPDN dn )
                                if ( rc != LDAP_SUCCESS ) {
                                        rc = slap_bv2undef_ad( &ava->la_attr,
                                                &ad, &text,
-                                               SLAP_AD_PROXIED|SLAP_AD_NOINSERT );
+                                               SLAP_AD_PROXIED|slap_DN_strict );
                                        if ( rc != LDAP_SUCCESS ) {
                                                return LDAP_INVALID_SYNTAX;
                                        }
@@ -356,7 +358,7 @@ LDAPRDN_rewrite( LDAPRDN rdn, unsigned flags, void *ctx )
                        if ( rc != LDAP_SUCCESS ) {
                                rc = slap_bv2undef_ad( &ava->la_attr,
                                        &ad, &text,
-                                       SLAP_AD_PROXIED|SLAP_AD_NOINSERT );
+                                       SLAP_AD_PROXIED|slap_DN_strict );
                                if ( rc != LDAP_SUCCESS ) {
                                        return LDAP_INVALID_SYNTAX;
                                }
@@ -488,7 +490,7 @@ LDAPDN_rewrite( LDAPDN dn, unsigned flags, void *ctx )
                                if ( rc != LDAP_SUCCESS ) {
                                        rc = slap_bv2undef_ad( &ava->la_attr,
                                                &ad, &text,
-                                               SLAP_AD_PROXIED|SLAP_AD_NOINSERT );
+                                               SLAP_AD_PROXIED|slap_DN_strict );
                                        if ( rc != LDAP_SUCCESS ) {
                                                return LDAP_INVALID_SYNTAX;
                                        }