]> git.sur5r.net Git - openldap/blob - servers/slapd/modify.c
Fix pointer initialization bug
[openldap] / servers / slapd / modify.c
1 /* $OpenLDAP$ */
2 /*
3  * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
4  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
5  */
6 /*
7  * Copyright (c) 1995 Regents of the University of Michigan.
8  * All rights reserved.
9  *
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.
16  */
17
18 #include "portable.h"
19
20 #include <stdio.h>
21
22 #include <ac/socket.h>
23 #include <ac/string.h>
24 #include <ac/time.h>
25
26 #include "lutil.h"
27
28 #include "ldap_pvt.h"
29 #include "slap.h"
30
31 int
32 do_modify(
33     Connection  *conn,
34     Operation   *op )
35 {
36         struct berval dn = { 0, NULL };
37         struct berval pdn = { 0, NULL };
38         struct berval ndn = { 0, NULL };
39         char            *last;
40         ber_tag_t       tag;
41         ber_len_t       len;
42         Modifications   *modlist = NULL;
43         Modifications   **modtail = &modlist;
44 #ifdef LDAP_DEBUG
45         Modifications *tmp;
46 #endif
47         Backend         *be;
48         int rc;
49         const char      *text;
50         int manageDSAit;
51
52 #ifdef NEW_LOGGING
53         LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
54                 "do_modify: enter\n" ));
55 #else
56         Debug( LDAP_DEBUG_TRACE, "do_modify\n", 0, 0, 0 );
57 #endif
58
59         /*
60          * Parse the modify request.  It looks like this:
61          *
62          *      ModifyRequest := [APPLICATION 6] SEQUENCE {
63          *              name    DistinguishedName,
64          *              mods    SEQUENCE OF SEQUENCE {
65          *                      operation       ENUMERATED {
66          *                              add     (0),
67          *                              delete  (1),
68          *                              replace (2)
69          *                      },
70          *                      modification    SEQUENCE {
71          *                              type    AttributeType,
72          *                              values  SET OF AttributeValue
73          *                      }
74          *              }
75          *      }
76          */
77
78         if ( ber_scanf( op->o_ber, "{m" /*}*/, &dn ) == LBER_ERROR ) {
79 #ifdef NEW_LOGGING
80                 LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
81                         "do_modify: ber_scanf failed\n" ));
82 #else
83                 Debug( LDAP_DEBUG_ANY, "do_modify: ber_scanf failed\n", 0, 0, 0 );
84 #endif
85
86                 send_ldap_disconnect( conn, op,
87                         LDAP_PROTOCOL_ERROR, "decoding error" );
88                 return SLAPD_DISCONNECT;
89         }
90
91 #ifdef NEW_LOGGING
92         LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
93                    "do_modify: dn (%s)\n", dn.bv_val ));
94 #else
95         Debug( LDAP_DEBUG_ARGS, "do_modify: dn (%s)\n", dn.bv_val, 0, 0 );
96 #endif
97
98
99         /* collect modifications & save for later */
100
101         for ( tag = ber_first_element( op->o_ber, &len, &last );
102             tag != LBER_DEFAULT;
103             tag = ber_next_element( op->o_ber, &len, last ) )
104         {
105                 ber_int_t mop;
106                 Modifications tmp, *mod;
107
108
109                 if ( ber_scanf( op->o_ber, "{i{m[W]}}", &mop,
110                     &tmp.sml_type, &tmp.sml_bvalues )
111                     == LBER_ERROR )
112                 {
113                         send_ldap_disconnect( conn, op,
114                                 LDAP_PROTOCOL_ERROR, "decoding modlist error" );
115                         rc = SLAPD_DISCONNECT;
116                         goto cleanup;
117                 }
118
119                 mod = (Modifications *) ch_malloc( sizeof(Modifications) );
120                 mod->sml_op = mop;
121                 mod->sml_type = tmp.sml_type;
122                 mod->sml_bvalues = tmp.sml_bvalues;
123                 mod->sml_desc = NULL;
124                 mod->sml_next =NULL;
125                 *modtail = mod;
126
127                 switch( mop ) {
128                 case LDAP_MOD_ADD:
129                         if ( mod->sml_bvalues == NULL ) {
130 #ifdef NEW_LOGGING
131                                 LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
132                                         "do_modify: modify/add operation (%ld) requires values\n",
133                                         (long)mop ));
134 #else
135                                 Debug( LDAP_DEBUG_ANY,
136                                         "do_modify: modify/add operation (%ld) requires values\n",
137                                         (long) mop, 0, 0 );
138 #endif
139
140                                 send_ldap_result( conn, op, LDAP_PROTOCOL_ERROR,
141                                         NULL, "modify/add operation requires values",
142                                         NULL, NULL );
143                                 rc = LDAP_PROTOCOL_ERROR;
144                                 goto cleanup;
145                         }
146
147                         /* fall through */
148
149                 case LDAP_MOD_DELETE:
150                 case LDAP_MOD_REPLACE:
151                         break;
152
153                 default: {
154 #ifdef NEW_LOGGING
155                                 LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
156                                         "do_modify: invalid modify operation (%ld)\n",
157                                         (long)mop ));
158 #else
159                                 Debug( LDAP_DEBUG_ANY,
160                                         "do_modify: invalid modify operation (%ld)\n",
161                                         (long) mop, 0, 0 );
162 #endif
163
164                                 send_ldap_result( conn, op, LDAP_PROTOCOL_ERROR,
165                                         NULL, "unrecognized modify operation", NULL, NULL );
166                                 rc = LDAP_PROTOCOL_ERROR;
167                                 goto cleanup;
168                         }
169                 }
170
171                 modtail = &mod->sml_next;
172         }
173         *modtail = NULL;
174
175         if( (rc = get_ctrls( conn, op, 1 )) != LDAP_SUCCESS ) {
176 #ifdef NEW_LOGGING
177                 LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
178                         "do_modify: get_ctrls failed\n" ));
179 #else
180                 Debug( LDAP_DEBUG_ANY, "do_modify: get_ctrls failed\n", 0, 0, 0 );
181 #endif
182
183                 goto cleanup;
184         }
185
186         rc = dnPrettyNormal( NULL, &dn, &pdn, &ndn );
187         if( rc != LDAP_SUCCESS ) {
188 #ifdef NEW_LOGGING
189                 LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
190                         "do_modify: conn %d  invalid dn (%s)\n",
191                         conn->c_connid, dn.bv_val ));
192 #else
193                 Debug( LDAP_DEBUG_ANY,
194                         "do_modify: invalid dn (%s)\n", dn.bv_val, 0, 0 );
195 #endif
196                 send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
197                     "invalid DN", NULL, NULL );
198                 goto cleanup;
199         }
200
201         if( ndn.bv_len == 0 ) {
202 #ifdef NEW_LOGGING
203                 LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
204                         "do_modify: attempt to modify root DSE.\n" ));
205 #else
206                 Debug( LDAP_DEBUG_ANY, "do_modify: root dse!\n", 0, 0, 0 );
207 #endif
208
209                 send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
210                         NULL, "modify upon the root DSE not supported", NULL, NULL );
211                 goto cleanup;
212
213 #if defined( SLAPD_SCHEMA_DN )
214         } else if ( strcasecmp( ndn.bv_val, SLAPD_SCHEMA_DN ) == 0 ) {
215 #ifdef NEW_LOGGING
216                 LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
217                         "do_modify: attempt to modify subschema subentry.\n" ));
218 #else
219                 Debug( LDAP_DEBUG_ANY, "do_modify: subschema subentry!\n", 0, 0, 0 );
220 #endif
221
222                 send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
223                         NULL, "modification of subschema subentry not supported",
224                         NULL, NULL );
225                 goto cleanup;
226 #endif
227         }
228
229 #ifdef LDAP_DEBUG
230 #ifdef NEW_LOGGING
231         LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
232                 "do_modify: modifications:\n" ));
233 #else
234         Debug( LDAP_DEBUG_ARGS, "modifications:\n", 0, 0, 0 );
235 #endif
236
237         for ( tmp = modlist; tmp != NULL; tmp = tmp->sml_next ) {
238 #ifdef NEW_LOGGING
239                 LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
240                         "\t%s:  %s\n", tmp->sml_op == LDAP_MOD_ADD ?
241                                 "add" : (tmp->sml_op == LDAP_MOD_DELETE ?
242                                         "delete" : "replace"), tmp->sml_type.bv_val ));
243
244                 if ( tmp->sml_bvalues == NULL ) {
245                         LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
246                            "\t\tno values" ));
247                 } else if ( tmp->sml_bvalues[0].bv_val == NULL ) {
248                         LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
249                            "\t\tzero values" ));
250                 } else if ( tmp->sml_bvalues[1].bv_val == NULL ) {
251                         LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
252                            "\t\tone value" ));
253                 } else {
254                         LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
255                            "\t\tmultiple values" ));
256                 }
257
258 #else
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 );
263
264                 if ( tmp->sml_bvalues == NULL ) {
265                         Debug( LDAP_DEBUG_ARGS, "%s\n",
266                            "\t\tno values", NULL, NULL );
267                 } else if ( tmp->sml_bvalues[0].bv_val == NULL ) {
268                         Debug( LDAP_DEBUG_ARGS, "%s\n",
269                            "\t\tzero values", NULL, NULL );
270                 } else if ( tmp->sml_bvalues[1].bv_val == NULL ) {
271                         Debug( LDAP_DEBUG_ARGS, "%s, length %ld\n",
272                            "\t\tone value", (long) tmp->sml_bvalues[0].bv_len, NULL );
273                 } else {
274                         Debug( LDAP_DEBUG_ARGS, "%s\n",
275                            "\t\tmultiple values", NULL, NULL );
276                 }
277 #endif
278         }
279 #endif
280
281         Statslog( LDAP_DEBUG_STATS, "conn=%ld op=%d MOD dn=\"%s\"\n",
282             op->o_connid, op->o_opid, dn.bv_val, 0, 0 );
283
284         manageDSAit = get_manageDSAit( op );
285
286         /*
287          * We could be serving multiple database backends.  Select the
288          * appropriate one, or send a referral to our "referral server"
289          * if we don't hold it.
290          */
291         if ( (be = select_backend( &ndn, manageDSAit, 0 )) == NULL ) {
292                 BerVarray ref = referral_rewrite( default_referral,
293                         NULL, &pdn, LDAP_SCOPE_DEFAULT );
294
295                 send_ldap_result( conn, op, rc = LDAP_REFERRAL,
296                         NULL, NULL, ref ? ref : default_referral, NULL );
297
298                 ber_bvarray_free( ref );
299                 goto cleanup;
300         }
301
302         /* check restrictions */
303         rc = backend_check_restrictions( be, conn, op, NULL, &text ) ;
304         if( rc != LDAP_SUCCESS ) {
305                 send_ldap_result( conn, op, rc,
306                         NULL, text, NULL, NULL );
307                 goto cleanup;
308         }
309
310         /* check for referrals */
311         rc = backend_check_referrals( be, conn, op, &pdn, &ndn );
312         if ( rc != LDAP_SUCCESS ) {
313                 goto cleanup;
314         }
315
316         /* deref suffix alias if appropriate */
317         suffix_alias( be, &ndn );
318
319         /*
320          * do the modify if 1 && (2 || 3)
321          * 1) there is a modify function implemented in this backend;
322          * 2) this backend is master for what it holds;
323          * 3) it's a replica and the dn supplied is the update_ndn.
324          */
325         if ( be->be_modify ) {
326                 /* do the update here */
327                 int repl_user = be_isupdate( be, &op->o_ndn );
328 #ifndef SLAPD_MULTIMASTER
329                 /* Multimaster slapd does not have to check for replicator dn
330                  * because it accepts each modify request
331                  */
332                 if ( !be->be_update_ndn.bv_len || repl_user )
333 #endif
334                 {
335                         int update = be->be_update_ndn.bv_len;
336                         const char *text;
337                         char textbuf[SLAP_TEXT_BUFLEN];
338                         size_t textlen = sizeof textbuf;
339
340                         rc = slap_mods_check( modlist, update, &text,
341                                 textbuf, textlen );
342
343                         if( rc != LDAP_SUCCESS ) {
344                                 send_ldap_result( conn, op, rc,
345                                         NULL, text, NULL, NULL );
346                                 goto cleanup;
347                         }
348
349                         if ( SLAP_LASTMOD(be) && !repl_user ) {
350                                 for( modtail = &modlist;
351                                         *modtail != NULL;
352                                         modtail = &(*modtail)->sml_next )
353                                 {
354                                         /* empty */
355                                 }
356
357                                 rc = slap_mods_opattrs( op, modlist, modtail, &text,
358                                         textbuf, textlen );
359                                 if( rc != LDAP_SUCCESS ) {
360                                         send_ldap_result( conn, op, rc,
361                                                 NULL, text,
362                                                 NULL, NULL );
363                                         goto cleanup;
364                                 }
365                         }
366
367                         if ( (*be->be_modify)( be, conn, op, &pdn, &ndn, modlist ) == 0
368 #ifdef SLAPD_MULTIMASTER
369                                 && !repl_user
370 #endif
371                         ) {
372                                 /* but we log only the ones not from a replicator user */
373                                 replog( be, op, &pdn, &ndn, modlist );
374                         }
375
376 #ifndef SLAPD_MULTIMASTER
377                 /* send a referral */
378                 } else {
379                         BerVarray defref = be->be_update_refs
380                                 ? be->be_update_refs : default_referral;
381                         BerVarray ref = referral_rewrite( defref,
382                                 NULL, &pdn, LDAP_SCOPE_DEFAULT );
383
384                         send_ldap_result( conn, op, rc = LDAP_REFERRAL, NULL, NULL,
385                                 ref ? ref : defref, NULL );
386
387                         ber_bvarray_free( ref );
388 #endif
389                 }
390         } else {
391                 send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
392                     NULL, "operation not supported within namingContext",
393                         NULL, NULL );
394         }
395
396 cleanup:
397         free( pdn.bv_val );
398         free( ndn.bv_val );
399         if ( modlist != NULL )
400                 slap_mods_free( modlist );
401         return rc;
402 }
403
404 /*
405  * Do basic attribute type checking and syntax validation.
406  */
407 int slap_mods_check(
408         Modifications *ml,
409         int update,
410         const char **text,
411         char *textbuf,
412         size_t textlen )
413 {
414         int rc;
415
416         for( ; ml != NULL; ml = ml->sml_next ) {
417                 AttributeDescription *ad = NULL;
418
419                 /* convert to attribute description */
420                 rc = slap_bv2ad( &ml->sml_type, &ml->sml_desc, text );
421
422                 if( rc != LDAP_SUCCESS ) {
423                         snprintf( textbuf, textlen, "%s: %s",
424                                 ml->sml_type.bv_val, *text );
425                         *text = textbuf;
426                         return rc;
427                 }
428
429                 ad = ml->sml_desc;
430
431                 if( slap_syntax_is_binary( ad->ad_type->sat_syntax )
432                         && !slap_ad_is_binary( ad ))
433                 {
434                         /* attribute requires binary transfer */
435                         snprintf( textbuf, textlen,
436                                 "%s: requires ;binary transfer",
437                                 ml->sml_type.bv_val );
438                         *text = textbuf;
439                         return LDAP_UNDEFINED_TYPE;
440                 }
441
442                 if( !slap_syntax_is_binary( ad->ad_type->sat_syntax )
443                         && slap_ad_is_binary( ad ))
444                 {
445                         /* attribute requires binary transfer */
446                         snprintf( textbuf, textlen,
447                                 "%s: disallows ;binary transfer",
448                                 ml->sml_type.bv_val );
449                         *text = textbuf;
450                         return LDAP_UNDEFINED_TYPE;
451                 }
452
453                 if( slap_ad_is_lang_range( ad )) {
454                         /* attribute requires binary transfer */
455                         snprintf( textbuf, textlen,
456                                 "%s: inappropriate use of language range option",
457                                 ml->sml_type.bv_val );
458                         *text = textbuf;
459                         return LDAP_UNDEFINED_TYPE;
460                 }
461
462                 if (!update && is_at_no_user_mod( ad->ad_type )) {
463                         /* user modification disallowed */
464                         snprintf( textbuf, textlen,
465                                 "%s: no user modification allowed",
466                                 ml->sml_type.bv_val );
467                         *text = textbuf;
468                         return LDAP_CONSTRAINT_VIOLATION;
469                 }
470
471                 if ( is_at_obsolete( ad->ad_type ) &&
472                         ( ml->sml_op == LDAP_MOD_ADD || ml->sml_bvalues != NULL ) )
473                 {
474                         /*
475                          * attribute is obsolete,
476                          * only allow replace/delete with no values
477                          */
478                         snprintf( textbuf, textlen,
479                                 "%s: attribute is obsolete",
480                                 ml->sml_type.bv_val );
481                         *text = textbuf;
482                         return LDAP_CONSTRAINT_VIOLATION;
483                 }
484
485                 /*
486                  * check values
487                  */
488                 if( ml->sml_bvalues != NULL ) {
489                         ber_len_t nvals;
490                         slap_syntax_validate_func *validate =
491                                 ad->ad_type->sat_syntax->ssyn_validate;
492                         slap_syntax_transform_func *pretty =
493                                 ad->ad_type->sat_syntax->ssyn_pretty;
494  
495                         if( !pretty && !validate ) {
496                                 *text = "no validator for syntax";
497                                 snprintf( textbuf, textlen,
498                                         "%s: no validator for syntax %s",
499                                         ml->sml_type.bv_val,
500                                         ad->ad_type->sat_syntax->ssyn_oid );
501                                 *text = textbuf;
502                                 return LDAP_INVALID_SYNTAX;
503                         }
504
505                         /*
506                          * check that each value is valid per syntax
507                          *      and pretty if appropriate
508                          */
509                         for( nvals = 0; ml->sml_bvalues[nvals].bv_val; nvals++ ) {
510                                 struct berval pval;
511                                 if( pretty ) {
512                                         rc = pretty( ad->ad_type->sat_syntax,
513                                                 &ml->sml_bvalues[nvals], &pval );
514                                 } else {
515                                         rc = validate( ad->ad_type->sat_syntax,
516                                                 &ml->sml_bvalues[nvals] );
517                                 }
518
519                                 if( rc != 0 ) {
520                                         snprintf( textbuf, textlen,
521                                                 "%s: value #%ld invalid per syntax",
522                                                 ml->sml_type.bv_val, (long) nvals );
523                                         *text = textbuf;
524                                         return LDAP_INVALID_SYNTAX;
525                                 }
526
527                                 if( pretty ) {
528                                         ber_memfree( ml->sml_bvalues[nvals].bv_val );
529                                         ml->sml_bvalues[nvals] = pval;
530                                 }
531                         }
532
533                         /*
534                          * a rough single value check... an additional check is needed
535                          * to catch add of single value to existing single valued attribute
536                          */
537                         if( ( ml->sml_op == LDAP_MOD_ADD || ml->sml_op == LDAP_MOD_REPLACE )
538                                 && nvals > 1 && is_at_single_value( ad->ad_type ))
539                         {
540                                 snprintf( textbuf, textlen,
541                                         "%s: multiple value provided",
542                                         ml->sml_type.bv_val );
543                                 *text = textbuf;
544                                 return LDAP_CONSTRAINT_VIOLATION;
545                         }
546                 }
547         }
548
549         return LDAP_SUCCESS;
550 }
551
552 int slap_mods_opattrs(
553         Operation *op,
554         Modifications *mods,
555         Modifications **modtail,
556         const char **text,
557         char *textbuf, size_t textlen )
558 {
559         struct berval name, timestamp, csn;
560         time_t now = slap_get_time();
561         char timebuf[22];
562         char csnbuf[64];
563         struct tm *ltm;
564         Modifications *mod;
565
566         int mop = op->o_tag == LDAP_REQ_ADD
567                 ? LDAP_MOD_ADD : LDAP_MOD_REPLACE;
568
569         assert( modtail != NULL );
570         assert( *modtail == NULL );
571
572         ldap_pvt_thread_mutex_lock( &gmtime_mutex );
573         ltm = gmtime( &now );
574         strftime( timebuf, sizeof(timebuf), "%Y%m%d%H%M%SZ", ltm );
575
576         csn.bv_len = lutil_csnstr( csnbuf, sizeof( csnbuf ), 0, 0 );
577         ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
578         csn.bv_val = csnbuf;
579
580         timestamp.bv_val = timebuf;
581         timestamp.bv_len = strlen(timebuf);
582
583         if( op->o_dn.bv_len == 0 ) {
584                 name.bv_val = SLAPD_ANONYMOUS;
585                 name.bv_len = sizeof(SLAPD_ANONYMOUS)-1;
586         } else {
587                 name = op->o_dn;
588         }
589
590         if( op->o_tag == LDAP_REQ_ADD ) {
591                 struct berval tmpval;
592                 char uuidbuf[40];
593                 int rc;
594
595                 rc = mods_structural_class( mods, &tmpval, text, textbuf, textlen );
596                 if( rc != LDAP_SUCCESS ) {
597                         return rc;
598                 }
599                 if ( tmpval.bv_len ) {
600                         mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
601                         mod->sml_op = mop;
602                         mod->sml_type.bv_val = NULL;
603                         mod->sml_desc = slap_schema.si_ad_structuralObjectClass;
604                         mod->sml_bvalues = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
605                         ber_dupbv( &mod->sml_bvalues[0], &tmpval );
606                         mod->sml_bvalues[1].bv_val = NULL;
607                         assert( mod->sml_bvalues[0].bv_val );
608                         *modtail = mod;
609                         modtail = &mod->sml_next;
610                 }
611
612                 tmpval.bv_len = lutil_uuidstr( uuidbuf, sizeof( uuidbuf ) );
613                 tmpval.bv_val = uuidbuf;
614                 
615                 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
616                 mod->sml_op = mop;
617                 mod->sml_type.bv_val = NULL;
618                 mod->sml_desc = slap_schema.si_ad_entryUUID;
619                 mod->sml_bvalues = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
620                 ber_dupbv( &mod->sml_bvalues[0], &tmpval );
621                 mod->sml_bvalues[1].bv_val = NULL;
622                 assert( mod->sml_bvalues[0].bv_val );
623                 *modtail = mod;
624                 modtail = &mod->sml_next;
625
626                 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
627                 mod->sml_op = mop;
628                 mod->sml_type.bv_val = NULL;
629                 mod->sml_desc = slap_schema.si_ad_creatorsName;
630                 mod->sml_bvalues = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
631                 ber_dupbv( &mod->sml_bvalues[0], &name );
632                 mod->sml_bvalues[1].bv_val = NULL;
633                 assert( mod->sml_bvalues[0].bv_val );
634                 *modtail = mod;
635                 modtail = &mod->sml_next;
636
637                 mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
638                 mod->sml_op = mop;
639                 mod->sml_type.bv_val = NULL;
640                 mod->sml_desc = slap_schema.si_ad_createTimestamp;
641                 mod->sml_bvalues = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
642                 ber_dupbv( &mod->sml_bvalues[0], &timestamp );
643                 mod->sml_bvalues[1].bv_val = NULL;
644                 assert( mod->sml_bvalues[0].bv_val );
645                 *modtail = mod;
646                 modtail = &mod->sml_next;
647         }
648
649         mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
650         mod->sml_op = mop;
651         mod->sml_type.bv_val = NULL;
652         mod->sml_desc = slap_schema.si_ad_entryCSN;
653         mod->sml_bvalues = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
654         ber_dupbv( &mod->sml_bvalues[0], &csn );
655         mod->sml_bvalues[1].bv_val = NULL;
656         assert( mod->sml_bvalues[0].bv_val );
657         *modtail = mod;
658         modtail = &mod->sml_next;
659
660         mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
661         mod->sml_op = mop;
662         mod->sml_type.bv_val = NULL;
663         mod->sml_desc = slap_schema.si_ad_modifiersName;
664         mod->sml_bvalues = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
665         ber_dupbv( &mod->sml_bvalues[0], &name );
666         mod->sml_bvalues[1].bv_val = NULL;
667         assert( mod->sml_bvalues[0].bv_val );
668         *modtail = mod;
669         modtail = &mod->sml_next;
670
671         mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
672         mod->sml_op = mop;
673         mod->sml_type.bv_val = NULL;
674         mod->sml_desc = slap_schema.si_ad_modifyTimestamp;
675         mod->sml_bvalues = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
676         ber_dupbv( &mod->sml_bvalues[0], &timestamp );
677         mod->sml_bvalues[1].bv_val = NULL;
678         assert( mod->sml_bvalues[0].bv_val );
679         *modtail = mod;
680         modtail = &mod->sml_next;
681
682         *modtail = NULL;
683
684         return LDAP_SUCCESS;
685 }