/* $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
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 ) {
}
new = ch_malloc( (anum+vnum+1) * sizeof(struct berval));
- if ( a->a_nvals && a->a_nvals != a->a_vals ) {
+
+ /* sanity check: if normalized modifications come in, either
+ * no values are present or normalized existing values differ
+ * from non-normalized; if no normalized modifications come in,
+ * either no values are present or normalized existing values
+ * don't differ from non-normalized */
+ if ( nvals != NULL ) {
+ assert( nvals != vals );
+ assert( a->a_nvals == NULL || a->a_nvals != a->a_vals );
+
+ } else {
+ assert( a->a_nvals == NULL || a->a_nvals == a->a_vals );
+ }
+
+ if ( ( a->a_nvals && a->a_nvals != a->a_vals ) || nvals != NULL ) {
nnew = ch_malloc( (anum+vnum+1) * sizeof(struct berval));
/* Shouldn't happen... */
if ( !nvals ) nvals = vals;