Clean up some structuralObject checks to improve readability.

Functionality not changed (excepting one error message).
This commit is contained in:
Kurt Zeilenga 2002-08-27 01:55:09 +00:00
parent 00003ac539
commit 11236eae56
2 changed files with 19 additions and 15 deletions

View file

@ -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) ) {

View file

@ -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;
}