summaryrefslogtreecommitdiff
path: root/source3/winbindd/winbindd.c
diff options
context:
space:
mode:
authorAndreas Schneider <anschneider@suse.de>2007-11-26 11:44:30 +0100
committerMichael Adam <obnox@samba.org>2008-01-07 10:24:34 +0100
commit18699d003b1d4460ffb36db61860e6c31acbf1cb (patch)
tree51bb97c90b9328c8b60d237029223972f1c810b1 /source3/winbindd/winbindd.c
parent3f4699f5a3f3c7a2ad11119c266e5a018d71b0fe (diff)
downloadsamba-18699d003b1d4460ffb36db61860e6c31acbf1cb.tar.gz
samba-18699d003b1d4460ffb36db61860e6c31acbf1cb.tar.bz2
samba-18699d003b1d4460ffb36db61860e6c31acbf1cb.zip
Prevent winbindd from segfaulting due to corrupted cache tdb.
If we try to flush the caches and due to a corrupted tdb we and have no tdb context close the tdb and validate it. Initialize the cache afterwards again. (This used to be commit d0c0f91fb9f3438a18c6f47ed894f525beb75cbf)
Diffstat (limited to 'source3/winbindd/winbindd.c')
-rw-r--r--source3/winbindd/winbindd.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index 07cf22618e..dfad50bf96 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -121,7 +121,23 @@ static void flush_caches(void)
otherwise cached access denied errors due to restrict anonymous
hang around until the sequence number changes. */
- wcache_invalidate_cache();
+ if (wcache_invalidate_cache() < 0) {
+ DEBUG(0, ("invalidating the cache failed; revalidate the cache\n"));
+ /* Close the cache to be able to valdite the cache */
+ close_winbindd_cache();
+ /*
+ * Ensure all cache and idmap caches are consistent
+ * before we initialize the cache again.
+ */
+ if (winbindd_validate_cache() < 0) {
+ DEBUG(0, ("corrupted tdb found, trying to restore backup\n"));
+ }
+
+ /* Initialize cache again. */
+ if (!initialize_winbindd_cache()) {
+ exit(1);
+ }
+ }
}
/* Handle the signal by unlinking socket and exiting */