andykimpe / rpms / 389-ds-base

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

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

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