aboutsummaryrefslogtreecommitdiff
path: root/nscd
diff options
context:
space:
mode:
Diffstat (limited to 'nscd')
-rw-r--r--nscd/aicache.c10
-rw-r--r--nscd/grpcache.c10
-rw-r--r--nscd/hstcache.c10
-rw-r--r--nscd/initgrcache.c10
-rw-r--r--nscd/pwdcache.c10
5 files changed, 36 insertions, 14 deletions
diff --git a/nscd/aicache.c b/nscd/aicache.c
index 6c8d83a..b136921 100644
--- a/nscd/aicache.c
+++ b/nscd/aicache.c
@@ -511,9 +511,15 @@ next_nip:
if (fd != -1)
TEMP_FAILURE_RETRY (send (fd, &notfound, total, MSG_NOSIGNAL));
- dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len, 1);
/* If we cannot permanently store the result, so be it. */
- if (dataset != NULL)
+ if (db->negtimeout == 0)
+ {
+ /* Mark the old entry as obsolete. */
+ if (dh != NULL)
+ dh->usable = false;
+ dataset = NULL;
+ }
+ else if ((dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len, 1)) != NULL)
{
dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
dataset->head.recsize = total;
diff --git a/nscd/grpcache.c b/nscd/grpcache.c
index 0e7f81f..8a2f80c 100644
--- a/nscd/grpcache.c
+++ b/nscd/grpcache.c
@@ -118,10 +118,14 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req,
written = TEMP_FAILURE_RETRY (send (fd, &notfound, total,
MSG_NOSIGNAL));
- dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len,
- 1);
/* If we cannot permanently store the result, so be it. */
- if (dataset != NULL)
+ if (db->negtimeout == 0)
+ {
+ /* Mark the old entry as obsolete. */
+ if (dh != NULL)
+ dh->usable = false;
+ }
+ else if ((dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len, 1)) != NULL)
{
dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
dataset->head.recsize = total;
diff --git a/nscd/hstcache.c b/nscd/hstcache.c
index 1ab5860..1f09c0b 100644
--- a/nscd/hstcache.c
+++ b/nscd/hstcache.c
@@ -141,10 +141,14 @@ cache_addhst (struct database_dyn *db, int fd, request_header *req,
MSG_NOSIGNAL)) != total)
all_written = false;
- dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len,
- 1);
/* If we cannot permanently store the result, so be it. */
- if (dataset != NULL)
+ if (db->negtimeout == 0)
+ {
+ /* Mark the old entry as obsolete. */
+ if (dh != NULL)
+ dh->usable = false;
+ }
+ else if ((dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len, 1)) != NULL)
{
dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
dataset->head.recsize = total;
diff --git a/nscd/initgrcache.c b/nscd/initgrcache.c
index 8cb6cf1..7fd564d 100644
--- a/nscd/initgrcache.c
+++ b/nscd/initgrcache.c
@@ -202,10 +202,14 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req,
written = TEMP_FAILURE_RETRY (send (fd, &notfound, total,
MSG_NOSIGNAL));
- dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len,
- 1);
/* If we cannot permanently store the result, so be it. */
- if (dataset != NULL)
+ if (db->negtimeout == 0)
+ {
+ /* Mark the old entry as obsolete. */
+ if (dh != NULL)
+ dh->usable = false;
+ }
+ else if ((dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len, 1)) != NULL)
{
dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
dataset->head.recsize = total;
diff --git a/nscd/pwdcache.c b/nscd/pwdcache.c
index 47b8052..94e1c52 100644
--- a/nscd/pwdcache.c
+++ b/nscd/pwdcache.c
@@ -124,10 +124,14 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req,
written = TEMP_FAILURE_RETRY (send (fd, &notfound, total,
MSG_NOSIGNAL));
- dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len,
- 1);
/* If we cannot permanently store the result, so be it. */
- if (dataset != NULL)
+ if (db->negtimeout == 0)
+ {
+ /* Mark the old entry as obsolete. */
+ if (dh != NULL)
+ dh->usable = false;
+ }
+ else if ((dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len, 1)) != NULL)
{
dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
dataset->head.recsize = total;