summaryrefslogtreecommitdiffstats
path: root/server/responder/nss/nsssrv_cmd.c
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2009-10-24 13:36:34 -0400
committerStephen Gallagher <sgallagh@redhat.com>2009-10-27 10:42:12 -0400
commit3a21103f61bf9b60256cc2d0da54b757b634319f (patch)
treec958e19a991e8d6b9c6e3dbe0cc4f62e4ad425b2 /server/responder/nss/nsssrv_cmd.c
parentee633d9fe3b48a88387edab7978bb16422525d21 (diff)
downloadsssd-3a21103f61bf9b60256cc2d0da54b757b634319f.tar.gz
sssd-3a21103f61bf9b60256cc2d0da54b757b634319f.tar.xz
sssd-3a21103f61bf9b60256cc2d0da54b757b634319f.zip
Move responsibility for entry expiration timeout
The providers are now responsible for determining how long a cached entry is considered valid. The default is the same as before (600s)
Diffstat (limited to 'server/responder/nss/nsssrv_cmd.c')
-rw-r--r--server/responder/nss/nsssrv_cmd.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/server/responder/nss/nsssrv_cmd.c b/server/responder/nss/nsssrv_cmd.c
index ebfd1d562..3d4226fbe 100644
--- a/server/responder/nss/nsssrv_cmd.c
+++ b/server/responder/nss/nsssrv_cmd.c
@@ -281,6 +281,7 @@ static errno_t check_cache(struct nss_dom_ctx *dctx,
int refresh_timeout;
time_t now;
uint64_t lastUpdate;
+ uint64_t cacheExpire;
struct nss_cmd_ctx *cmdctx = dctx->cmdctx;
struct cli_ctx *cctx = cmdctx->cctx;
bool call_provider = false;
@@ -297,13 +298,14 @@ static errno_t check_cache(struct nss_dom_ctx *dctx,
} else if ((req_type == SSS_DP_GROUP) ||
((req_type == SSS_DP_USER) && (res->count == 1))) {
- timeout = nctx->cache_timeout;
refresh_timeout = nctx->cache_refresh_timeout;
now = time(NULL);
lastUpdate = ldb_msg_find_attr_as_uint64(res->msgs[0],
SYSDB_LAST_UPDATE, 0);
- if (lastUpdate + timeout < now) {
+ cacheExpire = ldb_msg_find_attr_as_uint64(res->msgs[0],
+ SYSDB_CACHE_EXPIRE, 0);
+ if (cacheExpire < now) {
/* This is a cache miss. We need to get the updated user
* information before returning it.
*/
@@ -2906,7 +2908,7 @@ static void nss_cmd_getinit_callback(void *ptr, int status,
struct sysdb_ctx *sysdb;
struct nss_ctx *nctx;
int timeout;
- uint64_t lastUpdate;
+ uint64_t cacheExpire;
uint8_t *body;
size_t blen;
bool call_provider = false;
@@ -2932,11 +2934,9 @@ static void nss_cmd_getinit_callback(void *ptr, int status,
break;
case 1:
- timeout = nctx->cache_timeout;
-
- lastUpdate = ldb_msg_find_attr_as_uint64(res->msgs[0],
- SYSDB_LAST_UPDATE, 0);
- if (lastUpdate + timeout < time(NULL)) {
+ cacheExpire = ldb_msg_find_attr_as_uint64(res->msgs[0],
+ SYSDB_CACHE_EXPIRE, 0);
+ if (cacheExpire < time(NULL)) {
call_provider = true;
}
break;