Commit Graph

481 Commits

Author SHA1 Message Date
Andreas Schwab ab09bf616a Properly fix memory leak in _nss_dns_gethostbyname4_r with big DNS answer
Instead of trying to guess whether the second buffer needs to be freed
set a flag at the place it is allocated
2014-02-19 14:39:21 +01:00
Ondřej Bílka ab7ac0f2cf Deduplicate resolv/nss_dns/dns-host.c
In resolv/nss_dns/dns-host.c one of code path duplicated code after
that. We merge these paths.
2014-02-16 12:59:23 +01:00
Andreas Schwab d668061994 Fix memory leak in _nss_dns_gethostbyname4_r with big DNS answer 2014-02-13 12:54:34 +01:00
Joseph Myers 498afc54df Combine __USE_BSD and __USE_SVID into __USE_MISC.
This patch cleans up following the obsoletion of _BSD_SOURCE and
_SVID_SOURCE by combining __USE_BSD and __USE_SVID into __USE_MISC.

The only non-mechanical part of this patch is the changes to
features.h; everything else is simple substitution of __USE_MISC for
the old macros.  Thus, this patch leaves obviously redundant
conditionals such as "defined __USE_MISC || defined __USE_MISC", and
does not update #endif comments where they referred to BSD or SVID in
words instead of the literal macro name.  This is intended to
facilitate patch review by separating the less mechanical changes from
these purely mechanical changes into a separate patch.  (I do intend
to integrate all the changes from
<https://sourceware.org/ml/libc-alpha/2013-12/msg00226.html>, which I
believe includes all the trailing comment updates, in subsequent
patches.)

