Commit b1534d0e authored by Howard Chu's avatar Howard Chu
Browse files

Kludge to allow reading undefined attrs in DNs at startup

parent 1f6bb31d
......@@ -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 = ≻
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 );
}
......
......@@ -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;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment