diff options
author | Ulrich Drepper <drepper@redhat.com> | 2000-01-19 00:10:36 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2000-01-19 00:10:36 +0000 |
commit | 9e56c380bce196b1e66fbed5c6684776f86307db (patch) | |
tree | 8fa1cea6d81742d3a993ec3626b0780f6fd011cc /nscd/hstcache.c | |
parent | c7e85d0c08ccbfc7604f6d50579c3a4b25281ff1 (diff) | |
download | glibc-9e56c380bce196b1e66fbed5c6684776f86307db.zip glibc-9e56c380bce196b1e66fbed5c6684776f86307db.tar.gz glibc-9e56c380bce196b1e66fbed5c6684776f86307db.tar.bz2 |
Update.
* nscd/connections.c (dbs): Use
PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP for .lock.
Pretty printing.
* nscd/hstcache.c (cache_addhst): Don't automatically add IPv6
address. Suggested by Philip Blundell.
Diffstat (limited to 'nscd/hstcache.c')
-rw-r--r-- | nscd/hstcache.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/nscd/hstcache.c b/nscd/hstcache.c index b8a80af..a2f8115a 100644 --- a/nscd/hstcache.c +++ b/nscd/hstcache.c @@ -1,5 +1,5 @@ /* Cache handling for host lookup. - Copyright (C) 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -30,13 +30,11 @@ #include <unistd.h> #include <libintl.h> #include <arpa/inet.h> +#include <arpa/nameser.h> #include "nscd.h" #include "dbg_log.h" -/* Get implementation for some internal functions. */ -#include "../resolv/mapv4v6addr.h" - /* This is the standard reply in case the service is disabled. */ static const hst_response_header disabled = @@ -160,8 +158,8 @@ cache_addhst (struct database *db, int fd, request_header *req, void *key, + h_name_len + h_aliases_cnt * sizeof (size_t) + h_addr_list_cnt * (hst->h_length - + (hst->h_length == INADDRSZ - ? IN6ADDRSZ : 0))); + + (hst->h_length == NS_INADDRSZ + ? NS_IN6ADDRSZ : 0))); data = (struct hostdata *) malloc (total + req->key_len); if (data == NULL) @@ -186,14 +184,6 @@ cache_addhst (struct database *db, int fd, request_header *req, void *key, for (cnt = 0; cnt < h_addr_list_cnt; ++cnt) cp = mempcpy (cp, hst->h_addr_list[cnt], hst->h_length); - /* And the generated IPv6 addresses if necessary. */ - if (hst->h_length == INADDRSZ) - { - /* Generate the IPv6 addresses. */ - for (cnt = 0; cnt < h_addr_list_cnt; cp += IN6ADDRSZ, ++cnt) - map_v4v6_address (hst->h_addr_list[cnt], cp); - } - /* Then the aliases. */ aliases = cp; for (cnt = 0; cnt < h_aliases_cnt; ++cnt) @@ -214,7 +204,7 @@ cache_addhst (struct database *db, int fd, request_header *req, void *key, unnecessarily let the receiver wait. */ written = write (fd, data, total); - addr_list_type = (hst->h_length == INADDRSZ + addr_list_type = (hst->h_length == NS_INADDRSZ ? GETHOSTBYADDR : GETHOSTBYADDRv6); /* Compute the timeout time. */ @@ -349,7 +339,7 @@ addhstbyaddr (struct database *db, int fd, request_header *req, seteuid (uid); } - while (__gethostbyaddr_r (key, INADDRSZ, AF_INET, &resultbuf, buffer, + while (__gethostbyaddr_r (key, NS_INADDRSZ, AF_INET, &resultbuf, buffer, buflen, &hst, &h_errno) != 0 && h_errno == NETDB_INTERNAL && errno == ERANGE) @@ -438,7 +428,7 @@ addhstbyaddrv6 (struct database *db, int fd, request_header *req, seteuid (uid); } - while (__gethostbyaddr_r (key, IN6ADDRSZ, AF_INET6, &resultbuf, + while (__gethostbyaddr_r (key, NS_IN6ADDRSZ, AF_INET6, &resultbuf, buffer, buflen, &hst, &h_errno) != 0 && h_errno == NETDB_INTERNAL && errno == ERANGE) |