diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-09-01 01:11:15 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:36:18 -0500 |
commit | 1b5cb7309d13b472eff12e1bfb5191ca8e0391ae (patch) | |
tree | 1a5c3a09ca31283e0ece166debb66b723c991e7f | |
parent | 99054eb40a4ce3e2b065132129cb5f8db4db0f78 (diff) | |
download | samba-1b5cb7309d13b472eff12e1bfb5191ca8e0391ae.tar.gz samba-1b5cb7309d13b472eff12e1bfb5191ca8e0391ae.tar.bz2 samba-1b5cb7309d13b472eff12e1bfb5191ca8e0391ae.zip |
r9857: Fix rename/delete issues
(This used to be commit d6dce7ef3eb21a5e90244cf2ce7403ab43b12d63)
-rw-r--r-- | source4/lib/ldb/modules/ldb_map.c | 35 | ||||
-rw-r--r-- | source4/lib/samba3/PLAN | 1 | ||||
-rwxr-xr-x | testprogs/ejs/samba3sam | 13 |
3 files changed, 29 insertions, 20 deletions
diff --git a/source4/lib/ldb/modules/ldb_map.c b/source4/lib/ldb/modules/ldb_map.c index de7a00ef60..cdf0e29405 100644 --- a/source4/lib/ldb/modules/ldb_map.c +++ b/source4/lib/ldb/modules/ldb_map.c @@ -725,19 +725,26 @@ static int map_rename(struct ldb_module *module, const struct ldb_dn *olddn, con { struct ldb_map_context *privdat = map_get_privdat(module); struct ldb_dn *n_olddn, *n_newdn; - int ret; - - ret = ldb_next_rename_record(module, n_olddn, n_newdn); - + int fb_ret, mp_ret; + n_olddn = map_local_dn(module, module, olddn); n_newdn = map_local_dn(module, module, newdn); - ret = ldb_rename(privdat->mapped_ldb, n_olddn, n_newdn); + mp_ret = ldb_rename(privdat->mapped_ldb, n_olddn, n_newdn); + if (mp_ret != -1) { + ldb_debug(module->ldb, LDB_DEBUG_TRACE, "Mapped record renamed"); + } + + fb_ret = ldb_next_rename_record(module, olddn, newdn); + + if (fb_ret != -1) { + ldb_debug(module->ldb, LDB_DEBUG_TRACE, "Fallback record renamed"); + } talloc_free(n_olddn); talloc_free(n_newdn); - return ret; + return (fb_ret == -1 && mp_ret == -1)?-1:0; } /* @@ -747,17 +754,23 @@ static int map_delete(struct ldb_module *module, const struct ldb_dn *dn) { struct ldb_map_context *privdat = map_get_privdat(module); struct ldb_dn *newdn; - int ret; + int fb_ret, mp_ret; - ret = ldb_next_delete_record(module, dn); - newdn = map_local_dn(module, module, dn); - ldb_delete(privdat->mapped_ldb, newdn); + mp_ret = ldb_delete(privdat->mapped_ldb, newdn); + if (mp_ret != -1) { + ldb_debug(module->ldb, LDB_DEBUG_TRACE, "Mapped record deleted"); + } + + fb_ret = ldb_next_delete_record(module, dn); + if (fb_ret != -1) { + ldb_debug(module->ldb, LDB_DEBUG_TRACE, "Fallback record deleted"); + } talloc_free(newdn); - return ret; + return (fb_ret == -1 && mp_ret == -1)?-1:0; } /* search fallback database */ diff --git a/source4/lib/samba3/PLAN b/source4/lib/samba3/PLAN index 80885a4ec7..4351ce2e61 100644 --- a/source4/lib/samba3/PLAN +++ b/source4/lib/samba3/PLAN @@ -1,4 +1,3 @@ TODO (SoC project): - [ldb_map] some more strict checking when sending data to an LDAP server - - [ldb_map] fix rename - fix ntPwdHash / lmPwdHash bug diff --git a/testprogs/ejs/samba3sam b/testprogs/ejs/samba3sam index 26c3248f07..14ddd011e9 100755 --- a/testprogs/ejs/samba3sam +++ b/testprogs/ejs/samba3sam @@ -164,21 +164,18 @@ assert(msg.length >= 1); assert(msg[0].description == undefined); println("Renaming record..."); -ok = s4.rename("cn=Niemand,ou=Tests,dc=vernstok,dc=nl", "cn=Iemand,ou=Tests,dc=vernstok,dc=nl"); +ok = s4.rename("cn=Niemand,ou=Tests,dc=vernstok,dc=nl", "cn=Niemand,dc=vernstok,dc=nl"); -println("Checking whether old record is gone..."); +println("Checking whether DN has changed..."); msg = s4.search("(cn=Niemand)"); -assert(msg.length == 0); - -println("Checking whether new record is there..."); -msg = s4.search("(cn=Iemand)"); assert(msg.length == 1); +assert(msg[0].dn == "cn=Niemand,dc=vernstok,dc=nl"); println("Deleting record..."); -ok = s4.del("cn=Iemand,ou=Tests,dc=vernstok,dc=nl"); +ok = s4.del("cn=Niemand,dc=vernstok,dc=nl"); assert(ok); println("Checking whether record is gone..."); -msg = s4.search("(cn=Iemand)"); +msg = s4.search("(cn=Niemand)"); assert(msg.length == 0); |