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",
156 Debug( LDAP_DEBUG_ANY,
157 "do_modify: invalid modify operation (%ld)\n",
161 send_ldap_error( op, rs, LDAP_PROTOCOL_ERROR,
162 "unrecognized modify operation" );
167 modtail = &mod->sml_next;
171 if( get_ctrls( op, rs, 1 ) != LDAP_SUCCESS ) {
173 LDAP_LOG( OPERATION, ERR, "do_modify: get_ctrls failed\n", 0, 0, 0 );
175 Debug( LDAP_DEBUG_ANY, "do_modify: get_ctrls failed\n", 0, 0, 0 );
181 rs->sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn,
183 if( rs->sr_err != LDAP_SUCCESS ) {
185 LDAP_LOG( OPERATION, INFO, "do_modify: conn %d invalid dn (%s)\n",
186 op->o_connid, dn.bv_val, 0 );
188 Debug( LDAP_DEBUG_ANY,
189 "do_modify: invalid dn (%s)\n", dn.bv_val, 0, 0 );
191 send_ldap_error( op, rs, LDAP_INVALID_DN_SYNTAX, "invalid DN" );
195 if( op->o_req_ndn.bv_len == 0 ) {
197 LDAP_LOG( OPERATION, ERR,
198 "do_modify: attempt to modify root DSE.\n",0, 0, 0 );
200 Debug( LDAP_DEBUG_ANY, "do_modify: root dse!\n", 0, 0, 0 );
203 send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
204 "modify upon the root DSE not supported" );
207 } else if ( bvmatch( &op->o_req_ndn, &global_schemandn ) ) {
209 LDAP_LOG( OPERATION, ERR,
210 "do_modify: attempt to modify subschema subentry.\n" , 0, 0, 0 );
212 Debug( LDAP_DEBUG_ANY, "do_modify: subschema subentry!\n", 0, 0, 0 );
215 send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
216 "modification of subschema subentry not supported" );
222 LDAP_LOG( OPERATION, DETAIL1, "do_modify: modifications:\n", 0, 0, 0 );
224 Debug( LDAP_DEBUG_ARGS, "modifications:\n", 0, 0, 0 );
227 for ( tmp = modlist; tmp != NULL; tmp = tmp->sml_next ) {
229 LDAP_LOG( OPERATION, DETAIL1, "\t%s: %s\n",
230 tmp->sml_op == LDAP_MOD_ADD ?
231 "add" : (tmp->sml_op == LDAP_MOD_DELETE ?
232 "delete" : "replace"), tmp->sml_type.bv_val, 0 );
234 if ( tmp->sml_values == NULL ) {
235 LDAP_LOG( OPERATION, DETAIL1, "\t\tno values", 0, 0, 0 );
236 } else if ( tmp->sml_values[0].bv_val == NULL ) {
237 LDAP_LOG( OPERATION, DETAIL1, "\t\tzero values", 0, 0, 0 );
238 } else if ( tmp->sml_values[1].bv_val == NULL ) {
239 LDAP_LOG( OPERATION, DETAIL1, "\t\tone value", 0, 0, 0 );
241 LDAP_LOG( OPERATION, DETAIL1, "\t\tmultiple values", 0, 0, 0 );
245 Debug( LDAP_DEBUG_ARGS, "\t%s: %s\n",
246 tmp->sml_op == LDAP_MOD_ADD
247 ? "add" : (tmp->sml_op == LDAP_MOD_DELETE
248 ? "delete" : "replace"), tmp->sml_type.bv_val, 0 );
250 if ( tmp->sml_values == NULL ) {
251 Debug( LDAP_DEBUG_ARGS, "%s\n",
252 "\t\tno values", NULL, NULL );
253 } else if ( tmp->sml_values[0].bv_val == NULL ) {
254 Debug( LDAP_DEBUG_ARGS, "%s\n",
255 "\t\tzero values", NULL, NULL );
256 } else if ( tmp->sml_values[1].bv_val == NULL ) {
257 Debug( LDAP_DEBUG_ARGS, "%s, length %ld\n",
258 "\t\tone value", (long) tmp->sml_values[0].bv_len, NULL );
260 Debug( LDAP_DEBUG_ARGS, "%s\n",
261 "\t\tmultiple values", NULL, NULL );
266 if ( StatslogTest( LDAP_DEBUG_STATS ) ) {
267 char abuf[BUFSIZ/2], *ptr = abuf;
270 Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu MOD dn=\"%s\"\n",
271 op->o_connid, op->o_opid, dn.bv_val, 0, 0 );
273 for ( tmp = modlist; tmp != NULL; tmp = tmp->sml_next ) {
274 if (len + 1 + tmp->sml_type.bv_len > sizeof(abuf)) {
275 Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu MOD attr=%s\n",
276 op->o_connid, op->o_opid, abuf, 0, 0 );
284 ptr = lutil_strcopy(ptr, tmp->sml_type.bv_val);
285 len += tmp->sml_type.bv_len;
288 Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu MOD attr=%s\n",
289 op->o_connid, op->o_opid, abuf, 0, 0 );
292 #endif /* LDAP_DEBUG */
294 manageDSAit = get_manageDSAit( op );
297 * We could be serving multiple database backends. Select the
298 * appropriate one, or send a referral to our "referral server"
299 * if we don't hold it.
301 op->o_bd = select_backend( &op->o_req_ndn, manageDSAit, 0 );
302 if ( op->o_bd == NULL ) {
303 rs->sr_ref = referral_rewrite( default_referral,
304 NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
305 if (!rs->sr_ref) rs->sr_ref = default_referral;
307 if (rs->sr_ref != NULL ) {
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 );
313 send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
314 "referral missing" );
319 /* check restrictions */
320 if( backend_check_restrictions( op, rs, NULL ) != LDAP_SUCCESS ) {
321 send_ldap_result( op, rs );
325 /* check for referrals */
326 if( backend_check_referrals( op, rs ) != LDAP_SUCCESS ) {
330 #if defined( LDAP_SLAPI )
331 slapi_x_pblock_set_operation( pb, op );
332 slapi_pblock_set( pb, SLAPI_MODIFY_TARGET, (void *)dn.bv_val );
333 slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)manageDSAit );
334 modv = slapi_x_modifications2ldapmods( &modlist );
335 slapi_pblock_set( pb, SLAPI_MODIFY_MODS, (void *)modv );
337 rs->sr_err = doPluginFNs( op->o_bd, SLAPI_PLUGIN_PRE_MODIFY_FN, pb );
338 if ( rs->sr_err < 0 ) {
340 * A preoperation plugin failure will abort the
344 LDAP_LOG( OPERATION, INFO, "do_modify: modify preoperation plugin "
345 "failed\n", 0, 0, 0 );
347 Debug(LDAP_DEBUG_TRACE, "do_modify: modify preoperation plugin failed.\n",
350 if ( ( slapi_pblock_get( op->o_pb, SLAPI_RESULT_CODE, (void *)&rs->sr_err ) != 0 ) ||
351 rs->sr_err == LDAP_SUCCESS ) {
352 rs->sr_err = LDAP_OTHER;
354 slapi_x_free_ldapmods( modv );
360 * It's possible that the preoperation plugin changed the
361 * modification array, so we need to convert it back to
362 * a Modification list.
364 * Calling slapi_x_modifications2ldapmods() destroyed modlist so
365 * we don't need to free it.
367 slapi_pblock_get( pb, SLAPI_MODIFY_MODS, (void **)&modv );
368 modlist = slapi_x_ldapmods2modifications( modv );
371 * NB: it is valid for the plugin to return no modifications
372 * (for example, a plugin might store some attributes elsewhere
373 * and remove them from the modification list; if only those
374 * attribute types were included in the modification request,
375 * then slapi_x_ldapmods2modifications() above will return
378 * However, the post-operation plugin should still be
381 if ( modlist == NULL ) {
382 rs->sr_err = LDAP_SUCCESS;
383 send_ldap_result( op, rs );
385 #endif /* defined( LDAP_SLAPI ) */
388 * do the modify if 1 && (2 || 3)
389 * 1) there is a modify function implemented in this backend;
390 * 2) this backend is master for what it holds;
391 * 3) it's a replica and the dn supplied is the update_ndn.
393 if ( op->o_bd->be_modify ) {
394 /* do the update here */
395 int repl_user = be_isupdate( op->o_bd, &op->o_ndn );
397 /* Multimaster slapd does not have to check for replicator dn
398 * because it accepts each modify request
400 #if defined(LDAP_SYNCREPL) && !defined(SLAPD_MULTIMASTER)
401 if ( !op->o_bd->syncinfo &&
402 ( !op->o_bd->be_update_ndn.bv_len || repl_user ))
403 #elif defined(LDAP_SYNCREPL) && defined(SLAPD_MULTIMASTER)
404 if ( !op->o_bd->syncinfo ) /* LDAP_SYNCREPL overrides MM */
405 #elif !defined(LDAP_SYNCREPL) && !defined(SLAPD_MULTIMASTER)
406 if ( !op->o_bd->be_update_ndn.bv_len || repl_user )
409 int update = op->o_bd->be_update_ndn.bv_len;
410 char textbuf[SLAP_TEXT_BUFLEN];
411 size_t textlen = sizeof textbuf;
413 rs->sr_err = slap_mods_check( modlist, update, &rs->sr_text,
414 textbuf, textlen, NULL );
416 if( rs->sr_err != LDAP_SUCCESS ) {
417 send_ldap_result( op, rs );
422 for( modtail = &modlist;
424 modtail = &(*modtail)->sml_next )
429 rs->sr_err = slap_mods_opattrs( op, modlist, modtail,
430 &rs->sr_text, textbuf, textlen );
431 if( rs->sr_err != LDAP_SUCCESS ) {
432 send_ldap_result( op, rs );
437 op->orm_modlist = modlist;
438 if ( (op->o_bd->be_modify)( op, rs ) == 0
439 #ifdef SLAPD_MULTIMASTER
443 /* but we log only the ones not from a replicator user */
447 #if defined(LDAP_SYNCREPL) || !defined(SLAPD_MULTIMASTER)
448 /* send a referral */
450 BerVarray defref = NULL;
452 if ( op->o_bd->syncinfo ) {
453 defref = op->o_bd->syncinfo->provideruri_bv;
457 defref = op->o_bd->be_update_refs
458 ? op->o_bd->be_update_refs : default_referral;
460 if ( defref != NULL ) {
461 rs->sr_ref = referral_rewrite( defref,
463 LDAP_SCOPE_DEFAULT );
464 if (!rs->sr_ref) rs->sr_ref = defref;
465 rs->sr_err = LDAP_REFERRAL;
466 send_ldap_result( op, rs );
467 if (rs->sr_ref != defref) {
468 ber_bvarray_free( rs->sr_ref );
471 send_ldap_error( op, rs,
472 LDAP_UNWILLING_TO_PERFORM,
473 "referral missing" );
478 send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
479 "operation not supported within namingContext" );
482 #if defined( LDAP_SLAPI )
483 } /* modlist != NULL */
485 if ( doPluginFNs( op->o_bd, SLAPI_PLUGIN_POST_MODIFY_FN, pb ) < 0 ) {
487 LDAP_LOG( OPERATION, INFO, "do_modify: modify postoperation plugins "
488 "failed\n", 0, 0, 0 );
490 Debug(LDAP_DEBUG_TRACE, "do_modify: modify postoperation plugins "
491 "failed.\n", 0, 0, 0);
494 #endif /* defined( LDAP_SLAPI ) */
497 op->o_tmpfree( op->o_req_dn.bv_val, op->o_tmpmemctx );
498 op->o_tmpfree( op->o_req_ndn.bv_val, op->o_tmpmemctx );
499 if ( modlist != NULL ) slap_mods_free( modlist );
500 #if defined( LDAP_SLAPI )
501 if ( modv != NULL ) slapi_x_free_ldapmods( modv );
507 * Do basic attribute type checking and syntax validation.
519 for( ; ml != NULL; ml = ml->sml_next ) {
520 AttributeDescription *ad = NULL;
522 /* convert to attribute description */
523 rc = slap_bv2ad( &ml->sml_type, &ml->sml_desc, text );
525 if( rc != LDAP_SUCCESS ) {
526 snprintf( textbuf, textlen, "%s: %s",
527 ml->sml_type.bv_val, *text );
534 if( slap_syntax_is_binary( ad->ad_type->sat_syntax )
535 && !slap_ad_is_binary( ad ))
537 /* attribute requires binary transfer */
538 snprintf( textbuf, textlen,
539 "%s: requires ;binary transfer",
540 ml->sml_type.bv_val );
542 return LDAP_UNDEFINED_TYPE;
545 if( !slap_syntax_is_binary( ad->ad_type->sat_syntax )
546 && slap_ad_is_binary( ad ))
548 /* attribute requires binary transfer */
549 snprintf( textbuf, textlen,
550 "%s: disallows ;binary transfer",
551 ml->sml_type.bv_val );
553 return LDAP_UNDEFINED_TYPE;
556 if( slap_ad_is_tag_range( ad )) {
557 /* attribute requires binary transfer */
558 snprintf( textbuf, textlen,
559 "%s: inappropriate use of tag range option",
560 ml->sml_type.bv_val );
562 return LDAP_UNDEFINED_TYPE;
565 if (!update && is_at_no_user_mod( ad->ad_type )) {
566 /* user modification disallowed */
567 snprintf( textbuf, textlen,
568 "%s: no user modification allowed",
569 ml->sml_type.bv_val );
571 return LDAP_CONSTRAINT_VIOLATION;
574 if ( is_at_obsolete( ad->ad_type ) &&
575 ( ml->sml_op == LDAP_MOD_ADD || ml->sml_values != NULL ) )
578 * attribute is obsolete,
579 * only allow replace/delete with no values
581 snprintf( textbuf, textlen,
582 "%s: attribute is obsolete",
583 ml->sml_type.bv_val );
585 return LDAP_CONSTRAINT_VIOLATION;
591 if( ml->sml_values != NULL ) {
593 slap_syntax_validate_func *validate =
594 ad->ad_type->sat_syntax->ssyn_validate;
595 slap_syntax_transform_func *pretty =
596 ad->ad_type->sat_syntax->ssyn_pretty;
598 if( !pretty && !validate ) {
599 *text = "no validator for syntax";
600 snprintf( textbuf, textlen,
601 "%s: no validator for syntax %s",
603 ad->ad_type->sat_syntax->ssyn_oid );
605 return LDAP_INVALID_SYNTAX;
609 * check that each value is valid per syntax
610 * and pretty if appropriate
612 for( nvals = 0; ml->sml_values[nvals].bv_val; nvals++ ) {
615 rc = pretty( ad->ad_type->sat_syntax,
616 &ml->sml_values[nvals], &pval, ctx );
618 rc = validate( ad->ad_type->sat_syntax,
619 &ml->sml_values[nvals] );
623 snprintf( textbuf, textlen,
624 "%s: value #%ld invalid per syntax",
625 ml->sml_type.bv_val, (long) nvals );
627 return LDAP_INVALID_SYNTAX;
631 ber_memfree_x( ml->sml_values[nvals].bv_val, ctx );
632 ml->sml_values[nvals] = pval;
637 * a rough single value check... an additional check is needed
638 * to catch add of single value to existing single valued attribute
640 if ((ml->sml_op == LDAP_MOD_ADD || ml->sml_op == LDAP_MOD_REPLACE)
641 && nvals > 1 && is_at_single_value( ad->ad_type ))
643 snprintf( textbuf, textlen,
644 "%s: multiple values provided",
645 ml->sml_type.bv_val );
647 return LDAP_CONSTRAINT_VIOLATION;
650 if( nvals && ad->ad_type->sat_equality &&
651 ad->ad_type->sat_equality->smr_normalize )
653 ml->sml_nvalues = ber_memalloc_x(
654 (nvals+1)*sizeof(struct berval), ctx );
656 for( nvals = 0; ml->sml_values[nvals].bv_val; nvals++ ) {
657 rc = ad->ad_type->sat_equality->smr_normalize(
659 ad->ad_type->sat_syntax,
660 ad->ad_type->sat_equality,
661 &ml->sml_values[nvals], &ml->sml_nvalues[nvals], ctx );
664 LDAP_LOG( OPERATION, DETAIL1,
665 "str2entry: NULL (ssyn_normalize %d)\n",
668 Debug( LDAP_DEBUG_ANY,
669 "<= str2entry NULL (ssyn_normalize %d)\n",
672 snprintf( textbuf, textlen,
673 "%s: value #%ld normalization failed",
674 ml->sml_type.bv_val, (long) nvals );
680 ml->sml_nvalues[nvals].bv_val = NULL;
681 ml->sml_nvalues[nvals].bv_len = 0;
691 int slap_mods_opattrs(
694 Modifications **modtail,
696 char *textbuf, size_t textlen )
698 struct berval name, timestamp, csn;
700 char timebuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
701 char csnbuf[ LDAP_LUTIL_CSNSTR_BUFSIZE ];
704 int mop = op->o_tag == LDAP_REQ_ADD
705 ? LDAP_MOD_ADD : LDAP_MOD_REPLACE;
708 syncinfo_t *si = op->o_si;
711 assert( modtail != NULL );
712 assert( *modtail == NULL );
715 if ( SLAP_LASTMOD(op->o_bd) && ( !si || si->lastmod == LASTMOD_GEN ))
717 if ( SLAP_LASTMOD(op->o_bd) )
721 time_t now = slap_get_time();
723 ldap_pvt_thread_mutex_lock( &gmtime_mutex );
724 ltm = gmtime( &now );
725 lutil_gentime( timebuf, sizeof(timebuf), ltm );
727 csn.bv_len = lutil_csnstr( csnbuf, sizeof( csnbuf ), 0, 0 );
728 ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
731 timestamp.bv_val = timebuf;
732 timestamp.bv_len = strlen(timebuf);
734 if( op->o_dn.bv_len == 0 ) {
735 name.bv_val = SLAPD_ANONYMOUS;
736 name.bv_len = sizeof(SLAPD_ANONYMOUS)-1;
744 if( op->o_tag == LDAP_REQ_ADD ) {
745 struct berval tmpval;
747 if( global_schemacheck ) {
748 int rc = mods_structural_class( mods, &tmpval,
749 text, textbuf, textlen );
750 if( rc != LDAP_SUCCESS ) {
754 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
756 mod->sml_type.bv_val = NULL;
757 mod->sml_desc = slap_schema.si_ad_structuralObjectClass;
759 (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
760 ber_dupbv( &mod->sml_values[0], &tmpval );
761 mod->sml_values[1].bv_len = 0;
762 mod->sml_values[1].bv_val = NULL;
763 assert( mod->sml_values[0].bv_val );
765 (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
766 ber_dupbv( &mod->sml_nvalues[0], &tmpval );
767 mod->sml_nvalues[1].bv_len = 0;
768 mod->sml_nvalues[1].bv_val = NULL;
769 assert( mod->sml_nvalues[0].bv_val );
771 modtail = &mod->sml_next;
775 if ( SLAP_LASTMOD(op->o_bd) && ( !si || si->lastmod == LASTMOD_GEN ))
777 if ( SLAP_LASTMOD(op->o_bd) )
780 char uuidbuf[ LDAP_LUTIL_UUIDSTR_BUFSIZE ];
785 tmpval.bv_len = lutil_uuidstr( uuidbuf, sizeof( uuidbuf ) );
786 tmpval.bv_val = uuidbuf;
788 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
790 mod->sml_type.bv_val = NULL;
791 mod->sml_desc = slap_schema.si_ad_entryUUID;
793 (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
794 ber_dupbv( &mod->sml_values[0], &tmpval );
795 mod->sml_values[1].bv_len = 0;
796 mod->sml_values[1].bv_val = NULL;
797 assert( mod->sml_values[0].bv_val );
798 mod->sml_nvalues = NULL;
800 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_creatorsName;
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_createTimestamp;
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;
839 if ( SLAP_LASTMOD(op->o_bd) && ( !si || si->lastmod == LASTMOD_GEN ))
841 if ( SLAP_LASTMOD(op->o_bd) )
844 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
846 mod->sml_type.bv_val = NULL;
847 mod->sml_desc = slap_schema.si_ad_entryCSN;
848 mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
849 ber_dupbv( &mod->sml_values[0], &csn );
850 mod->sml_values[1].bv_len = 0;
851 mod->sml_values[1].bv_val = NULL;
852 assert( mod->sml_values[0].bv_val );
853 mod->sml_nvalues = NULL;
855 modtail = &mod->sml_next;
857 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
859 mod->sml_type.bv_val = NULL;
860 mod->sml_desc = slap_schema.si_ad_modifiersName;
861 mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
862 ber_dupbv( &mod->sml_values[0], &name );
863 mod->sml_values[1].bv_len = 0;
864 mod->sml_values[1].bv_val = NULL;
865 assert( mod->sml_values[0].bv_val );
867 (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
868 ber_dupbv( &mod->sml_nvalues[0], &nname );
869 mod->sml_nvalues[1].bv_len = 0;
870 mod->sml_nvalues[1].bv_val = NULL;
871 assert( mod->sml_nvalues[0].bv_val );
873 modtail = &mod->sml_next;
875 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
877 mod->sml_type.bv_val = NULL;
878 mod->sml_desc = slap_schema.si_ad_modifyTimestamp;
879 mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
880 ber_dupbv( &mod->sml_values[0], ×tamp );
881 mod->sml_values[1].bv_len = 0;
882 mod->sml_values[1].bv_val = NULL;
883 assert( mod->sml_values[0].bv_val );
884 mod->sml_nvalues = NULL;
886 modtail = &mod->sml_next;