Skip to content
Snippets Groups Projects
Commit 11236eae authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Clean up some structuralObject checks to improve readability.

Functionality not changed (excepting one error message).
parent 00003ac5
No related branches found
No related tags found
No related merge requests found
......@@ -589,18 +589,17 @@ int slap_mods_opattrs(
if( rc != LDAP_SUCCESS ) {
return rc;
}
if ( tmpval.bv_len ) {
mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
mod->sml_op = mop;
mod->sml_type.bv_val = NULL;
mod->sml_desc = slap_schema.si_ad_structuralObjectClass;
mod->sml_bvalues = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
ber_dupbv( &mod->sml_bvalues[0], &tmpval );
mod->sml_bvalues[1].bv_val = NULL;
assert( mod->sml_bvalues[0].bv_val );
*modtail = mod;
modtail = &mod->sml_next;
}
mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
mod->sml_op = mop;
mod->sml_type.bv_val = NULL;
mod->sml_desc = slap_schema.si_ad_structuralObjectClass;
mod->sml_bvalues = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
ber_dupbv( &mod->sml_bvalues[0], &tmpval );
mod->sml_bvalues[1].bv_val = NULL;
assert( mod->sml_bvalues[0].bv_val );
*modtail = mod;
modtail = &mod->sml_next;
}
if( SLAP_LASTMOD(be) ) {
......
......@@ -177,8 +177,6 @@ entry_schema_check(
rc = structural_class( aoc->a_vals, &nsc, &oc, text, textbuf, textlen );
if( rc != LDAP_SUCCESS ) {
return rc;
} else if ( nsc.bv_len == 0 ) {
return LDAP_OBJECT_CLASS_VIOLATION;
}
*text = textbuf;
......@@ -541,8 +539,9 @@ int structural_class(
}
}
if( scp )
if( scp ) {
*scp = sc;
}
if( sc == NULL ) {
*text = "no structural object classes provided";
......@@ -550,6 +549,12 @@ int structural_class(
}
*scbv = ocs[scn];
if( scbv->bv_len ) {
*text = "invalid structural object class";
return LDAP_OBJECT_CLASS_VIOLATION;
}
return LDAP_SUCCESS;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment