int
entry_schema_check(
- Entry *e, Attribute *oldattrs,
+ Backend *be,
+ Entry *e,
+ Attribute *oldattrs,
const char** text,
char *textbuf, size_t textlen )
{
AttributeDescription *ad_objectClass
= slap_schema.si_ad_objectClass;
int extensible = 0;
+ int subentry = is_entry_subentry( e );
+ int collective = 0;
+
+ if( subentry) collective = is_entry_collectiveAttributes( e );
*text = textbuf;
/* misc attribute checks */
for ( a = e->e_attrs; a != NULL; a = a->a_next ) {
+ const char *type = a->a_desc->ad_cname.bv_val;
+
/* there should be at least one value */
assert( a->a_vals );
assert( a->a_vals[0].bv_val != NULL );
if( a->a_desc->ad_type->sat_check ) {
int rc = (a->a_desc->ad_type->sat_check)(
- e, a, text, textbuf, textlen );
+ be, e, a, text, textbuf, textlen );
if( rc != LDAP_SUCCESS ) {
return rc;
}
}
+ if( !collective && is_at_collective( a->a_desc->ad_type ) ) {
+ snprintf( textbuf, textlen, "attribute '%s' "
+ "may only appear in collectiveAttributes subentry",
+ type );
+ return LDAP_OBJECT_CLASS_VIOLATION;
+ }
+
/* if single value type, check for multiple values */
if( is_at_single_value( a->a_desc->ad_type ) &&
a->a_vals[1].bv_val != NULL )
{
- char *type = a->a_desc->ad_cname.bv_val;
-
snprintf( textbuf, textlen,
"attribute '%s' cannot have multiple values",
type );
}
if ( oc->sco_check ) {
- int rc = (oc->sco_check)( e, oc,
+ int rc = (oc->sco_check)( be, e, oc,
text, textbuf, textlen );
if( rc != LDAP_SUCCESS ) {
return rc;