mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-15 03:01:09 +08:00
validate object class before checking required and allowed
This commit is contained in:
parent
40fa9d36ce
commit
6db0228171
@ -28,9 +28,11 @@ int
|
|||||||
oc_schema_check( Entry *e )
|
oc_schema_check( Entry *e )
|
||||||
{
|
{
|
||||||
Attribute *a, *aoc;
|
Attribute *a, *aoc;
|
||||||
|
ObjectClass *oc;
|
||||||
int i;
|
int i;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
|
||||||
/* find the object class attribute - could error out here */
|
/* find the object class attribute - could error out here */
|
||||||
if ( (aoc = attr_find( e->e_attrs, "objectclass" )) == NULL ) {
|
if ( (aoc = attr_find( e->e_attrs, "objectclass" )) == NULL ) {
|
||||||
Debug( LDAP_DEBUG_ANY, "No object class for entry (%s)\n",
|
Debug( LDAP_DEBUG_ANY, "No object class for entry (%s)\n",
|
||||||
@ -40,14 +42,23 @@ oc_schema_check( Entry *e )
|
|||||||
|
|
||||||
/* check that the entry has required attrs for each oc */
|
/* check that the entry has required attrs for each oc */
|
||||||
for ( i = 0; aoc->a_vals[i] != NULL; i++ ) {
|
for ( i = 0; aoc->a_vals[i] != NULL; i++ ) {
|
||||||
char *s = oc_check_required( e, aoc->a_vals[i]->bv_val );
|
if ( (oc = oc_find( aoc->a_vals[i]->bv_val )) == NULL ) {
|
||||||
|
|
||||||
if (s != NULL) {
|
|
||||||
Debug( LDAP_DEBUG_ANY,
|
Debug( LDAP_DEBUG_ANY,
|
||||||
"Entry (%s), oc \"%s\" requires attr \"%s\"\n",
|
"Objectclass \"%s\" not defined",
|
||||||
e->e_dn, aoc->a_vals[i]->bv_val, s );
|
aoc->a_vals[i]->bv_val, 0, 0 );
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char *s = oc_check_required( e, aoc->a_vals[i]->bv_val );
|
||||||
|
|
||||||
|
if (s != NULL) {
|
||||||
|
Debug( LDAP_DEBUG_ANY,
|
||||||
|
"Entry (%s), oc \"%s\" requires attr \"%s\"\n",
|
||||||
|
e->e_dn, aoc->a_vals[i]->bv_val, s );
|
||||||
|
ret = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ret != 0 ) {
|
if ( ret != 0 ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user