diff options
author | Michael Adam <obnox@samba.org> | 2008-08-06 22:33:58 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2008-08-13 11:54:07 +0200 |
commit | 6afa8e573e1afe93fb126f851aaf6b0c0cd8d75a (patch) | |
tree | 915b92ca7fe2111e8c28852bcd188553855b1c14 /source3 | |
parent | ebaf208fc363ba4a53fc61523aab2e6392738aa1 (diff) | |
download | samba-6afa8e573e1afe93fb126f851aaf6b0c0cd8d75a.tar.gz samba-6afa8e573e1afe93fb126f851aaf6b0c0cd8d75a.tar.bz2 samba-6afa8e573e1afe93fb126f851aaf6b0c0cd8d75a.zip |
idmap tdb2: fix broken logic in tdb2_store_bystring().
1. use the return value that idmap_tdb2_open_perm_db() gives us
2. don't write to the local db if writing to the perm db failed.
3. fix wrong interpretation of return value of the local store
Michael
(This used to be commit be8c6b4f2f40014313899b5cbc1da9d390d94fee)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/winbindd/idmap_tdb2.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/source3/winbindd/idmap_tdb2.c b/source3/winbindd/idmap_tdb2.c index cb5e9ec6d4..172922b85f 100644 --- a/source3/winbindd/idmap_tdb2.c +++ b/source3/winbindd/idmap_tdb2.c @@ -383,15 +383,18 @@ static TDB_DATA tdb2_fetch_bystring(TALLOC_CTX *mem_ctx, const char *keystr) static NTSTATUS tdb2_store_bystring(const char *keystr, TDB_DATA data, int flags) { 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_store_bystring(idmap_tdb2_perm, keystr, data, flags); if (!NT_STATUS_IS_OK(ret)) { - ret = tdb_store_bystring(idmap_tdb2_tmp, keystr, data, flags) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL; + return ret; } - return ret; + return (tdb_store_bystring(idmap_tdb2_tmp, keystr, data, flags) == 0) + ? NT_STATUS_OK + : NT_STATUS_UNSUCCESSFUL; } /* |