summaryrefslogtreecommitdiff
path: root/nss
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
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')
-rw-r--r--nss/digits_dots.c84
-rw-r--r--nss/getXXbyYY.c15
-rw-r--r--nss/getXXbyYY_r.c12
-rw-r--r--nss/nsswitch.h6
4 files changed, 32 insertions, 85 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)
{
diff --git a/nss/getXXbyYY.c b/nss/getXXbyYY.c
index 6ec9097c04..854a3e859b 100644
--- a/nss/getXXbyYY.c
+++ b/nss/getXXbyYY.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2001,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2001,2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -66,15 +66,10 @@
# define H_ERRNO_VAR_P NULL
#endif
-#ifndef HAVE_TYPE
-# define TYPE_VAR_P NULL
-# define FLAGS_VAR 0
-#endif
-
#ifdef HAVE_AF
-# define AF_VAR_P &af
+# define AF_VAL af
#else
-# define AF_VAR_P NULL
+# define AF_VAL AF_INET
#endif
/* Prototype for reentrant version we use here. */
@@ -112,9 +107,7 @@ FUNCTION_NAME (ADD_PARAMS)
if (buffer != NULL)
{
if (__nss_hostname_digits_dots (name, &resbuf, &buffer,
- &buffer_size,
- 0, &result, NULL, TYPE_VAR_P,
- FLAGS_VAR, AF_VAR_P,
+ &buffer_size, 0, &result, NULL, AF_VAL,
H_ERRNO_VAR_P))
goto done;
}
diff --git a/nss/getXXbyYY_r.c b/nss/getXXbyYY_r.c
index b17f33c8e0..6338aa5905 100644
--- a/nss/getXXbyYY_r.c
+++ b/nss/getXXbyYY_r.c
@@ -99,15 +99,10 @@
# define H_ERRNO_VAR_P NULL
#endif
-#ifndef HAVE_TYPE
-# define TYPE_VAR_P NULL
-# define FLAGS_VAR 0
-#endif
-
#ifdef HAVE_AF
-# define AF_VAR_P &af
+# define AF_VAL af
#else
-# define AF_VAR_P NULL
+# define AF_VAL AF_INET
#endif
/* Type of the lookup function we need here. */
@@ -151,8 +146,7 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
#ifdef HANDLE_DIGITS_DOTS
switch (__nss_hostname_digits_dots (name, resbuf, &buffer, NULL,
- buflen, result, &status,
- TYPE_VAR_P, FLAGS_VAR, AF_VAR_P,
+ buflen, result, &status, AF_VAL,
H_ERRNO_VAR_P))
{
case -1:
diff --git a/nss/nsswitch.h b/nss/nsswitch.h
index c419708d1d..96568c69a6 100644
--- a/nss/nsswitch.h
+++ b/nss/nsswitch.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-1999,2001,2002,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1996-1999,2001,2002,2003,2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -172,8 +172,8 @@ extern 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);
libc_hidden_proto (__nss_hostname_digits_dots)
#endif /* nsswitch.h */