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
static struct winbind_cache *wcache;
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)
{
/* get the winbind_cache structure */
static struct winbind_cache *get_cache(struct winbindd_domain *domain)
{
if (wcache->tdb != NULL)
return true;
if (wcache->tdb != NULL)
return true;
- db_path = state_path("winbindd_cache.tdb");
+ db_path = wcache_path();
if (db_path == NULL) {
return false;
}
if (db_path == NULL) {
return false;
}
tdb_close(wcache->tdb);
wcache->tdb = NULL;
tdb_close(wcache->tdb);
wcache->tdb = NULL;
- db_path = state_path("winbindd_cache.tdb");
+ db_path = wcache_path();
if (db_path == NULL) {
return false;
}
if (db_path == NULL) {
return false;
}
- db_path = state_path("winbindd_cache.tdb");
+ db_path = wcache_path();
if (db_path == NULL) {
return;
}
if (db_path == NULL) {
return;
}
DEBUG(10, ("winbindd_validate_cache: replacing panic function\n"));
smb_panic_fn = validate_panic;
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;
}
if (tdb_path == NULL) {
goto done;
}
DEBUG(10, ("winbindd_validate_cache: replacing panic function\n"));
smb_panic_fn = validate_panic;
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;
}
if (tdb_path == NULL) {
goto err_panic_restore;
}