浏览代码

Ticket 47411 - Replace substring search with plain search in referint plugin

Bug Description:  RI plugin uses a substring search by default, which is much more
                  expensive than an equality search filter.

Fix Description:  Only use the substring search if the operation is a modrdn.

https://fedorahosted.org/389/ticket/47411

Reveiwed by: richm(Thanks!)

(cherry picked from commit a5dde495a7df7b19fd71cccdb0eb1b91d1f73b58)
Mark Reynolds 12 年之前
父节点
当前提交
6cc76d8a96
共有 1 个文件被更改,包括 7 次插入4 次删除
  1. 7 4
      ldap/servers/plugins/referint/referint.c

+ 7 - 4
ldap/servers/plugins/referint/referint.c

@@ -704,11 +704,14 @@ update_integrity(char **argv, Slapi_DN *origSDN,
     {
     {
         search_base = slapi_sdn_get_dn( sdn );
         search_base = slapi_sdn_get_dn( sdn );
 
 
-        for(i = 3; argv[i] != NULL; i++)
-        {
+        for(i = 3; argv[i] != NULL; i++){
             char buf[BUFSIZ];
             char buf[BUFSIZ];
-            filter = slapi_ch_smprintf("(%s=*%s)", argv[i],
-                                    escape_filter_value(origDN, len, buf));
+            if(newrDN){
+                /* we need to check the children of the old dn, so use a wildcard */
+                filter = slapi_ch_smprintf("(%s=*%s)", argv[i], escape_filter_value(origDN, len, buf));
+            } else {
+                filter = slapi_ch_smprintf("(%s=%s)", argv[i], escape_filter_value(origDN, len, buf));
+            }
             if ( filter ) {
             if ( filter ) {
                 /* Need only the current attribute and its subtypes */
                 /* Need only the current attribute and its subtypes */
                 char *attrs[2];
                 char *attrs[2];