- {
- Attribute *sc = attr_find( e->e_attrs,
- slap_schema.si_ad_structuralObjectClass );
- Attribute *oc = attr_find( e->e_attrs,
- slap_schema.si_ad_objectClass );
-
- if( oc == NULL ) {
- fprintf( stderr, "%s: dn=\"%s\" (line=%d): %s\n",
- progname, e->e_dn, lineno,
- "no objectClass attribute");
- rc = EXIT_FAILURE;
- entry_free( e );
- if( continuemode ) continue;
- break;
- }
-
- if( sc == NULL ) {
- struct berval val;
-
- rc = structural_class( oc->a_vals, &val,
- NULL, &text, textbuf, textlen );
-
- if( rc != LDAP_SUCCESS ) {
- fprintf( stderr, "%s: dn=\"%s\" (line=%d): (%d) %s\n",
- progname, e->e_dn, lineno, rc, text );
- rc = EXIT_FAILURE;
- entry_free( e );
- if( continuemode ) continue;
- break;
- }
-
- attr_merge_one( e, slap_schema.si_ad_structuralObjectClass,
- &val, NULL );
- }
-
- /* check schema */
- rc = entry_schema_check( be, e, NULL, &text, textbuf, textlen );
-
- if( rc != LDAP_SUCCESS ) {
- fprintf( stderr, "%s: dn=\"%s\" (line=%d): (%d) %s\n",
- progname, e->e_dn, lineno, rc, text );
- rc = EXIT_FAILURE;
- entry_free( e );
- if( continuemode ) continue;
- break;
- }
+ rc = slap_tool_entry_check( progname, op, e, lineno, &text, textbuf, textlen );
+ if ( rc != LDAP_SUCCESS ) {
+ rc = EXIT_FAILURE;
+ entry_free( e );
+ if( continuemode ) continue;
+ break;