Parcourir la source

Only check modrdn ops for backend/suffix correctness if not the default backend

The function slapi_mapping_tree_select_and_check() is only called for
modrdn operations, to make sure we are not attempting to rename a suffix
or move an entry from one backend to another.  This defeats datainterop
plugins that may want to perform some other operation in these cases.  If
the target suffix/backend is not found, the default backend is used.  If
the default backend is being used, don't check for all errors, just allow
the operation to pass through to the preop plugins.
Need to make sure this doesn't cause problems if
1) null suffix is not used - entry really is bogus or doesn't exist
2) null suffix is being used but entry belongs to another null suffix or
is really bogus
Reviewed by: nhosoi (Thanks!)
Tested on: Fedora 14 x86_64
Rich Megginson il y a 15 ans
Parent
commit
09baba59e5
1 fichiers modifiés avec 3 ajouts et 2 suppressions
  1. 3 2
      ldap/servers/slapd/mapping_tree.c

+ 3 - 2
ldap/servers/slapd/mapping_tree.c

@@ -2291,6 +2291,7 @@ int slapi_mapping_tree_select_and_check(Slapi_PBlock *pb,char *newdn, Slapi_Back
     Slapi_DN *target_sdn = NULL;
     Slapi_DN dn_newdn;
     Slapi_Backend * new_be = NULL;
+    Slapi_Backend * def_be = defbackend_get_backend();
     Slapi_Entry * new_referral = NULL;
     mapping_tree_node *target_node;
     int index;
@@ -2329,7 +2330,7 @@ int slapi_mapping_tree_select_and_check(Slapi_PBlock *pb,char *newdn, Slapi_Back
     {
         /* suffix is a part of mapping tree. We should not free it */
         const Slapi_DN *suffix = slapi_get_suffix_by_dn(target_sdn);
-        if (NULL == suffix)
+        if ((*be != def_be) && (NULL == suffix))
         {
             ret = LDAP_NO_SUCH_OBJECT;
             PR_snprintf(errorbuf, BUFSIZ,
@@ -2337,7 +2338,7 @@ int slapi_mapping_tree_select_and_check(Slapi_PBlock *pb,char *newdn, Slapi_Back
                         slapi_sdn_get_dn(target_sdn));
             goto unlock_and_return;
         }
-        if (0 == slapi_sdn_compare(target_sdn, suffix))
+        if (suffix && (0 == slapi_sdn_compare(target_sdn, suffix)))
         {
             /* target_sdn is a suffix */
             const Slapi_DN *new_suffix = NULL;