summaryrefslogtreecommitdiff
path: root/nss/digits_dots.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-05-26 06:42:16 +0000
committerUlrich Drepper <drepper@redhat.com>2004-05-26 06:42:16 +0000
commit1773d1ba5fa4c82e3a609f11742e159039b01c24 (patch)
tree971c00b818979ef1463d669f9b724988360e8220 /nss/digits_dots.c
parentffdd5e50e18b0cb212acad135e421d932cf3d3a2 (diff)
downloadglibc-1773d1ba5fa4c82e3a609f11742e159039b01c24.tar.gz
Update.
2004-05-25 Ulrich Drepper <drepper@redhat.com> * nss/digits_dots.c (__nss_hostname_digits_dots): Remove typep and flags parameter, convert afp to simple int parameter. Adjust code. typep was never != NULL and flags therefore also unused. *afp is never modified. * nss/nsswitch.h: Adjust __nss_hostname_digits_dots prototype. * nss/getXXbyYY.c: Remove HAVE_TYPE handling. Adjust af parameter handling for __nss_hostname_digits_dots calls. * nss/getXXbyYY_r.c: Likewise. * elf/dl-load.c (_dl_map_object_from_fd): Map DSOs with MAP_DENYWRITE.
Diffstat (limited to 'nss/digits_dots.c')
-rw-r--r--nss/digits_dots.c84
1 files changed, 22 insertions, 62 deletions
diff --git a/nss/digits_dots.c b/nss/digits_dots.c
index 4dc897c32c..17207945b9 100644
--- a/nss/digits_dots.c
+++ b/nss/digits_dots.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by H.J. Lu <hjl@gnu.ai.mit.edu>, 1997.
@@ -37,8 +37,7 @@ int
__nss_hostname_digits_dots (const char *name, struct hostent *resbuf,
char **buffer, size_t *buffer_size,
size_t buflen, struct hostent **result,
- enum nss_status *status, int *typep,
- int flags, int *afp, int *h_errnop)
+ enum nss_status *status, int af, int *h_errnop)
{
int save;
@@ -67,14 +66,6 @@ __nss_hostname_digits_dots (const char *name, struct hostent *resbuf,
char **h_alias_ptr;
size_t size_needed;
int addr_size;
- int af;
-
- if (typep != NULL)
- af = *typep;
- else if (afp != NULL)
- af = *afp;
- else
- af = -1;
switch (af)
{
@@ -87,18 +78,8 @@ __nss_hostname_digits_dots (const char *name, struct hostent *resbuf,
break;
default:
- if (typep != NULL)
- {
- /* This must not happen. */
- if (h_errnop != NULL)
- *h_errnop = HOST_NOT_FOUND;
- goto done;
- }
- else
- {
- af = (_res.options & RES_USE_INET6) ? AF_INET6 : AF_INET;
- addr_size = af == AF_INET6 ? IN6ADDRSZ : INADDRSZ;
- }
+ af = (_res.options & RES_USE_INET6) ? AF_INET6 : AF_INET;
+ addr_size = af == AF_INET6 ? IN6ADDRSZ : INADDRSZ;
break;
}
@@ -180,38 +161,25 @@ __nss_hostname_digits_dots (const char *name, struct hostent *resbuf,
(*h_addr_ptrs)[0] = (char *) host_addr;
(*h_addr_ptrs)[1] = NULL;
resbuf->h_addr_list = *h_addr_ptrs;
- if ((typep != NULL && *typep == AF_INET6)
- || (af == AF_INET
- && (_res.options & RES_USE_INET6)))
+ if (af == AF_INET && (_res.options & RES_USE_INET6))
{
- if (typep != NULL && (flags & AI_V4MAPPED) == 0)
- {
- /* That's bad. The user hasn't specified that she
- allows IPv4 numeric addresses. */
- *result = NULL;
- *h_errnop = HOST_NOT_FOUND;
- goto done;
- }
- else
- {
- /* We need to change the IP v4 address into the
- IP v6 address. */
- char tmp[INADDRSZ];
- char *p = (char *) host_addr;
- int i;
-
- /* Save a copy of the IP v4 address. */
- memcpy (tmp, host_addr, INADDRSZ);
- /* Mark this ipv6 addr as a mapped ipv4. */
- for (i = 0; i < 10; i++)
- *p++ = 0x00;
- *p++ = 0xff;
- *p++ = 0xff;
- /* Copy the IP v4 address. */
- memcpy (p, tmp, INADDRSZ);
- resbuf->h_addrtype = AF_INET6;
- resbuf->h_length = IN6ADDRSZ;
- }
+ /* We need to change the IP v4 address into the
+ IP v6 address. */
+ char tmp[INADDRSZ];
+ char *p = (char *) host_addr;
+ int i;
+
+ /* Save a copy of the IP v4 address. */
+ memcpy (tmp, host_addr, INADDRSZ);
+ /* Mark this ipv6 addr as a mapped ipv4. */
+ for (i = 0; i < 10; i++)
+ *p++ = 0x00;
+ *p++ = 0xff;
+ *p++ = 0xff;
+ /* Copy the IP v4 address. */
+ memcpy (p, tmp, INADDRSZ);
+ resbuf->h_addrtype = AF_INET6;
+ resbuf->h_length = IN6ADDRSZ;
}
else
{
@@ -242,14 +210,6 @@ __nss_hostname_digits_dots (const char *name, struct hostent *resbuf,
host_addr_list_t *h_addr_ptrs;
size_t size_needed;
int addr_size;
- int af;
-
- if (typep != NULL)
- af = *typep;
- else if (afp != NULL)
- af = *afp;
- else
- af = -1;
switch (af)
{