Commit 6db02281 authored by Gary Williams's avatar Gary Williams
Browse files

validate object class before checking required and allowed

parent 40fa9d36
......@@ -28,9 +28,11 @@ int
oc_schema_check( Entry *e )
{
Attribute *a, *aoc;
ObjectClass *oc;
int i;
int ret = 0;
/* find the object class attribute - could error out here */
if ( (aoc = attr_find( e->e_attrs, "objectclass" )) == NULL ) {
Debug( LDAP_DEBUG_ANY, "No object class for entry (%s)\n",
......@@ -40,6 +42,14 @@ oc_schema_check( Entry *e )
/* check that the entry has required attrs for each oc */
for ( i = 0; aoc->a_vals[i] != NULL; i++ ) {
if ( (oc = oc_find( aoc->a_vals[i]->bv_val )) == NULL ) {
Debug( LDAP_DEBUG_ANY,
"Objectclass \"%s\" not defined",
aoc->a_vals[i]->bv_val, 0, 0 );
ret = 1;
}
else
{
char *s = oc_check_required( e, aoc->a_vals[i]->bv_val );
if (s != NULL) {
......@@ -49,6 +59,7 @@ oc_schema_check( Entry *e )
ret = 1;
}
}
}
if ( ret != 0 ) {
return( ret );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment