1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-25 17:57:42 +03:00

winbindd: Introduce helper function for winbindd_cache.tdb directory

Also add a comment why the file is placed in the state directory.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Aug 19 13:30:23 CEST 2016 on sn-devel-144
This commit is contained in:
Christof Schmitt 2016-08-18 14:01:50 -07:00 committed by Andreas Schneider
parent 5dd79dc128
commit be099e4f76

View File

@ -111,6 +111,15 @@ void (*smb_panic_fn)(const char *const why) = smb_panic;
static struct winbind_cache *wcache;
static char *wcache_path(void)
{
/*
* Data needs to be kept persistent in state directory for
* running with "winbindd offline logon".
*/
return state_path("winbindd_cache.tdb");
}
/* get the winbind_cache structure */
static struct winbind_cache *get_cache(struct winbindd_domain *domain)
{
@ -3195,7 +3204,7 @@ bool init_wcache(void)
if (wcache->tdb != NULL)
return true;
db_path = state_path("winbindd_cache.tdb");
db_path = wcache_path();
if (db_path == NULL) {
return false;
}
@ -3247,7 +3256,7 @@ bool initialize_winbindd_cache(void)
tdb_close(wcache->tdb);
wcache->tdb = NULL;
db_path = state_path("winbindd_cache.tdb");
db_path = wcache_path();
if (db_path == NULL) {
return false;
}
@ -3384,7 +3393,7 @@ void wcache_flush_cache(void)
return;
}
db_path = state_path("winbindd_cache.tdb");
db_path = wcache_path();
if (db_path == NULL) {
return;
}
@ -4281,7 +4290,7 @@ int winbindd_validate_cache(void)
DEBUG(10, ("winbindd_validate_cache: replacing panic function\n"));
smb_panic_fn = validate_panic;
tdb_path = state_path("winbindd_cache.tdb");
tdb_path = wcache_path();
if (tdb_path == NULL) {
goto done;
}
@ -4352,7 +4361,7 @@ int winbindd_validate_cache_nobackup(void)
DEBUG(10, ("winbindd_validate_cache: replacing panic function\n"));
smb_panic_fn = validate_panic;
tdb_path = state_path("winbindd_cache.tdb");
tdb_path = wcache_path();
if (tdb_path == NULL) {
goto err_panic_restore;
}