- for ( i = 0; mod->sm_bvalues[i].bv_val != NULL; i++ ) {
- /* test asserted values against existing values */
- if( a ) {
- for( matched = 0, j = 0; a->a_vals[j].bv_val != NULL; j++ ) {
- if ( bvmatch( &mod->sm_bvalues[i], &a->a_vals[j] ) ) {
- if ( permissive ) {
- matched++;
- continue;
- }
- /* value exists already */
- *text = textbuf;
- snprintf( textbuf, textlen,
- "modify/%s: %s: value #%i already exists",
- op, mod->sm_desc->ad_cname.bv_val, j );
- return LDAP_TYPE_OR_VALUE_EXISTS;
- }
- }
- if ( permissive && matched == j ) {
- /* values already exist; do nothing */
- return LDAP_SUCCESS;
- }
- }
-
- /* test asserted values against themselves */
- for( j = 0; j < i; j++ ) {
- if ( bvmatch( &mod->sm_bvalues[i], &mod->sm_bvalues[j] ) ) {
- /* value exists already */
- *text = textbuf;
- snprintf( textbuf, textlen,
- "modify/%s: %s: value #%i already exists",
- op, mod->sm_desc->ad_cname.bv_val, j );
- return LDAP_TYPE_OR_VALUE_EXISTS;
- }
+ if ( permissive ) {
+ i = mod->sm_numvals;
+ pmod.sm_values = (BerVarray)ch_malloc(
+ (i + 1) * sizeof( struct berval ));
+ if ( pmod.sm_nvalues != NULL ) {
+ pmod.sm_nvalues = (BerVarray)ch_malloc(
+ (i + 1) * sizeof( struct berval ));