andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
dc8c34
From bcb16bff39feb1bd965fb3fc98d815225946de57 Mon Sep 17 00:00:00 2001
dc8c34
From: Mark Reynolds <mreynolds@redhat.com>
dc8c34
Date: Wed, 31 Jul 2013 12:21:19 -0400
dc8c34
Subject: [PATCH 412/413] Ticket 47411 - Replace substring search with plain
dc8c34
 search in referint plugin
dc8c34
dc8c34
Bug Description:  RI plugin uses a substring search by default, which is much more
dc8c34
                  expensive than an equality search filter.
dc8c34
dc8c34
Fix Description:  Only use the substring search if the operation is a modrdn.
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/47411
dc8c34
dc8c34
Reveiwed by: richm(Thanks!)
dc8c34
dc8c34
(cherry picked from commit a5dde495a7df7b19fd71cccdb0eb1b91d1f73b58)
dc8c34
(cherry picked from commit 6cc76d8a96b4c41b00475280b0f3f236778bb35e)
dc8c34
---
dc8c34
 ldap/servers/plugins/referint/referint.c | 11 +++++++----
dc8c34
 1 file changed, 7 insertions(+), 4 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/servers/plugins/referint/referint.c b/ldap/servers/plugins/referint/referint.c
dc8c34
index 4a722c1..bd0fbe9 100644
dc8c34
--- a/ldap/servers/plugins/referint/referint.c
dc8c34
+++ b/ldap/servers/plugins/referint/referint.c
dc8c34
@@ -704,11 +704,14 @@ update_integrity(char **argv, Slapi_DN *origSDN,
dc8c34
     {
dc8c34
         search_base = slapi_sdn_get_dn( sdn );
dc8c34
 
dc8c34
-        for(i = 3; argv[i] != NULL; i++)
dc8c34
-        {
dc8c34
+        for(i = 3; argv[i] != NULL; i++){
dc8c34
             char buf[BUFSIZ];
dc8c34
-            filter = slapi_ch_smprintf("(%s=*%s)", argv[i],
dc8c34
-                                    escape_filter_value(origDN, len, buf));
dc8c34
+            if(newrDN){
dc8c34
+                /* we need to check the children of the old dn, so use a wildcard */
dc8c34
+                filter = slapi_ch_smprintf("(%s=*%s)", argv[i], escape_filter_value(origDN, len, buf));
dc8c34
+            } else {
dc8c34
+                filter = slapi_ch_smprintf("(%s=%s)", argv[i], escape_filter_value(origDN, len, buf));
dc8c34
+            }
dc8c34
             if ( filter ) {
dc8c34
                 /* Need only the current attribute and its subtypes */
dc8c34
                 char *attrs[2];
dc8c34
-- 
dc8c34
2.4.11
dc8c34