diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-09-01 01:11:15 +0000 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2005-09-01 01:11:15 +0000 |
commit | 98802dc859dc5e78c0f5856e616ff44e19225d49 (patch) | |
tree | 850e049f5052734474f8927eb5c365fe5a35de3a /source/lib/ldb/modules/ldb_map.c | |
parent | de8fa0a9fbf035c3d59696f70229dd6d19f562a6 (diff) | |
download | samba-98802dc859dc5e78c0f5856e616ff44e19225d49.tar.gz samba-98802dc859dc5e78c0f5856e616ff44e19225d49.tar.xz samba-98802dc859dc5e78c0f5856e616ff44e19225d49.zip |
r9857: Fix rename/delete issues
Diffstat (limited to 'source/lib/ldb/modules/ldb_map.c')
-rw-r--r-- | source/lib/ldb/modules/ldb_map.c | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/source/lib/ldb/modules/ldb_map.c b/source/lib/ldb/modules/ldb_map.c index de7a00ef60a..cdf0e294058 100644 --- a/source/lib/ldb/modules/ldb_map.c +++ b/source/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 */ |