* 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.
This commit is contained in:
Ulrich Drepper 2002-08-26 08:40:21 +00:00
parent 442685a8ba
commit 26c91f01fa
2 changed files with 21 additions and 14 deletions

View file

@ -1,10 +1,16 @@
2002-08-26 Ulrich Drepper <drepper@redhat.com> 2002-08-26 Ulrich Drepper <drepper@redhat.com>
* 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/wfileops.c (_IO_wfile_seekoff): Set fp->_offset after * libio/wfileops.c (_IO_wfile_seekoff): Set fp->_offset after
finding the read position [PR libc/4265]. finding the read position [PR libc/4265].
* libio/Makefile (tests): Add bug-rewind2. * libio/Makefile (tests): Add bug-rewind2.
* libio/bug-rewind2.c: New file. * libio/bug-rewind2.c: New file.
* libio/bug-rewind.c: Fix creation of temp file.
2002-08-25 Ulrich Drepper <drepper@redhat.com> 2002-08-25 Ulrich Drepper <drepper@redhat.com>
* nss/getXXbyYY_r.c (REENTRANT_NAME): Return ENOENT if status is * nss/getXXbyYY_r.c (REENTRANT_NAME): Return ENOENT if status is

View file

@ -89,7 +89,7 @@ struct hostdata
static void static void
cache_addhst (struct database *db, int fd, request_header *req, void *key, 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 total;
ssize_t written; 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 handle and it is more than questionable whether it is
worthwhile complicating the cache handling just for handling worthwhile complicating the cache handling just for handling
such a special case. */ 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) for (cnt = 0; cnt < h_aliases_cnt; ++cnt)
{ {
if (addr_list_type == GETHOSTBYADDR) 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. */ /* Next the normal addresses. */
for (cnt = 0; cnt < h_addr_list_cnt; ++cnt) 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); cache_add (addr_list_type, addresses, hst->h_length, data, total,
addresses += hst->h_length; data, 0, t, db, owner);
} addresses += hst->h_length;
}
/* If necessary the IPv6 addresses. */ /* 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) for (cnt = 0; cnt < h_addr_list_cnt; ++cnt)
{ {
cache_add (GETHOSTBYADDRv6, addresses, IN6ADDRSZ, data, total, 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 /* Avoid adding names if more than one address is available. See
above for more info. */ 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 necessary add the key for this request. */
if (req->type == GETHOSTBYNAME || req->type == GETHOSTBYNAMEv6) if (req->type == GETHOSTBYNAME || req->type == GETHOSTBYNAMEv6)
@ -349,7 +350,7 @@ addhstbyname (struct database *db, int fd, request_header *req,
if (secure[hstdb]) if (secure[hstdb])
seteuid (oldeuid); seteuid (oldeuid);
cache_addhst (db, fd, req, key, hst, uid); cache_addhst (db, fd, req, key, hst, uid, 0);
if (use_malloc) if (use_malloc)
free (buffer); free (buffer);
@ -426,7 +427,7 @@ addhstbyaddr (struct database *db, int fd, request_header *req,
if (secure[hstdb]) if (secure[hstdb])
seteuid (oldeuid); seteuid (oldeuid);
cache_addhst (db, fd, req, key, hst, uid); cache_addhst (db, fd, req, key, hst, uid, 1);
if (use_malloc) if (use_malloc)
free (buffer); free (buffer);
@ -504,7 +505,7 @@ addhstbynamev6 (struct database *db, int fd, request_header *req,
if (secure[hstdb]) if (secure[hstdb])
seteuid (oldeuid); seteuid (oldeuid);
cache_addhst (db, fd, req, key, hst, uid); cache_addhst (db, fd, req, key, hst, uid, 0);
if (use_malloc) if (use_malloc)
free (buffer); free (buffer);
@ -581,7 +582,7 @@ addhstbyaddrv6 (struct database *db, int fd, request_header *req,
if (secure[hstdb]) if (secure[hstdb])
seteuid (oldeuid); seteuid (oldeuid);
cache_addhst (db, fd, req, key, hst, uid); cache_addhst (db, fd, req, key, hst, uid, 1);
if (use_malloc) if (use_malloc)
free (buffer); free (buffer);