diff options
author | Michael Adam <obnox@samba.org> | 2007-06-26 13:45:07 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:23:36 -0500 |
commit | 7c48598e86da3cbc116fd1992127f13132bc3f8f (patch) | |
tree | 7d929e55490232f505ff618ffab6b1b49aec9344 /source3/nsswitch | |
parent | 75f6a458b5d62f2d07e5f5dc121c72b6f26d0f65 (diff) | |
download | samba-7c48598e86da3cbc116fd1992127f13132bc3f8f.tar.gz samba-7c48598e86da3cbc116fd1992127f13132bc3f8f.tar.bz2 samba-7c48598e86da3cbc116fd1992127f13132bc3f8f.zip |
r23610: Move some winbindd_cache specific flags and actions
back to winbindd_cache.c. The generic mechanism
should open the cache tdb readonly and with default
flags.
Michael
(This used to be commit 062d8c61294a1e9f8588fa8af31954dd286c7bde)
Diffstat (limited to 'source3/nsswitch')
-rw-r--r-- | source3/nsswitch/winbindd_cache.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/source3/nsswitch/winbindd_cache.c b/source3/nsswitch/winbindd_cache.c index 122432d95b..cfd182666e 100644 --- a/source3/nsswitch/winbindd_cache.c +++ b/source3/nsswitch/winbindd_cache.c @@ -3279,14 +3279,32 @@ static void validate_panic(const char *const why) int winbindd_validate_cache(void) { - int ret; + int ret = -1; + const char *tdb_path = lock_path("winbindd_cache.tdb"); + TDB_CONTEXT *tdb = NULL; DEBUG(10, ("winbindd_validate_cache: replacing panic function\n")); smb_panic_fn = validate_panic; + + tdb = tdb_open_log(tdb_path, + WINBINDD_CACHE_TDB_DEFAULT_HASH_SIZE, + ( lp_winbind_offline_logon() + ? TDB_DEFAULT + : TDB_DEFAULT | TDB_CLEAR_IF_FIRST ), + O_RDWR|O_CREAT, + 0600); + if (!tdb) { + DEBUG(0, ("winbindd_validate_cache: " + "error opening/initializing tdb\n")); + goto done; + } + tdb_close(tdb); + ret = tdb_validate(lock_path("winbindd_cache.tdb"), cache_traverse_validate_fn); +done: DEBUG(10, ("winbindd_validate_cache: restoring panic function\n")); smb_panic_fn = smb_panic; return ret; |