From 89a947024a76f70af498bac97fd8ad2937f938ae Mon Sep 17 00:00:00 2001
From: Quanah Gibson-Mount <quanah@openldap.org>
Date: Thu, 15 Apr 2010 01:09:00 +0000
Subject: [PATCH] ITS#6469

---
 CHANGES                         | 1 +
 servers/slapd/back-bdb/modify.c | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/CHANGES b/CHANGES
index 96047ce9df..c8f633cae6 100644
--- a/CHANGES
+++ b/CHANGES
@@ -9,6 +9,7 @@ OpenLDAP 2.4.22 Engineering
 	Fixed slapd empty URI parsing (ITS#6465)
 	Fixed slapd REP_ENTRY flag handling (ITS#5340)
 	Fixed slapd sasl auxprop_lookup (ITS#6441)
+	Fixed slapd-bdb contextCSN updates from updatedn (ITS#6469)
 	Fixed slapo-collect REP_ENTRY flag handling (ITS#5340,ITS#6423)
 	Fixed slapo-dynlist REP_ENTRY flag handling (ITS#5340,ITS#6423)
 	Fixed slapo-rwm olcRwmMap handling (ITS#6436)
diff --git a/servers/slapd/back-bdb/modify.c b/servers/slapd/back-bdb/modify.c
index ea126d98a0..5db7aa9847 100644
--- a/servers/slapd/back-bdb/modify.c
+++ b/servers/slapd/back-bdb/modify.c
@@ -422,7 +422,13 @@ txnReturn:
 
 	ctrls[num_ctrls] = NULL;
 
-	slap_mods_opattrs( op, &op->orm_modlist, 1 );
+	/* Don't touch the opattrs, if this is a contextCSN update
+	 * initiated from updatedn */
+	if ( !be_isupdate(op) || !op->orm_modlist || op->orm_modlist->sml_next ||
+		 op->orm_modlist->sml_desc != slap_schema.si_ad_contextCSN ) {
+
+		slap_mods_opattrs( op, &op->orm_modlist, 1 );
+	}
 
 	if( 0 ) {
 retry:	/* transaction retry */
-- 
GitLab