mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-25 00:59:45 -05:00
Add an improved single value constraint check.
This commit is contained in:
parent
589a5c7442
commit
3e7e6bc6d5
2 changed files with 30 additions and 1 deletions
|
|
@ -477,7 +477,7 @@ int slap_modlist2mods(
|
|||
"%s: multiple value provided",
|
||||
ml->ml_type );
|
||||
*text = textbuf;
|
||||
return LDAP_INVALID_SYNTAX;
|
||||
return LDAP_CONSTRAINT_VIOLATION;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -131,6 +131,35 @@ entry_schema_check(
|
|||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* there should be at least one value */
|
||||
assert( a->a_vals );
|
||||
assert( a->a_vals[0] != NULL );
|
||||
|
||||
/* if single value type, check for multiple values */
|
||||
if( is_at_single_value( a->a_desc->ad_type ) &&
|
||||
a->a_vals[1] != NULL )
|
||||
{
|
||||
char *type = a->a_desc->ad_cname->bv_val;
|
||||
|
||||
snprintf( textbuf, textlen,
|
||||
"attribute '%s' cannot have multiple values",
|
||||
type );
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "schema", LDAP_LEVEL_INFO,
|
||||
"entry_schema_check: dn=\"%s\" %s\n",
|
||||
e->e_dn, textbuf ));
|
||||
#else
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"Entry (%s), %s\n",
|
||||
e->e_dn, textbuf, 0 );
|
||||
#endif
|
||||
|
||||
ret = LDAP_CONSTRAINT_VIOLATION;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return( ret );
|
||||
|
|
|
|||
Loading…
Reference in a new issue