/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1998-2006 The OpenLDAP Foundation.
+ * Copyright 1998-2007 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
goto cleanup;
}
- rs->sr_err = slap_mods_check( modlist,
+ rs->sr_err = slap_mods_check( op, modlist,
&rs->sr_text, textbuf, textlen, NULL );
if ( rs->sr_err != LDAP_SUCCESS ) {
* Do basic attribute type checking and syntax validation.
*/
int slap_mods_check(
+ Operation *op,
Modifications *ml,
const char **text,
char *textbuf,
/* convert to attribute description */
if ( ml->sml_desc == NULL ) {
rc = slap_bv2ad( &ml->sml_type, &ml->sml_desc, text );
+ if( rc != LDAP_SUCCESS ) {
+ if ( get_no_schema_check( op )) {
+ rc = slap_bv2undef_ad( &ml->sml_type, &ml->sml_desc,
+ text, 0 );
+ }
+ }
if( rc != LDAP_SUCCESS ) {
snprintf( textbuf, textlen, "%s: %s",
ml->sml_type.bv_val, *text );
#endif /* PRESERVE_ORDER */
cv = ml->sml_nvalues ? ml->sml_nvalues : ml->sml_values;
+ if ( ad == slap_schema.si_ad_objectClass )
+ mr = NULL; /* shortcut matching */
/* record indices to preserve input ordering */
ix = slap_sl_malloc( nvals * sizeof(int), ctx );
}
}
done:
- j = ix[i];
+ if ( i >= 0 )
+ j = ix[i];
+
slap_sl_free( ix, ctx );
if ( rc != LDAP_SUCCESS ) {
return rc;
} else if ( match == 0 ) {
/* value exists already */
+ assert( i >= 0 );
+ assert( i < nvals );
snprintf( textbuf, textlen,
"%s: value #%d provided more than once",
ml->sml_desc->ad_cname.bv_val, j );