From 8553823f94a1fcff7b75fbe23bef60af1e978c6f Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 13 Sep 2010 14:28:46 -0600 Subject: 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 --- ldap/servers/slapd/mapping_tree.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ldap/servers/slapd/mapping_tree.c b/ldap/servers/slapd/mapping_tree.c index 732dd3e7..813c6049 100644 --- a/ldap/servers/slapd/mapping_tree.c +++ b/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; -- cgit