From: Pierangelo Masarati Date: Wed, 21 Mar 2007 09:51:11 +0000 (+0000) Subject: improve previous commit (check result of structural_class()) X-Git-Tag: OPENLDAP_REL_ENG_2_4_MP~598 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4a7349018664a3df5eb9eb23477d1dc542373bed;p=openldap improve previous commit (check result of structural_class()) --- diff --git a/servers/slapd/bconfig.c b/servers/slapd/bconfig.c index d3bdd47f22..4cb3d1386c 100644 --- a/servers/slapd/bconfig.c +++ b/servers/slapd/bconfig.c @@ -4302,16 +4302,31 @@ config_add_internal( CfBackInfo *cfb, Entry *e, ConfigArgs *ca, SlapReply *rs, char textbuf[ SLAP_TEXT_BUFLEN ]; const char *text = textbuf; - Debug( LDAP_DEBUG_TRACE, "%s: config_add_internal: " - "DN=\"%s\" no structural objectClass\n", - op ? op->o_log_prefix : "", e->e_name.bv_val, 0 ); - - structural_class( oc_at->a_nvals, &soc, NULL, &text, textbuf, sizeof(textbuf), NULL ); + /* FIXME: check result */ + rc = structural_class( oc_at->a_nvals, &soc, NULL, + &text, textbuf, sizeof(textbuf), NULL ); + if ( rc != LDAP_SUCCESS ) { + Debug( LDAP_DEBUG_TRACE, "%s: config_add_internal: " + "DN=\"%s\" no structural objectClass (%s)\n", + op ? op->o_log_prefix : "", e->e_name.bv_val, text ); + return rc; + } attr_merge_one( e, slap_schema.si_ad_structuralObjectClass, &soc->soc_cname, NULL ); soc_at = attr_find( e->e_attrs, slap_schema.si_ad_structuralObjectClass ); if ( soc_at == NULL ) { + Debug( LDAP_DEBUG_TRACE, "%s: config_add_internal: " + "DN=\"%s\" no structural objectClass; " + "unable to merge computed class %s\n", + op ? op->o_log_prefix : "", e->e_name.bv_val, + soc->soc_cname.bv_val ); return LDAP_OBJECT_CLASS_VIOLATION; } + + Debug( LDAP_DEBUG_TRACE, "%s: config_add_internal: " + "DN=\"%s\" no structural objectClass; " + "computed objectClass %s merged\n", + op ? op->o_log_prefix : "", e->e_name.bv_val, + soc->soc_cname.bv_val ); } /* Fake the coordinates based on whether we're part of an