andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 6 months ago
Clone

Blame SOURCES/0007-Issue-4297-2nd-fix-for-on-ADD-replication-URP-issue-.patch

47c2e9
From a9f53e9958861e6a7a827bd852d72d51a6512396 Mon Sep 17 00:00:00 2001
47c2e9
From: tbordaz <tbordaz@redhat.com>
47c2e9
Date: Wed, 25 Nov 2020 18:07:34 +0100
47c2e9
Subject: [PATCH] Issue 4297 - 2nd fix for on ADD replication URP issue
47c2e9
 internal searches with filter containing unescaped chars (#4439)
47c2e9
47c2e9
Bug description:
47c2e9
	Previous fix is buggy because slapi_filter_escape_filter_value returns
47c2e9
        a escaped filter component not an escaped assertion value.
47c2e9
47c2e9
Fix description:
47c2e9
	use the escaped filter component
47c2e9
47c2e9
relates: https://github.com/389ds/389-ds-base/issues/4297
47c2e9
47c2e9
Reviewed by: William Brown
47c2e9
47c2e9
Platforms tested: F31
47c2e9
---
47c2e9
 ldap/servers/plugins/replication/urp.c | 16 ++++++++--------
47c2e9
 1 file changed, 8 insertions(+), 8 deletions(-)
47c2e9
47c2e9
diff --git a/ldap/servers/plugins/replication/urp.c b/ldap/servers/plugins/replication/urp.c
47c2e9
index f41dbc72d..ed340c9d8 100644
47c2e9
--- a/ldap/servers/plugins/replication/urp.c
47c2e9
+++ b/ldap/servers/plugins/replication/urp.c
47c2e9
@@ -1411,12 +1411,12 @@ urp_add_check_tombstone (Slapi_PBlock *pb, char *sessionid, Slapi_Entry *entry,
47c2e9
     Slapi_Entry **entries = NULL;
47c2e9
     Slapi_PBlock *newpb;
47c2e9
     char *basedn = slapi_entry_get_ndn(entry);
47c2e9
-    char *escaped_basedn;
47c2e9
+    char *escaped_filter;
47c2e9
     const Slapi_DN *suffix = slapi_get_suffix_by_dn(slapi_entry_get_sdn (entry));
47c2e9
-    escaped_basedn = slapi_filter_escape_filter_value("nscpentrydn", basedn);
47c2e9
+    escaped_filter = slapi_filter_escape_filter_value("nscpentrydn", basedn);
47c2e9
 
47c2e9
-    char *filter = slapi_filter_sprintf("(&(objectclass=nstombstone)(nscpentrydn=%s))", escaped_basedn);
47c2e9
-    slapi_ch_free((void **)&escaped_basedn);
47c2e9
+    char *filter = slapi_filter_sprintf("(&(objectclass=nstombstone)%s)", escaped_filter);
47c2e9
+    slapi_ch_free((void **)&escaped_filter);
47c2e9
     newpb = slapi_pblock_new();
47c2e9
     slapi_search_internal_set_pb(newpb,
47c2e9
                                  slapi_sdn_get_dn(suffix), /* Base DN */
47c2e9
@@ -1605,15 +1605,15 @@ urp_find_tombstone_for_glue (Slapi_PBlock *pb, char *sessionid, const Slapi_Entr
47c2e9
     Slapi_Entry **entries = NULL;
47c2e9
     Slapi_PBlock *newpb;
47c2e9
     const char *basedn = slapi_sdn_get_dn(parentdn);
47c2e9
-    char *escaped_basedn;
47c2e9
-    escaped_basedn = slapi_filter_escape_filter_value("nscpentrydn", (char *)basedn);
47c2e9
+    char *escaped_filter;
47c2e9
+    escaped_filter = slapi_filter_escape_filter_value("nscpentrydn", (char *)basedn);
47c2e9
 
47c2e9
     char *conflict_csnstr = (char*)slapi_entry_attr_get_ref((Slapi_Entry *)entry, "conflictcsn");
47c2e9
     CSN *conflict_csn = csn_new_by_string(conflict_csnstr);
47c2e9
     CSN *tombstone_csn = NULL;
47c2e9
 
47c2e9
-    char *filter = slapi_filter_sprintf("(&(objectclass=nstombstone)(nscpentrydn=%s))", escaped_basedn);
47c2e9
-    slapi_ch_free((void **)&escaped_basedn);
47c2e9
+    char *filter = slapi_filter_sprintf("(&(objectclass=nstombstone)%s)", escaped_filter);
47c2e9
+    slapi_ch_free((void **)&escaped_filter);
47c2e9
     newpb = slapi_pblock_new();
47c2e9
     char *parent_dn = slapi_dn_parent (basedn);
47c2e9
     slapi_search_internal_set_pb(newpb,
47c2e9
-- 
47c2e9
2.26.2
47c2e9