Bug 7590 - offline login fails because winbind deletes cache on every startup
Summary: offline login fails because winbind deletes cache on every startup
Alias: None
Product: Samba 3.5
Classification: Unclassified
Component: Winbind (show other bugs)
Version: 3.5.4
Hardware: Other Linux
: P3 normal
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
: 7709 (view as bug list)
Depends on:
Reported: 2010-07-27 03:34 UTC by David Woodhouse
Modified: 2010-10-28 07:27 UTC (History)
2 users (show)

See Also:

Fix for 3.5.x. (1.17 KB, patch)
2010-07-27 03:56 UTC, Jeremy Allison
no flags Details
Fix for 3.5.x. (1.15 KB, patch)
2010-07-27 03:58 UTC, Jeremy Allison
obnox: review+
gd: review+

Note You need to log in before you can comment on or make changes to this bug.
Description David Woodhouse 2010-07-27 03:34:50 UTC
tdb_check() will always return failure for a read-only database.
Silently, without any log output, when _tdb_lockall() fails.

This happens every time winbindd starts up, so offline login never works.

winbindd_validate_cache: replacing panic function
tdb_validate_open called for tdb '/var/lib/samba/winbindd_cache.tdb'
tdb_validate called for tdb '/var/lib/samba/winbindd_cache.tdb'
tdb_validate: forking to let child do validation.
tdb_validate: fork succeeded, child PID = 10213
tdb_validate: waiting for child to finish...
tdb_validate (validation child): created
tdb_validate (validation child): calling tdb_validate_child
tdb_validate_child: summary of validation status:
 * tdb error: yes
 * bad freelist: no
 * bad entry: no
 * unknown key: no
 => overall success: no
tdb_validate: validating child returned.
tdb_validate: child exited, code 255.
tdb_validate returning code '255' for tdb '/var/lib/samba/winbindd_cache.tdb'
tdb '/var/lib/samba/winbindd_cache.tdb' is invalid
Could not stat '/var/lib/samba/winbindd_cache.tdb.bak': No such file or
No backup found.
moved '/var/lib/samba/winbindd_cache.tdb' to
Corrupt tdb stored as '/var/lib/samba/winbindd_cache.tdb.corrupt'
winbindd_validate_cache: validation not successful.
removing tdb /var/lib/samba/winbindd_cache.tdb.
winbindd_validate_cache: restoring panic function
winbindd cache tdb corrupt and no backup could be restored.
initialize_winbindd_cache: clearing cache and re-creating with version number 1

[root@i7 dwoodhou]# rpm -q samba-winbind libtdb
Comment 1 Jeremy Allison 2010-07-27 03:48:52 UTC
This has been fixed in master. I'll create a patch for 3.5.x.
Comment 2 Jeremy Allison 2010-07-27 03:56:26 UTC
Created attachment 5873 [details]
Fix for 3.5.x.

Patch that was applied to master. Please review.

Comment 3 Jeremy Allison 2010-07-27 03:58:52 UTC
Created attachment 5874 [details]
Fix for 3.5.x.

Doh. Fix patch comment to be correct. Please review & check.
Comment 4 Jeremy Allison 2010-07-27 04:07:28 UTC
NB. The fix attached here also applies cleanly to the 3.4.x branch and is also needed there.

Comment 5 Jeremy Allison 2010-07-27 04:47:47 UTC
Comment on attachment 5874 [details]
Fix for 3.5.x.

Asking gd as well, to get coverage :-).
Comment 6 Michael Adam 2010-07-27 05:04:39 UTC
Comment on attachment 5874 [details]
Fix for 3.5.x.

gosh. thanks for catching that. I did not notice it.

Only question here is, why you did not keep Bo's authorship in the patch 6e48267c28b05c3837a3e5ffc1f5b58316cc286f from master. But that is cosmetic again. :-)
Comment 7 Jeremy Allison 2010-07-27 05:06:11 UTC
I didn't realize it was a separate patch that went into master with Bo's (C). Please feel free to use Bo's copyright, not mine.

Comment 8 Guenther Deschner 2010-08-13 10:01:52 UTC
Comment on attachment 5874 [details]
Fix for 3.5.x.

looks good, thanks! this was driving me nuts here recently :)
Comment 9 Guenther Deschner 2010-08-13 10:02:14 UTC
Karolin, please pick for 3.4 and 3.5
Comment 10 Karolin Seeger 2010-08-16 00:28:03 UTC
Pushed to both branches.
Closing out bug report.

Comment 11 Björn Jacke 2010-10-07 06:59:17 UTC
*** Bug 7709 has been marked as a duplicate of this bug. ***
Comment 12 Timo Aaltonen 2010-10-19 09:00:51 UTC
This commit alone is not enough to make offline cache work after a reboot. Even though the cache is listed as valid, pam_winbind fails to find the user (and getent/wbinfo doesn't list anything either). Tested on 3.5.6 and this patch backported for 3.4.7. Should probably file a new bug?
Comment 13 Jeremy Allison 2010-10-19 11:26:23 UTC
Yes, can you open a new bug to track the problem you are seeing please. Not finding the user is a different problem.
Comment 14 Timo Aaltonen 2010-10-28 07:27:31 UTC
Thanks, filed bug 7760 https://bugzilla.samba.org/show_bug.cgi?id=7760