static int stabilize_fn(struct tdb_context *tdb, TDB_DATA key, TDB_DATA val,
void *priv);
-static int wipe_fn(struct tdb_context *tdb, TDB_DATA key, TDB_DATA val,
- void *priv);
-
/**
* Stabilize gencache
*
return false;
}
- res = tdb_traverse(cache_notrans->tdb, wipe_fn, NULL);
+ res = tdb_wipe_all(cache_notrans->tdb);
if (res < 0) {
- DEBUG(10, ("tdb_traverse with wipe_fn on gencache_notrans.tdb "
- "failed: %s\n",
- tdb_errorstr(cache_notrans->tdb)));
- tdb_unlockall(cache_notrans->tdb);
- return false;
- }
-
- res = tdb_unlockall(cache_notrans->tdb);
- if (res != 0) {
- DEBUG(10, ("tdb_unlockall on gencache.tdb failed: "
- "%s\n", tdb_errorstr(cache->tdb)));
- return false;
+ DBG_DEBUG("tdb_wipe_all on gencache_notrans.tdb failed: %s\n",
+ tdb_errorstr(cache_notrans->tdb));
}
now = talloc_asprintf(talloc_tos(), "%d", (int)time(NULL));
TALLOC_FREE(now);
}
+ res = tdb_unlockall(cache_notrans->tdb);
+ if (res != 0) {
+ DEBUG(10, ("tdb_unlockall on gencache.tdb failed: "
+ "%s\n", tdb_errorstr(cache->tdb)));
+ return false;
+ }
+
return true;
}
return 0;
}
-static int wipe_fn(struct tdb_context *tdb, TDB_DATA key, TDB_DATA val,
- void *priv)
-{
- int res;
- bool ok;
- time_t timeout;
-
- res = tdb_data_cmp(key, last_stabilize_key());
- if (res == 0) {
- return 0;
- }
-
- ok = gencache_pull_timeout(val.dptr, &timeout, NULL);
- if (!ok) {
- DEBUG(10, ("Ignoring invalid entry\n"));
- return 0;
- }
-
- res = tdb_delete(tdb, key);
- if (res != 0) {
- DEBUG(10, ("tdb_delete from gencache_notrans.tdb failed: "
- "%s\n", tdb_errorstr(cache_notrans->tdb)));
- return -1;
- }
-
- return 0;
-}
-
-
/**
* Get existing entry from the cache file.
*