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;
106 tmp.sml_nvalues = NULL;
108 if ( ber_scanf( op->o_ber, "{i{m[W]}}", &mop,
109 &tmp.sml_type, &tmp.sml_values )
112 send_ldap_discon( op, rs, LDAP_PROTOCOL_ERROR, "decoding modlist error" );
113 rs->sr_err = SLAPD_DISCONNECT;
117 mod = (Modifications *) ch_malloc( sizeof(Modifications) );
119 mod->sml_type = tmp.sml_type;
120 mod->sml_values = tmp.sml_values;
121 mod->sml_nvalues = NULL;
122 mod->sml_desc = NULL;
123 mod->sml_next = NULL;
128 if ( mod->sml_values == NULL ) {
130 LDAP_LOG( OPERATION, ERR,
131 "do_modify: modify/add operation (%ld) requires values\n",
134 Debug( LDAP_DEBUG_ANY,
135 "do_modify: modify/add operation (%ld) requires values\n",
139 send_ldap_error( op, rs, LDAP_PROTOCOL_ERROR,
140 "modify/add operation requires values" );
146 case LDAP_MOD_DELETE:
147 case LDAP_MOD_REPLACE:
152 LDAP_LOG( OPERATION, ERR,
153 "do_modify: invalid modify operation (%ld)\n", (long)mop, 0, 0 );
155 Debug( LDAP_DEBUG_ANY,
156 "do_modify: invalid modify operation (%ld)\n",
160 send_ldap_error( op, rs, LDAP_PROTOCOL_ERROR,
161 "unrecognized modify operation" );
166 modtail = &mod->sml_next;
170 if( get_ctrls( op, rs, 1 ) != LDAP_SUCCESS ) {
172 LDAP_LOG( OPERATION, ERR, "do_modify: get_ctrls failed\n", 0, 0, 0 );
174 Debug( LDAP_DEBUG_ANY, "do_modify: get_ctrls failed\n", 0, 0, 0 );
180 rs->sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn, op->o_tmpmemctx );
181 if( rs->sr_err != LDAP_SUCCESS ) {
183 LDAP_LOG( OPERATION, INFO, "do_modify: conn %d invalid dn (%s)\n",
184 op->o_connid, dn.bv_val, 0 );
186 Debug( LDAP_DEBUG_ANY,
187 "do_modify: invalid dn (%s)\n", dn.bv_val, 0, 0 );
189 send_ldap_error( op, rs, LDAP_INVALID_DN_SYNTAX, "invalid DN" );
193 if( op->o_req_ndn.bv_len == 0 ) {
195 LDAP_LOG( OPERATION, ERR,
196 "do_modify: attempt to modify root DSE.\n",0, 0, 0 );
198 Debug( LDAP_DEBUG_ANY, "do_modify: root dse!\n", 0, 0, 0 );
201 send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
202 "modify upon the root DSE not supported" );
205 } else if ( bvmatch( &op->o_req_ndn, &global_schemandn ) ) {
207 LDAP_LOG( OPERATION, ERR,
208 "do_modify: attempt to modify subschema subentry.\n" , 0, 0, 0 );
210 Debug( LDAP_DEBUG_ANY, "do_modify: subschema subentry!\n", 0, 0, 0 );
213 send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
214 "modification of subschema subentry not supported" );
220 LDAP_LOG( OPERATION, DETAIL1, "do_modify: modifications:\n", 0, 0, 0 );
222 Debug( LDAP_DEBUG_ARGS, "modifications:\n", 0, 0, 0 );
225 for ( tmp = modlist; tmp != NULL; tmp = tmp->sml_next ) {
227 LDAP_LOG( OPERATION, DETAIL1, "\t%s: %s\n",
228 tmp->sml_op == LDAP_MOD_ADD ?
229 "add" : (tmp->sml_op == LDAP_MOD_DELETE ?
230 "delete" : "replace"), tmp->sml_type.bv_val, 0 );
232 if ( tmp->sml_values == NULL ) {
233 LDAP_LOG( OPERATION, DETAIL1, "\t\tno values", 0, 0, 0 );
234 } else if ( tmp->sml_values[0].bv_val == NULL ) {
235 LDAP_LOG( OPERATION, DETAIL1, "\t\tzero values", 0, 0, 0 );
236 } else if ( tmp->sml_values[1].bv_val == NULL ) {
237 LDAP_LOG( OPERATION, DETAIL1, "\t\tone value", 0, 0, 0 );
239 LDAP_LOG( OPERATION, DETAIL1, "\t\tmultiple values", 0, 0, 0 );
243 Debug( LDAP_DEBUG_ARGS, "\t%s: %s\n",
244 tmp->sml_op == LDAP_MOD_ADD
245 ? "add" : (tmp->sml_op == LDAP_MOD_DELETE
246 ? "delete" : "replace"), tmp->sml_type.bv_val, 0 );
248 if ( tmp->sml_values == NULL ) {
249 Debug( LDAP_DEBUG_ARGS, "%s\n",
250 "\t\tno values", NULL, NULL );
251 } else if ( tmp->sml_values[0].bv_val == NULL ) {
252 Debug( LDAP_DEBUG_ARGS, "%s\n",
253 "\t\tzero values", NULL, NULL );
254 } else if ( tmp->sml_values[1].bv_val == NULL ) {
255 Debug( LDAP_DEBUG_ARGS, "%s, length %ld\n",
256 "\t\tone value", (long) tmp->sml_values[0].bv_len, NULL );
258 Debug( LDAP_DEBUG_ARGS, "%s\n",
259 "\t\tmultiple values", NULL, NULL );
264 if ( StatslogTest( LDAP_DEBUG_STATS ) ) {
265 char abuf[BUFSIZ/2], *ptr = abuf;
268 Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu MOD dn=\"%s\"\n",
269 op->o_connid, op->o_opid, dn.bv_val, 0, 0 );
271 for ( tmp = modlist; tmp != NULL; tmp = tmp->sml_next ) {
272 if (len + 1 + tmp->sml_type.bv_len > sizeof(abuf)) {
273 Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu MOD attr=%s\n",
274 op->o_connid, op->o_opid, abuf, 0, 0 );
282 ptr = lutil_strcopy(ptr, tmp->sml_type.bv_val);
283 len += tmp->sml_type.bv_len;
286 Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu MOD attr=%s\n",
287 op->o_connid, op->o_opid, abuf, 0, 0 );
290 #endif /* LDAP_DEBUG */
292 manageDSAit = get_manageDSAit( op );
295 * We could be serving multiple database backends. Select the
296 * appropriate one, or send a referral to our "referral server"
297 * if we don't hold it.
299 if ( (op->o_bd = select_backend( &op->o_req_ndn, manageDSAit, 0 )) == NULL ) {
300 rs->sr_ref = referral_rewrite( default_referral,
301 NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
302 if (!rs->sr_ref) rs->sr_ref = default_referral;
304 if (rs->sr_ref != NULL ) {
305 rs->sr_err = LDAP_REFERRAL;
306 send_ldap_result( op, rs );
308 if (rs->sr_ref != default_referral) ber_bvarray_free( rs->sr_ref );
310 send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
311 "referral missing" );
316 /* check restrictions */
317 if( backend_check_restrictions( op, rs, NULL ) != LDAP_SUCCESS ) {
318 send_ldap_result( op, rs );
322 /* check for referrals */
323 if( backend_check_referrals( op, rs ) != LDAP_SUCCESS ) {
327 #if defined( LDAP_SLAPI )
328 slapi_x_pblock_set_operation( pb, op );
329 slapi_pblock_set( pb, SLAPI_MODIFY_TARGET, (void *)dn.bv_val );
330 slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)manageDSAit );
331 modv = slapi_x_modifications2ldapmods( &modlist );
332 slapi_pblock_set( pb, SLAPI_MODIFY_MODS, (void *)modv );
334 rs->sr_err = doPluginFNs( op->o_bd, SLAPI_PLUGIN_PRE_MODIFY_FN, pb );
335 if ( rs->sr_err < 0 ) {
337 * A preoperation plugin failure will abort the
341 LDAP_LOG( OPERATION, INFO, "do_modify: modify preoperation plugin "
342 "failed\n", 0, 0, 0 );
344 Debug(LDAP_DEBUG_TRACE, "do_modify: modify preoperation plugin failed.\n",
347 if ( slapi_pblock_get( pb, SLAPI_RESULT_CODE, (void *)&rs->sr_err ) != 0) {
348 rs->sr_err = LDAP_OTHER;
350 slapi_x_free_ldapmods( modv );
356 * It's possible that the preoperation plugin changed the
357 * modification array, so we need to convert it back to
358 * a Modification list.
360 * Calling slapi_x_modifications2ldapmods() destroyed modlist so
361 * we don't need to free it.
363 slapi_pblock_get( pb, SLAPI_MODIFY_MODS, (void **)&modv );
364 modlist = slapi_x_ldapmods2modifications( modv );
367 * NB: it is valid for the plugin to return no modifications
368 * (for example, a plugin might store some attributes elsewhere
369 * and remove them from the modification list; if only those
370 * attribute types were included in the modification request,
371 * then slapi_x_ldapmods2modifications() above will return
374 if ( modlist == NULL ) {
375 rs->sr_err = LDAP_SUCCESS;
376 send_ldap_result( op, rs );
379 #endif /* defined( LDAP_SLAPI ) */
382 * do the modify if 1 && (2 || 3)
383 * 1) there is a modify function implemented in this backend;
384 * 2) this backend is master for what it holds;
385 * 3) it's a replica and the dn supplied is the update_ndn.
387 if ( op->o_bd->be_modify ) {
388 /* do the update here */
389 int repl_user = be_isupdate( op->o_bd, &op->o_ndn );
390 #ifndef SLAPD_MULTIMASTER
391 /* Multimaster slapd does not have to check for replicator dn
392 * because it accepts each modify request
394 if ( !op->o_bd->be_update_ndn.bv_len || repl_user )
397 int update = op->o_bd->be_update_ndn.bv_len;
398 char textbuf[SLAP_TEXT_BUFLEN];
399 size_t textlen = sizeof textbuf;
401 rs->sr_err = slap_mods_check( modlist, update, &rs->sr_text,
402 textbuf, textlen, NULL );
404 if( rs->sr_err != LDAP_SUCCESS ) {
405 send_ldap_result( op, rs );
410 for( modtail = &modlist;
412 modtail = &(*modtail)->sml_next )
417 rs->sr_err = slap_mods_opattrs( op, modlist, modtail,
418 &rs->sr_text, textbuf, textlen );
419 if( rs->sr_err != LDAP_SUCCESS ) {
420 send_ldap_result( op, rs );
425 op->orm_modlist = modlist;
426 if ( (op->o_bd->be_modify)( op, rs ) == 0
427 #ifdef SLAPD_MULTIMASTER
431 /* but we log only the ones not from a replicator user */
435 #ifndef SLAPD_MULTIMASTER
436 /* send a referral */
438 BerVarray defref = op->o_bd->be_update_refs
439 ? op->o_bd->be_update_refs : default_referral;
440 if ( defref != NULL ) {
441 rs->sr_ref = referral_rewrite( defref,
443 LDAP_SCOPE_DEFAULT );
444 if (!rs->sr_ref) rs->sr_ref = defref;
445 rs->sr_err = LDAP_REFERRAL;
446 send_ldap_result( op, rs );
447 if (rs->sr_ref != defref) {
448 ber_bvarray_free( rs->sr_ref );
451 send_ldap_error( op, rs,
452 LDAP_UNWILLING_TO_PERFORM,
453 "referral missing" );
458 send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
459 "operation not supported within namingContext" );
462 #if defined( LDAP_SLAPI )
463 if ( doPluginFNs( op->o_bd, SLAPI_PLUGIN_POST_MODIFY_FN, pb ) < 0 ) {
465 LDAP_LOG( OPERATION, INFO, "do_modify: modify postoperation plugins "
466 "failed\n", 0, 0, 0 );
468 Debug(LDAP_DEBUG_TRACE, "do_modify: modify postoperation plugins "
469 "failed.\n", 0, 0, 0);
472 #endif /* defined( LDAP_SLAPI ) */
475 op->o_tmpfree( op->o_req_dn.bv_val, op->o_tmpmemctx );
476 op->o_tmpfree( op->o_req_ndn.bv_val, op->o_tmpmemctx );
477 if ( modlist != NULL ) slap_mods_free( modlist );
478 #if defined( LDAP_SLAPI )
479 if ( modv != NULL ) slapi_x_free_ldapmods( modv );
485 * Do basic attribute type checking and syntax validation.
497 for( ; ml != NULL; ml = ml->sml_next ) {
498 AttributeDescription *ad = NULL;
500 /* convert to attribute description */
501 rc = slap_bv2ad( &ml->sml_type, &ml->sml_desc, text );
503 if( rc != LDAP_SUCCESS ) {
504 snprintf( textbuf, textlen, "%s: %s",
505 ml->sml_type.bv_val, *text );
512 if( slap_syntax_is_binary( ad->ad_type->sat_syntax )
513 && !slap_ad_is_binary( ad ))
515 /* attribute requires binary transfer */
516 snprintf( textbuf, textlen,
517 "%s: requires ;binary transfer",
518 ml->sml_type.bv_val );
520 return LDAP_UNDEFINED_TYPE;
523 if( !slap_syntax_is_binary( ad->ad_type->sat_syntax )
524 && slap_ad_is_binary( ad ))
526 /* attribute requires binary transfer */
527 snprintf( textbuf, textlen,
528 "%s: disallows ;binary transfer",
529 ml->sml_type.bv_val );
531 return LDAP_UNDEFINED_TYPE;
534 if( slap_ad_is_tag_range( ad )) {
535 /* attribute requires binary transfer */
536 snprintf( textbuf, textlen,
537 "%s: inappropriate use of tag range option",
538 ml->sml_type.bv_val );
540 return LDAP_UNDEFINED_TYPE;
543 if (!update && is_at_no_user_mod( ad->ad_type )) {
544 /* user modification disallowed */
545 snprintf( textbuf, textlen,
546 "%s: no user modification allowed",
547 ml->sml_type.bv_val );
549 return LDAP_CONSTRAINT_VIOLATION;
552 if ( is_at_obsolete( ad->ad_type ) &&
553 ( ml->sml_op == LDAP_MOD_ADD || ml->sml_values != NULL ) )
556 * attribute is obsolete,
557 * only allow replace/delete with no values
559 snprintf( textbuf, textlen,
560 "%s: attribute is obsolete",
561 ml->sml_type.bv_val );
563 return LDAP_CONSTRAINT_VIOLATION;
569 if( ml->sml_values != NULL ) {
571 slap_syntax_validate_func *validate =
572 ad->ad_type->sat_syntax->ssyn_validate;
573 slap_syntax_transform_func *pretty =
574 ad->ad_type->sat_syntax->ssyn_pretty;
576 if( !pretty && !validate ) {
577 *text = "no validator for syntax";
578 snprintf( textbuf, textlen,
579 "%s: no validator for syntax %s",
581 ad->ad_type->sat_syntax->ssyn_oid );
583 return LDAP_INVALID_SYNTAX;
587 * check that each value is valid per syntax
588 * and pretty if appropriate
590 for( nvals = 0; ml->sml_values[nvals].bv_val; nvals++ ) {
593 rc = pretty( ad->ad_type->sat_syntax,
594 &ml->sml_values[nvals], &pval, ctx );
596 rc = validate( ad->ad_type->sat_syntax,
597 &ml->sml_values[nvals] );
601 snprintf( textbuf, textlen,
602 "%s: value #%ld invalid per syntax",
603 ml->sml_type.bv_val, (long) nvals );
605 return LDAP_INVALID_SYNTAX;
609 ber_memfree_x( ml->sml_values[nvals].bv_val, ctx );
610 ml->sml_values[nvals] = pval;
615 * a rough single value check... an additional check is needed
616 * to catch add of single value to existing single valued attribute
618 if ((ml->sml_op == LDAP_MOD_ADD || ml->sml_op == LDAP_MOD_REPLACE)
619 && nvals > 1 && is_at_single_value( ad->ad_type ))
621 snprintf( textbuf, textlen,
622 "%s: multiple values provided",
623 ml->sml_type.bv_val );
625 return LDAP_CONSTRAINT_VIOLATION;
628 if( nvals && ad->ad_type->sat_equality &&
629 ad->ad_type->sat_equality->smr_normalize )
631 ml->sml_nvalues = ber_memalloc_x( (nvals+1)*sizeof(struct berval), ctx );
632 for( nvals = 0; ml->sml_values[nvals].bv_val; nvals++ ) {
633 rc = ad->ad_type->sat_equality->smr_normalize(
635 ad->ad_type->sat_syntax,
636 ad->ad_type->sat_equality,
637 &ml->sml_values[nvals], &ml->sml_nvalues[nvals], ctx );
640 LDAP_LOG( OPERATION, DETAIL1,
641 "str2entry: NULL (ssyn_normalize %d)\n",
644 Debug( LDAP_DEBUG_ANY,
645 "<= str2entry NULL (ssyn_normalize %d)\n",
648 snprintf( textbuf, textlen,
649 "%s: value #%ld normalization failed",
650 ml->sml_type.bv_val, (long) nvals );
655 ml->sml_nvalues[nvals].bv_val = NULL;
656 ml->sml_nvalues[nvals].bv_len = 0;
664 int slap_mods_opattrs(
667 Modifications **modtail,
669 char *textbuf, size_t textlen )
671 struct berval name, timestamp, csn;
673 char timebuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
674 char csnbuf[ LDAP_LUTIL_CSNSTR_BUFSIZE ];
677 int mop = op->o_tag == LDAP_REQ_ADD
678 ? LDAP_MOD_ADD : LDAP_MOD_REPLACE;
680 assert( modtail != NULL );
681 assert( *modtail == NULL );
683 if( SLAP_LASTMOD(op->o_bd) ) {
685 time_t now = slap_get_time();
687 ldap_pvt_thread_mutex_lock( &gmtime_mutex );
688 ltm = gmtime( &now );
689 lutil_gentime( timebuf, sizeof(timebuf), ltm );
691 csn.bv_len = lutil_csnstr( csnbuf, sizeof( csnbuf ), 0, 0 );
692 ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
695 timestamp.bv_val = timebuf;
696 timestamp.bv_len = strlen(timebuf);
698 if( op->o_dn.bv_len == 0 ) {
699 name.bv_val = SLAPD_ANONYMOUS;
700 name.bv_len = sizeof(SLAPD_ANONYMOUS)-1;
708 if( op->o_tag == LDAP_REQ_ADD ) {
709 struct berval tmpval;
711 if( global_schemacheck ) {
712 int rc = mods_structural_class( mods, &tmpval,
713 text, textbuf, textlen );
714 if( rc != LDAP_SUCCESS ) {
718 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
720 mod->sml_type.bv_val = NULL;
721 mod->sml_desc = slap_schema.si_ad_structuralObjectClass;
723 (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
724 ber_dupbv( &mod->sml_values[0], &tmpval );
725 mod->sml_values[1].bv_len = 0;
726 mod->sml_values[1].bv_val = NULL;
727 assert( mod->sml_values[0].bv_val );
729 (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
730 ber_dupbv( &mod->sml_nvalues[0], &tmpval );
731 mod->sml_nvalues[1].bv_len = 0;
732 mod->sml_nvalues[1].bv_val = NULL;
733 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 );
754 mod->sml_nvalues = NULL;
756 modtail = &mod->sml_next;
758 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
760 mod->sml_type.bv_val = NULL;
761 mod->sml_desc = slap_schema.si_ad_creatorsName;
762 mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
763 ber_dupbv( &mod->sml_values[0], &name );
764 mod->sml_values[1].bv_len = 0;
765 mod->sml_values[1].bv_val = NULL;
766 assert( mod->sml_values[0].bv_val );
768 (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
769 ber_dupbv( &mod->sml_nvalues[0], &nname );
770 mod->sml_nvalues[1].bv_len = 0;
771 mod->sml_nvalues[1].bv_val = NULL;
772 assert( mod->sml_nvalues[0].bv_val );
774 modtail = &mod->sml_next;
776 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
778 mod->sml_type.bv_val = NULL;
779 mod->sml_desc = slap_schema.si_ad_createTimestamp;
780 mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
781 ber_dupbv( &mod->sml_values[0], ×tamp );
782 mod->sml_values[1].bv_len = 0;
783 mod->sml_values[1].bv_val = NULL;
784 assert( mod->sml_values[0].bv_val );
785 mod->sml_nvalues = NULL;
787 modtail = &mod->sml_next;
791 if( SLAP_LASTMOD(op->o_bd) ) {
792 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
794 mod->sml_type.bv_val = NULL;
795 mod->sml_desc = slap_schema.si_ad_entryCSN;
796 mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
797 ber_dupbv( &mod->sml_values[0], &csn );
798 mod->sml_values[1].bv_len = 0;
799 mod->sml_values[1].bv_val = NULL;
800 assert( mod->sml_values[0].bv_val );
801 mod->sml_nvalues = NULL;
803 modtail = &mod->sml_next;
805 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
807 mod->sml_type.bv_val = NULL;
808 mod->sml_desc = slap_schema.si_ad_modifiersName;
809 mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
810 ber_dupbv( &mod->sml_values[0], &name );
811 mod->sml_values[1].bv_len = 0;
812 mod->sml_values[1].bv_val = NULL;
813 assert( mod->sml_values[0].bv_val );
815 (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
816 ber_dupbv( &mod->sml_nvalues[0], &nname );
817 mod->sml_nvalues[1].bv_len = 0;
818 mod->sml_nvalues[1].bv_val = NULL;
819 assert( mod->sml_nvalues[0].bv_val );
821 modtail = &mod->sml_next;
823 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
825 mod->sml_type.bv_val = NULL;
826 mod->sml_desc = slap_schema.si_ad_modifyTimestamp;
827 mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
828 ber_dupbv( &mod->sml_values[0], ×tamp );
829 mod->sml_values[1].bv_len = 0;
830 mod->sml_values[1].bv_val = NULL;
831 assert( mod->sml_values[0].bv_val );
832 mod->sml_nvalues = NULL;
834 modtail = &mod->sml_next;