3 * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
4 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
7 * Copyright (c) 1995 Regents of the University of Michigan.
10 * Redistribution and use in source and binary forms are permitted
11 * provided that this notice is preserved and that due credit is given
12 * to the University of Michigan at Ann Arbor. The name of the University
13 * may not be used to endorse or promote products derived from this
14 * software without specific prior written permission. This software
15 * is provided ``as is'' without express or implied warranty.
22 #include <ac/socket.h>
23 #include <ac/string.h>
39 struct berval dn = { 0, NULL };
43 Modifications *modlist = NULL;
44 Modifications **modtail = &modlist;
49 LDAPMod **modv = NULL;
50 Slapi_PBlock *pb = op->o_pb;
55 LDAP_LOG( OPERATION, ENTRY, "do_modify: enter\n", 0, 0, 0 );
57 Debug( LDAP_DEBUG_TRACE, "do_modify\n", 0, 0, 0 );
61 * Parse the modify request. It looks like this:
63 * ModifyRequest := [APPLICATION 6] SEQUENCE {
64 * name DistinguishedName,
65 * mods SEQUENCE OF SEQUENCE {
66 * operation ENUMERATED {
71 * modification SEQUENCE {
73 * values SET OF AttributeValue
79 if ( ber_scanf( op->o_ber, "{m" /*}*/, &dn ) == LBER_ERROR ) {
81 LDAP_LOG( OPERATION, ERR, "do_modify: ber_scanf failed\n", 0, 0, 0 );
83 Debug( LDAP_DEBUG_ANY, "do_modify: ber_scanf failed\n", 0, 0, 0 );
86 send_ldap_discon( op, rs, LDAP_PROTOCOL_ERROR, "decoding error" );
87 return SLAPD_DISCONNECT;
91 LDAP_LOG( OPERATION, ARGS, "do_modify: dn (%s)\n", dn.bv_val, 0, 0 );
93 Debug( LDAP_DEBUG_ARGS, "do_modify: dn (%s)\n", dn.bv_val, 0, 0 );
97 /* collect modifications & save for later */
99 for ( tag = ber_first_element( op->o_ber, &len, &last );
101 tag = ber_next_element( op->o_ber, &len, last ) )
104 Modifications tmp, *mod;
107 tmp.sml_nvalues = NULL;
110 if ( ber_scanf( op->o_ber, "{i{m[W]}}", &mop,
111 &tmp.sml_type, &tmp.sml_values )
114 send_ldap_discon( op, rs, LDAP_PROTOCOL_ERROR, "decoding modlist error" );
115 rs->sr_err = SLAPD_DISCONNECT;
119 mod = (Modifications *) ch_malloc( sizeof(Modifications) );
121 mod->sml_type = tmp.sml_type;
122 mod->sml_values = tmp.sml_values;
124 mod->sml_nvalues = NULL;
126 mod->sml_desc = NULL;
127 mod->sml_next = NULL;
132 if ( mod->sml_values == NULL ) {
134 LDAP_LOG( OPERATION, ERR,
135 "do_modify: modify/add operation (%ld) requires values\n",
138 Debug( LDAP_DEBUG_ANY,
139 "do_modify: modify/add operation (%ld) requires values\n",
143 send_ldap_error( op, rs, LDAP_PROTOCOL_ERROR,
144 "modify/add operation requires values" );
150 case LDAP_MOD_DELETE:
151 case LDAP_MOD_REPLACE:
156 LDAP_LOG( OPERATION, ERR,
157 "do_modify: invalid modify operation (%ld)\n", (long)mop, 0, 0 );
159 Debug( LDAP_DEBUG_ANY,
160 "do_modify: invalid modify operation (%ld)\n",
164 send_ldap_error( op, rs, LDAP_PROTOCOL_ERROR,
165 "unrecognized modify operation" );
170 modtail = &mod->sml_next;
174 if( get_ctrls( op, rs, 1 ) != LDAP_SUCCESS ) {
176 LDAP_LOG( OPERATION, ERR, "do_modify: get_ctrls failed\n", 0, 0, 0 );
178 Debug( LDAP_DEBUG_ANY, "do_modify: get_ctrls failed\n", 0, 0, 0 );
184 rs->sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn );
185 if( rs->sr_err != LDAP_SUCCESS ) {
187 LDAP_LOG( OPERATION, INFO, "do_modify: conn %d invalid dn (%s)\n",
188 op->o_connid, dn.bv_val, 0 );
190 Debug( LDAP_DEBUG_ANY,
191 "do_modify: invalid dn (%s)\n", dn.bv_val, 0, 0 );
193 send_ldap_error( op, rs, LDAP_INVALID_DN_SYNTAX, "invalid DN" );
197 if( op->o_req_ndn.bv_len == 0 ) {
199 LDAP_LOG( OPERATION, ERR,
200 "do_modify: attempt to modify root DSE.\n",0, 0, 0 );
202 Debug( LDAP_DEBUG_ANY, "do_modify: root dse!\n", 0, 0, 0 );
205 send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
206 "modify upon the root DSE not supported" );
209 } else if ( bvmatch( &op->o_req_ndn, &global_schemandn ) ) {
211 LDAP_LOG( OPERATION, ERR,
212 "do_modify: attempt to modify subschema subentry.\n" , 0, 0, 0 );
214 Debug( LDAP_DEBUG_ANY, "do_modify: subschema subentry!\n", 0, 0, 0 );
217 send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
218 "modification of subschema subentry not supported" );
224 LDAP_LOG( OPERATION, DETAIL1, "do_modify: modifications:\n", 0, 0, 0 );
226 Debug( LDAP_DEBUG_ARGS, "modifications:\n", 0, 0, 0 );
229 for ( tmp = modlist; tmp != NULL; tmp = tmp->sml_next ) {
231 LDAP_LOG( OPERATION, DETAIL1, "\t%s: %s\n",
232 tmp->sml_op == LDAP_MOD_ADD ?
233 "add" : (tmp->sml_op == LDAP_MOD_DELETE ?
234 "delete" : "replace"), tmp->sml_type.bv_val, 0 );
236 if ( tmp->sml_values == NULL ) {
237 LDAP_LOG( OPERATION, DETAIL1, "\t\tno values", 0, 0, 0 );
238 } else if ( tmp->sml_values[0].bv_val == NULL ) {
239 LDAP_LOG( OPERATION, DETAIL1, "\t\tzero values", 0, 0, 0 );
240 } else if ( tmp->sml_values[1].bv_val == NULL ) {
241 LDAP_LOG( OPERATION, DETAIL1, "\t\tone value", 0, 0, 0 );
243 LDAP_LOG( OPERATION, DETAIL1, "\t\tmultiple values", 0, 0, 0 );
247 Debug( LDAP_DEBUG_ARGS, "\t%s: %s\n",
248 tmp->sml_op == LDAP_MOD_ADD
249 ? "add" : (tmp->sml_op == LDAP_MOD_DELETE
250 ? "delete" : "replace"), tmp->sml_type.bv_val, 0 );
252 if ( tmp->sml_values == NULL ) {
253 Debug( LDAP_DEBUG_ARGS, "%s\n",
254 "\t\tno values", NULL, NULL );
255 } else if ( tmp->sml_values[0].bv_val == NULL ) {
256 Debug( LDAP_DEBUG_ARGS, "%s\n",
257 "\t\tzero values", NULL, NULL );
258 } else if ( tmp->sml_values[1].bv_val == NULL ) {
259 Debug( LDAP_DEBUG_ARGS, "%s, length %ld\n",
260 "\t\tone value", (long) tmp->sml_values[0].bv_len, NULL );
262 Debug( LDAP_DEBUG_ARGS, "%s\n",
263 "\t\tmultiple values", NULL, NULL );
268 if ( StatslogTest( LDAP_DEBUG_STATS ) ) {
269 char abuf[BUFSIZ/2], *ptr = abuf;
272 Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu MOD dn=\"%s\"\n",
273 op->o_connid, op->o_opid, dn.bv_val, 0, 0 );
275 for ( tmp = modlist; tmp != NULL; tmp = tmp->sml_next ) {
276 if (len + 1 + tmp->sml_type.bv_len > sizeof(abuf)) {
277 Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu MOD attr=%s\n",
278 op->o_connid, op->o_opid, abuf, 0, 0 );
286 ptr = lutil_strcopy(ptr, tmp->sml_type.bv_val);
287 len += tmp->sml_type.bv_len;
290 Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu MOD attr=%s\n",
291 op->o_connid, op->o_opid, abuf, 0, 0 );
294 #endif /* LDAP_DEBUG */
296 manageDSAit = get_manageDSAit( op );
299 * We could be serving multiple database backends. Select the
300 * appropriate one, or send a referral to our "referral server"
301 * if we don't hold it.
303 if ( (op->o_bd = select_backend( &op->o_req_ndn, manageDSAit, 0 )) == NULL ) {
304 rs->sr_ref = referral_rewrite( default_referral,
305 NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
306 if (!rs->sr_ref) rs->sr_ref = default_referral;
308 rs->sr_err = LDAP_REFERRAL;
309 send_ldap_result( op, rs );
311 if (rs->sr_ref != default_referral) ber_bvarray_free( rs->sr_ref );
315 /* check restrictions */
316 if( backend_check_restrictions( op, rs, NULL ) != LDAP_SUCCESS ) {
317 send_ldap_result( op, rs );
321 /* check for referrals */
322 if( backend_check_referrals( op, rs ) != LDAP_SUCCESS ) {
326 #if defined( LDAP_SLAPI )
327 slapi_x_pblock_set_operation( pb, op );
328 slapi_pblock_set( pb, SLAPI_MODIFY_TARGET, (void *)dn.bv_val );
329 slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)manageDSAit );
330 modv = slapi_x_modifications2ldapmods( &modlist );
331 slapi_pblock_set( pb, SLAPI_MODIFY_MODS, (void *)modv );
333 rs->sr_err = doPluginFNs( op->o_bd, SLAPI_PLUGIN_PRE_MODIFY_FN, pb );
334 if ( rs->sr_err != 0 ) {
336 * A preoperation plugin failure will abort the
340 LDAP_LOG( OPERATION, INFO, "do_modify: modify preoperation plugin "
341 "failed\n", 0, 0, 0 );
343 Debug(LDAP_DEBUG_TRACE, "do_modify: modify preoperation plugin failed.\n",
346 if ( slapi_pblock_get( pb, SLAPI_RESULT_CODE, (void *)&rs->sr_err ) != 0) {
347 rs->sr_err = LDAP_OTHER;
349 slapi_x_free_ldapmods( modv );
355 * It's possible that the preoperation plugin changed the
356 * modification array, so we need to convert it back to
357 * a Modification list.
359 * Calling slapi_x_modifications2ldapmods() destroyed modlist so
360 * we don't need to free it.
362 slapi_pblock_get( pb, SLAPI_MODIFY_MODS, (void **)&modv );
363 modlist = slapi_x_ldapmods2modifications( modv );
366 * NB: it is valid for the plugin to return no modifications
367 * (for example, a plugin might store some attributes elsewhere
368 * and remove them from the modification list; if only those
369 * attribute types were included in the modification request,
370 * then slapi_x_ldapmods2modifications() above will return
373 if ( modlist == NULL ) {
374 rs->sr_err = LDAP_SUCCESS;
375 send_ldap_result( op, rs );
378 #endif /* defined( LDAP_SLAPI ) */
381 * do the modify if 1 && (2 || 3)
382 * 1) there is a modify function implemented in this backend;
383 * 2) this backend is master for what it holds;
384 * 3) it's a replica and the dn supplied is the update_ndn.
386 if ( op->o_bd->be_modify ) {
387 /* do the update here */
388 int repl_user = be_isupdate( op->o_bd, &op->o_ndn );
389 #ifndef SLAPD_MULTIMASTER
390 /* Multimaster slapd does not have to check for replicator dn
391 * because it accepts each modify request
393 if ( !op->o_bd->be_update_ndn.bv_len || repl_user )
396 int update = op->o_bd->be_update_ndn.bv_len;
397 char textbuf[SLAP_TEXT_BUFLEN];
398 size_t textlen = sizeof textbuf;
400 rs->sr_err = slap_mods_check( modlist, update, &rs->sr_text,
403 if( rs->sr_err != LDAP_SUCCESS ) {
404 send_ldap_result( op, rs );
409 for( modtail = &modlist;
411 modtail = &(*modtail)->sml_next )
416 rs->sr_err = slap_mods_opattrs( op, modlist, modtail,
417 &rs->sr_text, textbuf, textlen );
418 if( rs->sr_err != LDAP_SUCCESS ) {
419 send_ldap_result( op, rs );
424 op->orm_modlist = modlist;
425 if ( (op->o_bd->be_modify)( op, rs ) == 0
426 #ifdef SLAPD_MULTIMASTER
430 /* but we log only the ones not from a replicator user */
434 #ifndef SLAPD_MULTIMASTER
435 /* send a referral */
437 BerVarray defref = op->o_bd->be_update_refs
438 ? op->o_bd->be_update_refs : default_referral;
439 rs->sr_ref = referral_rewrite( defref,
440 NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
442 if (!rs->sr_ref) rs->sr_ref = defref;
443 rs->sr_err = LDAP_REFERRAL;
444 send_ldap_result( op, rs );
445 if (rs->sr_ref != defref) ber_bvarray_free( rs->sr_ref );
449 send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
450 "operation not supported within namingContext" );
453 #if defined( LDAP_SLAPI )
454 if ( doPluginFNs( op->o_bd, SLAPI_PLUGIN_POST_MODIFY_FN, pb ) != 0 ) {
456 LDAP_LOG( OPERATION, INFO, "do_modify: modify postoperation plugins "
457 "failed\n", 0, 0, 0 );
459 Debug(LDAP_DEBUG_TRACE, "do_modify: modify postoperation plugins "
460 "failed.\n", 0, 0, 0);
463 #endif /* defined( LDAP_SLAPI ) */
466 free( op->o_req_dn.bv_val );
467 free( op->o_req_ndn.bv_val );
468 if ( modlist != NULL ) slap_mods_free( modlist );
469 #if defined( LDAP_SLAPI )
470 if ( modv != NULL ) slapi_x_free_ldapmods( modv );
476 * Do basic attribute type checking and syntax validation.
487 for( ; ml != NULL; ml = ml->sml_next ) {
488 AttributeDescription *ad = NULL;
490 /* convert to attribute description */
491 rc = slap_bv2ad( &ml->sml_type, &ml->sml_desc, text );
493 if( rc != LDAP_SUCCESS ) {
494 snprintf( textbuf, textlen, "%s: %s",
495 ml->sml_type.bv_val, *text );
502 if( slap_syntax_is_binary( ad->ad_type->sat_syntax )
503 && !slap_ad_is_binary( ad ))
505 /* attribute requires binary transfer */
506 snprintf( textbuf, textlen,
507 "%s: requires ;binary transfer",
508 ml->sml_type.bv_val );
510 return LDAP_UNDEFINED_TYPE;
513 if( !slap_syntax_is_binary( ad->ad_type->sat_syntax )
514 && slap_ad_is_binary( ad ))
516 /* attribute requires binary transfer */
517 snprintf( textbuf, textlen,
518 "%s: disallows ;binary transfer",
519 ml->sml_type.bv_val );
521 return LDAP_UNDEFINED_TYPE;
524 if( slap_ad_is_tag_range( ad )) {
525 /* attribute requires binary transfer */
526 snprintf( textbuf, textlen,
527 "%s: inappropriate use of tag range option",
528 ml->sml_type.bv_val );
530 return LDAP_UNDEFINED_TYPE;
533 if (!update && is_at_no_user_mod( ad->ad_type )) {
534 /* user modification disallowed */
535 snprintf( textbuf, textlen,
536 "%s: no user modification allowed",
537 ml->sml_type.bv_val );
539 return LDAP_CONSTRAINT_VIOLATION;
542 if ( is_at_obsolete( ad->ad_type ) &&
543 ( ml->sml_op == LDAP_MOD_ADD || ml->sml_values != NULL ) )
546 * attribute is obsolete,
547 * only allow replace/delete with no values
549 snprintf( textbuf, textlen,
550 "%s: attribute is obsolete",
551 ml->sml_type.bv_val );
553 return LDAP_CONSTRAINT_VIOLATION;
559 if( ml->sml_values != NULL ) {
561 slap_syntax_validate_func *validate =
562 ad->ad_type->sat_syntax->ssyn_validate;
563 slap_syntax_transform_func *pretty =
564 ad->ad_type->sat_syntax->ssyn_pretty;
566 if( !pretty && !validate ) {
567 *text = "no validator for syntax";
568 snprintf( textbuf, textlen,
569 "%s: no validator for syntax %s",
571 ad->ad_type->sat_syntax->ssyn_oid );
573 return LDAP_INVALID_SYNTAX;
577 * check that each value is valid per syntax
578 * and pretty if appropriate
580 for( nvals = 0; ml->sml_values[nvals].bv_val; nvals++ ) {
583 rc = pretty( ad->ad_type->sat_syntax,
584 &ml->sml_values[nvals], &pval );
586 rc = validate( ad->ad_type->sat_syntax,
587 &ml->sml_values[nvals] );
591 snprintf( textbuf, textlen,
592 "%s: value #%ld invalid per syntax",
593 ml->sml_type.bv_val, (long) nvals );
595 return LDAP_INVALID_SYNTAX;
599 ber_memfree( ml->sml_values[nvals].bv_val );
600 ml->sml_values[nvals] = pval;
605 * a rough single value check... an additional check is needed
606 * to catch add of single value to existing single valued attribute
608 if ((ml->sml_op == LDAP_MOD_ADD || ml->sml_op == LDAP_MOD_REPLACE)
609 && nvals > 1 && is_at_single_value( ad->ad_type ))
611 snprintf( textbuf, textlen,
612 "%s: multiple values provided",
613 ml->sml_type.bv_val );
615 return LDAP_CONSTRAINT_VIOLATION;
619 if( nvals && ad->ad_type->sat_equality &&
620 ad->ad_type->sat_equality->smr_normalize )
622 ml->sml_nvalues = ch_malloc( (nvals+1)*sizeof(struct berval) );
623 for( nvals = 0; ml->sml_values[nvals].bv_val; nvals++ ) {
624 rc = ad->ad_type->sat_equality->smr_normalize(
626 ad->ad_type->sat_syntax,
627 ad->ad_type->sat_equality,
628 &ml->sml_values[nvals], &ml->sml_nvalues[nvals] );
631 LDAP_LOG( OPERATION, DETAIL1,
632 "str2entry: NULL (ssyn_normalize %d)\n",
635 Debug( LDAP_DEBUG_ANY,
636 "<= str2entry NULL (ssyn_normalize %d)\n",
639 snprintf( textbuf, textlen,
640 "%s: value #%ld normalization failed",
641 ml->sml_type.bv_val, (long) nvals );
646 ml->sml_nvalues[nvals].bv_val = NULL;
647 ml->sml_nvalues[nvals].bv_len = 0;
656 int slap_mods_opattrs(
659 Modifications **modtail,
661 char *textbuf, size_t textlen )
663 struct berval name, timestamp, csn;
667 char timebuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
668 char csnbuf[ LDAP_LUTIL_CSNSTR_BUFSIZE ];
671 int mop = op->o_tag == LDAP_REQ_ADD
672 ? LDAP_MOD_ADD : LDAP_MOD_REPLACE;
674 assert( modtail != NULL );
675 assert( *modtail == NULL );
677 if( SLAP_LASTMOD(op->o_bd) ) {
679 time_t now = slap_get_time();
681 ldap_pvt_thread_mutex_lock( &gmtime_mutex );
682 ltm = gmtime( &now );
683 lutil_gentime( timebuf, sizeof(timebuf), ltm );
685 csn.bv_len = lutil_csnstr( csnbuf, sizeof( csnbuf ), 0, 0 );
686 ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
689 timestamp.bv_val = timebuf;
690 timestamp.bv_len = strlen(timebuf);
692 if( op->o_dn.bv_len == 0 ) {
693 name.bv_val = SLAPD_ANONYMOUS;
694 name.bv_len = sizeof(SLAPD_ANONYMOUS)-1;
706 if( op->o_tag == LDAP_REQ_ADD ) {
707 struct berval tmpval;
709 if( global_schemacheck ) {
710 int rc = mods_structural_class( mods, &tmpval,
711 text, textbuf, textlen );
712 if( rc != LDAP_SUCCESS ) {
716 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
718 mod->sml_type.bv_val = NULL;
719 mod->sml_desc = slap_schema.si_ad_structuralObjectClass;
721 (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
722 ber_dupbv( &mod->sml_values[0], &tmpval );
723 mod->sml_values[1].bv_len = 0;
724 mod->sml_values[1].bv_val = NULL;
725 assert( mod->sml_values[0].bv_val );
728 (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
729 ber_dupbv( &mod->sml_nvalues[0], &tmpval );
730 mod->sml_nvalues[1].bv_len = 0;
731 mod->sml_nvalues[1].bv_val = NULL;
732 assert( mod->sml_nvalues[0].bv_val );
735 modtail = &mod->sml_next;
738 if( SLAP_LASTMOD(op->o_bd) ) {
739 char uuidbuf[ LDAP_LUTIL_UUIDSTR_BUFSIZE ];
741 tmpval.bv_len = lutil_uuidstr( uuidbuf, sizeof( uuidbuf ) );
742 tmpval.bv_val = uuidbuf;
744 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
746 mod->sml_type.bv_val = NULL;
747 mod->sml_desc = slap_schema.si_ad_entryUUID;
749 (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
750 ber_dupbv( &mod->sml_values[0], &tmpval );
751 mod->sml_values[1].bv_len = 0;
752 mod->sml_values[1].bv_val = NULL;
753 assert( mod->sml_values[0].bv_val );
755 mod->sml_nvalues = NULL;
758 modtail = &mod->sml_next;
760 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
762 mod->sml_type.bv_val = NULL;
763 mod->sml_desc = slap_schema.si_ad_creatorsName;
764 mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
765 ber_dupbv( &mod->sml_values[0], &name );
766 mod->sml_values[1].bv_len = 0;
767 mod->sml_values[1].bv_val = NULL;
768 assert( mod->sml_values[0].bv_val );
771 (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
772 ber_dupbv( &mod->sml_nvalues[0], &nname );
773 mod->sml_nvalues[1].bv_len = 0;
774 mod->sml_nvalues[1].bv_val = NULL;
775 assert( mod->sml_nvalues[0].bv_val );
778 modtail = &mod->sml_next;
780 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
782 mod->sml_type.bv_val = NULL;
783 mod->sml_desc = slap_schema.si_ad_createTimestamp;
784 mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
785 ber_dupbv( &mod->sml_values[0], ×tamp );
786 mod->sml_values[1].bv_len = 0;
787 mod->sml_values[1].bv_val = NULL;
788 assert( mod->sml_values[0].bv_val );
790 mod->sml_nvalues = NULL;
793 modtail = &mod->sml_next;
797 if( SLAP_LASTMOD(op->o_bd) ) {
798 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
800 mod->sml_type.bv_val = NULL;
801 mod->sml_desc = slap_schema.si_ad_entryCSN;
802 mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
803 ber_dupbv( &mod->sml_values[0], &csn );
804 mod->sml_values[1].bv_len = 0;
805 mod->sml_values[1].bv_val = NULL;
806 assert( mod->sml_values[0].bv_val );
808 mod->sml_nvalues = NULL;
811 modtail = &mod->sml_next;
813 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
815 mod->sml_type.bv_val = NULL;
816 mod->sml_desc = slap_schema.si_ad_modifiersName;
817 mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
818 ber_dupbv( &mod->sml_values[0], &name );
819 mod->sml_values[1].bv_len = 0;
820 mod->sml_values[1].bv_val = NULL;
821 assert( mod->sml_values[0].bv_val );
824 (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
825 ber_dupbv( &mod->sml_nvalues[0], &nname );
826 mod->sml_nvalues[1].bv_len = 0;
827 mod->sml_nvalues[1].bv_val = NULL;
828 assert( mod->sml_nvalues[0].bv_val );
831 modtail = &mod->sml_next;
833 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
835 mod->sml_type.bv_val = NULL;
836 mod->sml_desc = slap_schema.si_ad_modifyTimestamp;
837 mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
838 ber_dupbv( &mod->sml_values[0], ×tamp );
839 mod->sml_values[1].bv_len = 0;
840 mod->sml_values[1].bv_val = NULL;
841 assert( mod->sml_values[0].bv_val );
843 mod->sml_nvalues = NULL;
846 modtail = &mod->sml_next;