/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1998-2005 The OpenLDAP Foundation.
+ * Copyright 1998-2007 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
for ( n = 0; !BER_BVISNULL( &(*vals)[n] ); n++ ) {
; /* Empty */
}
- *vals = (BerVarray) SLAP_REALLOC( (char *) *vals,
+ *vals = (BerVarray) ch_realloc( (char *) *vals,
(n + nn + 1) * sizeof(struct berval) );
if( *vals == NULL ) {
Debug(LDAP_DEBUG_TRACE,
for ( n = 0; !BER_BVISNULL( &(*vals)[n] ); n++ ) {
; /* Empty */
}
- *vals = (BerVarray) SLAP_REALLOC( (char *) *vals,
+ *vals = (BerVarray) ch_realloc( (char *) *vals,
(n + 2) * sizeof(struct berval) );
if( *vals == NULL ) {
Debug(LDAP_DEBUG_TRACE,
rc = (mr->smr_syntax->ssyn_pretty)( mr->smr_syntax, in, &pval, ctx );
in = &pval;
- } else {
+ } else if ( mr->smr_syntax->ssyn_validate ) {
rc = (mr->smr_syntax->ssyn_validate)( mr->smr_syntax, in );
+
+ } else {
+ *text = "inappropriate matching request";
+ return LDAP_INAPPROPRIATE_MATCHING;
}
if( rc != LDAP_SUCCESS ) {
/*
* wrapper for validate function
* uses the validate function of the syntax after removing
- * the index, if allowed an present
+ * the index, if allowed and present
*/
int
ordered_value_validate(
AttributeDescription *ad,
- struct berval *in )
+ struct berval *in,
+ int mop )
{
struct berval bv = *in;
bv.bv_len -= ptr - bv.bv_val;
bv.bv_val = ptr;
in = &bv;
+ /* If deleting by index, just succeed */
+ if ( mop == LDAP_MOD_DELETE && BER_BVISEMPTY( &bv ))
+ return LDAP_SUCCESS;
}
}
bv.bv_len -= idx.bv_len;
bv.bv_val = ptr;
+ /* validator will already prevent this for Adds */
+ if ( BER_BVISEMPTY( &bv )) {
+ ber_dupbv_x( normalized, &idx, ctx );
+ return LDAP_SUCCESS;
+ }
val = &bv;
}
}