Tested x86_64.

	* include/features.h (__USE_BSD): Remove macro definitions.
	(__USE_SVID): Likewise.
	(_BSD_SOURCE): Likewise.
	(_SVID_SOURCE): Likewise.
	[!defined _BSD_SOURCE && !defined _SVID_SOURCE]: Remove condition
	from definition of _DEFAULT_SOURCE.
	[_BSD_SOURCE || _SVID_SOURCE]: Change condition to
	[_DEFAULT_SOURCE].
	* bits/fcntl.h [__USE_BSD]: Change condition to [__USE_MISC].
	* bits/mman.h [__USE_BSD]: Likewise.
	* bits/termios.h [__USE_BSD]: Likewise.
	* bits/waitstatus.h [__USE_BSD]: Likewise.
	* ctype/ctype.h [__USE_SVID]: Likewise.
	* dirent/dirent.h [__USE_BSD]: Likewise.
	* grp/grp.h [__USE_SVID]: Likewise.
	[__USE_BSD]: Likewise.
	* inet/netinet/igmp.h [__USE_BSD]: Likewise.
	* io/fcntl.h [__USE_BSD]: Likewise.
	* io/ftw.h [__USE_BSD]: Likewise.
	* io/sys/stat.h [__USE_BSD]: Likewise.
	* libio/bits/stdio-ldbl.h [__USE_BSD]: Likewise.
	* libio/bits/stdio2.h [__USE_BSD]: Likewise.
	* libio/stdio.h [__USE_SVID]: Likewise.
	[__USE_BSD]: Likewise.
	* math/math.h [__USE_SVID]: Likewise.
	[__USE_BSD]: Likewise.
	* misc/bits/syslog-ldbl.h [__USE_BSD]: Likewise.
	* misc/bits/syslog.h [__USE_BSD]: Likewise.
	* misc/search.h [__USE_SVID]: Likewise.
	* misc/sys/mman.h [__USE_BSD]: Likewise.
	* misc/sys/syslog.h [__USE_BSD]: Likewise.
	* misc/sys/uio.h [__USE_BSD]: Likewise.
	* posix/bits/unistd.h [__USE_BSD]: Likewise.
	* posix/glob.h [__USE_BSD]: Likewise.
	* posix/regex.h [__USE_BSD]: Likewise.
	* posix/sys/types.h [__USE_BSD]: Likewise.
	[__USE_SVID]: Likewise.
	* posix/sys/utsname.h [__USE_SVID]: Likewise.
	* posix/sys/wait.h [__USE_BSD]: Likewise.
	[__USE_SVID]: Likewise.
	* posix/unistd.h [__USE_BSD]: Likewise.
	[__USE_SVID]: Likewise.
	* pwd/pwd.h [__USE_SVID]: Likewise.
	* resolv/netdb.h [__USE_BSD]: Likewise.
	* setjmp/setjmp.h [__USE_BSD]: Likewise.
	* signal/signal.h [__USE_BSD]: Likewise.
	[__USE_SVID]: Likewise.
	* socket/sys/socket.h [__USE_BSD]: Likewise.
	* stdlib/fmtmsg.h [__USE_SVID]: Likewise.
	* stdlib/stdlib.h [__USE_BSD]: Likewise.
	[__USE_SVID]: Likewise.
	* string/bits/string2.h [__USE_BSD]: Likewise.
	[__USE_SVID]: Likewise.
	* string/bits/string3.h [__USE_BSD]: Likewise.
	* string/endian.h [__USE_BSD]: Likewise.
	* string/string.h [__USE_SVID]: Likewise.
	[__USE_BSD]: Likewise.
	* string/strings.h [__USE_BSD]: Likewise.
	* sysdeps/generic/netinet/ip.h [__USE_BSD]: Likewise.
	* sysdeps/gnu/netinet/ip_icmp.h [__USE_BSD]: Likewise.
	* sysdeps/mach/hurd/bits/fcntl.h [__USE_BSD]: Likewise.
	* sysdeps/mach/hurd/bits/stat.h [__USE_BSD]: Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/mman.h [__USE_BSD]: Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/termios.h [__USE_BSD]:
	Likewise.
	* sysdeps/unix/sysv/linux/bits/fcntl-linux.h [__USE_BSD]:
	Likewise.
	* sysdeps/unix/sysv/linux/bits/mman-linux.h [__USE_BSD]: Likewise.
	* sysdeps/unix/sysv/linux/bits/sys_errlist.h [__USE_BSD]:
	Likewise.
	* sysdeps/unix/sysv/linux/bits/termios.h [__USE_BSD]: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/termios.h [__USE_BSD]:
	Likewise.
	* sysdeps/unix/sysv/linux/netinet/if_ether.h [__USE_BSD]:
	Likewise.
	* sysdeps/unix/sysv/linux/netinet/if_fddi.h [__USE_BSD]: Likewise.
	* sysdeps/unix/sysv/linux/netinet/if_tr.h [__USE_BSD]: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/termios.h [__USE_BSD]:
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/termios.h [__USE_BSD]:
	Likewise.
	* sysdeps/x86/bits/string.h [__USE_BSD]: Likewise.
	* sysvipc/sys/ipc.h [__USE_SVID]: Likewise.
	* termios/termios.h [__USE_BSD]: Likewise.
	* time/sys/time.h [__USE_BSD]: Likewise.
	* time/time.h [__USE_BSD]: Likewise.
	[__USE_SVID]: Likewise.

	* sysdeps/unix/sysv/linux/hppa/bits/mman.h [__USE_BSD]: Change
	condition to [__USE_MISC].
