Commit Graph

402 Commits

Author SHA1 Message Date
Ulrich Drepper 505cf2c00a Fix up netdb.h for XPG7. 2010-01-12 16:43:00 -08:00
Andreas Schwab 51e4196f16 Handle running out of buffer space with IPv6 mapping enabled.
With big DNS answers like the one you get for goodtimesdot.com you can
get a truncated address list if IPv6 mapping is enabled.  Instead tell
the caller to resize the buffer.
2009-11-10 07:36:50 -08:00
Ulrich Drepper 75ded9bcdf Initialize local variable in resolver.
When the DNS server doesn't reply at all we possibly tested
an unitialized variable.
2009-10-29 23:01:58 -07:00
Petar Bogdanovic 3a85895fa3 Fix mixing IPv4 and IPv6 name server in resolv.conf. 2009-10-29 08:17:48 -07:00
Adam Tkac 2d0671cbbd Define and implement RES_USE_DNSSEC option in resolver. 2009-07-27 07:33:48 -07:00
Ulrich Drepper e28b969b49 Handle SERVFAIL, NOTIMP, REFUSED replies from DNS server better.
When doing IPv4+6 lookups we have to pass up the error record from
send_dg.
2009-07-26 12:16:24 -07:00
Ulrich Drepper 1c0ab5bd34 Handle overly large answer buffers in resolver.
In EDNS0 records the maximum result size is transmitted in a 16
bit value.  Large buffer sizes were handled incorrectly by using
only the low 16 bits.  Fix this by limiting the size to 0xffff.
2009-07-16 23:37:50 -07:00
Ulrich Drepper 44d20bca52 Implement second fallback mode for DNS requests.
There is some more shardware/software out there which has problems
if two DNS requests are sent using the same tuple

  (source addr, source port, dest addr, dest port)

