summaryrefslogtreecommitdiff
path: root/nscd
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-08-26 08:40:21 +0000
committerUlrich Drepper <drepper@redhat.com>2002-08-26 08:40:21 +0000
commit26c91f01faeedc6152ac4c43454420ed221e5651 (patch)
tree94848f3f9f1afc950cc35ae2525ee608c9ed638f /nscd
parent442685a8ba011460eb27ad83855d05c9c9345aa6 (diff)
downloadglibc-26c91f01faeedc6152ac4c43454420ed221e5651.tar.gz
Update.
* nscd/hstcache.c (cache_addhst): Add new parameter saying whether entry was for getaddr* lookup or not. Add only matching cache entry. Change all callers [PR libc/4317]. * libio/bug-rewind.c: Fix creation of temp file.
Diffstat (limited to 'nscd')
-rw-r--r--nscd/hstcache.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/nscd/hstcache.c b/nscd/hstcache.c
index 8866293b6c..dd8fc59f61 100644
--- a/nscd/hstcache.c
+++ b/nscd/hstcache.c
@@ -89,7 +89,7 @@ struct hostdata
static void
cache_addhst (struct database *db, int fd, request_header *req, void *key,
- struct hostent *hst, uid_t owner)
+ struct hostent *hst, uid_t owner, int add_addr)
{
ssize_t total;
ssize_t written;
@@ -219,7 +219,7 @@ cache_addhst (struct database *db, int fd, request_header *req, void *key,
handle and it is more than questionable whether it is
worthwhile complicating the cache handling just for handling
such a special case. */
- if (hst->h_addr_list[1] == NULL)
+ if (!add_addr && hst->h_addr_list[1] == NULL)
for (cnt = 0; cnt < h_aliases_cnt; ++cnt)
{
if (addr_list_type == GETHOSTBYADDR)
@@ -233,15 +233,16 @@ cache_addhst (struct database *db, int fd, request_header *req, void *key,
}
/* Next the normal addresses. */
- for (cnt = 0; cnt < h_addr_list_cnt; ++cnt)
- {
- cache_add (addr_list_type, addresses, hst->h_length, data, total,
- data, 0, t, db, owner);
- addresses += hst->h_length;
- }
+ if (add_addr)
+ for (cnt = 0; cnt < h_addr_list_cnt; ++cnt)
+ {
+ cache_add (addr_list_type, addresses, hst->h_length, data, total,
+ data, 0, t, db, owner);
+ addresses += hst->h_length;
+ }
/* If necessary the IPv6 addresses. */
- if (addr_list_type == GETHOSTBYADDR)
+ if (add_addr && addr_list_type == GETHOSTBYADDR)
for (cnt = 0; cnt < h_addr_list_cnt; ++cnt)
{
cache_add (GETHOSTBYADDRv6, addresses, IN6ADDRSZ, data, total,
@@ -251,7 +252,7 @@ cache_addhst (struct database *db, int fd, request_header *req, void *key,
/* Avoid adding names if more than one address is available. See
above for more info. */
- if (hst->h_addr_list[1] == NULL)
+ if (!add_addr && hst->h_addr_list[1] == NULL)
{
/* If necessary add the key for this request. */
if (req->type == GETHOSTBYNAME || req->type == GETHOSTBYNAMEv6)
@@ -349,7 +350,7 @@ addhstbyname (struct database *db, int fd, request_header *req,
if (secure[hstdb])
seteuid (oldeuid);
- cache_addhst (db, fd, req, key, hst, uid);
+ cache_addhst (db, fd, req, key, hst, uid, 0);
if (use_malloc)
free (buffer);
@@ -426,7 +427,7 @@ addhstbyaddr (struct database *db, int fd, request_header *req,
if (secure[hstdb])
seteuid (oldeuid);
- cache_addhst (db, fd, req, key, hst, uid);
+ cache_addhst (db, fd, req, key, hst, uid, 1);
if (use_malloc)
free (buffer);
@@ -504,7 +505,7 @@ addhstbynamev6 (struct database *db, int fd, request_header *req,
if (secure[hstdb])
seteuid (oldeuid);
- cache_addhst (db, fd, req, key, hst, uid);
+ cache_addhst (db, fd, req, key, hst, uid, 0);
if (use_malloc)
free (buffer);
@@ -581,7 +582,7 @@ addhstbyaddrv6 (struct database *db, int fd, request_header *req,
if (secure[hstdb])
seteuid (oldeuid);
- cache_addhst (db, fd, req, key, hst, uid);
+ cache_addhst (db, fd, req, key, hst, uid, 1);
if (use_malloc)
free (buffer);