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

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