2014-02-12 23:41:01 +00:00
Ondřej Bílka a1ffb40e32 Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
Allan McRae d4697bc93d Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
Ondřej Bílka d1d9eaf478 Use __glibc_reserved instead __unused. 2013-11-26 12:32:28 +01:00
Ondřej Bílka cabba9343c Correctly copy resolver address. Fixes bug #13028. 2013-10-14 08:17:09 +02:00
Joseph Myers 3f2e46a494 Remove --disable-versioning. 2013-09-04 15:25:42 +00:00
Ondřej Bílka 382466e04e Fix typos. 2013-08-30 18:08:59 +02:00
Ondřej Bílka 6f65e66895 Fix typos. 2013-08-29 09:11:45 +02:00
Roland McGrath fb431262c1 Clean up _res declaration to use __thread unconditionally. 2013-08-27 11:04:46 -07:00
Roland McGrath c4e42566cf Don't try to use ioctl unless [FIONREAD]. 2013-08-27 10:50:06 -07:00
Roland McGrath f890a59b10 Mild decrufting in resolv code. 2013-08-27 10:49:36 -07:00
Ondřej Bílka c0c3f78afb Fix typos. 2013-08-21 19:48:48 +02:00
Joseph Myers 60d2f8f3c7 Use (void) in no-arguments function definitions. 2013-06-08 00:22:23 +00:00
Joseph Myers 2e09a79ada Avoid use of "register" as optimization hint. 2013-06-07 22:24:35 +00:00
Ondrej Bilka 350635a59a Fix leading whitespaces. 2013-06-06 20:36:07 +02:00
Joseph Myers 9c84384cc1 Remove trailing whitespace. 2013-06-05 20:44:03 +00:00
Joseph Myers fab7ce3f5b Link extra-libs consistently with libc and ld.so. 2013-05-31 16:16:33 +00:00
Ryan S. Arnold e054f49430 Add #include <stdint.h> for uint[32|64]_t usage (except installed headers). 2013-05-16 11:32:54 -05:00
Andreas Jaeger c3ed8088e4 BZ#15084: Apparent typos in strings in res_debug.c
[BZ #15084]
	* resolv/res_debug.c (p_option): Fix strings for RES_USEBSTRING
	and RES_USEVC.
2013-04-29 21:17:30 +02:00
Andreas Jaeger f1a24198af BZ#15085: Fix comments/strings for RES_NOCHECKNAME
[BZ #15085]
	* resolv/resolv.h (RES_NOCHECKNAME): Mark as unimplemented.
	* resolv/res_debug.c (p_option): Mark RES_NOCHECKNAME as
	unimplemented.
2013-04-29 21:11:13 +02:00
Andreas Jaeger b1a36ceb3b BZ#15086: Fix res_debug printing of options
[BZ# 15086]
	* resolv/res_debug.c (p_option): Handle RES_NOALIASES,
	RES_KEEPTSIG, RES_BLAST, RES_NOIP6DOTINT, RES_SNGLKUP,
	RES_SNGLKUPREOP.
2013-04-29 21:00:57 +02:00
Andreas Jaeger f238fd190b Sort Versions files 2013-02-17 16:34:04 +01:00
Roland McGrath f1d70dad53 Remove lots of inline keywords. 2013-02-07 14:44:18 -08:00
Joseph Myers 568035b787 Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
Joseph Myers f4cf5f2d8b Add script to update copyright notices and reformat some to facilitate its use. 2013-01-01 16:29:10 +00:00
Aurelien Jarno cc8bb21c8a Fix assertion failures in resolver (BZ #13013).
[BZ #13013]
	* resolv/res_query.c(__libc_res_nquery): Assign hp and hp2
	depending n and resplen2 to catch cases where answer
	equals answerp2.
2012-11-30 15:04:27 -05:00
Thomas Schwinge 123be9deda Add recvmmsg and sendmmsg to the generic glibc API. 2012-11-20 19:26:04 +01:00
Siddhesh Poyarekar cfde9b463d Return EAI_SYSTEM if we're out of file descriptors
Resolves BZ #14719.
2012-11-19 13:02:48 +05:30
Joseph Myers 8ca8931812 Define IPPORT_RESERVED in netdb.h for XPG4 and UNIX98 (bug 14838). 2012-11-13 18:11:49 +00:00
Thomas Schwinge b830319d49 [BZ #157] Remove include/stub-tag.h for good. 2012-11-04 19:59:40 +01:00
Joseph Myers 03ac099f6b Define and use $(run-built-tests). 2012-10-24 00:08:46 +00:00
Jeroen van Bemmel 7b6e99be77 Avoid duplicate DNS requests if answer is longer than a implementation
limit

        [BZ #14307]
        * sysdeps/posix/getaddrinfo.c (gaih_inet): Increase the size of
        the temporary buffer used to invoke __gethostbyname2_r,
        __gethostbyaddr_r and gethostbyname4_r to make room for struct
        host_data / struct gaih_addrtuple.
        * resolv/nss_dns/dns-host.c (global scope): Move definition of
        implementation constants MAX_NR_ALIASES and MAX_NR_ADDRS to
        header file nss/nsswitch.h.
        * nss/nsswitch.h (global scope): Add definition of implementation
        constants MAX_NR_ALIASES and MAX_NR_ADDRS (moved from
        resolv/nss_dns/dns-host.c).
2012-07-12 11:31:48 +05:30
Siddhesh Poyarekar 6cd0a5eaf0 Merge copyright years in resolv/nss_dns/dns-host.c 2012-03-31 10:01:43 +05:30
Siddhesh Poyarekar 48c41d04ee Consider TTL of CNAME record and return minimum TTL in the chain
[BZ #13928] A DNS request consists of multiple resources combined into
a single hostent, including multiple CNAME records that may have been
assigned different TTL values. In such a case, nscd should take the
least TTL among all of the resources as the timeout for the hostent
before it is reloaded in its cache so that the hostent remains stale
in the database for the least amount of time.
2012-03-30 21:30:01 +05:30
Jeff Law 2f5a5ed02c * resolv/nss_dns/dns-host.c: Update copyright year. 2012-03-30 09:54:21 -06:00
Ulrich Drepper 966977f1b7 Better error handling for sendmmsg use in res_send 2012-03-30 08:38:58 -04:00
Ulrich Drepper 8e6d108343 Correct check for DNS request send success
This predates the sendmmsg use.  The two requests can use different
request sizes but the check for successful transfer always only used
buflen.
2012-03-30 08:27:11 -04:00
Ulrich Drepper c030f70c87 Speed up DNS by avoiding a system call if possible 2012-03-30 07:42:29 -04:00
Jeff Law 86ae07a8c9 [BZ #13760]
* resolv/nss_dns/dns-host.c (gaih_getanswer): Look for errno
        in the right place. Discard and retry query if response is
        larger than input buffer size.
2012-03-28 10:09:29 -06:00
Paul Pluzhnikov 3ff4252677 2012-03-23 Daniel Jacobowitz <dmj@google.com>
Paul Pluzhnikov  <ppluzhnikov@google.com>

	[BZ #6528]
	* grp/Makefile (otherlibs): Don't set it.
	* inet/Makefile (otherlibs): Likewise.
	* login/Makefile (otherlibs): Likewise.
	* nscd/Makefile (otherlibs): Likewise.
	* posix/Makefile (otherlibs): Likewise.
	* pwd/Makefile (otherlibs): Likewise.
	* rt/Makefile (otherlibs): Likewise.
	* sunrpc/Makefile (otherlibs): Likewise.
	* nss/Makefile (otherlibs): Likewise.
	Add libnss_files to routines and static-only-routines.
	($(objpfx)getent): Remove rule.
	* resolv/Makefile: Add libnss_dns and libresolv to routines and
	static-only-routines.
2012-03-23 09:47:03 -07:00
Thomas Schwinge 82d86f2844 Fix struct timespec normalization (as used in many other places). 2012-03-08 11:49:43 +01:00
Ulrich Drepper a4300c7a4d Remove distribute variable from Makefiles 2012-03-07 05:17:13 -05:00
Jeff Law 8fdceb2efd [network] Avoid out ouf bounds read in __libc_res_nquerydomain
2012-02-28  Jeff Law  <law@redhat.com>

	* resolv/res_query.c (__libc_res_nquerydomain): Avoid
	out of bounds read.
2012-02-29 11:51:27 -05:00
Paul Eggert 59ba27a63a Replace FSF snail mail address with URLs. 2012-02-09 23:18:22 +00:00
Ulrich Drepper a784e50247 Remove pre-ISO C support
No more __const.
2012-01-07 23:57:22 -05:00
Ulrich Drepper 0269750ca6 Remove non-ELF support 2012-01-07 20:30:26 -05:00
Ross Lagerwall ad8ac1bd6a Open /etc/resolv.conf with FD_CLOEXEC 2011-12-17 14:43:40 -05:00