summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-08-06 22:43:27 +0200
committerMichael Adam <obnox@samba.org>2008-08-13 11:54:07 +0200
commit134ea912781ba8da276217d6d663ab1967407f3e (patch)
treea1889ecf37b2b39df5e6ad541084c55307ef423a
parent6afa8e573e1afe93fb126f851aaf6b0c0cd8d75a (diff)
downloadsamba-134ea912781ba8da276217d6d663ab1967407f3e.tar.gz
samba-134ea912781ba8da276217d6d663ab1967407f3e.tar.bz2
samba-134ea912781ba8da276217d6d663ab1967407f3e.zip
idmap tdb2: fix broken logic in tdb2_delete_bystring().
1. use the return value that idmap_tdb2_open_perm_db() gives us 2. don't delete frep the local db if deleting from the perm db failed. 3. fix wrong interpretation of return value of the local delete Michael (This used to be commit 147573d7f6faab0ad90258b6a28c4b9575ccb6ea)
-rw-r--r--source3/winbindd/idmap_tdb2.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/source3/winbindd/idmap_tdb2.c b/source3/winbindd/idmap_tdb2.c
index 172922b85f..81553dc9c6 100644
--- a/source3/winbindd/idmap_tdb2.c
+++ b/source3/winbindd/idmap_tdb2.c
@@ -403,15 +403,18 @@ static NTSTATUS tdb2_store_bystring(const char *keystr, TDB_DATA data, int flags
static NTSTATUS tdb2_delete_bystring(const char *keystr)
{
NTSTATUS ret;
- NTSTATUS status = idmap_tdb2_open_perm_db();
- if (!NT_STATUS_IS_OK(status)) {
- return NT_STATUS_UNSUCCESSFUL;
+
+ ret = idmap_tdb2_open_perm_db();
+ if (!NT_STATUS_IS_OK(ret)) {
+ return ret;
}
ret = dbwrap_delete_bystring(idmap_tdb2_perm, keystr);
if (!NT_STATUS_IS_OK(ret)) {
- ret = tdb_delete_bystring(idmap_tdb2_tmp, keystr) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+ return ret;
}
- return ret;
+ return (tdb_delete_bystring(idmap_tdb2_tmp, keystr) == 0)
+ ? NT_STATUS_OK
+ : NT_STATUS_UNSUCCESSFUL;
}
/*