glibc/resolv/res_query.c

716 lines
21 KiB
C
Raw Normal View History

1995-02-18 02:27:10 +01:00
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
*
1995-02-18 02:27:10 +01:00
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
1995-02-18 02:27:10 +01:00
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
*/
/*
1995-02-18 02:27:10 +01:00
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
1995-02-18 02:27:10 +01:00
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
1995-02-18 02:27:10 +01:00
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
*/
/*
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
1995-02-18 02:27:10 +01:00
*/
#include <assert.h>
Update. Wed Aug 14 21:36:16 1996 Ulrich Drepper <drepper@cygnus.com> * stdlib/strtod.c (STRTOD): Correct assertion about size of wint_t and wchar_t. Reported by David Mosberger-Tang. Mon Aug 12 22:40:16 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * elf/dl-lookup.c (_dl_lookup_symbol): Remove fifth parameter RELOC_ADDR and make NOPLT a set of flags. All callers changed. Delete condition that checks for resolving to the location being filled in. Add condition to skip the executable's symbols if requested. * elf/link.h: Change declaration of _dl_lookup_symbol accordingly. (DL_LOOKUP_NOEXEC, DL_LOOKUP_NOPLT): New definitions. * elf/dl-reloc.c (RESOLVE): Remove second parameter and rename NOPLT to FLAGS. * elf/dl-runtime.c (RESOLVE): Likewise. * elf/rtld.c (RESOLVE): Likewise. * sysdeps/m68k/dl-machine.h (elf_machine_rela): Pass DL_LOOKUP_NOEXEC as second argument to the RESOLVE macro if processing a copy reloc, DL_LOOKUP_NOPLT for a jump slot reloc, zero otherwise. * sysdeps/alpha/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/i386/dl-machine.h (elf_machine_rel): Likewise. * sysdeps/mips/dl-machine.h (elf_machine_rel): Likewise. Wed Aug 14 17:57:08 1996 Ulrich Drepper <drepper@cygnus.com> * MakeTAGS: Clean up use of --omit-header and -n for xgettext. * po/header.pot: Add empty line at end. Sun Aug 11 13:45:33 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * MakeTAGS (all-pot): Remove $P/errlist.pot, all error messages are now in $P/stdio-common.pot. (XGETTEXTFLAGS-errlist.pot): Variable removed. Mon Aug 12 19:25:03 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * Makerules (do-ar, o-iterator-doit): Compute path to autolock script at run time, not configure time. * config.make.in, configure.in: Undo previous change. Wed Aug 14 13:20:02 1996 Ulrich Drepper <drepper@cygnus.com> * sysdeps/unix/sysv/linux/i386/close.S: Push return value of thread on stack as argument for `_exit'. Reported by Andreas Schwab. Mon Aug 12 19:36:25 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/unix/sysv/linux/m68k/clone.S: New file. Wed Aug 14 04:22:35 1996 Richard Henderson <rth@tamu.edu> * elf/dl-load.c (_dl_map_object): Save name in malloced memory. (_dl_map_object_from_fd): Free name on error. Wed Aug 14 13:00:09 1996 Ulrich Drepper <drepper@cygnus.com> * string/strdup.c: Use result of memcpy to avoid reloading. Tue Aug 13 00:55:03 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * shadow/sgetspent_r.c (__sgetspent_r): Copy string to buffer, not the other way round. * resolv/Makefile (libresolv-routines): Add base64, inet_net_ntop, inet_net_pton, inet_net. * resolv/arpa/nameser.h (__BIND): Update version number. Mon Aug 12 19:03:22 1996 Thomas Bushnell n/BSG <thomas@psilocin.gnu.ai.mit.edu> * sysdeps/generic/gnu/types.h: Declare __fd_mask as `unsigned long'. * mach/Makefile (mach/mach_host.uh): Depend on $(objpfx)/mach-syscalls.mk. ($(objpfx)mach-shortcuts.h): Depend on $(objpfx)mach/mach_host.h. (This fixes a make loop; thanks to Marcus Daniels <marcus@sysc.pdx.edu> for the patch.)
1996-08-14 23:45:21 +02:00
#include <sys/types.h>
1995-02-18 02:27:10 +01:00
#include <sys/param.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>
#include <ctype.h>
#include <errno.h>
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
#include <netdb.h>
#include <resolv.h>
#include <resolv/resolv-internal.h>
#include <resolv/resolv_context.h>
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <shlib-compat.h>
1995-02-18 02:27:10 +01:00
#if PACKETSZ > 65536
1995-02-18 02:27:10 +01:00
#define MAXPACKET PACKETSZ
#else
#define MAXPACKET 65536
1995-02-18 02:27:10 +01:00
#endif
Update. 2002-10-15 Jakub Jelinek <jakub@redhat.com> * include/resolv.h (__libc_res_nquery, __libc_res_nsearch, __libc_res_nsend): New prototypes. * resolv/res_query.c (QUERYSIZE): Define. (__libc_res_nquery): Renamed from res_nquery. Added answerp argument. Allocate only QUERYSIZE bytes first, if res_nmkquery fails use MAXPACKET buffer. Call __libc_res_nsend instead of res_nsend, pass answerp. (res_nquery): Changed into wrapper around __libc_res_nquery. (__libc_res_nsearch): Renamed from res_nsearch. Added answerp argument. Call __libc_res_nquerydomain and __libc_res_nquery instead of the non-__libc_ variants, pass them answerp. (res_nsearch): Changed into wrapper around __libc_res_nsearch. (__libc_res_nquerydomain): Renamed from res_nquerydomain. Added answerp argument. Call __libc_res_nquery instead of res_nquery, pass answerp. (res_nquerydomain): Changed into wrapper around __libc_res_nquerydomain. * resolv/res_send.c: Include sys/ioctl.h. (MAXPACKET): Define. (send_vc): Change arguments. Reallocate answer buffer if it is too small. (send_dg): Likewise. (__libc_res_nsend): Renamed from res_nsend. Added ansp argument. Reallocate answer buffer if it is too small and hooks are in use. Adjust calls to send_vc and send_dg. (res_nsend): Changed into wrapper around __libc_res_nsend. * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname2_r): Allocate just 1K answer buffer on the stack, use __libc_res_nsearch instead of res_nsearch. (_nss_dns_gethostbyaddr_r): Similarly with __libc_res_nquery. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Similarly with __libc_res_nsearch. * resolv/gethnamaddr.c (gethostbyname2): Likewise. (gethostbyaddr): Similarly with __libc_res_nquery. * resolv/Versions (libresolv): Export __libc_res_nquery and __libc_res_nsearch at GLIBC_PRIVATE.
2002-10-17 23:51:21 +02:00
#define QUERYSIZE (HFIXEDSZ + QFIXEDSZ + MAXCDNAME + 1)
static int
__res_context_querydomain (struct resolv_context *,
const char *name, const char *domain,
int class, int type, unsigned char *answer, int anslen,
unsigned char **answerp, unsigned char **answerp2, int *nanswerp2,
int *resplen2, int *answerp2_malloced);
/* Formulate a normal query, send, and await answer. Returned answer
is placed in supplied buffer ANSWER. Perform preliminary check of
answer, returning success only if no error is indicated and the
answer count is nonzero. Return the size of the response on
success, -1 on error. Error number is left in h_errno.
Caller must parse answer and determine whether it answers the
question. */
1995-02-18 02:27:10 +01:00
int
__res_context_query (struct resolv_context *ctx, const char *name,
int class, int type,
unsigned char *answer, int anslen,
unsigned char **answerp, unsigned char **answerp2,
int *nanswerp2, int *resplen2, int *answerp2_malloced)
1995-02-18 02:27:10 +01:00
{
struct __res_state *statp = ctx->resp;
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
HEADER *hp = (HEADER *) answer;
HEADER *hp2;
Update. 2002-10-09 Ulrich Drepper <drepper@redhat.com> * Versions.def (libc): Add GLIBC_2.3.1. (libpthread): Add GLIBC_2.3.1. * include/signal.h: Add libc_hidden_proto for __sigwait, __sigwaitinfo, and __sigtimedwait. * signal/Versions: Add __sigtimedwait, __sigwait, and __sigwaitinfo. * sysdeps/unix/sysv/linux/sigtimedwait.c (__sigtimedwait): Add libc_hidden_def. * sysdeps/unix/sysv/linux/sigwait.c (__sigwait): Likewise. * sysdeps/unix/sysv/linux/sigwaitinfo.c (__sigwaitinfo): Likewise. * include/sys/msg.h: Declare __libc_msgrcv and __libc_msgsnd. * sysdeps/unix/sysv/linux/msgrcv.c (__msgrcv): Rename to __libc_msgrcv and make old name an alias. * sysdeps/unix/sysv/linux/msgsnd.c (__msgsnd): Rename to __libc_msgsnd and make old name an alias. * sysvipc/Versions (libc) [GLIBC_PRIVATE]: Add __libc_msgrcv and __libc_msgsnd. * include/sys/uio.h: Declare __libc_readv and __libc_writev. * misc/Versions (libc) [GLIBC_PRIVATE]: Add __libc_readv and __libc_writev. * sysdeps/generic/readv.c (__readv): Rename to __libc_readv and make old name an alias. * sysdeps/posix/readv.c: Likewise * sysdeps/unix/sysv/aix/readv.c: Likewise. * sysdeps/unix/sysv/linux/readv.c: Likewise. * sysdeps/generic/writev.c (__writev): Rename to __libc_writev and make old name an alias. * sysdeps/posix/writev.c: Likewise * sysdeps/unix/sysv/aix/writev.c: Likewise. * sysdeps/unix/sysv/linux/writev.c: Likewise. * include/sys/wait.h: Declare __waitid. * posix/Versions (libc) [GLIBC_PRIVATE]: Add __waitid. * sysdeps/generic/waitid.c (waitid): Rename to __waitid and make old name an alias. * sysdeps/posix/waitid.c: Likewise. * sysdeps/unix/sysv/aix/waitid.c: Likewise. * sysdeps/unix/sysv/linux/syscalls.list: Add creat syscall. 2002-10-07 Jakub Jelinek <jakub@redhat.com> * include/alloca.h (__libc_use_alloca, __libc_alloca_cutoff): New prototypes. (__MAX_ALLOCA_CUTOFF): Define. Include allocalim.h. * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname2_r, _nss_dns_gethostbyaddr_r): Use alloca or malloc to allocate host_buffer depending on __libc_use_alloca. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyname_r, _nss_dns_getnetbyaddr_r): Use alloca or malloc to allocate net_buffer depending on __libc_use_alloca. * resolv/res_query.c (res_nquery): Use alloca or malloc to allocate buf depending on __libc_use_alloca. * resolv/gethnamaddr.c (gethostbyname2, gethostbyaddr): Likewise. * stdio-common/vfprintf.c (vfprintf): Use __libc_use_alloca instead of hardcoded constants. Pass proper size argument to alloca and compute end for wide char version. * stdio-common/printf_fp.c (__printf_fp): Use __libc_use_alloca instead of hardcoded constants. * string/strcoll.c (strcoll): Likewise. * string/strxfrm.c (strxfrm): Likewise. * sysdeps/posix/readv.c (__readv): Likewise. * sysdeps/posix/writev.c (__writev): Likewise. * sysdeps/generic/allocalim.h: New file.
2002-10-09 11:42:48 +02:00
int n, use_malloc = 0;
1995-02-18 02:27:10 +01:00
size_t bufsize = (type == T_QUERY_A_AND_AAAA ? 2 : 1) * QUERYSIZE;
* include/resolv.h: Adjust __libc_res_nquery and __libc_res_nsend prototypes. * include/arpa/nameser_compat.h: Define T_UNSPEC. * nis/Versions (libnss_nis): Export _nss_nis_gethostbyname4_r. (libnss_nisplus): Export _nss_nisplus_gethostbyname4_r. * nis/nss_nis/nis-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_nis_gethostbyname4_r): New function. * nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_parse_hostent): Change to also handle af==AF_UNSPEC. (get_tablename): New function. Use it to avoid duplication. (_nss_nisplus_gethostbyname4_r): New function. * nscd/aicache.c (addhstaiX): Use gethostbyname4_r function is available. * nss/Versions (libnss_files): Export _nss_files_gethostbyname4_r. * nss/nss.h: Define struct gaih_addrtuple. * nss/nss_files/files-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_files_gethostbyname4_r): New function. * resolv/Versions (libnss_dns): Export _nss_dns_gethostbyname4_r. * resolv/gethnmaddr.c: Adjust __libc_res_nsearch and __libc_res_nquery calls. * resolv/res_query.c (__libc_res_nquery): Take two additional parameters for second answer buffer. Handle type=T_UNSPEC to mean look up IPv4 and IPv6. Change all callers. * resolv/res_send.c (__libc_res_nsend): Take five aditional parameters for an additional query and answer buffer. Pass to send_vc and send_dg. (send_vc): Send possibly two requests and receive two answers. (send_dg): Likewise. * resolv/nss_dns/dns-host.c: Adjust calls to __libc_res_nsearch and __libc_res_nquery. (_nss_dns_gethostbyname4_r): New function. (gaih_getanswer_slice): Likewise. (gaih_getanswer): Likewise. * resolv/nss_dns/dns-canon.c (_nss_dns_getcanonname_r): Adjust __libc_res_nquery call. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Adjust __libc_res_nsearch call. * sysdeps/posix/getaddrinfo.c: Use gethostbyname4_r function is available.
2008-05-11 01:27:39 +02:00
u_char *buf = alloca (bufsize);
u_char *query1 = buf;
int nquery1 = -1;
u_char *query2 = NULL;
int nquery2 = 0;
1995-02-18 02:27:10 +01:00
again:
hp->rcode = NOERROR; /* default */
Update. 2002-10-09 Ulrich Drepper <drepper@redhat.com> * Versions.def (libc): Add GLIBC_2.3.1. (libpthread): Add GLIBC_2.3.1. * include/signal.h: Add libc_hidden_proto for __sigwait, __sigwaitinfo, and __sigtimedwait. * signal/Versions: Add __sigtimedwait, __sigwait, and __sigwaitinfo. * sysdeps/unix/sysv/linux/sigtimedwait.c (__sigtimedwait): Add libc_hidden_def. * sysdeps/unix/sysv/linux/sigwait.c (__sigwait): Likewise. * sysdeps/unix/sysv/linux/sigwaitinfo.c (__sigwaitinfo): Likewise. * include/sys/msg.h: Declare __libc_msgrcv and __libc_msgsnd. * sysdeps/unix/sysv/linux/msgrcv.c (__msgrcv): Rename to __libc_msgrcv and make old name an alias. * sysdeps/unix/sysv/linux/msgsnd.c (__msgsnd): Rename to __libc_msgsnd and make old name an alias. * sysvipc/Versions (libc) [GLIBC_PRIVATE]: Add __libc_msgrcv and __libc_msgsnd. * include/sys/uio.h: Declare __libc_readv and __libc_writev. * misc/Versions (libc) [GLIBC_PRIVATE]: Add __libc_readv and __libc_writev. * sysdeps/generic/readv.c (__readv): Rename to __libc_readv and make old name an alias. * sysdeps/posix/readv.c: Likewise * sysdeps/unix/sysv/aix/readv.c: Likewise. * sysdeps/unix/sysv/linux/readv.c: Likewise. * sysdeps/generic/writev.c (__writev): Rename to __libc_writev and make old name an alias. * sysdeps/posix/writev.c: Likewise * sysdeps/unix/sysv/aix/writev.c: Likewise. * sysdeps/unix/sysv/linux/writev.c: Likewise. * include/sys/wait.h: Declare __waitid. * posix/Versions (libc) [GLIBC_PRIVATE]: Add __waitid. * sysdeps/generic/waitid.c (waitid): Rename to __waitid and make old name an alias. * sysdeps/posix/waitid.c: Likewise. * sysdeps/unix/sysv/aix/waitid.c: Likewise. * sysdeps/unix/sysv/linux/syscalls.list: Add creat syscall. 2002-10-07 Jakub Jelinek <jakub@redhat.com> * include/alloca.h (__libc_use_alloca, __libc_alloca_cutoff): New prototypes. (__MAX_ALLOCA_CUTOFF): Define. Include allocalim.h. * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname2_r, _nss_dns_gethostbyaddr_r): Use alloca or malloc to allocate host_buffer depending on __libc_use_alloca. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyname_r, _nss_dns_getnetbyaddr_r): Use alloca or malloc to allocate net_buffer depending on __libc_use_alloca. * resolv/res_query.c (res_nquery): Use alloca or malloc to allocate buf depending on __libc_use_alloca. * resolv/gethnamaddr.c (gethostbyname2, gethostbyaddr): Likewise. * stdio-common/vfprintf.c (vfprintf): Use __libc_use_alloca instead of hardcoded constants. Pass proper size argument to alloca and compute end for wide char version. * stdio-common/printf_fp.c (__printf_fp): Use __libc_use_alloca instead of hardcoded constants. * string/strcoll.c (strcoll): Likewise. * string/strxfrm.c (strxfrm): Likewise. * sysdeps/posix/readv.c (__readv): Likewise. * sysdeps/posix/writev.c (__writev): Likewise. * sysdeps/generic/allocalim.h: New file.
2002-10-09 11:42:48 +02:00
if (type == T_QUERY_A_AND_AAAA)
* include/resolv.h: Adjust __libc_res_nquery and __libc_res_nsend prototypes. * include/arpa/nameser_compat.h: Define T_UNSPEC. * nis/Versions (libnss_nis): Export _nss_nis_gethostbyname4_r. (libnss_nisplus): Export _nss_nisplus_gethostbyname4_r. * nis/nss_nis/nis-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_nis_gethostbyname4_r): New function. * nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_parse_hostent): Change to also handle af==AF_UNSPEC. (get_tablename): New function. Use it to avoid duplication. (_nss_nisplus_gethostbyname4_r): New function. * nscd/aicache.c (addhstaiX): Use gethostbyname4_r function is available. * nss/Versions (libnss_files): Export _nss_files_gethostbyname4_r. * nss/nss.h: Define struct gaih_addrtuple. * nss/nss_files/files-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_files_gethostbyname4_r): New function. * resolv/Versions (libnss_dns): Export _nss_dns_gethostbyname4_r. * resolv/gethnmaddr.c: Adjust __libc_res_nsearch and __libc_res_nquery calls. * resolv/res_query.c (__libc_res_nquery): Take two additional parameters for second answer buffer. Handle type=T_UNSPEC to mean look up IPv4 and IPv6. Change all callers. * resolv/res_send.c (__libc_res_nsend): Take five aditional parameters for an additional query and answer buffer. Pass to send_vc and send_dg. (send_vc): Send possibly two requests and receive two answers. (send_dg): Likewise. * resolv/nss_dns/dns-host.c: Adjust calls to __libc_res_nsearch and __libc_res_nquery. (_nss_dns_gethostbyname4_r): New function. (gaih_getanswer_slice): Likewise. (gaih_getanswer): Likewise. * resolv/nss_dns/dns-canon.c (_nss_dns_getcanonname_r): Adjust __libc_res_nquery call. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Adjust __libc_res_nsearch call. * sysdeps/posix/getaddrinfo.c: Use gethostbyname4_r function is available.
2008-05-11 01:27:39 +02:00
{
n = __res_context_mkquery (ctx, QUERY, name, class, T_A, NULL,
query1, bufsize);
* include/resolv.h: Adjust __libc_res_nquery and __libc_res_nsend prototypes. * include/arpa/nameser_compat.h: Define T_UNSPEC. * nis/Versions (libnss_nis): Export _nss_nis_gethostbyname4_r. (libnss_nisplus): Export _nss_nisplus_gethostbyname4_r. * nis/nss_nis/nis-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_nis_gethostbyname4_r): New function. * nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_parse_hostent): Change to also handle af==AF_UNSPEC. (get_tablename): New function. Use it to avoid duplication. (_nss_nisplus_gethostbyname4_r): New function. * nscd/aicache.c (addhstaiX): Use gethostbyname4_r function is available. * nss/Versions (libnss_files): Export _nss_files_gethostbyname4_r. * nss/nss.h: Define struct gaih_addrtuple. * nss/nss_files/files-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_files_gethostbyname4_r): New function. * resolv/Versions (libnss_dns): Export _nss_dns_gethostbyname4_r. * resolv/gethnmaddr.c: Adjust __libc_res_nsearch and __libc_res_nquery calls. * resolv/res_query.c (__libc_res_nquery): Take two additional parameters for second answer buffer. Handle type=T_UNSPEC to mean look up IPv4 and IPv6. Change all callers. * resolv/res_send.c (__libc_res_nsend): Take five aditional parameters for an additional query and answer buffer. Pass to send_vc and send_dg. (send_vc): Send possibly two requests and receive two answers. (send_dg): Likewise. * resolv/nss_dns/dns-host.c: Adjust calls to __libc_res_nsearch and __libc_res_nquery. (_nss_dns_gethostbyname4_r): New function. (gaih_getanswer_slice): Likewise. (gaih_getanswer): Likewise. * resolv/nss_dns/dns-canon.c (_nss_dns_getcanonname_r): Adjust __libc_res_nquery call. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Adjust __libc_res_nsearch call. * sysdeps/posix/getaddrinfo.c: Use gethostbyname4_r function is available.
2008-05-11 01:27:39 +02:00
if (n > 0)
{
if ((statp->options & (RES_USE_EDNS0|RES_USE_DNSSEC)) != 0)
{
/* Use RESOLV_EDNS_BUFFER_SIZE because the receive
buffer can be reallocated. */
n = __res_nopt (ctx, n, query1, bufsize,
RESOLV_EDNS_BUFFER_SIZE);
if (n < 0)
goto unspec_nomem;
}
* include/resolv.h: Adjust __libc_res_nquery and __libc_res_nsend prototypes. * include/arpa/nameser_compat.h: Define T_UNSPEC. * nis/Versions (libnss_nis): Export _nss_nis_gethostbyname4_r. (libnss_nisplus): Export _nss_nisplus_gethostbyname4_r. * nis/nss_nis/nis-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_nis_gethostbyname4_r): New function. * nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_parse_hostent): Change to also handle af==AF_UNSPEC. (get_tablename): New function. Use it to avoid duplication. (_nss_nisplus_gethostbyname4_r): New function. * nscd/aicache.c (addhstaiX): Use gethostbyname4_r function is available. * nss/Versions (libnss_files): Export _nss_files_gethostbyname4_r. * nss/nss.h: Define struct gaih_addrtuple. * nss/nss_files/files-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_files_gethostbyname4_r): New function. * resolv/Versions (libnss_dns): Export _nss_dns_gethostbyname4_r. * resolv/gethnmaddr.c: Adjust __libc_res_nsearch and __libc_res_nquery calls. * resolv/res_query.c (__libc_res_nquery): Take two additional parameters for second answer buffer. Handle type=T_UNSPEC to mean look up IPv4 and IPv6. Change all callers. * resolv/res_send.c (__libc_res_nsend): Take five aditional parameters for an additional query and answer buffer. Pass to send_vc and send_dg. (send_vc): Send possibly two requests and receive two answers. (send_dg): Likewise. * resolv/nss_dns/dns-host.c: Adjust calls to __libc_res_nsearch and __libc_res_nquery. (_nss_dns_gethostbyname4_r): New function. (gaih_getanswer_slice): Likewise. (gaih_getanswer): Likewise. * resolv/nss_dns/dns-canon.c (_nss_dns_getcanonname_r): Adjust __libc_res_nquery call. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Adjust __libc_res_nsearch call. * sysdeps/posix/getaddrinfo.c: Use gethostbyname4_r function is available.
2008-05-11 01:27:39 +02:00
nquery1 = n;
/* Align the buffer. */
int npad = ((nquery1 + __alignof__ (HEADER) - 1)
& ~(__alignof__ (HEADER) - 1)) - nquery1;
if (n > bufsize - npad)
{
n = -1;
goto unspec_nomem;
}
int nused = n + npad;
query2 = buf + nused;
n = __res_context_mkquery (ctx, QUERY, name, class, T_AAAA,
NULL, query2, bufsize - nused);
* include/resolv.h: Adjust __libc_res_nquery and __libc_res_nsend prototypes. * include/arpa/nameser_compat.h: Define T_UNSPEC. * nis/Versions (libnss_nis): Export _nss_nis_gethostbyname4_r. (libnss_nisplus): Export _nss_nisplus_gethostbyname4_r. * nis/nss_nis/nis-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_nis_gethostbyname4_r): New function. * nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_parse_hostent): Change to also handle af==AF_UNSPEC. (get_tablename): New function. Use it to avoid duplication. (_nss_nisplus_gethostbyname4_r): New function. * nscd/aicache.c (addhstaiX): Use gethostbyname4_r function is available. * nss/Versions (libnss_files): Export _nss_files_gethostbyname4_r. * nss/nss.h: Define struct gaih_addrtuple. * nss/nss_files/files-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_files_gethostbyname4_r): New function. * resolv/Versions (libnss_dns): Export _nss_dns_gethostbyname4_r. * resolv/gethnmaddr.c: Adjust __libc_res_nsearch and __libc_res_nquery calls. * resolv/res_query.c (__libc_res_nquery): Take two additional parameters for second answer buffer. Handle type=T_UNSPEC to mean look up IPv4 and IPv6. Change all callers. * resolv/res_send.c (__libc_res_nsend): Take five aditional parameters for an additional query and answer buffer. Pass to send_vc and send_dg. (send_vc): Send possibly two requests and receive two answers. (send_dg): Likewise. * resolv/nss_dns/dns-host.c: Adjust calls to __libc_res_nsearch and __libc_res_nquery. (_nss_dns_gethostbyname4_r): New function. (gaih_getanswer_slice): Likewise. (gaih_getanswer): Likewise. * resolv/nss_dns/dns-canon.c (_nss_dns_getcanonname_r): Adjust __libc_res_nquery call. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Adjust __libc_res_nsearch call. * sysdeps/posix/getaddrinfo.c: Use gethostbyname4_r function is available.
2008-05-11 01:27:39 +02:00
if (n > 0
&& (statp->options & (RES_USE_EDNS0|RES_USE_DNSSEC)) != 0)
/* Use RESOLV_EDNS_BUFFER_SIZE because the receive
buffer can be reallocated. */
n = __res_nopt (ctx, n, query2, bufsize,
RESOLV_EDNS_BUFFER_SIZE);
* include/resolv.h: Adjust __libc_res_nquery and __libc_res_nsend prototypes. * include/arpa/nameser_compat.h: Define T_UNSPEC. * nis/Versions (libnss_nis): Export _nss_nis_gethostbyname4_r. (libnss_nisplus): Export _nss_nisplus_gethostbyname4_r. * nis/nss_nis/nis-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_nis_gethostbyname4_r): New function. * nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_parse_hostent): Change to also handle af==AF_UNSPEC. (get_tablename): New function. Use it to avoid duplication. (_nss_nisplus_gethostbyname4_r): New function. * nscd/aicache.c (addhstaiX): Use gethostbyname4_r function is available. * nss/Versions (libnss_files): Export _nss_files_gethostbyname4_r. * nss/nss.h: Define struct gaih_addrtuple. * nss/nss_files/files-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_files_gethostbyname4_r): New function. * resolv/Versions (libnss_dns): Export _nss_dns_gethostbyname4_r. * resolv/gethnmaddr.c: Adjust __libc_res_nsearch and __libc_res_nquery calls. * resolv/res_query.c (__libc_res_nquery): Take two additional parameters for second answer buffer. Handle type=T_UNSPEC to mean look up IPv4 and IPv6. Change all callers. * resolv/res_send.c (__libc_res_nsend): Take five aditional parameters for an additional query and answer buffer. Pass to send_vc and send_dg. (send_vc): Send possibly two requests and receive two answers. (send_dg): Likewise. * resolv/nss_dns/dns-host.c: Adjust calls to __libc_res_nsearch and __libc_res_nquery. (_nss_dns_gethostbyname4_r): New function. (gaih_getanswer_slice): Likewise. (gaih_getanswer): Likewise. * resolv/nss_dns/dns-canon.c (_nss_dns_getcanonname_r): Adjust __libc_res_nquery call. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Adjust __libc_res_nsearch call. * sysdeps/posix/getaddrinfo.c: Use gethostbyname4_r function is available.
2008-05-11 01:27:39 +02:00
nquery2 = n;
}
unspec_nomem:;
* include/resolv.h: Adjust __libc_res_nquery and __libc_res_nsend prototypes. * include/arpa/nameser_compat.h: Define T_UNSPEC. * nis/Versions (libnss_nis): Export _nss_nis_gethostbyname4_r. (libnss_nisplus): Export _nss_nisplus_gethostbyname4_r. * nis/nss_nis/nis-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_nis_gethostbyname4_r): New function. * nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_parse_hostent): Change to also handle af==AF_UNSPEC. (get_tablename): New function. Use it to avoid duplication. (_nss_nisplus_gethostbyname4_r): New function. * nscd/aicache.c (addhstaiX): Use gethostbyname4_r function is available. * nss/Versions (libnss_files): Export _nss_files_gethostbyname4_r. * nss/nss.h: Define struct gaih_addrtuple. * nss/nss_files/files-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_files_gethostbyname4_r): New function. * resolv/Versions (libnss_dns): Export _nss_dns_gethostbyname4_r. * resolv/gethnmaddr.c: Adjust __libc_res_nsearch and __libc_res_nquery calls. * resolv/res_query.c (__libc_res_nquery): Take two additional parameters for second answer buffer. Handle type=T_UNSPEC to mean look up IPv4 and IPv6. Change all callers. * resolv/res_send.c (__libc_res_nsend): Take five aditional parameters for an additional query and answer buffer. Pass to send_vc and send_dg. (send_vc): Send possibly two requests and receive two answers. (send_dg): Likewise. * resolv/nss_dns/dns-host.c: Adjust calls to __libc_res_nsearch and __libc_res_nquery. (_nss_dns_gethostbyname4_r): New function. (gaih_getanswer_slice): Likewise. (gaih_getanswer): Likewise. * resolv/nss_dns/dns-canon.c (_nss_dns_getcanonname_r): Adjust __libc_res_nquery call. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Adjust __libc_res_nsearch call. * sysdeps/posix/getaddrinfo.c: Use gethostbyname4_r function is available.
2008-05-11 01:27:39 +02:00
}
else
{
n = __res_context_mkquery (ctx, QUERY, name, class, type, NULL,
query1, bufsize);
* include/resolv.h: Adjust __libc_res_nquery and __libc_res_nsend prototypes. * include/arpa/nameser_compat.h: Define T_UNSPEC. * nis/Versions (libnss_nis): Export _nss_nis_gethostbyname4_r. (libnss_nisplus): Export _nss_nisplus_gethostbyname4_r. * nis/nss_nis/nis-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_nis_gethostbyname4_r): New function. * nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_parse_hostent): Change to also handle af==AF_UNSPEC. (get_tablename): New function. Use it to avoid duplication. (_nss_nisplus_gethostbyname4_r): New function. * nscd/aicache.c (addhstaiX): Use gethostbyname4_r function is available. * nss/Versions (libnss_files): Export _nss_files_gethostbyname4_r. * nss/nss.h: Define struct gaih_addrtuple. * nss/nss_files/files-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_files_gethostbyname4_r): New function. * resolv/Versions (libnss_dns): Export _nss_dns_gethostbyname4_r. * resolv/gethnmaddr.c: Adjust __libc_res_nsearch and __libc_res_nquery calls. * resolv/res_query.c (__libc_res_nquery): Take two additional parameters for second answer buffer. Handle type=T_UNSPEC to mean look up IPv4 and IPv6. Change all callers. * resolv/res_send.c (__libc_res_nsend): Take five aditional parameters for an additional query and answer buffer. Pass to send_vc and send_dg. (send_vc): Send possibly two requests and receive two answers. (send_dg): Likewise. * resolv/nss_dns/dns-host.c: Adjust calls to __libc_res_nsearch and __libc_res_nquery. (_nss_dns_gethostbyname4_r): New function. (gaih_getanswer_slice): Likewise. (gaih_getanswer): Likewise. * resolv/nss_dns/dns-canon.c (_nss_dns_getcanonname_r): Adjust __libc_res_nquery call. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Adjust __libc_res_nsearch call. * sysdeps/posix/getaddrinfo.c: Use gethostbyname4_r function is available.
2008-05-11 01:27:39 +02:00
if (n > 0
&& (statp->options & (RES_USE_EDNS0|RES_USE_DNSSEC)) != 0)
{
/* Use RESOLV_EDNS_BUFFER_SIZE if the receive buffer
can be reallocated. */
size_t advertise;
if (answerp == NULL)
advertise = anslen;
else
advertise = RESOLV_EDNS_BUFFER_SIZE;
n = __res_nopt (ctx, n, query1, bufsize, advertise);
}
* include/resolv.h: Adjust __libc_res_nquery and __libc_res_nsend prototypes. * include/arpa/nameser_compat.h: Define T_UNSPEC. * nis/Versions (libnss_nis): Export _nss_nis_gethostbyname4_r. (libnss_nisplus): Export _nss_nisplus_gethostbyname4_r. * nis/nss_nis/nis-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_nis_gethostbyname4_r): New function. * nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_parse_hostent): Change to also handle af==AF_UNSPEC. (get_tablename): New function. Use it to avoid duplication. (_nss_nisplus_gethostbyname4_r): New function. * nscd/aicache.c (addhstaiX): Use gethostbyname4_r function is available. * nss/Versions (libnss_files): Export _nss_files_gethostbyname4_r. * nss/nss.h: Define struct gaih_addrtuple. * nss/nss_files/files-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_files_gethostbyname4_r): New function. * resolv/Versions (libnss_dns): Export _nss_dns_gethostbyname4_r. * resolv/gethnmaddr.c: Adjust __libc_res_nsearch and __libc_res_nquery calls. * resolv/res_query.c (__libc_res_nquery): Take two additional parameters for second answer buffer. Handle type=T_UNSPEC to mean look up IPv4 and IPv6. Change all callers. * resolv/res_send.c (__libc_res_nsend): Take five aditional parameters for an additional query and answer buffer. Pass to send_vc and send_dg. (send_vc): Send possibly two requests and receive two answers. (send_dg): Likewise. * resolv/nss_dns/dns-host.c: Adjust calls to __libc_res_nsearch and __libc_res_nquery. (_nss_dns_gethostbyname4_r): New function. (gaih_getanswer_slice): Likewise. (gaih_getanswer): Likewise. * resolv/nss_dns/dns-canon.c (_nss_dns_getcanonname_r): Adjust __libc_res_nquery call. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Adjust __libc_res_nsearch call. * sysdeps/posix/getaddrinfo.c: Use gethostbyname4_r function is available.
2008-05-11 01:27:39 +02:00
nquery1 = n;
}
if (__glibc_unlikely (n <= 0) && !use_malloc) {
Update. 2002-10-15 Jakub Jelinek <jakub@redhat.com> * include/resolv.h (__libc_res_nquery, __libc_res_nsearch, __libc_res_nsend): New prototypes. * resolv/res_query.c (QUERYSIZE): Define. (__libc_res_nquery): Renamed from res_nquery. Added answerp argument. Allocate only QUERYSIZE bytes first, if res_nmkquery fails use MAXPACKET buffer. Call __libc_res_nsend instead of res_nsend, pass answerp. (res_nquery): Changed into wrapper around __libc_res_nquery. (__libc_res_nsearch): Renamed from res_nsearch. Added answerp argument. Call __libc_res_nquerydomain and __libc_res_nquery instead of the non-__libc_ variants, pass them answerp. (res_nsearch): Changed into wrapper around __libc_res_nsearch. (__libc_res_nquerydomain): Renamed from res_nquerydomain. Added answerp argument. Call __libc_res_nquery instead of res_nquery, pass answerp. (res_nquerydomain): Changed into wrapper around __libc_res_nquerydomain. * resolv/res_send.c: Include sys/ioctl.h. (MAXPACKET): Define. (send_vc): Change arguments. Reallocate answer buffer if it is too small. (send_dg): Likewise. (__libc_res_nsend): Renamed from res_nsend. Added ansp argument. Reallocate answer buffer if it is too small and hooks are in use. Adjust calls to send_vc and send_dg. (res_nsend): Changed into wrapper around __libc_res_nsend. * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname2_r): Allocate just 1K answer buffer on the stack, use __libc_res_nsearch instead of res_nsearch. (_nss_dns_gethostbyaddr_r): Similarly with __libc_res_nquery. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Similarly with __libc_res_nsearch. * resolv/gethnamaddr.c (gethostbyname2): Likewise. (gethostbyaddr): Similarly with __libc_res_nquery. * resolv/Versions (libresolv): Export __libc_res_nquery and __libc_res_nsearch at GLIBC_PRIVATE.
2002-10-17 23:51:21 +02:00
/* Retry just in case res_nmkquery failed because of too
short buffer. Shouldn't happen. */
bufsize = (type == T_QUERY_A_AND_AAAA ? 2 : 1) * MAXPACKET;
buf = malloc (bufsize);
Update. 2002-10-15 Jakub Jelinek <jakub@redhat.com> * include/resolv.h (__libc_res_nquery, __libc_res_nsearch, __libc_res_nsend): New prototypes. * resolv/res_query.c (QUERYSIZE): Define. (__libc_res_nquery): Renamed from res_nquery. Added answerp argument. Allocate only QUERYSIZE bytes first, if res_nmkquery fails use MAXPACKET buffer. Call __libc_res_nsend instead of res_nsend, pass answerp. (res_nquery): Changed into wrapper around __libc_res_nquery. (__libc_res_nsearch): Renamed from res_nsearch. Added answerp argument. Call __libc_res_nquerydomain and __libc_res_nquery instead of the non-__libc_ variants, pass them answerp. (res_nsearch): Changed into wrapper around __libc_res_nsearch. (__libc_res_nquerydomain): Renamed from res_nquerydomain. Added answerp argument. Call __libc_res_nquery instead of res_nquery, pass answerp. (res_nquerydomain): Changed into wrapper around __libc_res_nquerydomain. * resolv/res_send.c: Include sys/ioctl.h. (MAXPACKET): Define. (send_vc): Change arguments. Reallocate answer buffer if it is too small. (send_dg): Likewise. (__libc_res_nsend): Renamed from res_nsend. Added ansp argument. Reallocate answer buffer if it is too small and hooks are in use. Adjust calls to send_vc and send_dg. (res_nsend): Changed into wrapper around __libc_res_nsend. * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname2_r): Allocate just 1K answer buffer on the stack, use __libc_res_nsearch instead of res_nsearch. (_nss_dns_gethostbyaddr_r): Similarly with __libc_res_nquery. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Similarly with __libc_res_nsearch. * resolv/gethnamaddr.c (gethostbyname2): Likewise. (gethostbyaddr): Similarly with __libc_res_nquery. * resolv/Versions (libresolv): Export __libc_res_nquery and __libc_res_nsearch at GLIBC_PRIVATE.
2002-10-17 23:51:21 +02:00
if (buf != NULL) {
* include/resolv.h: Adjust __libc_res_nquery and __libc_res_nsend prototypes. * include/arpa/nameser_compat.h: Define T_UNSPEC. * nis/Versions (libnss_nis): Export _nss_nis_gethostbyname4_r. (libnss_nisplus): Export _nss_nisplus_gethostbyname4_r. * nis/nss_nis/nis-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_nis_gethostbyname4_r): New function. * nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_parse_hostent): Change to also handle af==AF_UNSPEC. (get_tablename): New function. Use it to avoid duplication. (_nss_nisplus_gethostbyname4_r): New function. * nscd/aicache.c (addhstaiX): Use gethostbyname4_r function is available. * nss/Versions (libnss_files): Export _nss_files_gethostbyname4_r. * nss/nss.h: Define struct gaih_addrtuple. * nss/nss_files/files-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_files_gethostbyname4_r): New function. * resolv/Versions (libnss_dns): Export _nss_dns_gethostbyname4_r. * resolv/gethnmaddr.c: Adjust __libc_res_nsearch and __libc_res_nquery calls. * resolv/res_query.c (__libc_res_nquery): Take two additional parameters for second answer buffer. Handle type=T_UNSPEC to mean look up IPv4 and IPv6. Change all callers. * resolv/res_send.c (__libc_res_nsend): Take five aditional parameters for an additional query and answer buffer. Pass to send_vc and send_dg. (send_vc): Send possibly two requests and receive two answers. (send_dg): Likewise. * resolv/nss_dns/dns-host.c: Adjust calls to __libc_res_nsearch and __libc_res_nquery. (_nss_dns_gethostbyname4_r): New function. (gaih_getanswer_slice): Likewise. (gaih_getanswer): Likewise. * resolv/nss_dns/dns-canon.c (_nss_dns_getcanonname_r): Adjust __libc_res_nquery call. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Adjust __libc_res_nsearch call. * sysdeps/posix/getaddrinfo.c: Use gethostbyname4_r function is available.
2008-05-11 01:27:39 +02:00
query1 = buf;
Update. 2002-10-15 Jakub Jelinek <jakub@redhat.com> * include/resolv.h (__libc_res_nquery, __libc_res_nsearch, __libc_res_nsend): New prototypes. * resolv/res_query.c (QUERYSIZE): Define. (__libc_res_nquery): Renamed from res_nquery. Added answerp argument. Allocate only QUERYSIZE bytes first, if res_nmkquery fails use MAXPACKET buffer. Call __libc_res_nsend instead of res_nsend, pass answerp. (res_nquery): Changed into wrapper around __libc_res_nquery. (__libc_res_nsearch): Renamed from res_nsearch. Added answerp argument. Call __libc_res_nquerydomain and __libc_res_nquery instead of the non-__libc_ variants, pass them answerp. (res_nsearch): Changed into wrapper around __libc_res_nsearch. (__libc_res_nquerydomain): Renamed from res_nquerydomain. Added answerp argument. Call __libc_res_nquery instead of res_nquery, pass answerp. (res_nquerydomain): Changed into wrapper around __libc_res_nquerydomain. * resolv/res_send.c: Include sys/ioctl.h. (MAXPACKET): Define. (send_vc): Change arguments. Reallocate answer buffer if it is too small. (send_dg): Likewise. (__libc_res_nsend): Renamed from res_nsend. Added ansp argument. Reallocate answer buffer if it is too small and hooks are in use. Adjust calls to send_vc and send_dg. (res_nsend): Changed into wrapper around __libc_res_nsend. * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname2_r): Allocate just 1K answer buffer on the stack, use __libc_res_nsearch instead of res_nsearch. (_nss_dns_gethostbyaddr_r): Similarly with __libc_res_nquery. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Similarly with __libc_res_nsearch. * resolv/gethnamaddr.c (gethostbyname2): Likewise. (gethostbyaddr): Similarly with __libc_res_nquery. * resolv/Versions (libresolv): Export __libc_res_nquery and __libc_res_nsearch at GLIBC_PRIVATE.
2002-10-17 23:51:21 +02:00
use_malloc = 1;
goto again;
}
Update. 2002-10-15 Jakub Jelinek <jakub@redhat.com> * include/resolv.h (__libc_res_nquery, __libc_res_nsearch, __libc_res_nsend): New prototypes. * resolv/res_query.c (QUERYSIZE): Define. (__libc_res_nquery): Renamed from res_nquery. Added answerp argument. Allocate only QUERYSIZE bytes first, if res_nmkquery fails use MAXPACKET buffer. Call __libc_res_nsend instead of res_nsend, pass answerp. (res_nquery): Changed into wrapper around __libc_res_nquery. (__libc_res_nsearch): Renamed from res_nsearch. Added answerp argument. Call __libc_res_nquerydomain and __libc_res_nquery instead of the non-__libc_ variants, pass them answerp. (res_nsearch): Changed into wrapper around __libc_res_nsearch. (__libc_res_nquerydomain): Renamed from res_nquerydomain. Added answerp argument. Call __libc_res_nquery instead of res_nquery, pass answerp. (res_nquerydomain): Changed into wrapper around __libc_res_nquerydomain. * resolv/res_send.c: Include sys/ioctl.h. (MAXPACKET): Define. (send_vc): Change arguments. Reallocate answer buffer if it is too small. (send_dg): Likewise. (__libc_res_nsend): Renamed from res_nsend. Added ansp argument. Reallocate answer buffer if it is too small and hooks are in use. Adjust calls to send_vc and send_dg. (res_nsend): Changed into wrapper around __libc_res_nsend. * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname2_r): Allocate just 1K answer buffer on the stack, use __libc_res_nsearch instead of res_nsearch. (_nss_dns_gethostbyaddr_r): Similarly with __libc_res_nquery. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Similarly with __libc_res_nsearch. * resolv/gethnamaddr.c (gethostbyname2): Likewise. (gethostbyaddr): Similarly with __libc_res_nquery. * resolv/Versions (libresolv): Export __libc_res_nquery and __libc_res_nsearch at GLIBC_PRIVATE.
2002-10-17 23:51:21 +02:00
}
if (__glibc_unlikely (n <= 0)) {
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
RES_SET_H_ERRNO(statp, NO_RECOVERY);
Update. 2002-10-09 Ulrich Drepper <drepper@redhat.com> * Versions.def (libc): Add GLIBC_2.3.1. (libpthread): Add GLIBC_2.3.1. * include/signal.h: Add libc_hidden_proto for __sigwait, __sigwaitinfo, and __sigtimedwait. * signal/Versions: Add __sigtimedwait, __sigwait, and __sigwaitinfo. * sysdeps/unix/sysv/linux/sigtimedwait.c (__sigtimedwait): Add libc_hidden_def. * sysdeps/unix/sysv/linux/sigwait.c (__sigwait): Likewise. * sysdeps/unix/sysv/linux/sigwaitinfo.c (__sigwaitinfo): Likewise. * include/sys/msg.h: Declare __libc_msgrcv and __libc_msgsnd. * sysdeps/unix/sysv/linux/msgrcv.c (__msgrcv): Rename to __libc_msgrcv and make old name an alias. * sysdeps/unix/sysv/linux/msgsnd.c (__msgsnd): Rename to __libc_msgsnd and make old name an alias. * sysvipc/Versions (libc) [GLIBC_PRIVATE]: Add __libc_msgrcv and __libc_msgsnd. * include/sys/uio.h: Declare __libc_readv and __libc_writev. * misc/Versions (libc) [GLIBC_PRIVATE]: Add __libc_readv and __libc_writev. * sysdeps/generic/readv.c (__readv): Rename to __libc_readv and make old name an alias. * sysdeps/posix/readv.c: Likewise * sysdeps/unix/sysv/aix/readv.c: Likewise. * sysdeps/unix/sysv/linux/readv.c: Likewise. * sysdeps/generic/writev.c (__writev): Rename to __libc_writev and make old name an alias. * sysdeps/posix/writev.c: Likewise * sysdeps/unix/sysv/aix/writev.c: Likewise. * sysdeps/unix/sysv/linux/writev.c: Likewise. * include/sys/wait.h: Declare __waitid. * posix/Versions (libc) [GLIBC_PRIVATE]: Add __waitid. * sysdeps/generic/waitid.c (waitid): Rename to __waitid and make old name an alias. * sysdeps/posix/waitid.c: Likewise. * sysdeps/unix/sysv/aix/waitid.c: Likewise. * sysdeps/unix/sysv/linux/syscalls.list: Add creat syscall. 2002-10-07 Jakub Jelinek <jakub@redhat.com> * include/alloca.h (__libc_use_alloca, __libc_alloca_cutoff): New prototypes. (__MAX_ALLOCA_CUTOFF): Define. Include allocalim.h. * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname2_r, _nss_dns_gethostbyaddr_r): Use alloca or malloc to allocate host_buffer depending on __libc_use_alloca. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyname_r, _nss_dns_getnetbyaddr_r): Use alloca or malloc to allocate net_buffer depending on __libc_use_alloca. * resolv/res_query.c (res_nquery): Use alloca or malloc to allocate buf depending on __libc_use_alloca. * resolv/gethnamaddr.c (gethostbyname2, gethostbyaddr): Likewise. * stdio-common/vfprintf.c (vfprintf): Use __libc_use_alloca instead of hardcoded constants. Pass proper size argument to alloca and compute end for wide char version. * stdio-common/printf_fp.c (__printf_fp): Use __libc_use_alloca instead of hardcoded constants. * string/strcoll.c (strcoll): Likewise. * string/strxfrm.c (strxfrm): Likewise. * sysdeps/posix/readv.c (__readv): Likewise. * sysdeps/posix/writev.c (__writev): Likewise. * sysdeps/generic/allocalim.h: New file.
2002-10-09 11:42:48 +02:00
if (use_malloc)
free (buf);
1995-02-18 02:27:10 +01:00
return (n);
}
assert (answerp == NULL || (void *) *answerp == (void *) answer);
n = __res_context_send (ctx, query1, nquery1, query2, nquery2, answer,
anslen, answerp, answerp2, nanswerp2, resplen2,
answerp2_malloced);
Update. 2002-10-09 Ulrich Drepper <drepper@redhat.com> * Versions.def (libc): Add GLIBC_2.3.1. (libpthread): Add GLIBC_2.3.1. * include/signal.h: Add libc_hidden_proto for __sigwait, __sigwaitinfo, and __sigtimedwait. * signal/Versions: Add __sigtimedwait, __sigwait, and __sigwaitinfo. * sysdeps/unix/sysv/linux/sigtimedwait.c (__sigtimedwait): Add libc_hidden_def. * sysdeps/unix/sysv/linux/sigwait.c (__sigwait): Likewise. * sysdeps/unix/sysv/linux/sigwaitinfo.c (__sigwaitinfo): Likewise. * include/sys/msg.h: Declare __libc_msgrcv and __libc_msgsnd. * sysdeps/unix/sysv/linux/msgrcv.c (__msgrcv): Rename to __libc_msgrcv and make old name an alias. * sysdeps/unix/sysv/linux/msgsnd.c (__msgsnd): Rename to __libc_msgsnd and make old name an alias. * sysvipc/Versions (libc) [GLIBC_PRIVATE]: Add __libc_msgrcv and __libc_msgsnd. * include/sys/uio.h: Declare __libc_readv and __libc_writev. * misc/Versions (libc) [GLIBC_PRIVATE]: Add __libc_readv and __libc_writev. * sysdeps/generic/readv.c (__readv): Rename to __libc_readv and make old name an alias. * sysdeps/posix/readv.c: Likewise * sysdeps/unix/sysv/aix/readv.c: Likewise. * sysdeps/unix/sysv/linux/readv.c: Likewise. * sysdeps/generic/writev.c (__writev): Rename to __libc_writev and make old name an alias. * sysdeps/posix/writev.c: Likewise * sysdeps/unix/sysv/aix/writev.c: Likewise. * sysdeps/unix/sysv/linux/writev.c: Likewise. * include/sys/wait.h: Declare __waitid. * posix/Versions (libc) [GLIBC_PRIVATE]: Add __waitid. * sysdeps/generic/waitid.c (waitid): Rename to __waitid and make old name an alias. * sysdeps/posix/waitid.c: Likewise. * sysdeps/unix/sysv/aix/waitid.c: Likewise. * sysdeps/unix/sysv/linux/syscalls.list: Add creat syscall. 2002-10-07 Jakub Jelinek <jakub@redhat.com> * include/alloca.h (__libc_use_alloca, __libc_alloca_cutoff): New prototypes. (__MAX_ALLOCA_CUTOFF): Define. Include allocalim.h. * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname2_r, _nss_dns_gethostbyaddr_r): Use alloca or malloc to allocate host_buffer depending on __libc_use_alloca. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyname_r, _nss_dns_getnetbyaddr_r): Use alloca or malloc to allocate net_buffer depending on __libc_use_alloca. * resolv/res_query.c (res_nquery): Use alloca or malloc to allocate buf depending on __libc_use_alloca. * resolv/gethnamaddr.c (gethostbyname2, gethostbyaddr): Likewise. * stdio-common/vfprintf.c (vfprintf): Use __libc_use_alloca instead of hardcoded constants. Pass proper size argument to alloca and compute end for wide char version. * stdio-common/printf_fp.c (__printf_fp): Use __libc_use_alloca instead of hardcoded constants. * string/strcoll.c (strcoll): Likewise. * string/strxfrm.c (strxfrm): Likewise. * sysdeps/posix/readv.c (__readv): Likewise. * sysdeps/posix/writev.c (__writev): Likewise. * sysdeps/generic/allocalim.h: New file.
2002-10-09 11:42:48 +02:00
if (use_malloc)
free (buf);
1995-02-18 02:27:10 +01:00
if (n < 0) {
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
RES_SET_H_ERRNO(statp, TRY_AGAIN);
1995-02-18 02:27:10 +01:00
return (n);
}
if (answerp != NULL)
/* __res_context_send might have reallocated the buffer. */
hp = (HEADER *) *answerp;
/* We simplify the following tests by assigning HP to HP2 or
vice versa. It is easy to verify that this is the same as
ignoring all tests of HP or HP2. */
if (answerp2 == NULL || *resplen2 < (int) sizeof (HEADER))
{
hp2 = hp;
}
else
{
hp2 = (HEADER *) *answerp2;
if (n < (int) sizeof (HEADER))
{
hp = hp2;
}
}
/* Make sure both hp and hp2 are defined */
assert((hp != NULL) && (hp2 != NULL));
* include/resolv.h: Adjust __libc_res_nquery and __libc_res_nsend prototypes. * include/arpa/nameser_compat.h: Define T_UNSPEC. * nis/Versions (libnss_nis): Export _nss_nis_gethostbyname4_r. (libnss_nisplus): Export _nss_nisplus_gethostbyname4_r. * nis/nss_nis/nis-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_nis_gethostbyname4_r): New function. * nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_parse_hostent): Change to also handle af==AF_UNSPEC. (get_tablename): New function. Use it to avoid duplication. (_nss_nisplus_gethostbyname4_r): New function. * nscd/aicache.c (addhstaiX): Use gethostbyname4_r function is available. * nss/Versions (libnss_files): Export _nss_files_gethostbyname4_r. * nss/nss.h: Define struct gaih_addrtuple. * nss/nss_files/files-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_files_gethostbyname4_r): New function. * resolv/Versions (libnss_dns): Export _nss_dns_gethostbyname4_r. * resolv/gethnmaddr.c: Adjust __libc_res_nsearch and __libc_res_nquery calls. * resolv/res_query.c (__libc_res_nquery): Take two additional parameters for second answer buffer. Handle type=T_UNSPEC to mean look up IPv4 and IPv6. Change all callers. * resolv/res_send.c (__libc_res_nsend): Take five aditional parameters for an additional query and answer buffer. Pass to send_vc and send_dg. (send_vc): Send possibly two requests and receive two answers. (send_dg): Likewise. * resolv/nss_dns/dns-host.c: Adjust calls to __libc_res_nsearch and __libc_res_nquery. (_nss_dns_gethostbyname4_r): New function. (gaih_getanswer_slice): Likewise. (gaih_getanswer): Likewise. * resolv/nss_dns/dns-canon.c (_nss_dns_getcanonname_r): Adjust __libc_res_nquery call. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Adjust __libc_res_nsearch call. * sysdeps/posix/getaddrinfo.c: Use gethostbyname4_r function is available.
2008-05-11 01:27:39 +02:00
if ((hp->rcode != NOERROR || ntohs(hp->ancount) == 0)
&& (hp2->rcode != NOERROR || ntohs(hp2->ancount) == 0)) {
switch (hp->rcode == NOERROR ? hp2->rcode : hp->rcode) {
1995-02-18 02:27:10 +01:00
case NXDOMAIN:
* include/resolv.h: Adjust __libc_res_nquery and __libc_res_nsend prototypes. * include/arpa/nameser_compat.h: Define T_UNSPEC. * nis/Versions (libnss_nis): Export _nss_nis_gethostbyname4_r. (libnss_nisplus): Export _nss_nisplus_gethostbyname4_r. * nis/nss_nis/nis-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_nis_gethostbyname4_r): New function. * nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_parse_hostent): Change to also handle af==AF_UNSPEC. (get_tablename): New function. Use it to avoid duplication. (_nss_nisplus_gethostbyname4_r): New function. * nscd/aicache.c (addhstaiX): Use gethostbyname4_r function is available. * nss/Versions (libnss_files): Export _nss_files_gethostbyname4_r. * nss/nss.h: Define struct gaih_addrtuple. * nss/nss_files/files-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_files_gethostbyname4_r): New function. * resolv/Versions (libnss_dns): Export _nss_dns_gethostbyname4_r. * resolv/gethnmaddr.c: Adjust __libc_res_nsearch and __libc_res_nquery calls. * resolv/res_query.c (__libc_res_nquery): Take two additional parameters for second answer buffer. Handle type=T_UNSPEC to mean look up IPv4 and IPv6. Change all callers. * resolv/res_send.c (__libc_res_nsend): Take five aditional parameters for an additional query and answer buffer. Pass to send_vc and send_dg. (send_vc): Send possibly two requests and receive two answers. (send_dg): Likewise. * resolv/nss_dns/dns-host.c: Adjust calls to __libc_res_nsearch and __libc_res_nquery. (_nss_dns_gethostbyname4_r): New function. (gaih_getanswer_slice): Likewise. (gaih_getanswer): Likewise. * resolv/nss_dns/dns-canon.c (_nss_dns_getcanonname_r): Adjust __libc_res_nquery call. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Adjust __libc_res_nsearch call. * sysdeps/posix/getaddrinfo.c: Use gethostbyname4_r function is available.
2008-05-11 01:27:39 +02:00
if ((hp->rcode == NOERROR && ntohs (hp->ancount) != 0)
|| (hp2->rcode == NOERROR
&& ntohs (hp2->ancount) != 0))
goto success;
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
RES_SET_H_ERRNO(statp, HOST_NOT_FOUND);
1995-02-18 02:27:10 +01:00
break;
case SERVFAIL:
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
RES_SET_H_ERRNO(statp, TRY_AGAIN);
1995-02-18 02:27:10 +01:00
break;
case NOERROR:
* include/resolv.h: Adjust __libc_res_nquery and __libc_res_nsend prototypes. * include/arpa/nameser_compat.h: Define T_UNSPEC. * nis/Versions (libnss_nis): Export _nss_nis_gethostbyname4_r. (libnss_nisplus): Export _nss_nisplus_gethostbyname4_r. * nis/nss_nis/nis-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_nis_gethostbyname4_r): New function. * nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_parse_hostent): Change to also handle af==AF_UNSPEC. (get_tablename): New function. Use it to avoid duplication. (_nss_nisplus_gethostbyname4_r): New function. * nscd/aicache.c (addhstaiX): Use gethostbyname4_r function is available. * nss/Versions (libnss_files): Export _nss_files_gethostbyname4_r. * nss/nss.h: Define struct gaih_addrtuple. * nss/nss_files/files-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_files_gethostbyname4_r): New function. * resolv/Versions (libnss_dns): Export _nss_dns_gethostbyname4_r. * resolv/gethnmaddr.c: Adjust __libc_res_nsearch and __libc_res_nquery calls. * resolv/res_query.c (__libc_res_nquery): Take two additional parameters for second answer buffer. Handle type=T_UNSPEC to mean look up IPv4 and IPv6. Change all callers. * resolv/res_send.c (__libc_res_nsend): Take five aditional parameters for an additional query and answer buffer. Pass to send_vc and send_dg. (send_vc): Send possibly two requests and receive two answers. (send_dg): Likewise. * resolv/nss_dns/dns-host.c: Adjust calls to __libc_res_nsearch and __libc_res_nquery. (_nss_dns_gethostbyname4_r): New function. (gaih_getanswer_slice): Likewise. (gaih_getanswer): Likewise. * resolv/nss_dns/dns-canon.c (_nss_dns_getcanonname_r): Adjust __libc_res_nquery call. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Adjust __libc_res_nsearch call. * sysdeps/posix/getaddrinfo.c: Use gethostbyname4_r function is available.
2008-05-11 01:27:39 +02:00
if (ntohs (hp->ancount) != 0
|| ntohs (hp2->ancount) != 0)
goto success;
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
RES_SET_H_ERRNO(statp, NO_DATA);
1995-02-18 02:27:10 +01:00
break;
case FORMERR:
case NOTIMP:
/* Servers must not reply to AAAA queries with
NOTIMP etc but some of them do. */
if ((hp->rcode == NOERROR && ntohs (hp->ancount) != 0)
|| (hp2->rcode == NOERROR
&& ntohs (hp2->ancount) != 0))
goto success;
/* FALLTHROUGH */
1995-02-18 02:27:10 +01:00
case REFUSED:
default:
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
RES_SET_H_ERRNO(statp, NO_RECOVERY);
1995-02-18 02:27:10 +01:00
break;
}
return (-1);
}
* include/resolv.h: Adjust __libc_res_nquery and __libc_res_nsend prototypes. * include/arpa/nameser_compat.h: Define T_UNSPEC. * nis/Versions (libnss_nis): Export _nss_nis_gethostbyname4_r. (libnss_nisplus): Export _nss_nisplus_gethostbyname4_r. * nis/nss_nis/nis-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_nis_gethostbyname4_r): New function. * nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_parse_hostent): Change to also handle af==AF_UNSPEC. (get_tablename): New function. Use it to avoid duplication. (_nss_nisplus_gethostbyname4_r): New function. * nscd/aicache.c (addhstaiX): Use gethostbyname4_r function is available. * nss/Versions (libnss_files): Export _nss_files_gethostbyname4_r. * nss/nss.h: Define struct gaih_addrtuple. * nss/nss_files/files-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_files_gethostbyname4_r): New function. * resolv/Versions (libnss_dns): Export _nss_dns_gethostbyname4_r. * resolv/gethnmaddr.c: Adjust __libc_res_nsearch and __libc_res_nquery calls. * resolv/res_query.c (__libc_res_nquery): Take two additional parameters for second answer buffer. Handle type=T_UNSPEC to mean look up IPv4 and IPv6. Change all callers. * resolv/res_send.c (__libc_res_nsend): Take five aditional parameters for an additional query and answer buffer. Pass to send_vc and send_dg. (send_vc): Send possibly two requests and receive two answers. (send_dg): Likewise. * resolv/nss_dns/dns-host.c: Adjust calls to __libc_res_nsearch and __libc_res_nquery. (_nss_dns_gethostbyname4_r): New function. (gaih_getanswer_slice): Likewise. (gaih_getanswer): Likewise. * resolv/nss_dns/dns-canon.c (_nss_dns_getcanonname_r): Adjust __libc_res_nquery call. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Adjust __libc_res_nsearch call. * sysdeps/posix/getaddrinfo.c: Use gethostbyname4_r function is available.
2008-05-11 01:27:39 +02:00
success:
1995-02-18 02:27:10 +01:00
return (n);
}
libresolv_hidden_def (__res_context_query)
/* Common part of res_nquery and res_query. */
static int
context_query_common (struct resolv_context *ctx,
const char *name, int class, int type,
unsigned char *answer, int anslen)
{
if (ctx == NULL)
{
RES_SET_H_ERRNO (&_res, NETDB_INTERNAL);
return -1;
}
int result = __res_context_query (ctx, name, class, type, answer, anslen,
NULL, NULL, NULL, NULL, NULL);
__resolv_context_put (ctx);
return result;
}
1995-02-18 02:27:10 +01:00
Update. 2002-10-15 Jakub Jelinek <jakub@redhat.com> * include/resolv.h (__libc_res_nquery, __libc_res_nsearch, __libc_res_nsend): New prototypes. * resolv/res_query.c (QUERYSIZE): Define. (__libc_res_nquery): Renamed from res_nquery. Added answerp argument. Allocate only QUERYSIZE bytes first, if res_nmkquery fails use MAXPACKET buffer. Call __libc_res_nsend instead of res_nsend, pass answerp. (res_nquery): Changed into wrapper around __libc_res_nquery. (__libc_res_nsearch): Renamed from res_nsearch. Added answerp argument. Call __libc_res_nquerydomain and __libc_res_nquery instead of the non-__libc_ variants, pass them answerp. (res_nsearch): Changed into wrapper around __libc_res_nsearch. (__libc_res_nquerydomain): Renamed from res_nquerydomain. Added answerp argument. Call __libc_res_nquery instead of res_nquery, pass answerp. (res_nquerydomain): Changed into wrapper around __libc_res_nquerydomain. * resolv/res_send.c: Include sys/ioctl.h. (MAXPACKET): Define. (send_vc): Change arguments. Reallocate answer buffer if it is too small. (send_dg): Likewise. (__libc_res_nsend): Renamed from res_nsend. Added ansp argument. Reallocate answer buffer if it is too small and hooks are in use. Adjust calls to send_vc and send_dg. (res_nsend): Changed into wrapper around __libc_res_nsend. * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname2_r): Allocate just 1K answer buffer on the stack, use __libc_res_nsearch instead of res_nsearch. (_nss_dns_gethostbyaddr_r): Similarly with __libc_res_nquery. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Similarly with __libc_res_nsearch. * resolv/gethnamaddr.c (gethostbyname2): Likewise. (gethostbyaddr): Similarly with __libc_res_nquery. * resolv/Versions (libresolv): Export __libc_res_nquery and __libc_res_nsearch at GLIBC_PRIVATE.
2002-10-17 23:51:21 +02:00
int
res_nquery(res_state statp,
const char *name, /* domain name */
int class, int type, /* class and type of query */
u_char *answer, /* buffer to put answer */
int anslen) /* size of answer buffer */
{
return context_query_common
(__resolv_context_get_override (statp), name, class, type, answer, anslen);
Update. 2002-10-15 Jakub Jelinek <jakub@redhat.com> * include/resolv.h (__libc_res_nquery, __libc_res_nsearch, __libc_res_nsend): New prototypes. * resolv/res_query.c (QUERYSIZE): Define. (__libc_res_nquery): Renamed from res_nquery. Added answerp argument. Allocate only QUERYSIZE bytes first, if res_nmkquery fails use MAXPACKET buffer. Call __libc_res_nsend instead of res_nsend, pass answerp. (res_nquery): Changed into wrapper around __libc_res_nquery. (__libc_res_nsearch): Renamed from res_nsearch. Added answerp argument. Call __libc_res_nquerydomain and __libc_res_nquery instead of the non-__libc_ variants, pass them answerp. (res_nsearch): Changed into wrapper around __libc_res_nsearch. (__libc_res_nquerydomain): Renamed from res_nquerydomain. Added answerp argument. Call __libc_res_nquery instead of res_nquery, pass answerp. (res_nquerydomain): Changed into wrapper around __libc_res_nquerydomain. * resolv/res_send.c: Include sys/ioctl.h. (MAXPACKET): Define. (send_vc): Change arguments. Reallocate answer buffer if it is too small. (send_dg): Likewise. (__libc_res_nsend): Renamed from res_nsend. Added ansp argument. Reallocate answer buffer if it is too small and hooks are in use. Adjust calls to send_vc and send_dg. (res_nsend): Changed into wrapper around __libc_res_nsend. * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname2_r): Allocate just 1K answer buffer on the stack, use __libc_res_nsearch instead of res_nsearch. (_nss_dns_gethostbyaddr_r): Similarly with __libc_res_nquery. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Similarly with __libc_res_nsearch. * resolv/gethnamaddr.c (gethostbyname2): Likewise. (gethostbyaddr): Similarly with __libc_res_nquery. * resolv/Versions (libresolv): Export __libc_res_nquery and __libc_res_nsearch at GLIBC_PRIVATE.
2002-10-17 23:51:21 +02:00
}
int
res_query (const char *name, int class, int type,
unsigned char *answer, int anslen)
{
return context_query_common
(__resolv_context_get (), name, class, type, answer, anslen);
}
/* Formulate a normal query, send, and retrieve answer in supplied
buffer. Return the size of the response on success, -1 on error.
If enabled, implement search rules until answer or unrecoverable
failure is detected. Error code, if any, is left in h_errno. */
1995-02-18 02:27:10 +01:00
int
__res_context_search (struct resolv_context *ctx,
const char *name, int class, int type,
unsigned char *answer, int anslen,
unsigned char **answerp, unsigned char **answerp2,
int *nanswerp2, int *resplen2, int *answerp2_malloced)
1995-02-18 02:27:10 +01:00
{
struct __res_state *statp = ctx->resp;
const char *cp;
1995-02-18 02:27:10 +01:00
HEADER *hp = (HEADER *) answer;
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
char tmp[NS_MAXDNAME];
1995-02-18 02:27:10 +01:00
u_int dots;
Update. 2000-07-18 Mark Kettenis <kettenis@gnu.org> Update resolver code to BIND 8.2.3-T5B. * resolv/Versions [GLIBC_2.2] (libc): Add __res_init and __res_nclose. [GLIBC_2.2] (libresolv): Add __dn_expand, __ns_samename, __res_mkquery, __res_nsend, __res_query, __res_querydomain and __res_search. * resolv/Banner: BIND-8.2.3-T5B. * resolv/base64.c: Update from BIND 8.2.3-T5B. * resolv/herror.c: Likewise. * resolv/inet_addr.c: Likewise. * resolv/inet_net_ntop.c: Likewise. * resolv/inet_net_pton.c: Likewise. * resolv/inet_neta.c: Likewise. * resolv/inet_ntop.c: Likewise. * resolv/nsap_addr.c: Likewise. * resolv/inet_pton.c: Likewise. Reject a few more more invalid IPv6 addresses (ISC bug #520). * resolv/ns_name.c: Avoid emitting RCS ID in object file. * resolv/ns_parse.c: Likewise. * resolv/ns_netint.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/ns_print.c: Update from BIND 8.2.3-T5B. Avoid emitting RCS ID in object file. * resolv/res_debug.c: Update from BIND 8.2.3-T5B. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_init.c: Likewise. (res_setoptions): Mark internal. * resolv/res_send.c: Likewise. [_LIBC]: Fully reinstate the code that avoids the FD_SETSIZE limit by using poll instead. * resolv/res_comp.c: Likewise. [SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_2)]: Make dn_expand a weak alias for __dn_expand. * resolv/res_data.c: Likewise. (res_close) [_LIBC]: Don't call res_nclose if RES_INIT isn't set in _res.options. Avoids a potential security risk by avoiding a close (0). [SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_2)]: Make res_mkquery, res_query, res_querydomain adn res_search weak aliases for __res_mkquery, __res_query, __res_querydomain and __res_search. * resolv/res_libc.c: (_res): Don't initialize. Fix res_close instead to avoid close(0). (res_init): Always use the static resolver context. [SHLIB_COMPAT (libc, GLIBC_2.0, GLIBC_2_2)]: Make res_init a weak alias for __res_init. * resolv/resolv.h: Update from BIND 8.2.3-T5B. Move definition of RES_SET_H_ERRNO and accompanying comment to... * include/resolv.h: ... here. * resolv/arpa/namser.h: Update from BIND 8.2.3-T5B. * resolv/arpa/nameser_compat.h: Likewise.
2000-07-20 00:03:58 +02:00
int trailing_dot, ret, saved_herrno;
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
int got_nodata = 0, got_servfail = 0, root_on_list = 0;
Update. 2000-07-18 Mark Kettenis <kettenis@gnu.org> Update resolver code to BIND 8.2.3-T5B. * resolv/Versions [GLIBC_2.2] (libc): Add __res_init and __res_nclose. [GLIBC_2.2] (libresolv): Add __dn_expand, __ns_samename, __res_mkquery, __res_nsend, __res_query, __res_querydomain and __res_search. * resolv/Banner: BIND-8.2.3-T5B. * resolv/base64.c: Update from BIND 8.2.3-T5B. * resolv/herror.c: Likewise. * resolv/inet_addr.c: Likewise. * resolv/inet_net_ntop.c: Likewise. * resolv/inet_net_pton.c: Likewise. * resolv/inet_neta.c: Likewise. * resolv/inet_ntop.c: Likewise. * resolv/nsap_addr.c: Likewise. * resolv/inet_pton.c: Likewise. Reject a few more more invalid IPv6 addresses (ISC bug #520). * resolv/ns_name.c: Avoid emitting RCS ID in object file. * resolv/ns_parse.c: Likewise. * resolv/ns_netint.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/ns_print.c: Update from BIND 8.2.3-T5B. Avoid emitting RCS ID in object file. * resolv/res_debug.c: Update from BIND 8.2.3-T5B. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_init.c: Likewise. (res_setoptions): Mark internal. * resolv/res_send.c: Likewise. [_LIBC]: Fully reinstate the code that avoids the FD_SETSIZE limit by using poll instead. * resolv/res_comp.c: Likewise. [SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_2)]: Make dn_expand a weak alias for __dn_expand. * resolv/res_data.c: Likewise. (res_close) [_LIBC]: Don't call res_nclose if RES_INIT isn't set in _res.options. Avoids a potential security risk by avoiding a close (0). [SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_2)]: Make res_mkquery, res_query, res_querydomain adn res_search weak aliases for __res_mkquery, __res_query, __res_querydomain and __res_search. * resolv/res_libc.c: (_res): Don't initialize. Fix res_close instead to avoid close(0). (res_init): Always use the static resolver context. [SHLIB_COMPAT (libc, GLIBC_2.0, GLIBC_2_2)]: Make res_init a weak alias for __res_init. * resolv/resolv.h: Update from BIND 8.2.3-T5B. Move definition of RES_SET_H_ERRNO and accompanying comment to... * include/resolv.h: ... here. * resolv/arpa/namser.h: Update from BIND 8.2.3-T5B. * resolv/arpa/nameser_compat.h: Likewise.
2000-07-20 00:03:58 +02:00
int tried_as_is = 0;
int searched = 0;
1995-02-18 02:27:10 +01:00
update from main archive Mon Sep 23 15:31:04 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu> * hurd/Makefile ($(includedir)/rpc/netdb.h): There is no make variable `top_srcdir' in libc; use $(..) instead. * sysdeps/mach/hurd/Makefile (rtld-installed-name): Delete special definition. It was a *Mistake*. (With a capital M.) * sysdeps/mach/getsysstats.c (__get_nprocs): Renamed from __get_nproc. (__get_nprocs_conf): Renamed from __get_nproc_conf. Fri Sep 27 03:49:56 1996 Ulrich Drepper <drepper@cygnus.com> Add support for cancelable system calls. * csu/initfini.c: Make in crti.o reference to symbol __libc_force_cancel_wrapper when compiling reentrant version. * misc/Makefile (routines): Add force-wrapper. * misc/force-wrapper.c: New file. * posix/system.c: Rename function to __libc_system and make system a weak alias. * sysdeps/stub/system.c: Likewise. * posix/wait.c: Rename function to __libc_wait and make __wait a weak alias. De-ANSI-fy. * sysdeps/standalone/read.c: Rename function to __libc_read and make __read a weak alias. * sysdeps/stub/read.c: Likewise. * sysdeps/standalone/write.c: Rename function to __libc_write and make __write a weak alias. * sysdeps/stub/write.c: Likewise. * sysdeps/stub/tcdrain.c: Rename function to __libc_tcdrain and make tcdrain a weak alias. * sysdeps/unix/bsd/tcdrain.c: Likewise. * sysdeps/unix/bsd/bsd4.4/tcdrain.c: Likewise. * sysdeps/unix/sysv/tcdrain.c: Likewise. * sysdeps/unix/sysv/linux/tcdrain.c: Likewise. * sysdeps/unix/bsd/bsd4.4/wait.c: Rename function to __libc_wait and make __wait a weak alias. * sysdeps/stub/waitpid.c: Rename function to __libc_waitpid and make __waitpid a weak alias. * sysdeps/unix/bsd/bsd4.4/waitpid.c: Likewise. * sysdeps/unix/sysv/linux/waitpid.c: Likewise. * sysdeps/unix/sysv/sysv4/waitpid.c: Likewise. * sysdeps/unix/common/pause.c: Rename function to __libc_pause and make pause a weak alias. De-ANSI-fy. * sysdeps/unix/syscalls.list: Change name for close, fcntl, fsync, lseek, open, read, and write to have __libc_ prefix and make old names a weak alias. * sysdeps/unix/mman/syscalls.list: Likewise for msync. * sysdeps/unix/sysv/linux/syscalls.list: Likewise for nanosleep. * io/creat.c: De-ANSI-fy. * sysdeps/unix/sysv/linux/syscalls.list: Add pause. Thu Sep 26 19:15:55 1996 Ulrich Drepper <drepper@cygnus.com> * misc/mntent.h: Add MNTTYPE_* and MNTOPT_* macros. Reported by Hans Grobler <grobh@nolian.ee.sun.ac.za>. Thu Sep 26 14:40:10 1996 Ulrich Drepper <drepper@cygnus.com> * sysdeps/posix/pathconf.c: Pass descriptor for just opened file to fpathconf. Reported by Martin von Loewis <martin@mira.isdn.cs.tu-berlin.de>. Thu Sep 26 04:02:43 1996 Ulrich Drepper <drepper@cygnus.com> * locale/programs/locfile.c (write_locale_data): Allocate room even for file name for LC_MESSAGES locale. (locafile_read): `tok_era' must be handled as a string list. * locale/programs/ld-time.c: Finish correction of handling `era'. * locale/C-time.c (_nl_C_LC_TIME): Add initializer for new fields. * locale/categories.def: Add postload function for LC_TIME. * locale/setlocale.c: Make lock global and rename to __libc_setlocale_lock. * locale/localeinfo.h (struct era_entry): New type. Used in strftime. Add prototypes for _nl_get_era_entry and _nl_get_alt_digit. * locale/lc-time.c (_nl_postload_time): New function. Initialize lazy intialization. (_nl_get_era_entry): New function. Return era entry which corresponds to given year. (_nl_get_alt_digit): New function. Return string with alternate digit representation for given number. * time/strftime.c (strftime): Use _nl_get_alt_digit to get string representing alternate digit notation. Wed Sep 25 17:31:55 1996 Ulrich Drepper <drepper@cygnus.com> * sysdeps/generic/waitstatus.h (union wait): Add w_status field. Reported by Hans Grobler <grobh@nolian.ee.sun.ac.za>. * elf/rtld.c (dl_main): Process LD_PRELOAD before loading ld.so.preload. Suggested by David Engel <david@elo.ods.com>. Wed Sep 25 13:10:57 1996 Ulrich Drepper <drepper@cygnus.com> * catgets/gencat.c (main): Change --version again because RMS wants the package name in parentheses. * db/makedb.c: Likewise. * locale/programs/locale.c: Likewise. * locale/programs/localedef.c: Likewise. Tue Sep 24 01:28:05 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * Makefile ($(objpfx)sysd-dirs): Depend on Subdirs files, command rewritten. ($(objpfx)version-info.h): Depend on Banner files, command rewritten. Wed Sep 25 02:44:41 1996 Ulrich Drepper <drepper@cygnus.com> * sysdeps/unix/sysv/linux/sleep.c: New file. Based on nanosleep. Tue Sep 24 21:46:02 1996 Ulrich Drepper <drepper@cygnus.com> * shadow/lckpwdf.c (PWD_LOCKFILE): Change to /etc/lock.pwd to be on the same device as the password file. * shadow/shadow.h (struct spwd): Change type of numeric fields to `long int' since there value are days, not seconds. * shadow/putspent.c: Change casts from time_t to `long int'. * shadow/sgetspent_r.c (LINE_READER): Likewise. Mon Sep 23 23:05:24 1996 Ulrich Drepper <drepper@cygnus.com> * sysdeps/unix/sysv/linux/errnos.h: Define __set_errno to make sure the thread specific variable is set as well as the global variable. * sysdeps/mach/hurd/errnos.awk: Define macro for source code compatibility. * sysdeps/stub/errnos.h: Likewise. * sysdeps/unix/bsd/bsd4.4/errnos.h: Likewise. * shadow/putspent.c: Don't include <errno.h>. * dirent/scandir.c (scandir): Use __set_errno to set errno variable. * elf/dl-load.c (open_path): Likewise. * inet/rcmd.c (rcmd): Likewise. (rresvport): Likewise. * intl/dcgettext.c [!__set_errno]: Define __set_errno. (DCGETTEXT): Use __set_errno to set errno variable. * io/fts.c (fts_open): Likewise. (fts_close): Likewise. (fts_read): Likewise. (fts_set): Likewise. (fts_children): Likewise. (fts_build): Likewise. (fts_stat): Likewise. * io/ftw.c (ftw_dir): Likewise. (ftw): Likewise. * io/getwd.c (getwd): Likewise. * io/lockf.c (lockf): Likewise. * libio/libioP.h [EINVAL]: Use __set_errno to define MAYBE_SET_EINVAL. * libio/iofdopen.c (_IO_fdopen): Use MAYBE_SET_EINVAL to errno. * libio/iogetdelim.c (_IO_getdelim): Likewise. * libio/fileops.c (_IO_file_open): Use __set_errno to set errno variable. * libio/iofgetpos.c (_IO_fgetpos): Likewise. * libio/iofsetpos.c (_IO_fsetpos): Likewise. * libio/ioftell.c (_IO_ftell): Likewise. * locale/loadlocale.c (_nl_load_locale): Likewise. * locale/nl_langinfo.c (nl_langinfo): Likewise. * locale/setlocale.c (ERROR_RETURN): Likewise. * login/getutid_r (__getutid_r): Likewise. * login/getutline_r (__getutline_r): Likewise. * login/login.c (tty_name): Likewise. * login/oututline_r.c (__pututline_r): Likewise. * malloc/malloc.c (morecore): Likewise. * misc/efgcvt_r.c (fcvt_r): Likewise. * misc/hsearch_r.c (hcreate_r): Likewise. (hdestroy_r): Likewise. (hsearch_r): Likewise. * nss/nsswitch.c (__nss_configure_lookup): Likewise. * nss/nss_dns/dns-host.c (_nss_dns_gethostbyname2_r): Likewise. (_nss_dns_gethostbyaddr_r): Likewise. * nss/nss_files/files-XXX.c (internal_getent): Likewise. * nss/nss_files/files-parse.c (parse_list): Likewise. * posix/confstr.c (confstr): Likewise. De-ANSI-fy. * posix/execvp.c (execvp): Likewise. * posix/glob.c: Define __set_errno. (glob): Use __set_errno to set errno variable. (glob_in_dir): Likewise. * pwd/getpw.c: Likewise. De-ANSI-fy. * pwd/putpwent.c: Likewise. * resolv/inet_net_ntop.c: Likewise. * resolv/inet_net_pton.c: Likewise. * resolv/inet_neta.c: Likewise. * resolv/inet_ntop.c: Likewise. * resolv/inet_pton.c: Likewise. * resolv/res_query.c (res_search): Likewise. * resolv/res_send.c (Aerror): Likewise. (Perror): Likewise. (res_send): Likewise. * signal/sigaddset.c: Likewise. De-ANSI-fy. * signal/sigdelset.c: Likewise. * signal/sigempty.c: Likewise. * signal/sigfillset.c: Likewise. * signal/sigismem.c: Likewise. * stdio/fclose.c: Likewise. * stdio/feof.c: Likewise. * stdio/ferror.c: Likewise. * stdio/fflush.c: Likewise. * stdio/fgetc.c: Likewise. * stdio/fgetpos.c: Likewise. * stdio/fgets.c: Likewise. * stdio/fileno.c: Likewise. * stdio/fmemopen.c: Likewise. * stdio/fopen.c: Likewise. * stdio/fputc.c: Likewise. * stdio/fread.c: Likewise. * stdio/freopen.c: Likewise. * stdio/fseek.c: Likewise. * stdio/fsetpos.c: Likewise. * stdio/ftell.c: Likewise. * stdio/fwrite.c: Likewise. * stdio/getdelim.c: Likewise. * stdio/gets.c: Likewise. * stdio/glue.c: Likewise. * stdio/internals.c: Likewise. * stdio/memstream.c: Likewise. * stdio/setvbuf.c: Likewise. * stdio/ungetc.c: Likewise. * stdio/vsscanf.c: Likewise. * stdio-common/reg-printf.c: Likewise. * stdio-common/vfprintf.c: Likewise. * stdio-common/vfscanf.c: Likewise. * stdlib/canonicalize.c: Likewise. * stdlib/msort.c: Likewise. * stdlib/random_r.c: Likewise. * stdlib/strfmon.c: Likewise. * stdlib/strtod.c: Likewise. * stdlib/strtol.c: Likewise. * sunrpc/bindrsvprt.c: Likewise. * time/asctime.c: Likewise. * time/localtime.c: Likewise. * wcsmbs/mbrtowc.c: Likewise. * wcsmbs/mbsnrtowcs.c: Likewise. * wcsmbs/mbsrtowcs.c: Likewise. * wcsmbs/wcrtomb.c: Likewise. * wcsmbs/wcsnrtombs.c: Likewise. * wcsmbs/wcsrtombs.c: Likewise. * wcsmbs/wcstok.c: Likewise. * sysdeps/generic/ftime.c: Likewise. * sysdeps/generic/pty.c: Likewise. * sysdeps/generic/setenv.c: Likewise. * sysdeps/generic/speed.c: Likewise. * sysdeps/generic/sysd-stdio.c: Likewise. * sysdeps/generic/uname.c: Likewise. * sysdeps/generic/vlimit.c: Likewise. * sysdeps/libm-ieee754/k_standard.c: Likewise. * sysdeps/libm-ieee754/s_ldexp.c: Likewise. * sysdeps/libm-ieee754/s_ldexpf.c: Likewise. * sysdeps/libm-ieee754/s_ldexpl.c: Likewise. * sysdeps/libm-ieee754/w_scalb.c: Likewise. * sysdeps/libm-ieee754/w_scalbf.c: Likewise. * sysdeps/libm-ieee754/w_scalbl.c: Likewise. * sysdeps/posix/dup2.c: Likewise. * sysdeps/posix/euidaccess.c: Likewise. * sysdeps/posix/fdopen.c: Likewise. * sysdeps/posix/flock.c: Likewise. * sysdeps/posix/fpathconf.c: Likewise. * sysdeps/posix/getcwd.c: Likewise. * sysdeps/posix/gettimeofday.c: Likewise. * sysdeps/posix/isatty.c: Likewise. * sysdeps/posix/isfdtype.c: Likewise. * sysdeps/posix/killpg.c: Likewise. * sysdeps/posix/mkstemp.c: Likewise. * sysdeps/posix/mktemp.c: Likewise. * sysdeps/posix/pathconf.c: Likewise. * sysdeps/posix/pipestream.c: Likewise. * sysdeps/posix/remove.c: Likewise. * sysdeps/posix/rename.c: Likewise. * sysdeps/posix/sigintr.c: Likewise. * sysdeps/posix/signal.c: Likewise. * sysdeps/posix/sigsuspend.c: Likewise. * sysdeps/posix/sigvec.c: Likewise. * sysdeps/posix/sleep.c: Likewise. * sysdeps/posix/sysconf.c: Likewise. * sysdeps/posix/system.c: Likewise. * sysdeps/posix/tempname.c: Likewise. * sysdeps/posix/truncate.c: Likewise. * sysdeps/posix/ttyname.c: Likewise. * sysdeps/posix/ttyname_r.c: Likewise. * sysdeps/posix/wait3.c: Likewise. * sysdeps/standalone/close.c: Likewise. * sysdeps/standalone/open.c: Likewise. * sysdeps/standalone/read.c: Likewise. * sysdeps/standalone/write.c: Likewise. * sysdeps/stub/__longjmp.c: Likewise. * sysdeps/stub/accept.c: Likewise. * sysdeps/stub/access.c: Likewise. * sysdeps/stub/acct.c: Likewise. * sysdeps/stub/adjtime.c: Likewise. * sysdeps/stub/alarm.c: Likewise. * sysdeps/stub/bind.c: Likewise. * sysdeps/stub/brk.c: Likewise. * sysdeps/stub/chdir.c: Likewise. * sysdeps/stub/chflags.c: Likewise. * sysdeps/stub/chmod.c: Likewise. * sysdeps/stub/chown.c: Likewise. * sysdeps/stub/chroot.c: Likewise. * sysdeps/stub/clock.c: Likewise. * sysdeps/stub/close.c: Likewise. * sysdeps/stub/closedir.c: Likewise. * sysdeps/stub/connect.c: Likewise. * sysdeps/stub/ctermid.c: Likewise. * sysdeps/stub/cuserid.c: Likewise. * sysdeps/stub/dirfd.c: Likewise. * sysdeps/stub/dup.c: Likewise. * sysdeps/stub/dup2.c: Likewise. * sysdeps/stub/euidaccess.c: Likewise. * sysdeps/stub/execve.c: Likewise. * sysdeps/stub/fchdir.c: Likewise. * sysdeps/stub/fchflags.c: Likewise. * sysdeps/stub/fchmod.c: Likewise. * sysdeps/stub/fchown.c: Likewise. * sysdeps/stub/fcntl.c: Likewise. * sysdeps/stub/fdopen.c: Likewise. * sysdeps/stub/fexecve.c: Likewise. * sysdeps/stub/flock.c: Likewise. * sysdeps/stub/fork.c: Likewise. * sysdeps/stub/fpathconf.c: Likewise. * sysdeps/stub/fstatfs.c: Likewise. * sysdeps/stub/fsync.c: Likewise. * sysdeps/stub/ftruncate.c: Likewise. * sysdeps/stub/fxstat.c: Likewise. * sysdeps/stub/getcwd.c: Likewise. * sysdeps/stub/getdents.c: Likewise. * sysdeps/stub/getdomain.c: Likewise. * sysdeps/stub/getdtsz.c: Likewise. * sysdeps/stub/getegid.c: Likewise. * sysdeps/stub/getenv.c: Likewise. * sysdeps/stub/geteuid.c: Likewise. * sysdeps/stub/getgid.c: Likewise. * sysdeps/stub/getgroups.c: Likewise. * sysdeps/stub/gethostid.c: Likewise. * sysdeps/stub/gethostname.c: Likewise. * sysdeps/stub/getitimer.c: Likewise. * sysdeps/stub/getlogin.c: Likewise. * sysdeps/stub/getlogin_r.c: Likewise. * sysdeps/stub/getpagesize.c: Likewise. * sysdeps/stub/getpeername.c: Likewise. * sysdeps/stub/getpid.c: Likewise. * sysdeps/stub/getppid.c: Likewise. * sysdeps/stub/getpriority.c: Likewise. * sysdeps/stub/getrlimit.c: Likewise. * sysdeps/stub/getrusage.c: Likewise. * sysdeps/stub/getsid.c: Likewise. * sysdeps/stub/getsockname.c: Likewise. * sysdeps/stub/getsockopt.c: Likewise. * sysdeps/stub/getsysstats.c: Likewise. * sysdeps/stub/gettimeofday.c: Likewise. * sysdeps/stub/getuid.c: Likewise. * sysdeps/stub/gtty.c: Likewise. * sysdeps/stub/ioctl.c: Likewise. * sysdeps/stub/isatty.c: Likewise. * sysdeps/stub/isfdtype.c: Likewise. * sysdeps/stub/kill.c: Likewise. * sysdeps/stub/killpg.c: Likewise. * sysdeps/stub/link.c: Likewise. * sysdeps/stub/listen.c: Likewise. * sysdeps/stub/lseek.c: Likewise. * sysdeps/stub/lxstat.c: Likewise. * sysdeps/stub/madvice.c: Likewise. * sysdeps/stub/mkdir.c: Likewise. * sysdeps/stub/mkfifo.c: Likewise. * sysdeps/stub/mkstemp.c: Likewise. * sysdeps/stub/mktemp.c: Likewise. * sysdeps/stub/mmap.c: Likewise. * sysdeps/stub/morecore.c: Likewise. * sysdeps/stub/mprotect.c: Likewise. * sysdeps/stub/msgctl.c: Likewise. * sysdeps/stub/msgget.c: Likewise. * sysdeps/stub/msgrcv.c: Likewise. * sysdeps/stub/msgsnd.c: Likewise. * sysdeps/stub/msync.c: Likewise. * sysdeps/stub/munmap.c: Likewise. * sysdeps/stub/nanosleep.c: Likewise. * sysdeps/stub/nice.c: Likewise. * sysdeps/stub/nlist.c: Likewise. * sysdeps/stub/open.c: Likewise. * sysdeps/stub/opendir.c: Likewise. * sysdeps/stub/pathconf.c: Likewise. * sysdeps/stub/pause.c: Likewise. * sysdeps/stub/pipe.c: Likewise. * sysdeps/stub/pipestream.c: Likewise. * sysdeps/stub/poll.c: Likewise. * sysdeps/stub/profil.c: Likewise. * sysdeps/stub/ptrace.c: Likewise. * sysdeps/stub/putenv.c: Likewise. * sysdeps/stub/raise.c: Likewise. * sysdeps/stub/read.c: Likewise. * sysdeps/stub/readdir.c: Likewise. * sysdeps/stub/readlink.c: Likewise. * sysdeps/stub/readv.c: Likewise. * sysdeps/stub/reboot.c: Likewise. * sysdeps/stub/recv.c: Likewise. * sysdeps/stub/recvfrom.c: Likewise. * sysdeps/stub/recvmsg.c: Likewise. * sysdeps/stub/remove.c: Likewise. * sysdeps/stub/rename.c: Likewise. * sysdeps/stub/revoke.c: Likewise. * sysdeps/stub/rewinddir.c: Likewise. * sysdeps/stub/rmdir.c: Likewise. * sysdeps/stub/sbrk.c: Likewise. * sysdeps/stub/sched_getp.c: Likewise. * sysdeps/stub/sched_gets.c: Likewise. * sysdeps/stub/sched_primax.c: Likewise. * sysdeps/stub/sched_primin.c: Likewise. * sysdeps/stub/sched_rr_gi.c: Likewise. * sysdeps/stub/sched_setp.c: Likewise. * sysdeps/stub/sched_sets.c: Likewise. * sysdeps/stub/sched_yield.c: Likewise. * sysdeps/stub/seekdir.c: Likewise. * sysdeps/stub/select.c: Likewise. * sysdeps/stub/semctl.c: Likewise. * sysdeps/stub/semget.c: Likewise. * sysdeps/stub/semop.c: Likewise. * sysdeps/stub/send.c: Likewise. * sysdeps/stub/sendmsg.c: Likewise. * sysdeps/stub/sendto.c: Likewise. * sysdeps/stub/setdomain.c: Likewise. * sysdeps/stub/setegid.c: Likewise. * sysdeps/stub/setenv.c: Likewise. * sysdeps/stub/seteuid.c: Likewise. * sysdeps/stub/setgid.c: Likewise. * sysdeps/stub/setgroups.c: Likewise. * sysdeps/stub/sethostid.c: Likewise. * sysdeps/stub/sethostname.c: Likewise. * sysdeps/stub/setitimer.c: Likewise. * sysdeps/stub/setjmp.c: Likewise. * sysdeps/stub/setlogin.c: Likewise. * sysdeps/stub/setpgid.c: Likewise. * sysdeps/stub/setpriority.c: Likewise. * sysdeps/stub/setregid.c: Likewise. * sysdeps/stub/setreuid.c: Likewise. * sysdeps/stub/setrlimit.c: Likewise. * sysdeps/stub/setsid.c: Likewise. * sysdeps/stub/setsockopt.c: Likewise. * sysdeps/stub/settimeofday.c: Likewise. * sysdeps/stub/setuid.c: Likewise. * sysdeps/stub/shmat.c: Likewise. * sysdeps/stub/shmctl.c: Likewise. * sysdeps/stub/shmdt.c: Likewise. * sysdeps/stub/shmget.c: Likewise. * sysdeps/stub/shutdown.c: Likewise. * sysdeps/stub/sigaction.c: Likewise. * sysdeps/stub/sigaltstack.c: Likewise. * sysdeps/stub/sigblock.c: Likewise. * sysdeps/stub/sigintr.c: Likewise. * sysdeps/stub/signal.c: Likewise. * sysdeps/stub/sigpause.c: Likewise. * sysdeps/stub/sigpending.c: Likewise. * sysdeps/stub/sigprocmask.c: Likewise. * sysdeps/stub/sigreturn.c: Likewise. * sysdeps/stub/sigsetmask.c: Likewise. * sysdeps/stub/sigstack.c: Likewise. * sysdeps/stub/sigsuspend.c: Likewise. * sysdeps/stub/sigvec.c: Likewise. * sysdeps/stub/sleep.c: Likewise. * sysdeps/stub/socket.c: Likewise. * sysdeps/stub/socketpair.c: Likewise. * sysdeps/stub/sstk.c: Likewise. * sysdeps/stub/statfs.c: Likewise. * sysdeps/stub/stime.c: Likewise. * sysdeps/stub/stty.c: Likewise. * sysdeps/stub/swapoff.c: Likewise. * sysdeps/stub/swapon.c: Likewise. * sysdeps/stub/symlink.c: Likewise. * sysdeps/stub/sync.c: Likewise. * sysdeps/stub/syscall.c: Likewise. * sysdeps/stub/sysconf.c: Likewise. * sysdeps/stub/sysd-stdio.c: Likewise. * sysdeps/stub/system.c: Likewise. * sysdeps/stub/tcdrain.c: Likewise. * sysdeps/stub/tcflow.c: Likewise. * sysdeps/stub/tcflush.c: Likewise. * sysdeps/stub/tcgetattr.c: Likewise. * sysdeps/stub/tcgetpgrp.c: Likewise. * sysdeps/stub/tcsendbrk.c: Likewise. * sysdeps/stub/tcsetattr.c: Likewise. * sysdeps/stub/tcsetpgrp.c: Likewise. * sysdeps/stub/telldir.c: Likewise. * sysdeps/stub/tempname.c: Likewise. * sysdeps/stub/time.c: Likewise. * sysdeps/stub/times.c: Likewise. * sysdeps/stub/truncate.c: Likewise. * sysdeps/stub/ttyname.c: Likewise. * sysdeps/stub/ttyname_r.c: Likewise. * sysdeps/stub/ualarm.c: Likewise. * sysdeps/stub/ulimit.c: Likewise. * sysdeps/stub/umask.c: Likewise. * sysdeps/stub/unlink.c: Likewise. * sysdeps/stub/usleep.c: Likewise. * sysdeps/stub/ustat.c: Likewise. * sysdeps/stub/utime.c: Likewise. * sysdeps/stub/utimes.c: Likewise. * sysdeps/stub/vhangup.c: Likewise. * sysdeps/stub/wait.c: Likewise. * sysdeps/stub/wait3.c: Likewise. * sysdeps/stub/wait4.c: Likewise. * sysdeps/stub/waitpid.c: Likewise. * sysdeps/stub/write.c: Likewise. * sysdeps/stub/writev.c: Likewise. * sysdeps/stub/xmknod.c: Likewise. * sysdeps/stub/xstat.c: Likewise. * sysdeps/unix/closedir.c: Likewise. * sysdeps/unix/fxstat.c: Likewise. * sysdeps/unix/getlogin.c: Likewise. * sysdeps/unix/getlogin_r.c: Likewise. * sysdeps/unix/mkdir.c: Likewise. * sysdeps/unix/nice.c: Likewise. * sysdeps/unix/nlist.c: Likewise. * sysdeps/unix/opendir.c: Likewise. * sysdeps/unix/readdir.c: Likewise. * sysdeps/unix/rmdir.c: Likewise. * sysdeps/unix/stime.c: Likewise. * sysdeps/unix/xmknod.c: Likewise. * sysdeps/unix/xstat.c: Likewise. * sysdeps/unix/bsd/isatty.c: Likewise. * sysdeps/unix/bsd/setegid.c: Likewise. * sysdeps/unix/bsd/seteuid.c: Likewise. * sysdeps/unix/bsd/setsid.c: Likewise. * sysdeps/unix/bsd/sigaction.c: Likewise. * sysdeps/unix/bsd/sigprocmask.c: Likewise. * sysdeps/unix/bsd/sigsuspend.c: Likewise. * sysdeps/unix/bsd/tcflow.c: Likewise. * sysdeps/unix/bsd/tcflush.c: Likewise. * sysdeps/unix/bsd/tcgetattr.c: Likewise. * sysdeps/unix/bsd/tcsetattr.c: Likewise. * sysdeps/unix/bsd/times.c: Likewise. * sysdeps/unix/bsd/ulimit.c: Likewise. * sysdeps/unix/common/lxstat.c: Likewise. * sysdeps/unix/common/tcsendbrk.c: Likewise. * sysdeps/unix/sysv/setrlimit.c: Likewise. * sysdeps/unix/sysv/settimeofday.c: Likewise. * sysdeps/unix/sysv/sigaction.c: Likewise. * sysdeps/unix/sysv/tcflow.c: Likewise. * sysdeps/unix/sysv/tcflush.c: Likewise. * sysdeps/unix/sysv/tcgetattr.c: Likewise. * sysdeps/unix/sysv/tcsendbrk.c: Likewise. * sysdeps/unix/sysv/tcsetattr.c: Likewise. * sysdeps/unix/bsd/ultrix4/sysconf.c: Likewise. * sysdeps/unix/sysv/irix4/getpriority.c: Likewise. * sysdeps/unix/sysv/irix4/setpriority.c: Likewise. * sysdeps/unix/sysv/linux/adjtime.c: Likewise. * sysdeps/unix/sysv/linux/gethostid.c: Likewise. * sysdeps/unix/sysv/linux/gethostname.c: Likewise. * sysdeps/unix/sysv/linux/getsysstats.c: Likewise. * sysdeps/unix/sysv/linux/ptrace.c: Likewise. * sysdeps/unix/sysv/linux/speed.c: Likewise. * sysdeps/unix/sysv/linux/ulimit.c: Likewise. * sysdeps/unix/sysv/sysv4/sigaction.c: Likewise. * sysdeps/unix/sysv/sysv4/sysconf.c: Likewise. * sysdeps/unix/bsd/sun/m68k/sigtramp.c: Likewise. * sysdeps/unix/bsd/sun/sparc/sigtramp.c: Likewise. * sysdeps/unix/bsd/sun/sunos4/speed.c: Likewise. * sysdeps/unix/bsd/sun/sunos4/tcsetattr.c: Likewise. * sysdeps/unix/sysv/linux/alpha/ioperm.c: Likewise. * sysdeps/unix/sysv/linux/i386/brk.c: Likewise. * sysdeps/unix/sysv/linux/i386/sigaction.c: Likewise. * sysdeps/unix/sysv/linux/m68k/brk.c: Likewise. * sunrpc/clnt_tcp.c: Protect declaration of errno by #ifndef. * sunrpc/clnt_udp.c: Likewise. * sunrpc/bindrsvprt.c: Likewise. * sunrpc/pm_getmaps.c: Likewise. * sunrpc/pmap_rmt.c: Likewise. * sunrpc/svc.c: Likewise. * sunrpc/svc_run.c: Likewise. * sunrpc/svc_tcp.c: Likewise. * sunrpc/svc_udp.c: Likewise. * sysdeps/generic/strtok.c: Don't check argument, just crash. * sysdeps/generic/strtok_r.c: Likewise. * sysdeps/stub/start.c: Make __errno a strong alias of errno. * sysdeps/unix/start.c: Likewise. De-ANSI-fy. * sysdeps/unix/sparc/start.c: Likewise. * sysdeps/standalone/m68k/m68020/start.S: Likewise. * sysdeps/unix/sysv/irix4/start.c: Likewise. * sysdeps/unix/bsd/ultrix4/mips/start.S: Likewise. * sysdeps/unix/sysv/linux/i386/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/m68k/sysdep.S: Likewise. Mon Sep 23 17:54:57 1996 Ulrich Drepper <drepper@cygnus.com> * catgets/gencat.c (main): Put package name in --version message in parantheses. Reported by Jim Meyering. * db/makedb.c: Likewise. * locale/programs/locale.c: Likewise. * locale/programs/localedef.c: Likewise. * sysdeps/i386/fpu/__math.h (tan): Make sure gcc knows we use two registers. Patch by John Bowman. Sat Sep 21 15:08:25 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/mach/libc-lock.h: Fix comment. * sysdeps/stubs/libc-lock.h: Likewise. Sat Sep 21 13:50:40 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * libio/genops.c (_IO_init) [_IO_MTSAFE_IO]: Dereference pointer to lock when passing it to __libc_lock_init macro. (_IO_default_finish) [_IO_MTSAFE_IO]: Dereference pointer to lock when passing it to __libc_lock_fini macro. Sat Sep 21 14:35:40 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/unix/sysv/linux/m68k/sysdep.h (SYSCALL_ERROR_HANDLER) [_LIBC_REENTRANT]: Add missing semicolon. * sysdeps/unix/sysv/linux/m68k/sysdep.S: Move inclusion of sysdep.h to the top outside of #ifndef PIC. Don't include errnos.h. Use the ENTRY macro. Sat Sep 21 14:33:41 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * libio/Makefile: Make `all' the default target. * po/Makefile: Likewise. Mon Sep 23 15:49:47 1996 Ulrich Drepper <drepper@cygnus.com> * stdlib/test-canon.c: Correct patch from Thu Sep 12 23:01:16 1996. I applied it incorrectly. * sysdeps/m68k/fpu/s_scalbn.c: Likewise. * sysdeps/m68k/fpu/s_scalbnf.c: Likewise. * sysdeps/m68k/fpu/s_scalbnl.c: Likewise. Mon Sep 23 03:00:10 1996 Ulrich Drepper <drepper@cygnus.com> * shadow/sgetspent_r.c (LINE_PARSER): Accept empty 9th field. Patch by NIIBE Yutaka <gniibe@mri.co.jp>. * shadow/sgetspent_r.c (LINE_PARSER): Don't accept any chars after 9th field. * sysdeps/unix/sysv/linux/Makefile [$(subdir)==misc] (sysdep_headers): Add sys/debugreg.h, sys/kd.h, sys/soundcard.h, and sys/vt.h. * sysdeps/unix/sysv/linux/sys/debugreg.h: New file. * sysdeps/unix/sysv/linux/sys/kd.h: New file. * sysdeps/unix/sysv/linux/sys/soundcard.h: New file. * sysdeps/unix/sysv/linux/sys/vt.h: New file. Reported by NIIBE Yutaka <gniibe@mri.co.jp>.
1996-09-27 05:45:24 +02:00
__set_errno (0);
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
RES_SET_H_ERRNO(statp, HOST_NOT_FOUND); /* True if we never query. */
1995-02-18 02:27:10 +01:00
dots = 0;
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
for (cp = name; *cp != '\0'; cp++)
1995-02-18 02:27:10 +01:00
dots += (*cp == '.');
trailing_dot = 0;
if (cp > name && *--cp == '.')
trailing_dot++;
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
/* If there aren't any dots, it could be a user-level alias. */
if (!dots && (cp = __res_context_hostalias
(ctx, name, tmp, sizeof tmp))!= NULL)
return __res_context_query (ctx, cp, class, type, answer,
anslen, answerp, answerp2,
nanswerp2, resplen2, answerp2_malloced);
1995-02-18 02:27:10 +01:00
/*
Update. 2000-07-18 Mark Kettenis <kettenis@gnu.org> Update resolver code to BIND 8.2.3-T5B. * resolv/Versions [GLIBC_2.2] (libc): Add __res_init and __res_nclose. [GLIBC_2.2] (libresolv): Add __dn_expand, __ns_samename, __res_mkquery, __res_nsend, __res_query, __res_querydomain and __res_search. * resolv/Banner: BIND-8.2.3-T5B. * resolv/base64.c: Update from BIND 8.2.3-T5B. * resolv/herror.c: Likewise. * resolv/inet_addr.c: Likewise. * resolv/inet_net_ntop.c: Likewise. * resolv/inet_net_pton.c: Likewise. * resolv/inet_neta.c: Likewise. * resolv/inet_ntop.c: Likewise. * resolv/nsap_addr.c: Likewise. * resolv/inet_pton.c: Likewise. Reject a few more more invalid IPv6 addresses (ISC bug #520). * resolv/ns_name.c: Avoid emitting RCS ID in object file. * resolv/ns_parse.c: Likewise. * resolv/ns_netint.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/ns_print.c: Update from BIND 8.2.3-T5B. Avoid emitting RCS ID in object file. * resolv/res_debug.c: Update from BIND 8.2.3-T5B. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_init.c: Likewise. (res_setoptions): Mark internal. * resolv/res_send.c: Likewise. [_LIBC]: Fully reinstate the code that avoids the FD_SETSIZE limit by using poll instead. * resolv/res_comp.c: Likewise. [SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_2)]: Make dn_expand a weak alias for __dn_expand. * resolv/res_data.c: Likewise. (res_close) [_LIBC]: Don't call res_nclose if RES_INIT isn't set in _res.options. Avoids a potential security risk by avoiding a close (0). [SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_2)]: Make res_mkquery, res_query, res_querydomain adn res_search weak aliases for __res_mkquery, __res_query, __res_querydomain and __res_search. * resolv/res_libc.c: (_res): Don't initialize. Fix res_close instead to avoid close(0). (res_init): Always use the static resolver context. [SHLIB_COMPAT (libc, GLIBC_2.0, GLIBC_2_2)]: Make res_init a weak alias for __res_init. * resolv/resolv.h: Update from BIND 8.2.3-T5B. Move definition of RES_SET_H_ERRNO and accompanying comment to... * include/resolv.h: ... here. * resolv/arpa/namser.h: Update from BIND 8.2.3-T5B. * resolv/arpa/nameser_compat.h: Likewise.
2000-07-20 00:03:58 +02:00
* If there are enough dots in the name, let's just give it a
* try 'as is'. The threshold can be set with the "ndots" option.
* Also, query 'as is', if there is a trailing dot in the name.
1995-02-18 02:27:10 +01:00
*/
Update. 2000-07-18 Mark Kettenis <kettenis@gnu.org> Update resolver code to BIND 8.2.3-T5B. * resolv/Versions [GLIBC_2.2] (libc): Add __res_init and __res_nclose. [GLIBC_2.2] (libresolv): Add __dn_expand, __ns_samename, __res_mkquery, __res_nsend, __res_query, __res_querydomain and __res_search. * resolv/Banner: BIND-8.2.3-T5B. * resolv/base64.c: Update from BIND 8.2.3-T5B. * resolv/herror.c: Likewise. * resolv/inet_addr.c: Likewise. * resolv/inet_net_ntop.c: Likewise. * resolv/inet_net_pton.c: Likewise. * resolv/inet_neta.c: Likewise. * resolv/inet_ntop.c: Likewise. * resolv/nsap_addr.c: Likewise. * resolv/inet_pton.c: Likewise. Reject a few more more invalid IPv6 addresses (ISC bug #520). * resolv/ns_name.c: Avoid emitting RCS ID in object file. * resolv/ns_parse.c: Likewise. * resolv/ns_netint.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/ns_print.c: Update from BIND 8.2.3-T5B. Avoid emitting RCS ID in object file. * resolv/res_debug.c: Update from BIND 8.2.3-T5B. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_init.c: Likewise. (res_setoptions): Mark internal. * resolv/res_send.c: Likewise. [_LIBC]: Fully reinstate the code that avoids the FD_SETSIZE limit by using poll instead. * resolv/res_comp.c: Likewise. [SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_2)]: Make dn_expand a weak alias for __dn_expand. * resolv/res_data.c: Likewise. (res_close) [_LIBC]: Don't call res_nclose if RES_INIT isn't set in _res.options. Avoids a potential security risk by avoiding a close (0). [SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_2)]: Make res_mkquery, res_query, res_querydomain adn res_search weak aliases for __res_mkquery, __res_query, __res_querydomain and __res_search. * resolv/res_libc.c: (_res): Don't initialize. Fix res_close instead to avoid close(0). (res_init): Always use the static resolver context. [SHLIB_COMPAT (libc, GLIBC_2.0, GLIBC_2_2)]: Make res_init a weak alias for __res_init. * resolv/resolv.h: Update from BIND 8.2.3-T5B. Move definition of RES_SET_H_ERRNO and accompanying comment to... * include/resolv.h: ... here. * resolv/arpa/namser.h: Update from BIND 8.2.3-T5B. * resolv/arpa/nameser_compat.h: Likewise.
2000-07-20 00:03:58 +02:00
saved_herrno = -1;
if (dots >= statp->ndots || trailing_dot) {
ret = __res_context_querydomain (ctx, name, NULL, class, type,
answer, anslen, answerp,
answerp2, nanswerp2, resplen2,
answerp2_malloced);
Do not fail if one of the two responses to AF_UNSPEC fails (BZ #14308) [Fixes BZ #14308, #12994, #13651] AF_UNSPEC results in sending two queries in parallel, one for the A record and the other for the AAAA record. If one of these is a referral, then the query fails, which is wrong. It should return at least the one successful response. The fix has two parts. The first part makes the referral fall back to the SERVFAIL path, which results in using the successful response. There is a bug in that path however, due to which the second part is necessary. The bug here is that if the first response is a failure and the second succeeds, __libc_res_nsearch does not detect that and assumes a failure. The case where the first response is a success and the second fails, works correctly. This condition is produced by buggy routers, so here's a crude interposable library that can simulate such a condition. The library overrides the recvfrom syscall and modifies the header of the packet received to reproduce this scenario. It has two key variables: mod_packet and first_error. The mod_packet variable when set to 0, results in odd packets being modified to be a referral. When set to 1, even packets are modified to be a referral. The first_error causes the first response to be a failure so that a domain-appended search is performed to test the second part of the __libc_nsearch fix. The driver for this fix is a simple getaddrinfo program that does an AF_UNSPEC query. I have omitted this since it should be easy to implement. I have tested this on x86_64. The interceptor library source: /* Override recvfrom and modify the header of the first DNS response to make it a referral and reproduce bz #845218. We have to resort to this ugly hack because we cannot make bind return the buggy response of a referral for the AAAA record and an authoritative response for the A record. */ #define _GNU_SOURCE #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <stdio.h> #include <stdbool.h> #include <endian.h> #include <dlfcn.h> #include <stdlib.h> /* Lifted from resolv/arpa/nameser_compat.h. */ typedef struct { unsigned id :16; /*%< query identification number */ #if BYTE_ORDER == BIG_ENDIAN /* fields in third byte */ unsigned qr: 1; /*%< response flag */ unsigned opcode: 4; /*%< purpose of message */ unsigned aa: 1; /*%< authoritive answer */ unsigned tc: 1; /*%< truncated message */ unsigned rd: 1; /*%< recursion desired */ /* fields * in * fourth * byte * */ unsigned ra: 1; /*%< recursion available */ unsigned unused :1; /*%< unused bits (MBZ as of 4.9.3a3) */ unsigned ad: 1; /*%< authentic data from named */ unsigned cd: 1; /*%< checking disabled by resolver */ unsigned rcode :4; /*%< response code */ #endif #if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN /* fields * in * third * byte * */ unsigned rd :1; /*%< recursion desired */ unsigned tc :1; /*%< truncated message */ unsigned aa :1; /*%< authoritive answer */ unsigned opcode :4; /*%< purpose of message */ unsigned qr :1; /*%< response flag */ /* fields * in * fourth * byte * */ unsigned rcode :4; /*%< response code */ unsigned cd: 1; /*%< checking disabled by resolver */ unsigned ad: 1; /*%< authentic data from named */ unsigned unused :1; /*%< unused bits (MBZ as of 4.9.3a3) */ unsigned ra :1; /*%< recursion available */ #endif /* remaining * bytes * */ unsigned qdcount :16; /*%< number of question entries */ unsigned ancount :16; /*%< number of answer entries */ unsigned nscount :16; /*%< number of authority entries */ unsigned arcount :16; /*%< number of resource entries */ } HEADER; static int done = 0; /* Packets to modify. 0 for the odd packets and 1 for even packets. */ static const int mod_packet = 0; /* Set to true if the first request should result in an error, resulting in a search query. */ static bool first_error = true; static ssize_t (*real_recvfrom) (int sockfd, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen); void __attribute__ ((constructor)) init (void) { real_recvfrom = dlsym (RTLD_NEXT, "recvfrom"); if (real_recvfrom == NULL) { printf ("Failed to get reference to recvfrom: %s\n", dlerror ()); printf ("Cannot simulate test\n"); abort (); } } /* Modify the second packet that we receive to set the header in a manner as to reproduce BZ #845218. */ static void mod_buf (HEADER *h, int port) { if (done % 2 == mod_packet || (first_error && done == 1)) { printf ("(Modifying header)"); if (first_error && done == 1) h->rcode = 3; else h->rcode = 0; /* NOERROR == 0. */ h->ancount = 0; h->aa = 0; h->ra = 0; h->arcount = 0; } done++; } ssize_t recvfrom (int sockfd, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen) { ssize_t ret = real_recvfrom (sockfd, buf, len, flags, src_addr, addrlen); int port = htons (((struct sockaddr_in *) src_addr)->sin_port); struct in_addr addr = ((struct sockaddr_in *) src_addr)->sin_addr; const char *host = inet_ntoa (addr); printf ("\n*** From %s:%d: ", host, port); mod_buf (buf, port); printf ("returned %zd\n", ret); return ret; }
2014-04-30 08:18:43 +02:00
if (ret > 0 || trailing_dot
/* If the second response is valid then we use that. */
|| (ret == 0 && resplen2 != NULL && *resplen2 > 0))
Update. 2000-07-18 Mark Kettenis <kettenis@gnu.org> Update resolver code to BIND 8.2.3-T5B. * resolv/Versions [GLIBC_2.2] (libc): Add __res_init and __res_nclose. [GLIBC_2.2] (libresolv): Add __dn_expand, __ns_samename, __res_mkquery, __res_nsend, __res_query, __res_querydomain and __res_search. * resolv/Banner: BIND-8.2.3-T5B. * resolv/base64.c: Update from BIND 8.2.3-T5B. * resolv/herror.c: Likewise. * resolv/inet_addr.c: Likewise. * resolv/inet_net_ntop.c: Likewise. * resolv/inet_net_pton.c: Likewise. * resolv/inet_neta.c: Likewise. * resolv/inet_ntop.c: Likewise. * resolv/nsap_addr.c: Likewise. * resolv/inet_pton.c: Likewise. Reject a few more more invalid IPv6 addresses (ISC bug #520). * resolv/ns_name.c: Avoid emitting RCS ID in object file. * resolv/ns_parse.c: Likewise. * resolv/ns_netint.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/ns_print.c: Update from BIND 8.2.3-T5B. Avoid emitting RCS ID in object file. * resolv/res_debug.c: Update from BIND 8.2.3-T5B. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_init.c: Likewise. (res_setoptions): Mark internal. * resolv/res_send.c: Likewise. [_LIBC]: Fully reinstate the code that avoids the FD_SETSIZE limit by using poll instead. * resolv/res_comp.c: Likewise. [SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_2)]: Make dn_expand a weak alias for __dn_expand. * resolv/res_data.c: Likewise. (res_close) [_LIBC]: Don't call res_nclose if RES_INIT isn't set in _res.options. Avoids a potential security risk by avoiding a close (0). [SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_2)]: Make res_mkquery, res_query, res_querydomain adn res_search weak aliases for __res_mkquery, __res_query, __res_querydomain and __res_search. * resolv/res_libc.c: (_res): Don't initialize. Fix res_close instead to avoid close(0). (res_init): Always use the static resolver context. [SHLIB_COMPAT (libc, GLIBC_2.0, GLIBC_2_2)]: Make res_init a weak alias for __res_init. * resolv/resolv.h: Update from BIND 8.2.3-T5B. Move definition of RES_SET_H_ERRNO and accompanying comment to... * include/resolv.h: ... here. * resolv/arpa/namser.h: Update from BIND 8.2.3-T5B. * resolv/arpa/nameser_compat.h: Likewise.
2000-07-20 00:03:58 +02:00
return (ret);
saved_herrno = h_errno;
tried_as_is++;
Update. 2002-10-15 Jakub Jelinek <jakub@redhat.com> * include/resolv.h (__libc_res_nquery, __libc_res_nsearch, __libc_res_nsend): New prototypes. * resolv/res_query.c (QUERYSIZE): Define. (__libc_res_nquery): Renamed from res_nquery. Added answerp argument. Allocate only QUERYSIZE bytes first, if res_nmkquery fails use MAXPACKET buffer. Call __libc_res_nsend instead of res_nsend, pass answerp. (res_nquery): Changed into wrapper around __libc_res_nquery. (__libc_res_nsearch): Renamed from res_nsearch. Added answerp argument. Call __libc_res_nquerydomain and __libc_res_nquery instead of the non-__libc_ variants, pass them answerp. (res_nsearch): Changed into wrapper around __libc_res_nsearch. (__libc_res_nquerydomain): Renamed from res_nquerydomain. Added answerp argument. Call __libc_res_nquery instead of res_nquery, pass answerp. (res_nquerydomain): Changed into wrapper around __libc_res_nquerydomain. * resolv/res_send.c: Include sys/ioctl.h. (MAXPACKET): Define. (send_vc): Change arguments. Reallocate answer buffer if it is too small. (send_dg): Likewise. (__libc_res_nsend): Renamed from res_nsend. Added ansp argument. Reallocate answer buffer if it is too small and hooks are in use. Adjust calls to send_vc and send_dg. (res_nsend): Changed into wrapper around __libc_res_nsend. * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname2_r): Allocate just 1K answer buffer on the stack, use __libc_res_nsearch instead of res_nsearch. (_nss_dns_gethostbyaddr_r): Similarly with __libc_res_nquery. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Similarly with __libc_res_nsearch. * resolv/gethnamaddr.c (gethostbyname2): Likewise. (gethostbyaddr): Similarly with __libc_res_nquery. * resolv/Versions (libresolv): Export __libc_res_nquery and __libc_res_nsearch at GLIBC_PRIVATE.
2002-10-17 23:51:21 +02:00
if (answerp && *answerp != answer) {
answer = *answerp;
anslen = MAXPACKET;
}
if (answerp2 && *answerp2_malloced)
* include/resolv.h: Adjust __libc_res_nquery and __libc_res_nsend prototypes. * include/arpa/nameser_compat.h: Define T_UNSPEC. * nis/Versions (libnss_nis): Export _nss_nis_gethostbyname4_r. (libnss_nisplus): Export _nss_nisplus_gethostbyname4_r. * nis/nss_nis/nis-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_nis_gethostbyname4_r): New function. * nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_parse_hostent): Change to also handle af==AF_UNSPEC. (get_tablename): New function. Use it to avoid duplication. (_nss_nisplus_gethostbyname4_r): New function. * nscd/aicache.c (addhstaiX): Use gethostbyname4_r function is available. * nss/Versions (libnss_files): Export _nss_files_gethostbyname4_r. * nss/nss.h: Define struct gaih_addrtuple. * nss/nss_files/files-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_files_gethostbyname4_r): New function. * resolv/Versions (libnss_dns): Export _nss_dns_gethostbyname4_r. * resolv/gethnmaddr.c: Adjust __libc_res_nsearch and __libc_res_nquery calls. * resolv/res_query.c (__libc_res_nquery): Take two additional parameters for second answer buffer. Handle type=T_UNSPEC to mean look up IPv4 and IPv6. Change all callers. * resolv/res_send.c (__libc_res_nsend): Take five aditional parameters for an additional query and answer buffer. Pass to send_vc and send_dg. (send_vc): Send possibly two requests and receive two answers. (send_dg): Likewise. * resolv/nss_dns/dns-host.c: Adjust calls to __libc_res_nsearch and __libc_res_nquery. (_nss_dns_gethostbyname4_r): New function. (gaih_getanswer_slice): Likewise. (gaih_getanswer): Likewise. * resolv/nss_dns/dns-canon.c (_nss_dns_getcanonname_r): Adjust __libc_res_nquery call. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Adjust __libc_res_nsearch call. * sysdeps/posix/getaddrinfo.c: Use gethostbyname4_r function is available.
2008-05-11 01:27:39 +02:00
{
free (*answerp2);
*answerp2 = NULL;
*nanswerp2 = 0;
*answerp2_malloced = 0;
* include/resolv.h: Adjust __libc_res_nquery and __libc_res_nsend prototypes. * include/arpa/nameser_compat.h: Define T_UNSPEC. * nis/Versions (libnss_nis): Export _nss_nis_gethostbyname4_r. (libnss_nisplus): Export _nss_nisplus_gethostbyname4_r. * nis/nss_nis/nis-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_nis_gethostbyname4_r): New function. * nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_parse_hostent): Change to also handle af==AF_UNSPEC. (get_tablename): New function. Use it to avoid duplication. (_nss_nisplus_gethostbyname4_r): New function. * nscd/aicache.c (addhstaiX): Use gethostbyname4_r function is available. * nss/Versions (libnss_files): Export _nss_files_gethostbyname4_r. * nss/nss.h: Define struct gaih_addrtuple. * nss/nss_files/files-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_files_gethostbyname4_r): New function. * resolv/Versions (libnss_dns): Export _nss_dns_gethostbyname4_r. * resolv/gethnmaddr.c: Adjust __libc_res_nsearch and __libc_res_nquery calls. * resolv/res_query.c (__libc_res_nquery): Take two additional parameters for second answer buffer. Handle type=T_UNSPEC to mean look up IPv4 and IPv6. Change all callers. * resolv/res_send.c (__libc_res_nsend): Take five aditional parameters for an additional query and answer buffer. Pass to send_vc and send_dg. (send_vc): Send possibly two requests and receive two answers. (send_dg): Likewise. * resolv/nss_dns/dns-host.c: Adjust calls to __libc_res_nsearch and __libc_res_nquery. (_nss_dns_gethostbyname4_r): New function. (gaih_getanswer_slice): Likewise. (gaih_getanswer): Likewise. * resolv/nss_dns/dns-canon.c (_nss_dns_getcanonname_r): Adjust __libc_res_nquery call. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Adjust __libc_res_nsearch call. * sysdeps/posix/getaddrinfo.c: Use gethostbyname4_r function is available.
2008-05-11 01:27:39 +02:00
}
Update. 2000-07-18 Mark Kettenis <kettenis@gnu.org> Update resolver code to BIND 8.2.3-T5B. * resolv/Versions [GLIBC_2.2] (libc): Add __res_init and __res_nclose. [GLIBC_2.2] (libresolv): Add __dn_expand, __ns_samename, __res_mkquery, __res_nsend, __res_query, __res_querydomain and __res_search. * resolv/Banner: BIND-8.2.3-T5B. * resolv/base64.c: Update from BIND 8.2.3-T5B. * resolv/herror.c: Likewise. * resolv/inet_addr.c: Likewise. * resolv/inet_net_ntop.c: Likewise. * resolv/inet_net_pton.c: Likewise. * resolv/inet_neta.c: Likewise. * resolv/inet_ntop.c: Likewise. * resolv/nsap_addr.c: Likewise. * resolv/inet_pton.c: Likewise. Reject a few more more invalid IPv6 addresses (ISC bug #520). * resolv/ns_name.c: Avoid emitting RCS ID in object file. * resolv/ns_parse.c: Likewise. * resolv/ns_netint.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/ns_print.c: Update from BIND 8.2.3-T5B. Avoid emitting RCS ID in object file. * resolv/res_debug.c: Update from BIND 8.2.3-T5B. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_init.c: Likewise. (res_setoptions): Mark internal. * resolv/res_send.c: Likewise. [_LIBC]: Fully reinstate the code that avoids the FD_SETSIZE limit by using poll instead. * resolv/res_comp.c: Likewise. [SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_2)]: Make dn_expand a weak alias for __dn_expand. * resolv/res_data.c: Likewise. (res_close) [_LIBC]: Don't call res_nclose if RES_INIT isn't set in _res.options. Avoids a potential security risk by avoiding a close (0). [SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_2)]: Make res_mkquery, res_query, res_querydomain adn res_search weak aliases for __res_mkquery, __res_query, __res_querydomain and __res_search. * resolv/res_libc.c: (_res): Don't initialize. Fix res_close instead to avoid close(0). (res_init): Always use the static resolver context. [SHLIB_COMPAT (libc, GLIBC_2.0, GLIBC_2_2)]: Make res_init a weak alias for __res_init. * resolv/resolv.h: Update from BIND 8.2.3-T5B. Move definition of RES_SET_H_ERRNO and accompanying comment to... * include/resolv.h: ... here. * resolv/arpa/namser.h: Update from BIND 8.2.3-T5B. * resolv/arpa/nameser_compat.h: Likewise.
2000-07-20 00:03:58 +02:00
}
1995-02-18 02:27:10 +01:00
/*
* We do at least one level of search if
* - there is no dot and RES_DEFNAME is set, or
* - there is at least one dot, there is no trailing dot,
* and RES_DNSRCH is set.
*/
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
if ((!dots && (statp->options & RES_DEFNAMES) != 0) ||
(dots && !trailing_dot && (statp->options & RES_DNSRCH) != 0)) {
1995-02-18 02:27:10 +01:00
int done = 0;
for (size_t domain_index = 0; !done; ++domain_index) {
const char *dname = __resolv_context_search_list
(ctx, domain_index);
if (dname == NULL)
break;
searched = 1;
1995-02-18 02:27:10 +01:00
/* __res_context_querydoman concatenates name
with dname with a "." in between. If we
pass it in dname the "." we got from the
configured default search path, we'll end
up with "name..", which won't resolve.
OTOH, passing it "" will result in "name.",
which has the intended effect for both
possible representations of the root
domain. */
if (dname[0] == '.')
dname++;
if (dname[0] == '\0')
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
root_on_list++;
ret = __res_context_querydomain
(ctx, name, dname, class, type,
answer, anslen, answerp, answerp2, nanswerp2,
resplen2, answerp2_malloced);
if (ret > 0 || (ret == 0 && resplen2 != NULL
&& *resplen2 > 0))
1995-02-18 02:27:10 +01:00
return (ret);
Update. 2002-10-15 Jakub Jelinek <jakub@redhat.com> * include/resolv.h (__libc_res_nquery, __libc_res_nsearch, __libc_res_nsend): New prototypes. * resolv/res_query.c (QUERYSIZE): Define. (__libc_res_nquery): Renamed from res_nquery. Added answerp argument. Allocate only QUERYSIZE bytes first, if res_nmkquery fails use MAXPACKET buffer. Call __libc_res_nsend instead of res_nsend, pass answerp. (res_nquery): Changed into wrapper around __libc_res_nquery. (__libc_res_nsearch): Renamed from res_nsearch. Added answerp argument. Call __libc_res_nquerydomain and __libc_res_nquery instead of the non-__libc_ variants, pass them answerp. (res_nsearch): Changed into wrapper around __libc_res_nsearch. (__libc_res_nquerydomain): Renamed from res_nquerydomain. Added answerp argument. Call __libc_res_nquery instead of res_nquery, pass answerp. (res_nquerydomain): Changed into wrapper around __libc_res_nquerydomain. * resolv/res_send.c: Include sys/ioctl.h. (MAXPACKET): Define. (send_vc): Change arguments. Reallocate answer buffer if it is too small. (send_dg): Likewise. (__libc_res_nsend): Renamed from res_nsend. Added ansp argument. Reallocate answer buffer if it is too small and hooks are in use. Adjust calls to send_vc and send_dg. (res_nsend): Changed into wrapper around __libc_res_nsend. * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname2_r): Allocate just 1K answer buffer on the stack, use __libc_res_nsearch instead of res_nsearch. (_nss_dns_gethostbyaddr_r): Similarly with __libc_res_nquery. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Similarly with __libc_res_nsearch. * resolv/gethnamaddr.c (gethostbyname2): Likewise. (gethostbyaddr): Similarly with __libc_res_nquery. * resolv/Versions (libresolv): Export __libc_res_nquery and __libc_res_nsearch at GLIBC_PRIVATE.
2002-10-17 23:51:21 +02:00
if (answerp && *answerp != answer) {
answer = *answerp;
anslen = MAXPACKET;
}
if (answerp2 && *answerp2_malloced)
* include/resolv.h: Adjust __libc_res_nquery and __libc_res_nsend prototypes. * include/arpa/nameser_compat.h: Define T_UNSPEC. * nis/Versions (libnss_nis): Export _nss_nis_gethostbyname4_r. (libnss_nisplus): Export _nss_nisplus_gethostbyname4_r. * nis/nss_nis/nis-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_nis_gethostbyname4_r): New function. * nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_parse_hostent): Change to also handle af==AF_UNSPEC. (get_tablename): New function. Use it to avoid duplication. (_nss_nisplus_gethostbyname4_r): New function. * nscd/aicache.c (addhstaiX): Use gethostbyname4_r function is available. * nss/Versions (libnss_files): Export _nss_files_gethostbyname4_r. * nss/nss.h: Define struct gaih_addrtuple. * nss/nss_files/files-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_files_gethostbyname4_r): New function. * resolv/Versions (libnss_dns): Export _nss_dns_gethostbyname4_r. * resolv/gethnmaddr.c: Adjust __libc_res_nsearch and __libc_res_nquery calls. * resolv/res_query.c (__libc_res_nquery): Take two additional parameters for second answer buffer. Handle type=T_UNSPEC to mean look up IPv4 and IPv6. Change all callers. * resolv/res_send.c (__libc_res_nsend): Take five aditional parameters for an additional query and answer buffer. Pass to send_vc and send_dg. (send_vc): Send possibly two requests and receive two answers. (send_dg): Likewise. * resolv/nss_dns/dns-host.c: Adjust calls to __libc_res_nsearch and __libc_res_nquery. (_nss_dns_gethostbyname4_r): New function. (gaih_getanswer_slice): Likewise. (gaih_getanswer): Likewise. * resolv/nss_dns/dns-canon.c (_nss_dns_getcanonname_r): Adjust __libc_res_nquery call. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Adjust __libc_res_nsearch call. * sysdeps/posix/getaddrinfo.c: Use gethostbyname4_r function is available.
2008-05-11 01:27:39 +02:00
{
free (*answerp2);
*answerp2 = NULL;
*nanswerp2 = 0;
*answerp2_malloced = 0;
* include/resolv.h: Adjust __libc_res_nquery and __libc_res_nsend prototypes. * include/arpa/nameser_compat.h: Define T_UNSPEC. * nis/Versions (libnss_nis): Export _nss_nis_gethostbyname4_r. (libnss_nisplus): Export _nss_nisplus_gethostbyname4_r. * nis/nss_nis/nis-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_nis_gethostbyname4_r): New function. * nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_parse_hostent): Change to also handle af==AF_UNSPEC. (get_tablename): New function. Use it to avoid duplication. (_nss_nisplus_gethostbyname4_r): New function. * nscd/aicache.c (addhstaiX): Use gethostbyname4_r function is available. * nss/Versions (libnss_files): Export _nss_files_gethostbyname4_r. * nss/nss.h: Define struct gaih_addrtuple. * nss/nss_files/files-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_files_gethostbyname4_r): New function. * resolv/Versions (libnss_dns): Export _nss_dns_gethostbyname4_r. * resolv/gethnmaddr.c: Adjust __libc_res_nsearch and __libc_res_nquery calls. * resolv/res_query.c (__libc_res_nquery): Take two additional parameters for second answer buffer. Handle type=T_UNSPEC to mean look up IPv4 and IPv6. Change all callers. * resolv/res_send.c (__libc_res_nsend): Take five aditional parameters for an additional query and answer buffer. Pass to send_vc and send_dg. (send_vc): Send possibly two requests and receive two answers. (send_dg): Likewise. * resolv/nss_dns/dns-host.c: Adjust calls to __libc_res_nsearch and __libc_res_nquery. (_nss_dns_gethostbyname4_r): New function. (gaih_getanswer_slice): Likewise. (gaih_getanswer): Likewise. * resolv/nss_dns/dns-canon.c (_nss_dns_getcanonname_r): Adjust __libc_res_nquery call. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Adjust __libc_res_nsearch call. * sysdeps/posix/getaddrinfo.c: Use gethostbyname4_r function is available.
2008-05-11 01:27:39 +02:00
}
Update. 2002-10-15 Jakub Jelinek <jakub@redhat.com> * include/resolv.h (__libc_res_nquery, __libc_res_nsearch, __libc_res_nsend): New prototypes. * resolv/res_query.c (QUERYSIZE): Define. (__libc_res_nquery): Renamed from res_nquery. Added answerp argument. Allocate only QUERYSIZE bytes first, if res_nmkquery fails use MAXPACKET buffer. Call __libc_res_nsend instead of res_nsend, pass answerp. (res_nquery): Changed into wrapper around __libc_res_nquery. (__libc_res_nsearch): Renamed from res_nsearch. Added answerp argument. Call __libc_res_nquerydomain and __libc_res_nquery instead of the non-__libc_ variants, pass them answerp. (res_nsearch): Changed into wrapper around __libc_res_nsearch. (__libc_res_nquerydomain): Renamed from res_nquerydomain. Added answerp argument. Call __libc_res_nquery instead of res_nquery, pass answerp. (res_nquerydomain): Changed into wrapper around __libc_res_nquerydomain. * resolv/res_send.c: Include sys/ioctl.h. (MAXPACKET): Define. (send_vc): Change arguments. Reallocate answer buffer if it is too small. (send_dg): Likewise. (__libc_res_nsend): Renamed from res_nsend. Added ansp argument. Reallocate answer buffer if it is too small and hooks are in use. Adjust calls to send_vc and send_dg. (res_nsend): Changed into wrapper around __libc_res_nsend. * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname2_r): Allocate just 1K answer buffer on the stack, use __libc_res_nsearch instead of res_nsearch. (_nss_dns_gethostbyaddr_r): Similarly with __libc_res_nquery. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Similarly with __libc_res_nsearch. * resolv/gethnamaddr.c (gethostbyname2): Likewise. (gethostbyaddr): Similarly with __libc_res_nquery. * resolv/Versions (libresolv): Export __libc_res_nquery and __libc_res_nsearch at GLIBC_PRIVATE.
2002-10-17 23:51:21 +02:00
1995-02-18 02:27:10 +01:00
/*
* If no server present, give up.
* If name isn't found in this domain,
* keep trying higher domains in the search list
* (if that's enabled).
* On a NO_DATA error, keep trying, otherwise
* a wildcard entry of another type could keep us
* from finding this entry higher in the domain.
* If we get some other error (negative answer or
* server failure), then stop searching up,
* but try the input name below in case it's
* fully-qualified.
*/
if (errno == ECONNREFUSED) {
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
RES_SET_H_ERRNO(statp, TRY_AGAIN);
1995-02-18 02:27:10 +01:00
return (-1);
}
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
switch (statp->res_h_errno) {
1995-02-18 02:27:10 +01:00
case NO_DATA:
got_nodata++;
/* FALLTHROUGH */
case HOST_NOT_FOUND:
/* keep trying */
break;
case TRY_AGAIN:
if (hp->rcode == SERVFAIL) {
/* try next search element, if any */
got_servfail++;
break;
}
/* FALLTHROUGH */
default:
/* anything else implies that we're done */
done++;
}
/* if we got here for some reason other than DNSRCH,
* we only wanted one iteration of the loop, so stop.
*/
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
if ((statp->options & RES_DNSRCH) == 0)
1995-02-18 02:27:10 +01:00
done++;
}
}
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
/*
2014-04-11 11:46:13 +02:00
* If the query has not already been tried as is then try it
* unless RES_NOTLDQUERY is set and there were no dots.
1995-02-18 02:27:10 +01:00
*/
if ((dots || !searched || (statp->options & RES_NOTLDQUERY) == 0)
&& !(tried_as_is || root_on_list)) {
ret = __res_context_querydomain
(ctx, name, NULL, class, type,
answer, anslen, answerp, answerp2, nanswerp2,
resplen2, answerp2_malloced);
if (ret > 0 || (ret == 0 && resplen2 != NULL
&& *resplen2 > 0))
1995-02-18 02:27:10 +01:00
return (ret);
}
/* if we got here, we didn't satisfy the search.
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
* if we did an initial full query, return that query's H_ERRNO
1995-02-18 02:27:10 +01:00
* (note that we wouldn't be here if that query had succeeded).
* else if we ever got a nodata, send that back as the reason.
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
* else send back meaningless H_ERRNO, that being the one from
1995-02-18 02:27:10 +01:00
* the last DNSRCH we did.
*/
if (answerp2 && *answerp2_malloced)
* include/resolv.h: Adjust __libc_res_nquery and __libc_res_nsend prototypes. * include/arpa/nameser_compat.h: Define T_UNSPEC. * nis/Versions (libnss_nis): Export _nss_nis_gethostbyname4_r. (libnss_nisplus): Export _nss_nisplus_gethostbyname4_r. * nis/nss_nis/nis-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_nis_gethostbyname4_r): New function. * nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_parse_hostent): Change to also handle af==AF_UNSPEC. (get_tablename): New function. Use it to avoid duplication. (_nss_nisplus_gethostbyname4_r): New function. * nscd/aicache.c (addhstaiX): Use gethostbyname4_r function is available. * nss/Versions (libnss_files): Export _nss_files_gethostbyname4_r. * nss/nss.h: Define struct gaih_addrtuple. * nss/nss_files/files-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_files_gethostbyname4_r): New function. * resolv/Versions (libnss_dns): Export _nss_dns_gethostbyname4_r. * resolv/gethnmaddr.c: Adjust __libc_res_nsearch and __libc_res_nquery calls. * resolv/res_query.c (__libc_res_nquery): Take two additional parameters for second answer buffer. Handle type=T_UNSPEC to mean look up IPv4 and IPv6. Change all callers. * resolv/res_send.c (__libc_res_nsend): Take five aditional parameters for an additional query and answer buffer. Pass to send_vc and send_dg. (send_vc): Send possibly two requests and receive two answers. (send_dg): Likewise. * resolv/nss_dns/dns-host.c: Adjust calls to __libc_res_nsearch and __libc_res_nquery. (_nss_dns_gethostbyname4_r): New function. (gaih_getanswer_slice): Likewise. (gaih_getanswer): Likewise. * resolv/nss_dns/dns-canon.c (_nss_dns_getcanonname_r): Adjust __libc_res_nquery call. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Adjust __libc_res_nsearch call. * sysdeps/posix/getaddrinfo.c: Use gethostbyname4_r function is available.
2008-05-11 01:27:39 +02:00
{
free (*answerp2);
*answerp2 = NULL;
*nanswerp2 = 0;
*answerp2_malloced = 0;
* include/resolv.h: Adjust __libc_res_nquery and __libc_res_nsend prototypes. * include/arpa/nameser_compat.h: Define T_UNSPEC. * nis/Versions (libnss_nis): Export _nss_nis_gethostbyname4_r. (libnss_nisplus): Export _nss_nisplus_gethostbyname4_r. * nis/nss_nis/nis-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_nis_gethostbyname4_r): New function. * nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_parse_hostent): Change to also handle af==AF_UNSPEC. (get_tablename): New function. Use it to avoid duplication. (_nss_nisplus_gethostbyname4_r): New function. * nscd/aicache.c (addhstaiX): Use gethostbyname4_r function is available. * nss/Versions (libnss_files): Export _nss_files_gethostbyname4_r. * nss/nss.h: Define struct gaih_addrtuple. * nss/nss_files/files-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_files_gethostbyname4_r): New function. * resolv/Versions (libnss_dns): Export _nss_dns_gethostbyname4_r. * resolv/gethnmaddr.c: Adjust __libc_res_nsearch and __libc_res_nquery calls. * resolv/res_query.c (__libc_res_nquery): Take two additional parameters for second answer buffer. Handle type=T_UNSPEC to mean look up IPv4 and IPv6. Change all callers. * resolv/res_send.c (__libc_res_nsend): Take five aditional parameters for an additional query and answer buffer. Pass to send_vc and send_dg. (send_vc): Send possibly two requests and receive two answers. (send_dg): Likewise. * resolv/nss_dns/dns-host.c: Adjust calls to __libc_res_nsearch and __libc_res_nquery. (_nss_dns_gethostbyname4_r): New function. (gaih_getanswer_slice): Likewise. (gaih_getanswer): Likewise. * resolv/nss_dns/dns-canon.c (_nss_dns_getcanonname_r): Adjust __libc_res_nquery call. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Adjust __libc_res_nsearch call. * sysdeps/posix/getaddrinfo.c: Use gethostbyname4_r function is available.
2008-05-11 01:27:39 +02:00
}
Update. 2000-07-18 Mark Kettenis <kettenis@gnu.org> Update resolver code to BIND 8.2.3-T5B. * resolv/Versions [GLIBC_2.2] (libc): Add __res_init and __res_nclose. [GLIBC_2.2] (libresolv): Add __dn_expand, __ns_samename, __res_mkquery, __res_nsend, __res_query, __res_querydomain and __res_search. * resolv/Banner: BIND-8.2.3-T5B. * resolv/base64.c: Update from BIND 8.2.3-T5B. * resolv/herror.c: Likewise. * resolv/inet_addr.c: Likewise. * resolv/inet_net_ntop.c: Likewise. * resolv/inet_net_pton.c: Likewise. * resolv/inet_neta.c: Likewise. * resolv/inet_ntop.c: Likewise. * resolv/nsap_addr.c: Likewise. * resolv/inet_pton.c: Likewise. Reject a few more more invalid IPv6 addresses (ISC bug #520). * resolv/ns_name.c: Avoid emitting RCS ID in object file. * resolv/ns_parse.c: Likewise. * resolv/ns_netint.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/ns_print.c: Update from BIND 8.2.3-T5B. Avoid emitting RCS ID in object file. * resolv/res_debug.c: Update from BIND 8.2.3-T5B. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_init.c: Likewise. (res_setoptions): Mark internal. * resolv/res_send.c: Likewise. [_LIBC]: Fully reinstate the code that avoids the FD_SETSIZE limit by using poll instead. * resolv/res_comp.c: Likewise. [SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_2)]: Make dn_expand a weak alias for __dn_expand. * resolv/res_data.c: Likewise. (res_close) [_LIBC]: Don't call res_nclose if RES_INIT isn't set in _res.options. Avoids a potential security risk by avoiding a close (0). [SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_2)]: Make res_mkquery, res_query, res_querydomain adn res_search weak aliases for __res_mkquery, __res_query, __res_querydomain and __res_search. * resolv/res_libc.c: (_res): Don't initialize. Fix res_close instead to avoid close(0). (res_init): Always use the static resolver context. [SHLIB_COMPAT (libc, GLIBC_2.0, GLIBC_2_2)]: Make res_init a weak alias for __res_init. * resolv/resolv.h: Update from BIND 8.2.3-T5B. Move definition of RES_SET_H_ERRNO and accompanying comment to... * include/resolv.h: ... here. * resolv/arpa/namser.h: Update from BIND 8.2.3-T5B. * resolv/arpa/nameser_compat.h: Likewise.
2000-07-20 00:03:58 +02:00
if (saved_herrno != -1)
RES_SET_H_ERRNO(statp, saved_herrno);
else if (got_nodata)
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
RES_SET_H_ERRNO(statp, NO_DATA);
1995-02-18 02:27:10 +01:00
else if (got_servfail)
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
RES_SET_H_ERRNO(statp, TRY_AGAIN);
1995-02-18 02:27:10 +01:00
return (-1);
}
libresolv_hidden_def (__res_context_search)
/* Common part of res_nsearch and res_search. */
static int
context_search_common (struct resolv_context *ctx,
const char *name, int class, int type,
unsigned char *answer, int anslen)
{
if (ctx == NULL)
{
RES_SET_H_ERRNO (&_res, NETDB_INTERNAL);
return -1;
}
int result = __res_context_search (ctx, name, class, type, answer, anslen,
NULL, NULL, NULL, NULL, NULL);
__resolv_context_put (ctx);
return result;
}
1995-02-18 02:27:10 +01:00
Update. 2002-10-15 Jakub Jelinek <jakub@redhat.com> * include/resolv.h (__libc_res_nquery, __libc_res_nsearch, __libc_res_nsend): New prototypes. * resolv/res_query.c (QUERYSIZE): Define. (__libc_res_nquery): Renamed from res_nquery. Added answerp argument. Allocate only QUERYSIZE bytes first, if res_nmkquery fails use MAXPACKET buffer. Call __libc_res_nsend instead of res_nsend, pass answerp. (res_nquery): Changed into wrapper around __libc_res_nquery. (__libc_res_nsearch): Renamed from res_nsearch. Added answerp argument. Call __libc_res_nquerydomain and __libc_res_nquery instead of the non-__libc_ variants, pass them answerp. (res_nsearch): Changed into wrapper around __libc_res_nsearch. (__libc_res_nquerydomain): Renamed from res_nquerydomain. Added answerp argument. Call __libc_res_nquery instead of res_nquery, pass answerp. (res_nquerydomain): Changed into wrapper around __libc_res_nquerydomain. * resolv/res_send.c: Include sys/ioctl.h. (MAXPACKET): Define. (send_vc): Change arguments. Reallocate answer buffer if it is too small. (send_dg): Likewise. (__libc_res_nsend): Renamed from res_nsend. Added ansp argument. Reallocate answer buffer if it is too small and hooks are in use. Adjust calls to send_vc and send_dg. (res_nsend): Changed into wrapper around __libc_res_nsend. * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname2_r): Allocate just 1K answer buffer on the stack, use __libc_res_nsearch instead of res_nsearch. (_nss_dns_gethostbyaddr_r): Similarly with __libc_res_nquery. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Similarly with __libc_res_nsearch. * resolv/gethnamaddr.c (gethostbyname2): Likewise. (gethostbyaddr): Similarly with __libc_res_nquery. * resolv/Versions (libresolv): Export __libc_res_nquery and __libc_res_nsearch at GLIBC_PRIVATE.
2002-10-17 23:51:21 +02:00
int
res_nsearch(res_state statp,
const char *name, /* domain name */
int class, int type, /* class and type of query */
u_char *answer, /* buffer to put answer */
int anslen) /* size of answer */
{
return context_search_common
(__resolv_context_get_override (statp), name, class, type, answer, anslen);
Update. 2002-10-15 Jakub Jelinek <jakub@redhat.com> * include/resolv.h (__libc_res_nquery, __libc_res_nsearch, __libc_res_nsend): New prototypes. * resolv/res_query.c (QUERYSIZE): Define. (__libc_res_nquery): Renamed from res_nquery. Added answerp argument. Allocate only QUERYSIZE bytes first, if res_nmkquery fails use MAXPACKET buffer. Call __libc_res_nsend instead of res_nsend, pass answerp. (res_nquery): Changed into wrapper around __libc_res_nquery. (__libc_res_nsearch): Renamed from res_nsearch. Added answerp argument. Call __libc_res_nquerydomain and __libc_res_nquery instead of the non-__libc_ variants, pass them answerp. (res_nsearch): Changed into wrapper around __libc_res_nsearch. (__libc_res_nquerydomain): Renamed from res_nquerydomain. Added answerp argument. Call __libc_res_nquery instead of res_nquery, pass answerp. (res_nquerydomain): Changed into wrapper around __libc_res_nquerydomain. * resolv/res_send.c: Include sys/ioctl.h. (MAXPACKET): Define. (send_vc): Change arguments. Reallocate answer buffer if it is too small. (send_dg): Likewise. (__libc_res_nsend): Renamed from res_nsend. Added ansp argument. Reallocate answer buffer if it is too small and hooks are in use. Adjust calls to send_vc and send_dg. (res_nsend): Changed into wrapper around __libc_res_nsend. * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname2_r): Allocate just 1K answer buffer on the stack, use __libc_res_nsearch instead of res_nsearch. (_nss_dns_gethostbyaddr_r): Similarly with __libc_res_nquery. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Similarly with __libc_res_nsearch. * resolv/gethnamaddr.c (gethostbyname2): Likewise. (gethostbyaddr): Similarly with __libc_res_nquery. * resolv/Versions (libresolv): Export __libc_res_nquery and __libc_res_nsearch at GLIBC_PRIVATE.
2002-10-17 23:51:21 +02:00
}
int
res_search (const char *name, int class, int type,
unsigned char *answer, int anslen)
{
return context_search_common
(__resolv_context_get (), name, class, type, answer, anslen);
}
/* Perform a call on res_query on the concatenation of name and
domain. */
Update. 2002-10-15 Jakub Jelinek <jakub@redhat.com> * include/resolv.h (__libc_res_nquery, __libc_res_nsearch, __libc_res_nsend): New prototypes. * resolv/res_query.c (QUERYSIZE): Define. (__libc_res_nquery): Renamed from res_nquery. Added answerp argument. Allocate only QUERYSIZE bytes first, if res_nmkquery fails use MAXPACKET buffer. Call __libc_res_nsend instead of res_nsend, pass answerp. (res_nquery): Changed into wrapper around __libc_res_nquery. (__libc_res_nsearch): Renamed from res_nsearch. Added answerp argument. Call __libc_res_nquerydomain and __libc_res_nquery instead of the non-__libc_ variants, pass them answerp. (res_nsearch): Changed into wrapper around __libc_res_nsearch. (__libc_res_nquerydomain): Renamed from res_nquerydomain. Added answerp argument. Call __libc_res_nquery instead of res_nquery, pass answerp. (res_nquerydomain): Changed into wrapper around __libc_res_nquerydomain. * resolv/res_send.c: Include sys/ioctl.h. (MAXPACKET): Define. (send_vc): Change arguments. Reallocate answer buffer if it is too small. (send_dg): Likewise. (__libc_res_nsend): Renamed from res_nsend. Added ansp argument. Reallocate answer buffer if it is too small and hooks are in use. Adjust calls to send_vc and send_dg. (res_nsend): Changed into wrapper around __libc_res_nsend. * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname2_r): Allocate just 1K answer buffer on the stack, use __libc_res_nsearch instead of res_nsearch. (_nss_dns_gethostbyaddr_r): Similarly with __libc_res_nquery. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Similarly with __libc_res_nsearch. * resolv/gethnamaddr.c (gethostbyname2): Likewise. (gethostbyaddr): Similarly with __libc_res_nquery. * resolv/Versions (libresolv): Export __libc_res_nquery and __libc_res_nsearch at GLIBC_PRIVATE.
2002-10-17 23:51:21 +02:00
static int
__res_context_querydomain (struct resolv_context *ctx,
const char *name, const char *domain,
int class, int type,
unsigned char *answer, int anslen,
unsigned char **answerp, unsigned char **answerp2,
int *nanswerp2, int *resplen2,
int *answerp2_malloced)
1995-02-18 02:27:10 +01:00
{
struct __res_state *statp = ctx->resp;
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
char nbuf[MAXDNAME];
1995-02-18 02:27:10 +01:00
const char *longname = nbuf;
2011-07-20 17:40:37 +02:00
size_t n, d;
1995-02-18 02:27:10 +01:00
if (domain == NULL) {
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
n = strlen(name);
/* Decrement N prior to checking it against MAXDNAME
so that we detect a wrap to SIZE_MAX and return
a reasonable error. */
n--;
if (n >= MAXDNAME - 1) {
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
RES_SET_H_ERRNO(statp, NO_RECOVERY);
return (-1);
}
longname = name;
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
} else {
n = strlen(name);
d = strlen(domain);
if (n + d + 1 >= MAXDNAME) {
RES_SET_H_ERRNO(statp, NO_RECOVERY);
return (-1);
}
sprintf(nbuf, "%s.%s", name, domain);
}
return __res_context_query (ctx, longname, class, type, answer,
anslen, answerp, answerp2, nanswerp2,
resplen2, answerp2_malloced);
}
/* Common part of res_nquerydomain and res_querydomain. */
static int
context_querydomain_common (struct resolv_context *ctx,
const char *name, const char *domain,
int class, int type,
unsigned char *answer, int anslen)
{
if (ctx == NULL)
{
RES_SET_H_ERRNO (&_res, NETDB_INTERNAL);
return -1;
}
int result = __res_context_querydomain (ctx, name, domain, class, type,
answer, anslen,
NULL, NULL, NULL, NULL, NULL);
__resolv_context_put (ctx);
return result;
Update. 2002-10-15 Jakub Jelinek <jakub@redhat.com> * include/resolv.h (__libc_res_nquery, __libc_res_nsearch, __libc_res_nsend): New prototypes. * resolv/res_query.c (QUERYSIZE): Define. (__libc_res_nquery): Renamed from res_nquery. Added answerp argument. Allocate only QUERYSIZE bytes first, if res_nmkquery fails use MAXPACKET buffer. Call __libc_res_nsend instead of res_nsend, pass answerp. (res_nquery): Changed into wrapper around __libc_res_nquery. (__libc_res_nsearch): Renamed from res_nsearch. Added answerp argument. Call __libc_res_nquerydomain and __libc_res_nquery instead of the non-__libc_ variants, pass them answerp. (res_nsearch): Changed into wrapper around __libc_res_nsearch. (__libc_res_nquerydomain): Renamed from res_nquerydomain. Added answerp argument. Call __libc_res_nquery instead of res_nquery, pass answerp. (res_nquerydomain): Changed into wrapper around __libc_res_nquerydomain. * resolv/res_send.c: Include sys/ioctl.h. (MAXPACKET): Define. (send_vc): Change arguments. Reallocate answer buffer if it is too small. (send_dg): Likewise. (__libc_res_nsend): Renamed from res_nsend. Added ansp argument. Reallocate answer buffer if it is too small and hooks are in use. Adjust calls to send_vc and send_dg. (res_nsend): Changed into wrapper around __libc_res_nsend. * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname2_r): Allocate just 1K answer buffer on the stack, use __libc_res_nsearch instead of res_nsearch. (_nss_dns_gethostbyaddr_r): Similarly with __libc_res_nquery. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Similarly with __libc_res_nsearch. * resolv/gethnamaddr.c (gethostbyname2): Likewise. (gethostbyaddr): Similarly with __libc_res_nquery. * resolv/Versions (libresolv): Export __libc_res_nquery and __libc_res_nsearch at GLIBC_PRIVATE.
2002-10-17 23:51:21 +02:00
}
int
res_nquerydomain(res_state statp,
const char *name,
const char *domain,
int class, int type, /* class and type of query */
u_char *answer, /* buffer to put answer */
int anslen) /* size of answer */
{
return context_querydomain_common
(__resolv_context_get_override (statp),
name, domain, class, type, answer, anslen);
1995-02-18 02:27:10 +01:00
}
int
res_querydomain (const char *name, const char *domain, int class, int type,
unsigned char *answer, int anslen)
{
return context_querydomain_common
(__resolv_context_get (), name, domain, class, type, answer, anslen);
}
update from main archive 960921 Sun Sep 22 03:40:52 1996 Ulrich Drepper <drepper@cygnus.com> * resolv/resolv.h: Update to bind-4.9.5-T4B. * resolv/base64.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_query.c: Likewise. * resolv/gethnamaddr.c: Likewise. * nss/nss_dns/dns-host.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_send.c: Likewise. * resolv/arpa/nameser.h: Likewise. Attention: MAXDNAME is much higher now. * resolv/Banner: New file. * resolv/Makefile (distribute): Add Banner. Sat Sep 21 19:15:24 1996 Ulrich Drepper <drepper@cygnus.com> * sysdeps/stub/getsysstats.c: New file. * sysdeps/unix/sysv/linux/getsysstats.c: New file. * misc/Makefile (headers): Add sys/sysinfo.h. (routines): Add getsysstats. * sysdeps/unix/sysv/linux/Makefile [$(subdir)==misc] (sysdep_headers): Remove sys/sysinfo.h. * sysdeps/generic/sys/sysinfo.h: New file. * sysdeps/unix/sysv/linux/sys/sysinfo.h: Add prototype for get_nprocs, get_phys_pages, and get_avphys_pages. * misc/Makefile (routines): Add mntent_r. * misc/mntent_r.c: New file. * misc/mntent.c: Remove all functions but getmntent and use __getmntent_r. * misc/mntent.h: Add prototype for __getmntent_r. * misc/fstab.c: Use __getmntent_r function instead of getmntent. This will not clobber the state in getmntent. * sysdeps/generic/confname.h: Add _SC_PROCESSORS_CONF, _SC_NPROCESSORS_ONLN, _SC_PHYS_PAGES, _SC_AVPHYS_PAGES, _SC_ATEXIT_MAX, and _SC_PASS_MAX. * sysdeps/stub/sysconf.c: Add handling _SC_PROCESSORS_CONF and _SC_NPROCESSORS_ONLN by calling __get_nprocs, _SC_PHYS_PAGES by calling __get_phys_pages, _SY_AVPHYS_PAGES by calling __get_avphys_pages, _SC_ATEXIT_MAX and _SC_PASS_MAX. * sysdeps/posix/sysconf.c: Likewise. * posix/getconf.c (vars): Add _NPROCESSORS_CONF, _NPROCESSORS_ONLN, _PHYS_PAGES, _AVPHYS_PAGES, ATEXIT_MAX, and PASS_MAX entries. Sat Sep 21 05:20:36 1996 Ulrich Drepper <drepper@cygnus.com> * version.h (VERSION): Bump to 1.95. * Make-dist (+tsrcs): Don't filter out files in subdirs which match files in the sysdeps hierachy (welcome back, sys/syscall.h!). * resolv/Makefile (libresolv-routines): Remove getnetnamad. Sat Sep 21 03:00:19 1996 Ulrich Drepper <drepper@cygnus.com> * locale/loadlocale.c (_nl_free_locale): Remove function. * locale/localeinfo.h: Remove prototype for _nl_free_locale. * locale/setlocale.c (setlocale): Don't free locale data of categories which succeeded to load after a wrong or missing data file was observed. * locale/setlocale (setlocale): Initialize NEWNAME correctly so that it works even when the locale data is not used. * stdlib/random_r.c: Fix typo in comment. * stdlib/drand48-iter.c: Likewise. * stdlib/drand48.c: Likewise. * stdlib/erand48.c: Likewise. * stdlib/jrand48.c: Likewise. * stdlib/lcong48.c: Likewise. * stdlib/lrand48.c: Likewise. * stdlib/mrand48.c: Likewise. * stdlib/nrand48.c: Likewise. * stdlib/random.c: Likewise. * stdlib/seed48.c: Likewise. * stdlib/srand48.c: Likewise. * misc/search.h: Likewise. * misc/hsearch.c: Likewise. * misc/hsearch_r.c: Likewise. * sysdeps/unix/sysv/linux/m68k/sysdep.S (__errno_location): Thu Sep 19 23:36:19 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu> * hurd/hurdinit.c (__libc_argv): Provide common decl. (_hurd_setproc): Don't declare __libc_argv here.
1996-09-22 05:06:42 +02:00
const char *
__res_context_hostalias (struct resolv_context *ctx,
const char *name, char *dst, size_t siz)
{
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
char *file, *cp1, *cp2;
1995-02-18 02:27:10 +01:00
char buf[BUFSIZ];
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
FILE *fp;
1995-02-18 02:27:10 +01:00
if (ctx->resp->options & RES_NOALIASES)
return (NULL);
2022-08-11 20:23:08 +02:00
file = __libc_secure_getenv("HOSTALIASES");
if (file == NULL || (fp = fopen(file, "rce")) == NULL)
1995-02-18 02:27:10 +01:00
return (NULL);
setbuf(fp, NULL);
1995-02-18 02:27:10 +01:00
buf[sizeof(buf) - 1] = '\0';
while (fgets(buf, sizeof(buf), fp)) {
for (cp1 = buf; *cp1 && !isspace(*cp1); ++cp1)
;
if (!*cp1)
break;
*cp1 = '\0';
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
if (ns_samename(buf, name) == 1) {
1995-02-18 02:27:10 +01:00
while (isspace(*++cp1))
;
if (!*cp1)
break;
for (cp2 = cp1 + 1; *cp2 && !isspace(*cp2); ++cp2)
;
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
*cp2 = '\0';
strncpy(dst, cp1, siz - 1);
dst[siz - 1] = '\0';
1995-02-18 02:27:10 +01:00
fclose(fp);
Update. 1999-12-03 Andreas Jaeger <aj@suse.de> * nss/getXXbyYY.c: Include <resolv.h> (FUNCTION_NAME): Use res_ninit instead of res_init. * nss/getXXbyYY_r.c [NEED__RES]: Include <resolv.h> for _res declaration and prototypes. Remove extra _res declaration. (INTERNAL): Use thread aware res_ninit function. * inet/gethstbyad_r.c: Include <resolv.h>. * resolv/res_data.c: Update from Bind 8.2.2-P5. Moved res_init to res_libc.c. Disabled unneeded functions. * resolv/res_libc.c: New file. * Versions.def: Add version GLIBC_2.2 for libpthread. Add versions GLIBC_2.1 and GLIBC_2.2 for libresolv. * include/resolv.h: Add internal interfaces. * resolv/Makefile (routines): Add new files. (libresolv-routines): Likewise. (distribute): Likewise. * resolv/gethnamaddr.c: Use thread safe resolver functions. * resolv/nss_dns/dns-host.c: Likewise. * resolv/nss_dns/dns-network.c: Likewise. * resolv/arpa/nameser.h: Update from Bind 8.2.2-P5. * resolv/nsap_addr.c: Likewise. * resolv/res_comp.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_init.c: Likewise. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_send.c: Likewise. * resolv/resolv.h: Likewise. * resolv/Versions: Add __res_state and __res_ninit with version GLIBC_2.2 to libc. Add new interfaces with version GLIBC_2.2 to libresolv. * resolv/Banner: Update. * include/arpa/nameser_compat.h: New file. * resolv/ns_name.c: New file from Bind 8.2.2-P5. * resolv/ns_netint.c: Likewise. * resolv/ns_parse.c: Likewise. * resolv/ns_print.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/arpa/nameser_compat.h: Likewise. * resolv/res_debug.h: Likewise. Some patches are based on work done by Adam D. Bradley <artdodge@cs.bu.edu>. * sysdeps/unix/sysv/linux/configure.in: Remove check for ldconfig, set always use_ldconfig instead.
1999-12-04 19:05:55 +01:00
return (dst);
1995-02-18 02:27:10 +01:00
}
}
fclose(fp);
return (NULL);
}
libresolv_hidden_def (__res_context_hostalias)
/* Common part of res_hostalias and hostalias. */
static const char *
context_hostalias_common (struct resolv_context *ctx,
const char *name, char *dst, size_t siz)
{
if (ctx == NULL)
{
RES_SET_H_ERRNO (&_res, NETDB_INTERNAL);
return NULL;
}
const char *result = __res_context_hostalias (ctx, name, dst, siz);
__resolv_context_put (ctx);
return result;
}
const char *
res_hostalias (res_state statp, const char *name, char *dst, size_t siz)
{
return context_hostalias_common
(__resolv_context_get_override (statp), name, dst, siz);
}
const char *
hostalias (const char *name)
{
static char abuf[MAXDNAME];
return context_hostalias_common
(__resolv_context_get (), name, abuf, sizeof (abuf));
}
#if SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_2)
# undef res_query
# undef res_querydomain
# undef res_search
weak_alias (__res_query, res_query);
weak_alias (__res_querydomain, res_querydomain);
weak_alias (__res_search, res_search);
#endif