]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/add.c
reject registrations when back-monitor is not configured
[openldap] / servers / slapd / add.c
index 30af7693dda1ae7be0983c4cebd17cd6a9b513ce..7df87348aa1c7b1b5b8740e63044c4b5e5b24230 100644 (file)
@@ -195,8 +195,9 @@ done:;
        slap_graduate_commit_csn( op );
 
        if ( modlist != NULL ) {
-               slap_mods_free( modlist );
+               slap_mods_free( modlist, 0 );
        }
+
        if ( op->ora_e != NULL ) {
                entry_free( op->ora_e );
        }
@@ -395,12 +396,15 @@ slap_mods2entry(
        const char **text,
        char *textbuf, size_t textlen )
 {
-       Attribute **tail = &(*e)->e_attrs;
+       Attribute **tail;
 
        if ( initial ) {
-               assert( *tail == NULL );
+               assert( (*e)->e_attrs == NULL );
        }
 
+       for ( tail = &(*e)->e_attrs; *tail != NULL; tail = &(*tail)->a_next )
+               ;
+
        *text = textbuf;
 
        for( ; mods != NULL; mods = mods->sml_next ) {
@@ -415,6 +419,17 @@ slap_mods2entry(
 #ifdef SLURPD_FRIENDLY
                        ber_len_t i,j;
 
+                       if ( !initial ) {
+                               /*      
+                                * This check allows overlays to override operational
+                                * attributes by setting them directly in the entry.
+                                * We assume slap_mods_no_user_mod_check() was called
+                                * with the user modifications.
+                                */
+                               *text = NULL;
+                               return LDAP_SUCCESS;
+                       }
+
                        for( i=0; attr->a_vals[i].bv_val; i++ ) {
                                /* count them */
                        }
@@ -432,12 +447,11 @@ slap_mods2entry(
                                for ( j = 0; mods->sml_values[j].bv_val; j++ ) {
                                        ber_dupbv( &attr->a_vals[i+j], &mods->sml_values[j] );
                                }
-                               BER_BVZERO( &attr->a_vals[i+j] );       
+                               BER_BVZERO( &attr->a_vals[i+j] );
+                               j++;
                        } else {
                                AC_MEMCPY( &attr->a_vals[i], mods->sml_values,
                                        sizeof( struct berval ) * j );
-                               ch_free( mods->sml_values );
-                               mods->sml_values = NULL;
                        }
 
                        if( mods->sml_nvalues ) {
@@ -451,8 +465,6 @@ slap_mods2entry(
                                } else {
                                        AC_MEMCPY( &attr->a_nvals[i], mods->sml_nvalues,
                                                sizeof( struct berval ) * j );
-                                       ch_free( mods->sml_nvalues );
-                                       mods->sml_nvalues = NULL;
                                }
                        } else {
                                attr->a_nvals = attr->a_vals;
@@ -506,7 +518,6 @@ slap_mods2entry(
 
                /* move ad to attr structure */
                attr->a_desc = mods->sml_desc;
-               if ( !dup ) mods->sml_desc = NULL;
 
                /* move values to attr structure */
                /*      should check for duplicates */
@@ -520,7 +531,6 @@ slap_mods2entry(
                        BER_BVZERO( &attr->a_vals[i] );
                } else {
                        attr->a_vals = mods->sml_values;
-                       mods->sml_values = NULL;
                }
 
                if ( mods->sml_nvalues ) {
@@ -534,7 +544,6 @@ slap_mods2entry(
                                BER_BVZERO( &attr->a_nvals[i] );
                        } else {
                                attr->a_nvals = mods->sml_nvalues;
-                               mods->sml_nvalues = NULL;
                        }
                } else {
                        attr->a_nvals = attr->a_vals;