Handle nscd negtimeout==0

This commit is contained in:
Thorsten Kukuk 2011-07-01 22:53:01 -04:00 committed by Ulrich Drepper
parent 6d4d8e8eef
commit 445b4a53ea
6 changed files with 44 additions and 14 deletions

View File

@ -1,3 +1,11 @@
2011-07-01 Thorsten Kukuk <kukuk@suse.de>
* nscd/pwdcache.c (cache_addpw): Handle zero negtimeout.
* nscd/initgrcache.c (addinitgroupsX): Likewise.
* nscd/hstcache.c (cache_addhst): Likewise.
* nscd/grpcache.c (cache_addgr): Likewise.
* nscd/aicache.c (addhstaiX): Likewise
2011-07-01 Andreas Schwab <schwab@redhat.com>
* nis/nss_compat/compat-pwd.c (getpwent_next_nss_netgr): Query NIS

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;