glibc/resolv/res_data.c

35 lines
1.4 KiB
C
Raw Normal View History

/*
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
* Copyright (c) 1995-1999 by Internet Software Consortium.
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
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
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
* copyright notice and this permission notice appear in all copies.
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
*
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
* 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.
*/
#include <resolv.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
void
res_close(void) {
2013-06-06 19:36:03 +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
* Some stupid programs out there call res_close() before res_init().
* Since _res._vcsock isn't explicitly initialized, these means that
* we could do a close(0), which might lead to some security problems.
* Therefore we check if res_init() was called before by looking at
* the RES_INIT bit in _res.options. If it hasn't been set we bail out
* early. */
if ((_res.options & RES_INIT) == 0)
return;
/* We don't free the name server addresses because we never
did it and it would be done implicitly on shutdown. */
__res_iclose(&_res, false);
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
}