Blame SOURCES/0023-Ticket-50363-ds-replcheck-incorrectly-reports-error-.patch

26521d
From 86bbfb42aa03a7dd1ea0a9faa130d3cdb31aab5e Mon Sep 17 00:00:00 2001
26521d
From: Mark Reynolds <mreynolds@redhat.com>
26521d
Date: Mon, 13 May 2019 10:03:58 -0400
26521d
Subject: [PATCH] Ticket 50363 - ds-replcheck incorrectly reports error out of
26521d
 order multi-valued attributes
26521d
26521d
Bug Description:  If for some reason an entry's multi-valued attribute
26521d
                  values are in different orders on different replicas
26521d
                  the tool reports this as an inconsistency when it is
26521d
                  not.
26521d
26521d
Fix Description:  For both offline & online processing sort each entry's
26521d
                  multi-valued attribute values.
26521d
26521d
https://pagure.io/389-ds-base/issue/50363
26521d
26521d
Reviewed by: firstyear & mhonek (Thanks!!)
26521d
---
26521d
 ldap/admin/src/scripts/ds-replcheck | 7 ++++++-
26521d
 1 file changed, 6 insertions(+), 1 deletion(-)
26521d
26521d
diff --git a/ldap/admin/src/scripts/ds-replcheck b/ldap/admin/src/scripts/ds-replcheck
26521d
index 57748b09f..a9411cb4f 100755
26521d
--- a/ldap/admin/src/scripts/ds-replcheck
26521d
+++ b/ldap/admin/src/scripts/ds-replcheck
26521d
@@ -110,7 +110,7 @@ def convert_entries(entries):
26521d
 
26521d
     for entry in entries:
26521d
         new_entry = Entry(entry)
26521d
-        new_entry.data = {k.lower(): v for k, v in list(new_entry.data.items())}
26521d
+        new_entry.data = {k.lower(): sorted(v) for k, v in list(new_entry.data.items())}
26521d
         if new_entry.dn.endswith("cn=mapping tree,cn=config"):
26521d
             '''Skip replica entry (ldapsearch brings this in because the filter
26521d
             we use triggers an internal operation to return the config entry - so
26521d
@@ -381,6 +381,11 @@ def ldif_search(LDIF, dn):
26521d
     # Keep track of entry index - we use this later when searching the LDIF again
26521d
     result['idx'] = count
26521d
 
26521d
+    # Sort all the multi-valued attributes
26521d
+    for k, v in data.items():
26521d
+        v.sort()
26521d
+        data[k] = v
26521d
+
26521d
     result['glue'] = None
26521d
     if found_conflict and found_subentry and found_tombstone is False:
26521d
         result['entry'] = None
26521d
-- 
26521d
2.17.2
26521d