]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/modify.c
Cleanup
[openldap] / servers / slapd / modify.c
index d0282b16e6039ca45b70e5303eab6cd78aaf2624..69ce10283173f629aced19269de813f3ce5ad523 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2007 The OpenLDAP Foundation.
+ * Copyright 1998-2009 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -268,6 +268,7 @@ fe_op_modify( Operation *op, SlapReply *rs )
        if ( op->orm_increment && !SLAP_INCREMENT( op->o_bd ) ) {
                send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
                        "modify/increment not supported in context" );
+               goto cleanup;
        }
 
        /*
@@ -383,6 +384,10 @@ slap_mods_no_user_mod_check(
                        continue;
                }
 
+               if ( ml->sml_flags & SLAP_MOD_INTERNAL ) {
+                       continue;
+               }
+
                if ( get_relax( op ) ) {
                        if ( ml->sml_desc->ad_type->sat_flags & SLAP_AT_MANAGEABLE ) {
                                ml->sml_flags |= SLAP_MOD_MANAGING;
@@ -585,6 +590,7 @@ int slap_mods_check(
                                        ml->sml_values[nvals] = pval;
                                }
                        }
+                       ml->sml_values[nvals].bv_len = 0;
                        ml->sml_numvals = nvals;
 
                        /*
@@ -684,7 +690,7 @@ slap_sort_vals(
 #define        SWAP(a,b,tmp)   tmp=(a);(a)=(b);(b)=tmp
 #define        COMP(a,b)       match=0; rc = ordered_value_match( &match, \
                                                ad, mr, SLAP_MR_EQUALITY \
-                                                               | SLAP_MR_VALUE_OF_ATTRIBUTE_SYNTAX \
+                                                               | SLAP_MR_VALUE_OF_ASSERTION_SYNTAX \
                                                                | SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH \
                                                                | SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH, \
                                                                &(a), &(b), text );
@@ -802,7 +808,7 @@ slap_sort_vals(
                }
        }
        done:
-       if ( i >= 0 )
+       if ( match == 0 && i >= 0 )
                *dup = ix[i];
 
        /* For sorted attributes, put the values in index order */
@@ -842,21 +848,11 @@ slap_sort_vals(
  */
 void slap_timestamp( time_t *tm, struct berval *bv )
 {
-       struct tm *ltm;
-#ifdef HAVE_GMTIME_R
-       struct tm ltm_buf;
-
-       ltm = gmtime_r( tm, &ltm_buf );
-#else
-       ldap_pvt_thread_mutex_lock( &gmtime_mutex );
-       ltm = gmtime( tm );
-#endif
+       struct tm ltm;
 
-       bv->bv_len = lutil_gentime( bv->bv_val, bv->bv_len, ltm );
+       ldap_pvt_gmtime( tm, &ltm );
 
-#ifndef HAVE_GMTIME_R
-       ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
-#endif
+       bv->bv_len = lutil_gentime( bv->bv_val, bv->bv_len, &ltm );
 }
 
 /* Called for all modify and modrdn ops. If the current op was replicated
@@ -870,7 +866,7 @@ void slap_mods_opattrs(
        struct berval name, timestamp, csn = BER_BVNULL;
        struct berval nname;
        char timebuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
-       char csnbuf[ LDAP_LUTIL_CSNSTR_BUFSIZE ];
+       char csnbuf[ LDAP_PVT_CSNSTR_BUFSIZE ];
        Modifications *mod, **modtail, *modlast;
        int gotcsn = 0, gotmname = 0, gotmtime = 0;