This can range from firewalls to load balancers.  Some of the vendors
already fixed it in response to this problem.  Still, we need a way
to make glibc work with broken environments.  The single-request-reopen
flag can be used or we fall back automatically to this mode.
2009-06-26 03:47:47 -07:00
Ulrich Drepper 310647e980 Remember we switched to single-request mode.
This change prevents repetition in most later calls of the resolver
in case the DNS server or the network connection is broken.
2009-06-11 10:07:33 -07:00
Andreas Schwab ff6ff38db2 Remove redundant .gitignore files. 2009-05-16 10:18:34 +02:00
Jim Meyering 2e180a2622 rename each .cvsignore file to .gitignore 2009-05-15 18:13:37 +02:00
Ulrich Drepper cf4f16cc88 [BZ #10128]
2009-05-05  Aurelien Jarno  <aurelien@aurel32.net>
	[BZ #10128]
	* resolv/res_query.c (__libc_res_nquery): If one query returns NOTIMP
	or FORMERR and the other NOERROR, don't raise an error.
2009-05-09 16:12:41 +00:00
Ulrich Drepper 74b3cf224e (send_dg): Don't just ignore the result we got in case we only receive one reply in single-request mode. 2009-04-16 20:29:33 +00:00
Ulrich Drepper d0e81f10e5 * resolv/res_send.c (send_dg): Don't switch into single-request
mode if we already are in it.
2009-04-16 14:29:34 +00:00
Ulrich Drepper 4c8b8cc332 * malloc/malloc.c (_int_realloc): Add parameter with old block
size.  Remove duplicated test.  Don't handle mmap'ed blocks here.
	Adjust all callers.
	* malloc/hooks.c (realloc_check): Adjust _int_realloc call.
2009-04-08 18:00:34 +00:00
Ulrich Drepper c6807d38a1 * resolv/res_hconf.c (_res_hconf_trim_domain): Use strcasecmp
instead of __strcasecmp.
	* resolv/nss_dns/dns-host.c (getanswer_r): Likewise.
2009-04-07 16:13:15 +00:00
Ulrich Drepper ae06191038 * resolv/resolv.h (RES_SNGLKUP): Define.
* resolv/res_init.c (res_setoptions): Recognize single-request option.
	* resolv/res_send.c (send_dg): If we sent two requests at once and
	only get one reply before timeout switch to mode where we send the
	second request only after the first answer has been received.
2009-04-07 02:00:27 +00:00
Jakub Jelinek d82a27f841 * stdlib/monetary.h: Uglify function parameter names.
* sunrpc/rpc/pmap_clnt.h: Likewise. 
* sunrpc/rpc/svc.h: Likewise. 
* sunrpc/rpc/xdr.h: Likewise. 
* sunrpc/rpc/clnt.h: Likewise. 
* resolv/netdb.h: Likewise. 
* resolv/arpa/nameser.h: Likewise. 
* resolv/resolv.h: Likewise. 
* argp/argp.h: Likewise. 
* locale/langinfo.h: Likewise. 
* io/sys/stat.h: Likewise. 
* posix/spawn.h: Likewise. 
* nis/rpcsvc/nislib.h: Likewise. 
* malloc/obstack.h: Likewise. 
* sysdeps/ia64/bits/link.h: Likewise. 
* sysdeps/i386/bits/link.h: Likewise. 
* sysdeps/s390/bits/link.h: Likewise. 
* sysdeps/powerpc/bits/link.h: Likewise. 
* sysdeps/x86_64/bits/link.h: Likewise. 
* sysdeps/sparc/bits/link.h: Likewise. 
* sysdeps/sh/bits/link.h: Likewise. 
* sysdeps/unix/sysv/linux/i386/sys/io.h: Likewise. 
* sysdeps/unix/sysv/linux/x86_64/sys/io.h: Likewise. 
* sysdeps/unix/sysv/linux/sparc/sys/eventfd.h: Likewise. 
* sysdeps/unix/sysv/linux/sys/eventfd.h: Likewise.
2009-02-16  Jakub Jelinek  <jakub@redhat.com>

	* stdlib/monetary.h: Uglify function parameter names.
	* sunrpc/rpc/pmap_clnt.h: Likewise.
	* sunrpc/rpc/svc.h: Likewise.
	* sunrpc/rpc/xdr.h: Likewise.
	* sunrpc/rpc/clnt.h: Likewise.
	* resolv/netdb.h: Likewise.
	* resolv/arpa/nameser.h: Likewise.
	* resolv/resolv.h: Likewise.
	* argp/argp.h: Likewise.
	* locale/langinfo.h: Likewise.
	* io/sys/stat.h: Likewise.
	* posix/spawn.h: Likewise.
	* nis/rpcsvc/nislib.h: Likewise.
	* malloc/obstack.h: Likewise.
	* sysdeps/ia64/bits/link.h: Likewise.
	* sysdeps/i386/bits/link.h: Likewise.
	* sysdeps/s390/bits/link.h: Likewise.
	* sysdeps/powerpc/bits/link.h: Likewise.
	* sysdeps/x86_64/bits/link.h: Likewise.
	* sysdeps/sparc/bits/link.h: Likewise.
	* sysdeps/sh/bits/link.h: Likewise.
	* sysdeps/unix/sysv/linux/i386/sys/io.h: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/sys/io.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sys/eventfd.h: Likewise.
	* sysdeps/unix/sysv/linux/sys/eventfd.h: Likewise.
2009-02-16 21:00:15 +00:00
Ulrich Drepper 1a9dd4e4e4 [BZ #9781]
* grp/compat-initgroups.c (compat_call): Switch to use malloc when
	the input line is too long.
2009-02-07 04:40:57 +00:00
Ulrich Drepper df9293cb16 * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyaddr2_r): Check and
adjust the buffer alignment.
2009-01-08 00:03:29 +00:00
Ulrich Drepper 16b7dc27a9 * resolv/res_init.c (__res_vinit): Count all servers in statp->nscount. 2008-12-29 19:53:48 +00:00
Ulrich Drepper 200da00a7c * resolv/res_send.c (send_dg): Use correct guards for SOCK_CLOEXEC
use.

	* sysdeps/unix/sysv/linux/kernel-features.h: Fix typo in accept4
	handling.
2008-12-08 04:08:51 +00:00
Ulrich Drepper 905ef0daeb * resolv/res_init.c (__res_vinit): Always assign to statp->nscount
after reading name server list.
2008-12-08 03:59:18 +00:00
Ulrich Drepper da5ac1352d * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname3_r): Recognize
ESRCH return value.
	(_nss_dns_gethostbyname4_r): Likewise.
	* resolv/res_init.c (__res_vinit): Initialize nscount to zero.
	* sysdeps/posix/getaddrinfo.c (gaih_inet): In case we use
	gethostbyname4_r, we don't have a separate IPv6 status, so copy
	the no_data variable.
2008-12-03 07:30:39 +00:00
Ulrich Drepper 6f5c31171f * resolv/res_init.c (__res_vinit): Fill in IPv4 name server
information at the correct index.
2008-12-03 05:20:19 +00:00
Ulrich Drepper 9744268c10 * resolv/res_send.c (send_dg): Create sockets with non-blocking
flag already set.
2008-12-02 06:21:18 +00:00
Ulrich Drepper 9ba2747432 (gaih_getanswer_slice): Don't abort for unknown request types for now. 2008-11-12 07:52:20 +00:00
Ulrich Drepper ad12e63582 [BZ #6942]
2008-10-07  Andreas Schwab  <schwab@suse.de>
	[BZ #6942]
	* resolv/res_send.c (send_vc): Fix last change.
	(send_dg): Align here as well.
2008-10-31 17:37:28 +00:00
Ulrich Drepper 332c4465b0 * grp/initgroups.c (internal_getgrouplist): Don't prematurely
abort if there is no initgroups_dyn function.
2008-10-30 16:55:44 +00:00
Ulrich Drepper 21b07d8ba5 * resolv/res_send.c (send_dg): On timeout, only return nonzero
result if any of the queries really provided an answer.
2008-10-30 16:00:44 +00:00
Ulrich Drepper 660675dec1 Fix tests for existence of second reply. 2008-10-24 08:20:04 +00:00
Ulrich Drepper 49685151ea * resolv/res_query.c (__libc_res_nquery): Add a few casts. 2008-10-24 07:05:38 +00:00
Ulrich Drepper e39e69467e (send_vc): Fix use of unaligned address. Properly handle partial reads. 2008-10-06 16:29:06 +00:00
Ulrich Drepper be1c55f265 (res_nmkquery): Call ns_name_compress directly instead of going through dn_comp. 2008-08-12 06:56:53 +00:00
Ulrich Drepper cd5743fdec * Versions.def: Add GLIBC_2.9 to libresolv.
* include/resolv.h: Remove hidden proto declarations for __ns_*
	functions.  Add them for __dn_count_labels and __p_secstodate.
	* include/arpa/nameser.h: Add a number of hidden proto declarations.
	Define ns_msg_getflags macro here.
	* resolv/res_debug.c: Add hidden definition for __dn_count_labels
	and __p_secstodate.
	* resolv/Versions: Export functions from <arpa/nameser.h> from
	libresolv in version GLIBC_2.9.
	* resolv/ns_name.c: Integrate changes from bind 9.5.0.  Add necessary
	hidden definitions.
	* 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/arpa/nameser.h: Likewise.  Remove macros which redirect
	function calls.
	* resolv/nss_dns/dns-canon.c (_nss_dns_getcanonname_r): Use __ns_get16
	instead of ns_get16.
	* resolv/nss_dns/dns-host.c (getanswer_r): Use __ns_get16 and
	__ns_get32 instead of ns_get16 and ns_get32 respectively.
	(gaih_getanswer_slice): Likewise.
	* resolv/Makefile (libresolv-routines): Add ns_date.
	* resolv/ns_date.c: New file.
2008-08-01 17:16:31 +00:00
Ulrich Drepper b7da31a164 * resolv/res_send.c (__libc_res_nsend): Take additional parameter.
Use it instead of locally defined resplen2 variable.
	(res_nsend): Adjust for __libc_res_nsend interface change.
	(send_vc): Initialize *resplen2 if necessary.  Read length of
	package into an appropriately aligned variable.  Store converted length
	in new variable and use it appropriately.
	Add branch prediction help.
	* resolv/res_query.c (__libc_res_nquery): Take additional parameter
	and pass it on to __libc_res_nsend.  Adjust all callers.
	(__libc_res_nsearch): Likewise.
	(__libc_res_nqeurydomain): Likewise.
	* resolv/nss_dns/dns-host.c: Adjust for __libc_res_nsearch interface
	change.
	(_nss_dns_gethostbyname4): Don't unconditionally allocate tmp array.
	Define resplen2 variable and pass it to __libc_res_nsearch and then
	to gaih_getanswer.
	(getanswer_r): In case of incorrect DNS data don't overread buffer.
	Add branch prediction.
	(gaih_getanswer_slice): Likewise.  Check for invalid data types.
	(gaih_getanswer): Don't decode second slice if first one failed due
	to a too small buffer.  Don't let not found status of second
	decoder shadow results of the first.
	* resolv/gethnamaddr.c (gethostbyname2): Adjust for __libc_res_nsearch
	and __libc_res_nquery interface changes
	(gethostbyaddr): Adjust for __libc_res_nquery interface change.
	* include/resolv.h: Adjust prototypes for __libc_res_nquery,
	__libc_res_nsearch, and __libc_res_nsend.
	* resolv/nss_dns/dns-canon.c: Adjust for __libc_res_nquery interface
	change.
	* resolv/nss_dns/dns-network.c: Adjust for __libc_res_nquery and
	__libc_res_nsearch interface changes.
2008-07-28 22:55:10 +00:00
Ulrich Drepper 835113c60e * resolv/res_send.c: Remove unnecessary res_pquery prototype. 2008-07-09 22:41:56 +00:00
Ulrich Drepper fdc769f68b * resolv/res_query.c (__libc_res_nquery): Issue debug message only
if DEBUG is defined.
2008-07-09 20:48:04 +00:00
Ulrich Drepper 44abc397e6 * resolv/res_query.c (__libc_res_nquery): Align buffer for T_AAAA
query.  Adjust buffer size computation for padding.
2008-07-09 17:59:15 +00:00
Ulrich Drepper 34ca2ff7da * resolv/res_debig.c (__p_type_syms): Add ns_t_dname entry.
Patch by Peter Jones <pjones@redhat.com>.
2008-06-27 04:45:06 +00:00
Ulrich Drepper f854efd722 * resolv/nss_dns/dns-host.c (gaih_getanswer): Don't
unconditionally use second gaih_getanswer_slice result.
2008-06-13 04:36:35 +00:00
Ulrich Drepper c128355211 * resolv/nss_dns/dns-host.c (gaih_getanswer_slice): Also log and
ignore T_DNAME messages.
	* resolv/arpa/nameser_compat.h (T_DNAME): Define.
2008-06-10 22:36:45 +00:00
Ulrich Drepper c536b04dbc (T_DNAME): Define. 2008-06-10 22:35:01 +00:00
Ulrich Drepper e200388380 * resolv/res_send.c (send_dg): If we already have one of two
answers and the server reports SERVFAI, NOTIMP, or REFUSED, then
	use the one answer insted of failing.
2008-05-24 17:51:45 +00:00
Ulrich Drepper 5908f779e7 * resolv/res_query.c (__libc_res_nquery): In case one of two
answer was too short don't try to read that answer's header.

	* resolv/res_send.c (send_dg): In case of timeout and there are
	two queries and one has been answered, return value indicating
	success.
2008-05-19 17:34:14 +00:00
Ulrich Drepper 343996c47c * resolv/nss_dns/dns-host.c (gaih_getanswer_slice): If there are
no answers return NSS_STATUS_NOTFOUND.
	(gaih_getanswer): Don't call gaih_getanswer_slice if the answer
	buffer does not have any content.

	* nscd/servicescache.c: Likewise.
2008-05-17 19:54:58 +00:00
Ulrich Drepper 1eb946b935 * 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-10 23:27:39 +00:00
Ulrich Drepper 0073dd2d49 * resolv/res_mkquery.c (__res_nopt): Use NS_PUT16 instead of ns_put16. 2008-04-20 04:56:49 +00:00
Ulrich Drepper a7eba295f0 Handle scope IDs in resolv.conf. 2008-04-07 17:20:25 +00:00
Ulrich Drepper 72e6cdfa2c Remove useless "if" before "free". 2008-03-19 06:43:34 +00:00