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 };
40 struct berval pdn = { 0, NULL };
41 struct berval ndn = { 0, NULL };
45 Modifications *modlist = NULL;
46 Modifications **modtail = &modlist;
51 LDAPMod **modv = NULL;
52 Slapi_PBlock *pb = op->o_pb;
60 LDAP_LOG( OPERATION, ENTRY, "do_modify: enter\n", 0, 0, 0 );
62 Debug( LDAP_DEBUG_TRACE, "do_modify\n", 0, 0, 0 );
66 * Parse the modify request. It looks like this:
68 * ModifyRequest := [APPLICATION 6] SEQUENCE {
69 * name DistinguishedName,
70 * mods SEQUENCE OF SEQUENCE {
71 * operation ENUMERATED {
76 * modification SEQUENCE {
78 * values SET OF AttributeValue
84 if ( ber_scanf( op->o_ber, "{m" /*}*/, &dn ) == LBER_ERROR ) {
86 LDAP_LOG( OPERATION, ERR, "do_modify: ber_scanf failed\n", 0, 0, 0 );
88 Debug( LDAP_DEBUG_ANY, "do_modify: ber_scanf failed\n", 0, 0, 0 );
91 send_ldap_disconnect( conn, op,
92 LDAP_PROTOCOL_ERROR, "decoding error" );
93 return SLAPD_DISCONNECT;
97 LDAP_LOG( OPERATION, ARGS, "do_modify: dn (%s)\n", dn.bv_val, 0, 0 );
99 Debug( LDAP_DEBUG_ARGS, "do_modify: dn (%s)\n", dn.bv_val, 0, 0 );
103 /* collect modifications & save for later */
105 for ( tag = ber_first_element( op->o_ber, &len, &last );
107 tag = ber_next_element( op->o_ber, &len, last ) )
110 Modifications tmp, *mod;
113 tmp.sml_nvalues = NULL;
116 if ( ber_scanf( op->o_ber, "{i{m[W]}}", &mop,
117 &tmp.sml_type, &tmp.sml_values )
120 send_ldap_disconnect( conn, op,
121 LDAP_PROTOCOL_ERROR, "decoding modlist error" );
122 rc = SLAPD_DISCONNECT;
126 mod = (Modifications *) ch_malloc( sizeof(Modifications) );
128 mod->sml_type = tmp.sml_type;
129 mod->sml_values = tmp.sml_values;
131 mod->sml_nvalues = NULL;
133 mod->sml_desc = NULL;
134 mod->sml_next = NULL;
139 if ( mod->sml_values == NULL ) {
141 LDAP_LOG( OPERATION, ERR,
142 "do_modify: modify/add operation (%ld) requires values\n",
145 Debug( LDAP_DEBUG_ANY,
146 "do_modify: modify/add operation (%ld) requires values\n",
150 send_ldap_result( conn, op, LDAP_PROTOCOL_ERROR,
151 NULL, "modify/add operation requires values",
153 rc = LDAP_PROTOCOL_ERROR;
159 case LDAP_MOD_DELETE:
160 case LDAP_MOD_REPLACE:
165 LDAP_LOG( OPERATION, ERR,
166 "do_modify: invalid modify operation (%ld)\n", (long)mop, 0, 0 );
168 Debug( LDAP_DEBUG_ANY,
169 "do_modify: invalid modify operation (%ld)\n",
173 send_ldap_result( conn, op, LDAP_PROTOCOL_ERROR,
174 NULL, "unrecognized modify operation", NULL, NULL );
175 rc = LDAP_PROTOCOL_ERROR;
180 modtail = &mod->sml_next;
184 if( (rc = get_ctrls( conn, op, 1 )) != LDAP_SUCCESS ) {
186 LDAP_LOG( OPERATION, ERR, "do_modify: get_ctrls failed\n", 0, 0, 0 );
188 Debug( LDAP_DEBUG_ANY, "do_modify: get_ctrls failed\n", 0, 0, 0 );
194 rc = dnPrettyNormal( NULL, &dn, &pdn, &ndn );
195 if( rc != LDAP_SUCCESS ) {
197 LDAP_LOG( OPERATION, INFO, "do_modify: conn %d invalid dn (%s)\n",
198 conn->c_connid, dn.bv_val, 0 );
200 Debug( LDAP_DEBUG_ANY,
201 "do_modify: invalid dn (%s)\n", dn.bv_val, 0, 0 );
203 send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
204 "invalid DN", NULL, NULL );
208 if( ndn.bv_len == 0 ) {
210 LDAP_LOG( OPERATION, ERR,
211 "do_modify: attempt to modify root DSE.\n",0, 0, 0 );
213 Debug( LDAP_DEBUG_ANY, "do_modify: root dse!\n", 0, 0, 0 );
216 send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
217 NULL, "modify upon the root DSE not supported", NULL, NULL );
220 } else if ( bvmatch( &ndn, &global_schemandn ) ) {
222 LDAP_LOG( OPERATION, ERR,
223 "do_modify: attempt to modify subschema subentry.\n" , 0, 0, 0 );
225 Debug( LDAP_DEBUG_ANY, "do_modify: subschema subentry!\n", 0, 0, 0 );
228 send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
229 NULL, "modification of subschema subentry not supported",
236 LDAP_LOG( OPERATION, DETAIL1, "do_modify: modifications:\n", 0, 0, 0 );
238 Debug( LDAP_DEBUG_ARGS, "modifications:\n", 0, 0, 0 );
241 for ( tmp = modlist; tmp != NULL; tmp = tmp->sml_next ) {
243 LDAP_LOG( OPERATION, DETAIL1, "\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 LDAP_LOG( OPERATION, DETAIL1, "\t\tno values", 0, 0, 0 );
250 } else if ( tmp->sml_values[0].bv_val == NULL ) {
251 LDAP_LOG( OPERATION, DETAIL1, "\t\tzero values", 0, 0, 0 );
252 } else if ( tmp->sml_values[1].bv_val == NULL ) {
253 LDAP_LOG( OPERATION, DETAIL1, "\t\tone value", 0, 0, 0 );
255 LDAP_LOG( OPERATION, DETAIL1, "\t\tmultiple values", 0, 0, 0 );
259 Debug( LDAP_DEBUG_ARGS, "\t%s: %s\n",
260 tmp->sml_op == LDAP_MOD_ADD
261 ? "add" : (tmp->sml_op == LDAP_MOD_DELETE
262 ? "delete" : "replace"), tmp->sml_type.bv_val, 0 );
264 if ( tmp->sml_values == NULL ) {
265 Debug( LDAP_DEBUG_ARGS, "%s\n",
266 "\t\tno values", NULL, NULL );
267 } else if ( tmp->sml_values[0].bv_val == NULL ) {
268 Debug( LDAP_DEBUG_ARGS, "%s\n",
269 "\t\tzero values", NULL, NULL );
270 } else if ( tmp->sml_values[1].bv_val == NULL ) {
271 Debug( LDAP_DEBUG_ARGS, "%s, length %ld\n",
272 "\t\tone value", (long) tmp->sml_values[0].bv_len, NULL );
274 Debug( LDAP_DEBUG_ARGS, "%s\n",
275 "\t\tmultiple values", NULL, NULL );
280 if ( StatslogTest( LDAP_DEBUG_STATS ) ) {
281 char abuf[BUFSIZ/2], *ptr = abuf;
284 Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu MOD dn=\"%s\"\n",
285 op->o_connid, op->o_opid, dn.bv_val, 0, 0 );
287 for ( tmp = modlist; tmp != NULL; tmp = tmp->sml_next ) {
288 if (len + 1 + tmp->sml_type.bv_len > sizeof(abuf)) {
289 Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu MOD attr=%s\n",
290 op->o_connid, op->o_opid, abuf, 0, 0 );
298 ptr = lutil_strcopy(ptr, tmp->sml_type.bv_val);
299 len += tmp->sml_type.bv_len;
302 Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu MOD attr=%s\n",
303 op->o_connid, op->o_opid, abuf, 0, 0 );
306 #endif /* LDAP_DEBUG */
308 manageDSAit = get_manageDSAit( op );
311 * We could be serving multiple database backends. Select the
312 * appropriate one, or send a referral to our "referral server"
313 * if we don't hold it.
315 if ( (be = select_backend( &ndn, manageDSAit, 0 )) == NULL ) {
316 BerVarray ref = referral_rewrite( default_referral,
317 NULL, &pdn, LDAP_SCOPE_DEFAULT );
319 send_ldap_result( conn, op, rc = LDAP_REFERRAL,
320 NULL, NULL, ref ? ref : default_referral, NULL );
322 ber_bvarray_free( ref );
326 /* check restrictions */
327 rc = backend_check_restrictions( be, conn, op, NULL, &text ) ;
328 if( rc != LDAP_SUCCESS ) {
329 send_ldap_result( conn, op, rc,
330 NULL, text, NULL, NULL );
334 /* check for referrals */
335 rc = backend_check_referrals( be, conn, op, &pdn, &ndn );
336 if ( rc != LDAP_SUCCESS ) {
340 #if defined( LDAP_SLAPI )
341 slapi_x_backend_set_pb( pb, be );
342 slapi_x_connection_set_pb( pb, conn );
343 slapi_x_operation_set_pb( pb, op );
344 slapi_pblock_set( pb, SLAPI_MODIFY_TARGET, (void *)dn.bv_val );
345 slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)manageDSAit );
346 modv = slapi_x_modifications2ldapmods( &modlist );
347 slapi_pblock_set( pb, SLAPI_MODIFY_MODS, (void *)modv );
349 rc = doPluginFNs( be, SLAPI_PLUGIN_PRE_MODIFY_FN, pb );
352 * A preoperation plugin failure will abort the
356 LDAP_LOG( OPERATION, INFO, "do_modify: modify preoperation plugin "
357 "failed\n", 0, 0, 0 );
359 Debug(LDAP_DEBUG_TRACE, "do_modify: modify preoperation plugin failed.\n",
362 if ( slapi_pblock_get( pb, SLAPI_RESULT_CODE, (void *)&rc ) != 0) {
365 ldap_mods_free( modv, 1 );
371 * It's possible that the preoperation plugin changed the
372 * modification array, so we need to convert it back to
373 * a Modification list.
375 * Calling slapi_x_modifications2ldapmods() destroyed modlist so
376 * we don't need to free it.
378 slapi_pblock_get( pb, SLAPI_MODIFY_MODS, (void **)&modv );
379 modlist = slapi_x_ldapmods2modifications( modv );
380 #endif /* defined( LDAP_SLAPI ) */
383 * do the modify if 1 && (2 || 3)
384 * 1) there is a modify function implemented in this backend;
385 * 2) this backend is master for what it holds;
386 * 3) it's a replica and the dn supplied is the update_ndn.
388 if ( be->be_modify ) {
389 /* do the update here */
390 int repl_user = be_isupdate( be, &op->o_ndn );
391 #ifndef SLAPD_MULTIMASTER
392 /* Multimaster slapd does not have to check for replicator dn
393 * because it accepts each modify request
395 if ( !be->be_update_ndn.bv_len || repl_user )
398 int update = be->be_update_ndn.bv_len;
400 char textbuf[SLAP_TEXT_BUFLEN];
401 size_t textlen = sizeof textbuf;
403 rc = slap_mods_check( modlist, update, &text,
406 if( rc != LDAP_SUCCESS ) {
407 send_ldap_result( conn, op, rc,
408 NULL, text, NULL, NULL );
413 for( modtail = &modlist;
415 modtail = &(*modtail)->sml_next )
420 rc = slap_mods_opattrs( be, op, modlist, modtail, &text,
422 if( rc != LDAP_SUCCESS ) {
423 send_ldap_result( conn, op, rc,
430 if ( (*be->be_modify)( be, conn, op, &pdn, &ndn, modlist ) == 0
431 #ifdef SLAPD_MULTIMASTER
435 /* but we log only the ones not from a replicator user */
436 replog( be, op, &pdn, &ndn, modlist );
439 #ifndef SLAPD_MULTIMASTER
440 /* send a referral */
442 BerVarray defref = be->be_update_refs
443 ? be->be_update_refs : default_referral;
444 BerVarray ref = referral_rewrite( defref,
445 NULL, &pdn, LDAP_SCOPE_DEFAULT );
447 send_ldap_result( conn, op, rc = LDAP_REFERRAL, NULL, NULL,
448 ref ? ref : defref, NULL );
450 ber_bvarray_free( ref );
454 send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
455 NULL, "operation not supported within namingContext",
459 #if defined( LDAP_SLAPI )
460 if ( doPluginFNs( be, SLAPI_PLUGIN_POST_MODIFY_FN, pb ) != 0 ) {
462 LDAP_LOG( OPERATION, INFO, "do_modify: modify postoperation plugins "
463 "failed\n", 0, 0, 0 );
465 Debug(LDAP_DEBUG_TRACE, "do_modify: modify postoperation plugins "
466 "failed.\n", 0, 0, 0);
469 #endif /* defined( LDAP_SLAPI ) */
474 if ( modlist != NULL ) slap_mods_free( modlist );
475 #if defined( LDAP_SLAPI )
476 if ( modv != NULL ) slapi_x_free_ldapmods( modv );
482 * Do basic attribute type checking and syntax validation.
493 for( ; ml != NULL; ml = ml->sml_next ) {
494 AttributeDescription *ad = NULL;
496 /* convert to attribute description */
497 rc = slap_bv2ad( &ml->sml_type, &ml->sml_desc, text );
499 if( rc != LDAP_SUCCESS ) {
500 snprintf( textbuf, textlen, "%s: %s",
501 ml->sml_type.bv_val, *text );
508 if( slap_syntax_is_binary( ad->ad_type->sat_syntax )
509 && !slap_ad_is_binary( ad ))
511 /* attribute requires binary transfer */
512 snprintf( textbuf, textlen,
513 "%s: requires ;binary transfer",
514 ml->sml_type.bv_val );
516 return LDAP_UNDEFINED_TYPE;
519 if( !slap_syntax_is_binary( ad->ad_type->sat_syntax )
520 && slap_ad_is_binary( ad ))
522 /* attribute requires binary transfer */
523 snprintf( textbuf, textlen,
524 "%s: disallows ;binary transfer",
525 ml->sml_type.bv_val );
527 return LDAP_UNDEFINED_TYPE;
530 if( slap_ad_is_tag_range( ad )) {
531 /* attribute requires binary transfer */
532 snprintf( textbuf, textlen,
533 "%s: inappropriate use of tag range option",
534 ml->sml_type.bv_val );
536 return LDAP_UNDEFINED_TYPE;
539 if (!update && is_at_no_user_mod( ad->ad_type )) {
540 /* user modification disallowed */
541 snprintf( textbuf, textlen,
542 "%s: no user modification allowed",
543 ml->sml_type.bv_val );
545 return LDAP_CONSTRAINT_VIOLATION;
548 if ( is_at_obsolete( ad->ad_type ) &&
549 ( ml->sml_op == LDAP_MOD_ADD || ml->sml_values != NULL ) )
552 * attribute is obsolete,
553 * only allow replace/delete with no values
555 snprintf( textbuf, textlen,
556 "%s: attribute is obsolete",
557 ml->sml_type.bv_val );
559 return LDAP_CONSTRAINT_VIOLATION;
565 if( ml->sml_values != NULL ) {
567 slap_syntax_validate_func *validate =
568 ad->ad_type->sat_syntax->ssyn_validate;
569 slap_syntax_transform_func *pretty =
570 ad->ad_type->sat_syntax->ssyn_pretty;
572 if( !pretty && !validate ) {
573 *text = "no validator for syntax";
574 snprintf( textbuf, textlen,
575 "%s: no validator for syntax %s",
577 ad->ad_type->sat_syntax->ssyn_oid );
579 return LDAP_INVALID_SYNTAX;
583 * check that each value is valid per syntax
584 * and pretty if appropriate
586 for( nvals = 0; ml->sml_values[nvals].bv_val; nvals++ ) {
589 rc = pretty( ad->ad_type->sat_syntax,
590 &ml->sml_values[nvals], &pval );
592 rc = validate( ad->ad_type->sat_syntax,
593 &ml->sml_values[nvals] );
597 snprintf( textbuf, textlen,
598 "%s: value #%ld invalid per syntax",
599 ml->sml_type.bv_val, (long) nvals );
601 return LDAP_INVALID_SYNTAX;
605 ber_memfree( ml->sml_values[nvals].bv_val );
606 ml->sml_values[nvals] = pval;
611 * a rough single value check... an additional check is needed
612 * to catch add of single value to existing single valued attribute
614 if ((ml->sml_op == LDAP_MOD_ADD || ml->sml_op == LDAP_MOD_REPLACE)
615 && nvals > 1 && is_at_single_value( ad->ad_type ))
617 snprintf( textbuf, textlen,
618 "%s: multiple values provided",
619 ml->sml_type.bv_val );
621 return LDAP_CONSTRAINT_VIOLATION;
625 if( nvals && ad->ad_type->sat_equality &&
626 ad->ad_type->sat_equality->smr_normalize )
628 ml->sml_nvalues = ch_malloc( (nvals+1)*sizeof(struct berval) );
629 for( nvals = 0; ml->sml_values[nvals].bv_val; nvals++ ) {
630 rc = ad->ad_type->sat_equality->smr_normalize(
632 ad->ad_type->sat_syntax,
633 ad->ad_type->sat_equality,
634 &ml->sml_values[nvals], &ml->sml_nvalues[nvals] );
637 LDAP_LOG( OPERATION, DETAIL1,
638 "str2entry: NULL (ssyn_normalize %d)\n",
641 Debug( LDAP_DEBUG_ANY,
642 "<= str2entry NULL (ssyn_normalize %d)\n",
645 snprintf( textbuf, textlen,
646 "%s: value #%ld normalization failed",
647 ml->sml_type.bv_val, (long) nvals );
652 ml->sml_nvalues[nvals].bv_val = NULL;
653 ml->sml_nvalues[nvals].bv_len = 0;
662 int slap_mods_opattrs(
666 Modifications **modtail,
668 char *textbuf, size_t textlen )
670 struct berval name, timestamp, csn;
674 char timebuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
675 char csnbuf[ LDAP_LUTIL_CSNSTR_BUFSIZE ];
678 int mop = op->o_tag == LDAP_REQ_ADD
679 ? LDAP_MOD_ADD : LDAP_MOD_REPLACE;
681 assert( modtail != NULL );
682 assert( *modtail == NULL );
684 if( SLAP_LASTMOD(be) ) {
686 time_t now = slap_get_time();
688 ldap_pvt_thread_mutex_lock( &gmtime_mutex );
689 ltm = gmtime( &now );
690 lutil_gentime( timebuf, sizeof(timebuf), ltm );
692 csn.bv_len = lutil_csnstr( csnbuf, sizeof( csnbuf ), 0, 0 );
693 ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
696 timestamp.bv_val = timebuf;
697 timestamp.bv_len = strlen(timebuf);
699 if( op->o_dn.bv_len == 0 ) {
700 name.bv_val = SLAPD_ANONYMOUS;
701 name.bv_len = sizeof(SLAPD_ANONYMOUS)-1;
713 if( op->o_tag == LDAP_REQ_ADD ) {
714 struct berval tmpval;
716 if( global_schemacheck ) {
717 int rc = mods_structural_class( mods, &tmpval,
718 text, textbuf, textlen );
719 if( rc != LDAP_SUCCESS ) {
723 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
725 mod->sml_type.bv_val = NULL;
726 mod->sml_desc = slap_schema.si_ad_structuralObjectClass;
728 (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
729 ber_dupbv( &mod->sml_values[0], &tmpval );
730 mod->sml_values[1].bv_len = 0;
731 mod->sml_values[1].bv_val = NULL;
732 assert( mod->sml_values[0].bv_val );
735 (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
736 ber_dupbv( &mod->sml_nvalues[0], &tmpval );
737 mod->sml_nvalues[1].bv_len = 0;
738 mod->sml_nvalues[1].bv_val = NULL;
739 assert( mod->sml_nvalues[0].bv_val );
742 modtail = &mod->sml_next;
745 if( SLAP_LASTMOD(be) ) {
746 char uuidbuf[ LDAP_LUTIL_UUIDSTR_BUFSIZE ];
748 tmpval.bv_len = lutil_uuidstr( uuidbuf, sizeof( uuidbuf ) );
749 tmpval.bv_val = uuidbuf;
751 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
753 mod->sml_type.bv_val = NULL;
754 mod->sml_desc = slap_schema.si_ad_entryUUID;
756 (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
757 ber_dupbv( &mod->sml_values[0], &tmpval );
758 mod->sml_values[1].bv_len = 0;
759 mod->sml_values[1].bv_val = NULL;
760 assert( mod->sml_values[0].bv_val );
762 mod->sml_nvalues = NULL;
765 modtail = &mod->sml_next;
767 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
769 mod->sml_type.bv_val = NULL;
770 mod->sml_desc = slap_schema.si_ad_creatorsName;
771 mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
772 ber_dupbv( &mod->sml_values[0], &name );
773 mod->sml_values[1].bv_len = 0;
774 mod->sml_values[1].bv_val = NULL;
775 assert( mod->sml_values[0].bv_val );
778 (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
779 ber_dupbv( &mod->sml_nvalues[0], &nname );
780 mod->sml_nvalues[1].bv_len = 0;
781 mod->sml_nvalues[1].bv_val = NULL;
782 assert( mod->sml_nvalues[0].bv_val );
785 modtail = &mod->sml_next;
787 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
789 mod->sml_type.bv_val = NULL;
790 mod->sml_desc = slap_schema.si_ad_createTimestamp;
791 mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
792 ber_dupbv( &mod->sml_values[0], ×tamp );
793 mod->sml_values[1].bv_len = 0;
794 mod->sml_values[1].bv_val = NULL;
795 assert( mod->sml_values[0].bv_val );
797 mod->sml_nvalues = NULL;
800 modtail = &mod->sml_next;
804 if( SLAP_LASTMOD(be) ) {
805 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
807 mod->sml_type.bv_val = NULL;
808 mod->sml_desc = slap_schema.si_ad_entryCSN;
809 mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
810 ber_dupbv( &mod->sml_values[0], &csn );
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 mod->sml_nvalues = NULL;
818 modtail = &mod->sml_next;
820 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
822 mod->sml_type.bv_val = NULL;
823 mod->sml_desc = slap_schema.si_ad_modifiersName;
824 mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
825 ber_dupbv( &mod->sml_values[0], &name );
826 mod->sml_values[1].bv_len = 0;
827 mod->sml_values[1].bv_val = NULL;
828 assert( mod->sml_values[0].bv_val );
831 (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
832 ber_dupbv( &mod->sml_nvalues[0], &nname );
833 mod->sml_nvalues[1].bv_len = 0;
834 mod->sml_nvalues[1].bv_val = NULL;
835 assert( mod->sml_nvalues[0].bv_val );
838 modtail = &mod->sml_next;
840 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
842 mod->sml_type.bv_val = NULL;
843 mod->sml_desc = slap_schema.si_ad_modifyTimestamp;
844 mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
845 ber_dupbv( &mod->sml_values[0], ×tamp );
846 mod->sml_values[1].bv_len = 0;
847 mod->sml_values[1].bv_val = NULL;
848 assert( mod->sml_values[0].bv_val );
850 mod->sml_nvalues = NULL;
853 modtail = &mod->sml_next;