From: Howard Chu Date: Mon, 8 Oct 2007 12:31:24 +0000 (+0000) Subject: More for #4884, helper for #5173 X-Git-Tag: OPENLDAP_REL_ENG_2_4_6~50 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3a021cd2507eb7b07a1d8e505c8999c0de6b6c72;p=openldap More for #4884, helper for #5173 --- diff --git a/servers/slapd/bconfig.c b/servers/slapd/bconfig.c index 7576a2c2f7..0cf122727f 100644 --- a/servers/slapd/bconfig.c +++ b/servers/slapd/bconfig.c @@ -4187,11 +4187,26 @@ config_add_internal( CfBackInfo *cfb, Entry *e, ConfigArgs *ca, SlapReply *rs, rc = LDAP_SUCCESS; } + colst = count_ocs( oc_at, &nocs ); + /* Check whether the Add is allowed by its parent, and do * any necessary arg setup */ if ( last ) { rc = config_add_oc( &coptr, last, e, ca ); + if ( rc == LDAP_CONSTRAINT_VIOLATION ) { + for ( i = 0; ico_oc->soc_kind == LDAP_SCHEMA_STRUCTURAL ) + continue; + if ( colst[i]->co_ldadd && + ( rc = colst[i]->co_ldadd( last, e, ca )) + != LDAP_CONSTRAINT_VIOLATION ) { + coptr = colst[i]; + break; + } + } + } if ( rc == LDAP_CONSTRAINT_VIOLATION ) { Debug( LDAP_DEBUG_TRACE, "%s: config_add_internal: " "DN=\"%s\" no structural objectClass add function\n", @@ -4200,8 +4215,6 @@ config_add_internal( CfBackInfo *cfb, Entry *e, ConfigArgs *ca, SlapReply *rs, } } - colst = count_ocs( oc_at, &nocs ); - /* Add the entry but don't parse it, we already have its contents */ if ( rc == LDAP_COMPARE_TRUE ) { rc = LDAP_SUCCESS; @@ -4300,6 +4313,8 @@ ok: rc = ca->bi->bi_db_open( ca->be, &ca->reply ); ca->be->bd_info = bi_orig; } + } else if ( ca->cleanup ) { + rc = ca->cleanup( ca ); } if ( rc ) { if (ca->cr_msg[0] == '\0')