]> git.sur5r.net Git - openldap/commitdiff
improve previous commit (check result of structural_class())
authorPierangelo Masarati <ando@openldap.org>
Wed, 21 Mar 2007 09:51:11 +0000 (09:51 +0000)
committerPierangelo Masarati <ando@openldap.org>
Wed, 21 Mar 2007 09:51:11 +0000 (09:51 +0000)
servers/slapd/bconfig.c

index d3bdd47f221fb97bab9bf01110bc52aae46ddb3f..4cb3d1386c199f4bd23e38ec68172dc6ffecebb3 100644 (file)
@@ -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