* nscd/hstcache.c (cache_addhst): When reloading an entry which
	suddenly has two or more addresses, ignore it and remove the old
	entry.
This commit is contained in:
Ulrich Drepper 2007-08-22 03:30:02 +00:00
parent 1ce7d80ddc
commit c44d3bdf14
2 changed files with 23 additions and 12 deletions

View File

@ -1,5 +1,10 @@
2007-08-21 Ulrich Drepper <drepper@redhat.com> 2007-08-21 Ulrich Drepper <drepper@redhat.com>
[BZ #4905]
* nscd/hstcache.c (cache_addhst): When reloading an entry which
suddenly has two or more addresses, ignore it and remove the old
entry.
[BZ #4814] [BZ #4814]
* resolv/res_hconf.c: Prepare for compiling outside libc. * resolv/res_hconf.c: Prepare for compiling outside libc.
* nscd/res_hconf.c: New file. * nscd/res_hconf.c: New file.

View File

@ -298,25 +298,31 @@ cache_addhst (struct database_dyn *db, int fd, request_header *req,
/* The data has not changed. We will just bump the /* The data has not changed. We will just bump the
timeout value. Note that the new record has been timeout value. Note that the new record has been
allocated on the stack and need not be freed. */ allocated on the stack and need not be freed. */
assert (h_addr_list_cnt == 1);
dh->timeout = dataset->head.timeout; dh->timeout = dataset->head.timeout;
++dh->nreloads; ++dh->nreloads;
} }
else else
{ {
/* We have to create a new record. Just allocate if (h_addr_list_cnt == 1)
appropriate memory and copy it. */
struct dataset *newp
= (struct dataset *) mempool_alloc (db, total + req->key_len);
if (newp != NULL)
{ {
/* Adjust pointers into the memory block. */ /* We have to create a new record. Just allocate
addresses = (char *) newp + (addresses - (char *) dataset); appropriate memory and copy it. */
aliases = (char *) newp + (aliases - (char *) dataset); struct dataset *newp
assert (key_copy != NULL); = (struct dataset *) mempool_alloc (db,
key_copy = (char *) newp + (key_copy - (char *) dataset); total + req->key_len);
if (newp != NULL)
{
/* Adjust pointers into the memory block. */
addresses = (char *) newp + (addresses
- (char *) dataset);
aliases = (char *) newp + (aliases - (char *) dataset);
assert (key_copy != NULL);
key_copy = (char *) newp + (key_copy - (char *) dataset);
dataset = memcpy (newp, dataset, total + req->key_len); dataset = memcpy (newp, dataset, total + req->key_len);
alloca_used = false; alloca_used = false;
}
} }
/* Mark the old record as obsolete. */ /* Mark the old record as obsolete. */