]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/overlays/rwm.c
Merge remote-tracking branch 'origin/mdb.master'
[openldap] / servers / slapd / overlays / rwm.c
index 05cf98aee61b891b820978d803cda91d2ee3a391..35769d142ae3acdae43db099e2aa9c7bff87dfcb 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2003-2012 The OpenLDAP Foundation.
+ * Copyright 2003-2013 The OpenLDAP Foundation.
  * Portions Copyright 2003 Pierangelo Masarati.
  * All rights reserved.
  *
@@ -107,10 +107,12 @@ rwm_op_rollback( Operation *op, SlapReply *rs, rwm_op_state *ros )
                break;
        case LDAP_REQ_MODRDN:
                if ( op->orr_newSup != ros->orr_newSup ) {
-                       ch_free( op->orr_newSup->bv_val );
-                       ch_free( op->orr_nnewSup->bv_val );
-                       op->o_tmpfree( op->orr_newSup, op->o_tmpmemctx );
-                       op->o_tmpfree( op->orr_nnewSup, op->o_tmpmemctx );
+                       if ( op->orr_newSup ) {
+                               ch_free( op->orr_newSup->bv_val );
+                               ch_free( op->orr_nnewSup->bv_val );
+                               op->o_tmpfree( op->orr_newSup, op->o_tmpmemctx );
+                               op->o_tmpfree( op->orr_nnewSup, op->o_tmpmemctx );
+                       }
                        op->orr_newSup = ros->orr_newSup;
                        op->orr_nnewSup = ros->orr_nnewSup;
                }
@@ -1277,7 +1279,13 @@ rwm_attrs( Operation *op, SlapReply *rs, Attribute** a_first, int stripEntryDN )
                                                                NULL );
 
                                                        if ( rc != LDAP_SUCCESS ) {
-                                                               BER_BVZERO( &(*ap)->a_nvals[i] );
+                                                               /* FIXME: this is wrong, putting a non-normalized value
+                                                                * into nvals. But when a proxy sends us bogus data,
+                                                                * we still need to give it to the client, even if it
+                                                                * violates the syntax. I.e., we don't want to silently
+                                                                * drop things and trigger an apparent data loss.
+                                                                */
+                                                               ber_dupbv( &(*ap)->a_nvals[i], &(*ap)->a_vals[i] );
                                                        }
                                                }
                                                BER_BVZERO( &(*ap)->a_nvals[i] );