summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-07-11 17:44:15 +0200
committerVolker Lendecke <vl@samba.org>2008-07-11 17:53:25 +0200
commitcc78ea5d09f2d8e338f0626fb1215f06ee7e1bbe (patch)
treefabc4fc675c19819962cb06121428ccecd103c04
parentd670d0a09bec3b6900421df17fc9d959545ee953 (diff)
downloadsamba-cc78ea5d09f2d8e338f0626fb1215f06ee7e1bbe.tar.gz
samba-cc78ea5d09f2d8e338f0626fb1215f06ee7e1bbe.tar.bz2
samba-cc78ea5d09f2d8e338f0626fb1215f06ee7e1bbe.zip
Revert "Return timed out entries from gencache_get if timeout param != NULL"
This reverts commit 2954b2be563149380e1fae7fe088b98d6cbd42e7. (This used to be commit 77ab2fb306a7ad59447a3e1591c2af03447e09c5)
-rw-r--r--source3/lib/gencache.c25
-rw-r--r--source3/utils/net_cache.c3
2 files changed, 11 insertions, 17 deletions
diff --git a/source3/lib/gencache.c b/source3/lib/gencache.c
index 1b4342a62b..b773f83c58 100644
--- a/source3/lib/gencache.c
+++ b/source3/lib/gencache.c
@@ -166,16 +166,15 @@ bool gencache_del(const char *keystr)
*
* @param keystr string that represents a key of this entry
* @param valstr buffer that is allocated and filled with the entry value
- * buffer's disposing must be done outside
- * @param timeout If == NULL, the caller is not interested in timed out
- * entries. If != NULL, return the timeout timestamp, the
- * caller must figure out itself if this entry is timed out.
+ * buffer's disposing must be done outside
+ * @param timeout pointer to a time_t that is filled with entry's
+ * timeout
*
* @retval true when entry is successfuly fetched
* @retval False for failure
**/
-bool gencache_get(const char *keystr, char **valstr, time_t *ptimeout)
+bool gencache_get(const char *keystr, char **valstr, time_t *timeout)
{
TDB_DATA databuf;
time_t t;
@@ -208,13 +207,9 @@ bool gencache_get(const char *keystr, char **valstr, time_t *ptimeout)
"timeout = %s", t > time(NULL) ? "valid" :
"expired", keystr, endptr+1, ctime(&t)));
- if ((t <= time(NULL)) && (ptimeout == NULL)) {
-
- /*
- * The entry is expired, and the caller isn't interested in
- * timed out ones. Delete it.
- */
+ if (t <= time(NULL)) {
+ /* We're expired, delete the entry */
tdb_delete_bystring(cache, keystr);
SAFE_FREE(databuf.dptr);
@@ -229,15 +224,15 @@ bool gencache_get(const char *keystr, char **valstr, time_t *ptimeout)
return False;
}
}
-
+
SAFE_FREE(databuf.dptr);
- if (ptimeout) {
- *ptimeout = t;
+ if (timeout) {
+ *timeout = t;
}
return True;
-}
+}
/**
* Get existing entry from the cache file.
diff --git a/source3/utils/net_cache.c b/source3/utils/net_cache.c
index 21fcc9155d..4e9ae18c0d 100644
--- a/source3/utils/net_cache.c
+++ b/source3/utils/net_cache.c
@@ -225,8 +225,7 @@ static int net_cache_get(struct net_context *c, int argc, const char **argv)
return -1;
}
- if (gencache_get(keystr, &valuestr, &timeout)
- && (timeout > time(NULL))) {
+ if (gencache_get(keystr, &valuestr, &timeout)) {
print_cache_entry(keystr, valuestr, timeout, NULL);
return 0;
}