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 );
364 #endif /* defined( LDAP_SLAPI ) */
367 * do the modify if 1 && (2 || 3)
368 * 1) there is a modify function implemented in this backend;
369 * 2) this backend is master for what it holds;
370 * 3) it's a replica and the dn supplied is the update_ndn.
372 if ( op->o_bd->be_modify ) {
373 /* do the update here */
374 int repl_user = be_isupdate( op->o_bd, &op->o_ndn );
375 #ifndef SLAPD_MULTIMASTER
376 /* Multimaster slapd does not have to check for replicator dn
377 * because it accepts each modify request
379 if ( !op->o_bd->be_update_ndn.bv_len || repl_user )
382 int update = op->o_bd->be_update_ndn.bv_len;
383 char textbuf[SLAP_TEXT_BUFLEN];
384 size_t textlen = sizeof textbuf;
386 rs->sr_err = slap_mods_check( modlist, update, &rs->sr_text,
389 if( rs->sr_err != LDAP_SUCCESS ) {
390 send_ldap_result( op, rs );
395 for( modtail = &modlist;
397 modtail = &(*modtail)->sml_next )
402 rs->sr_err = slap_mods_opattrs( op, modlist, modtail,
403 &rs->sr_text, textbuf, textlen );
404 if( rs->sr_err != LDAP_SUCCESS ) {
405 send_ldap_result( op, rs );
410 op->orm_modlist = modlist;
411 if ( (op->o_bd->be_modify)( op, rs ) == 0
412 #ifdef SLAPD_MULTIMASTER
416 /* but we log only the ones not from a replicator user */
420 #ifndef SLAPD_MULTIMASTER
421 /* send a referral */
423 BerVarray defref = op->o_bd->be_update_refs
424 ? op->o_bd->be_update_refs : default_referral;
425 rs->sr_ref = referral_rewrite( defref,
426 NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
428 if (!rs->sr_ref) rs->sr_ref = defref;
429 rs->sr_err = LDAP_REFERRAL;
430 send_ldap_result( op, rs );
431 if (rs->sr_ref != defref) ber_bvarray_free( rs->sr_ref );
435 send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
436 "operation not supported within namingContext" );
439 #if defined( LDAP_SLAPI )
440 if ( doPluginFNs( op->o_bd, SLAPI_PLUGIN_POST_MODIFY_FN, pb ) != 0 ) {
442 LDAP_LOG( OPERATION, INFO, "do_modify: modify postoperation plugins "
443 "failed\n", 0, 0, 0 );
445 Debug(LDAP_DEBUG_TRACE, "do_modify: modify postoperation plugins "
446 "failed.\n", 0, 0, 0);
449 #endif /* defined( LDAP_SLAPI ) */
452 free( op->o_req_dn.bv_val );
453 free( op->o_req_ndn.bv_val );
454 if ( modlist != NULL ) slap_mods_free( modlist );
455 #if defined( LDAP_SLAPI )
456 if ( modv != NULL ) slapi_x_free_ldapmods( modv );
462 * Do basic attribute type checking and syntax validation.
473 for( ; ml != NULL; ml = ml->sml_next ) {
474 AttributeDescription *ad = NULL;
476 /* convert to attribute description */
477 rc = slap_bv2ad( &ml->sml_type, &ml->sml_desc, text );
479 if( rc != LDAP_SUCCESS ) {
480 snprintf( textbuf, textlen, "%s: %s",
481 ml->sml_type.bv_val, *text );
488 if( slap_syntax_is_binary( ad->ad_type->sat_syntax )
489 && !slap_ad_is_binary( ad ))
491 /* attribute requires binary transfer */
492 snprintf( textbuf, textlen,
493 "%s: requires ;binary transfer",
494 ml->sml_type.bv_val );
496 return LDAP_UNDEFINED_TYPE;
499 if( !slap_syntax_is_binary( ad->ad_type->sat_syntax )
500 && slap_ad_is_binary( ad ))
502 /* attribute requires binary transfer */
503 snprintf( textbuf, textlen,
504 "%s: disallows ;binary transfer",
505 ml->sml_type.bv_val );
507 return LDAP_UNDEFINED_TYPE;
510 if( slap_ad_is_tag_range( ad )) {
511 /* attribute requires binary transfer */
512 snprintf( textbuf, textlen,
513 "%s: inappropriate use of tag range option",
514 ml->sml_type.bv_val );
516 return LDAP_UNDEFINED_TYPE;
519 if (!update && is_at_no_user_mod( ad->ad_type )) {
520 /* user modification disallowed */
521 snprintf( textbuf, textlen,
522 "%s: no user modification allowed",
523 ml->sml_type.bv_val );
525 return LDAP_CONSTRAINT_VIOLATION;
528 if ( is_at_obsolete( ad->ad_type ) &&
529 ( ml->sml_op == LDAP_MOD_ADD || ml->sml_values != NULL ) )
532 * attribute is obsolete,
533 * only allow replace/delete with no values
535 snprintf( textbuf, textlen,
536 "%s: attribute is obsolete",
537 ml->sml_type.bv_val );
539 return LDAP_CONSTRAINT_VIOLATION;
545 if( ml->sml_values != NULL ) {
547 slap_syntax_validate_func *validate =
548 ad->ad_type->sat_syntax->ssyn_validate;
549 slap_syntax_transform_func *pretty =
550 ad->ad_type->sat_syntax->ssyn_pretty;
552 if( !pretty && !validate ) {
553 *text = "no validator for syntax";
554 snprintf( textbuf, textlen,
555 "%s: no validator for syntax %s",
557 ad->ad_type->sat_syntax->ssyn_oid );
559 return LDAP_INVALID_SYNTAX;
563 * check that each value is valid per syntax
564 * and pretty if appropriate
566 for( nvals = 0; ml->sml_values[nvals].bv_val; nvals++ ) {
569 rc = pretty( ad->ad_type->sat_syntax,
570 &ml->sml_values[nvals], &pval );
572 rc = validate( ad->ad_type->sat_syntax,
573 &ml->sml_values[nvals] );
577 snprintf( textbuf, textlen,
578 "%s: value #%ld invalid per syntax",
579 ml->sml_type.bv_val, (long) nvals );
581 return LDAP_INVALID_SYNTAX;
585 ber_memfree( ml->sml_values[nvals].bv_val );
586 ml->sml_values[nvals] = pval;
591 * a rough single value check... an additional check is needed
592 * to catch add of single value to existing single valued attribute
594 if ((ml->sml_op == LDAP_MOD_ADD || ml->sml_op == LDAP_MOD_REPLACE)
595 && nvals > 1 && is_at_single_value( ad->ad_type ))
597 snprintf( textbuf, textlen,
598 "%s: multiple values provided",
599 ml->sml_type.bv_val );
601 return LDAP_CONSTRAINT_VIOLATION;
605 if( nvals && ad->ad_type->sat_equality &&
606 ad->ad_type->sat_equality->smr_normalize )
608 ml->sml_nvalues = ch_malloc( (nvals+1)*sizeof(struct berval) );
609 for( nvals = 0; ml->sml_values[nvals].bv_val; nvals++ ) {
610 rc = ad->ad_type->sat_equality->smr_normalize(
612 ad->ad_type->sat_syntax,
613 ad->ad_type->sat_equality,
614 &ml->sml_values[nvals], &ml->sml_nvalues[nvals] );
617 LDAP_LOG( OPERATION, DETAIL1,
618 "str2entry: NULL (ssyn_normalize %d)\n",
621 Debug( LDAP_DEBUG_ANY,
622 "<= str2entry NULL (ssyn_normalize %d)\n",
625 snprintf( textbuf, textlen,
626 "%s: value #%ld normalization failed",
627 ml->sml_type.bv_val, (long) nvals );
632 ml->sml_nvalues[nvals].bv_val = NULL;
633 ml->sml_nvalues[nvals].bv_len = 0;
642 int slap_mods_opattrs(
645 Modifications **modtail,
647 char *textbuf, size_t textlen )
649 struct berval name, timestamp, csn;
653 char timebuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
654 char csnbuf[ LDAP_LUTIL_CSNSTR_BUFSIZE ];
657 int mop = op->o_tag == LDAP_REQ_ADD
658 ? LDAP_MOD_ADD : LDAP_MOD_REPLACE;
660 assert( modtail != NULL );
661 assert( *modtail == NULL );
663 if( SLAP_LASTMOD(op->o_bd) ) {
665 time_t now = slap_get_time();
667 ldap_pvt_thread_mutex_lock( &gmtime_mutex );
668 ltm = gmtime( &now );
669 lutil_gentime( timebuf, sizeof(timebuf), ltm );
671 csn.bv_len = lutil_csnstr( csnbuf, sizeof( csnbuf ), 0, 0 );
672 ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
675 timestamp.bv_val = timebuf;
676 timestamp.bv_len = strlen(timebuf);
678 if( op->o_dn.bv_len == 0 ) {
679 name.bv_val = SLAPD_ANONYMOUS;
680 name.bv_len = sizeof(SLAPD_ANONYMOUS)-1;
692 if( op->o_tag == LDAP_REQ_ADD ) {
693 struct berval tmpval;
695 if( global_schemacheck ) {
696 int rc = mods_structural_class( mods, &tmpval,
697 text, textbuf, textlen );
698 if( rc != LDAP_SUCCESS ) {
702 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
704 mod->sml_type.bv_val = NULL;
705 mod->sml_desc = slap_schema.si_ad_structuralObjectClass;
707 (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
708 ber_dupbv( &mod->sml_values[0], &tmpval );
709 mod->sml_values[1].bv_len = 0;
710 mod->sml_values[1].bv_val = NULL;
711 assert( mod->sml_values[0].bv_val );
714 (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
715 ber_dupbv( &mod->sml_nvalues[0], &tmpval );
716 mod->sml_nvalues[1].bv_len = 0;
717 mod->sml_nvalues[1].bv_val = NULL;
718 assert( mod->sml_nvalues[0].bv_val );
721 modtail = &mod->sml_next;
724 if( SLAP_LASTMOD(op->o_bd) ) {
725 char uuidbuf[ LDAP_LUTIL_UUIDSTR_BUFSIZE ];
727 tmpval.bv_len = lutil_uuidstr( uuidbuf, sizeof( uuidbuf ) );
728 tmpval.bv_val = uuidbuf;
730 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
732 mod->sml_type.bv_val = NULL;
733 mod->sml_desc = slap_schema.si_ad_entryUUID;
735 (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
736 ber_dupbv( &mod->sml_values[0], &tmpval );
737 mod->sml_values[1].bv_len = 0;
738 mod->sml_values[1].bv_val = NULL;
739 assert( mod->sml_values[0].bv_val );
741 mod->sml_nvalues = NULL;
744 modtail = &mod->sml_next;
746 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
748 mod->sml_type.bv_val = NULL;
749 mod->sml_desc = slap_schema.si_ad_creatorsName;
750 mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
751 ber_dupbv( &mod->sml_values[0], &name );
752 mod->sml_values[1].bv_len = 0;
753 mod->sml_values[1].bv_val = NULL;
754 assert( mod->sml_values[0].bv_val );
757 (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
758 ber_dupbv( &mod->sml_nvalues[0], &nname );
759 mod->sml_nvalues[1].bv_len = 0;
760 mod->sml_nvalues[1].bv_val = NULL;
761 assert( mod->sml_nvalues[0].bv_val );
764 modtail = &mod->sml_next;
766 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
768 mod->sml_type.bv_val = NULL;
769 mod->sml_desc = slap_schema.si_ad_createTimestamp;
770 mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
771 ber_dupbv( &mod->sml_values[0], ×tamp );
772 mod->sml_values[1].bv_len = 0;
773 mod->sml_values[1].bv_val = NULL;
774 assert( mod->sml_values[0].bv_val );
776 mod->sml_nvalues = NULL;
779 modtail = &mod->sml_next;
783 if( SLAP_LASTMOD(op->o_bd) ) {
784 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
786 mod->sml_type.bv_val = NULL;
787 mod->sml_desc = slap_schema.si_ad_entryCSN;
788 mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
789 ber_dupbv( &mod->sml_values[0], &csn );
790 mod->sml_values[1].bv_len = 0;
791 mod->sml_values[1].bv_val = NULL;
792 assert( mod->sml_values[0].bv_val );
794 mod->sml_nvalues = NULL;
797 modtail = &mod->sml_next;
799 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
801 mod->sml_type.bv_val = NULL;
802 mod->sml_desc = slap_schema.si_ad_modifiersName;
803 mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
804 ber_dupbv( &mod->sml_values[0], &name );
805 mod->sml_values[1].bv_len = 0;
806 mod->sml_values[1].bv_val = NULL;
807 assert( mod->sml_values[0].bv_val );
810 (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
811 ber_dupbv( &mod->sml_nvalues[0], &nname );
812 mod->sml_nvalues[1].bv_len = 0;
813 mod->sml_nvalues[1].bv_val = NULL;
814 assert( mod->sml_nvalues[0].bv_val );
817 modtail = &mod->sml_next;
819 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
821 mod->sml_type.bv_val = NULL;
822 mod->sml_desc = slap_schema.si_ad_modifyTimestamp;
823 mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
824 ber_dupbv( &mod->sml_values[0], ×tamp );
825 mod->sml_values[1].bv_len = 0;
826 mod->sml_values[1].bv_val = NULL;
827 assert( mod->sml_values[0].bv_val );
829 mod->sml_nvalues = NULL;
832 modtail = &mod->sml_next;