Commit Graph

700 Commits

Author SHA1 Message Date
Florian Weimer 5e0c421cc0 nss_dns: Check address length before creating addrinfo result [BZ #19831]
Previously, we allocated room in the result space before the check,
leaving uninitialized data there in case the check failed.

This also consolidates the behavior between single (A or AAAA) and
dual (A and AAAA in parallel) queries.  Single queries checked
the record length against the QTYPE, not the RRTYPE.
2016-04-27 16:39:12 +02:00
Florian Weimer b9b026c9c0 resolv, nss_dns: Remove remaining syslog logging [BZ #19862]
The fix for bug 14841 only removed part of the logging.
2016-04-27 16:21:40 +02:00
Florian Weimer f749498fa5 nss_dns: Validate RDATA length against packet length [BZ #19830]
In _nss_dns_getcanonname_r, a check for the availability of RR metadata
was missing as well.
2016-04-27 15:11:42 +02:00
Florian Weimer b9bdfa7c8f resolv: Always set *resplen2 out parameter in send_vc [BZ #19825]
In various error scenarios (for example, if the server closes the
TCP connection before sending the full response), send_vc can return
without resetting the *resplen2 value.  This can pass uninitialized
or unexpected data to the caller.
2016-04-27 14:26:47 +02:00
Florian Weimer d29fb41f44 nss_dns: Fix assertion failure in _nss_dns_getcanonname_r [BZ #19865] 2016-04-11 10:55:43 +02:00
Florian Weimer 317b199b4a CVE-2016-3075: Stack overflow in _nss_dns_getnetbyname_r [BZ #19879]
The defensive copy is not needed because the name may not alias the
output buffer.
2016-03-29 12:57:56 +02:00
Florian Weimer b66d837bb5 resolv: Always set *resplen2 out parameter in send_dg [BZ #19791]
Since commit 44d20bca52 (Implement
second fallback mode for DNS requests), there is a code path which
returns early, before *resplen2 is initialized.  This happens if the
name server address is immediately recognized as invalid (because of
lack of protocol support, or if it is a broadcast address such
255.255.255.255, or another invalid address).

If this happens and *resplen2 was non-zero (which is the case if a
previous query resulted in a failure), __libc_res_nquery would reuse
an existing second answer buffer.  This answer has been previously
identified as unusable (for example, it could be an NXDOMAIN
response).  Due to the presence of a second answer, no name server
switching will occur.  The result is a name resolution failure,
although a successful resolution would have been possible if name
servers have been switched and queries had proceeded along the search
path.

The above paragraph still simplifies the situation.  Before glibc
2.23, if the second answer needed malloc, the stub resolver would
still attempt to reuse the second answer, but this is not possible
because __libc_res_nsearch has freed it, after the unsuccessful call
to __libc_res_nquerydomain, and set the buffer pointer to NULL.  This
eventually leads to an assertion failure in __libc_res_nquery:

	/* Make sure both hp and hp2 are defined */
	assert((hp != NULL) && (hp2 != NULL));

If assertions are disabled, the consequence is a NULL pointer
dereference on the next line.

Starting with glibc 2.23, as a result of commit
e9db92d3ac (CVE-2015-7547: getaddrinfo()
stack-based buffer overflow (Bug 18665)), the second answer is always
allocated with malloc.  This means that the assertion failure happens
with small responses as well because there is no buffer to reuse, as
soon as there is a name resolution failure which triggers a search for
an answer along the search path.

This commit addresses the issue by ensuring that *resplen2 is
initialized before the send_dg function returns.

This commit also addresses a bug where an invalid second reply is
incorrectly returned as a valid to the caller.
2016-03-25 11:49:52 +01:00
Samuel Thibault 35fbb341f8 Fix hurd build
* sysdeps/mach/hurd/openat.c (__openat): Add missing ellipsis.
	* resolv/gai_sigqueue.c (__gai_sigqueue): Add missing internal_function
	qualifier.
	* /rt/aio_sigqueue.c (__aio_sigqueue): Add missing attribute_hidden
	internal_function qualifiers.
2016-03-16 13:57:57 +01:00
Andreas Schwab 5e7fdabd7d Fix resource leak in resolver (bug 19257)
The number of currently defined nameservers is stored in ->nscount,
whereas ->_u._ext.nscount is set by __libc_res_nsend only after local
initializations.
2016-03-15 13:15:54 +01:00
Florian Weimer aff8c7a9a7 res_ninit: Update comment
Since commit e66e7419a6 (Actually make
it possible to user the default name server.), the default is
INADDR_LOOPBACK, not INADDR_ANY.
2016-02-19 17:00:47 +01:00
Carlos O'Donell e9db92d3ac CVE-2015-7547: getaddrinfo() stack-based buffer overflow (Bug 18665).
* A stack-based buffer overflow was found in libresolv when invoked from
  libnss_dns, allowing specially crafted DNS responses to seize control
  of execution flow in the DNS client.  The buffer overflow occurs in
  the functions send_dg (send datagram) and send_vc (send TCP) for the
  NSS module libnss_dns.so.2 when calling getaddrinfo with AF_UNSPEC
  family.  The use of AF_UNSPEC triggers the low-level resolver code to
  send out two parallel queries for A and AAAA.  A mismanagement of the
  buffers used for those queries could result in the response of a query
  writing beyond the alloca allocated buffer created by
  _nss_dns_gethostbyname4_r.  Buffer management is simplified to remove
  the overflow.  Thanks to the Google Security Team and Red Hat for
  reporting the security impact of this issue, and Robert Holiday of
  Ciena for reporting the related bug 18665. (CVE-2015-7547)

See also:
https://sourceware.org/ml/libc-alpha/2016-02/msg00416.html
https://sourceware.org/ml/libc-alpha/2016-02/msg00418.html
2016-02-16 21:29:32 -05:00
Martin Sebor f2b3078e6a Fix build failures with -DDEBUG.
[BZ #19443]
        * crypt/crypt_util.c [DEBUG] (_ufc_prbits): Correct format string.
        [DEBUG] (_ufc_set_bits): Declare used.
        * iconv/gconv_dl.c [DEBUG]: Add a missing include directive.
        [DEBUG] (print_all): Declare used.
        * resolv/res_send.c [DEBUG] (__libc_res_nsend): Explicitly convert
        operands of the ternary ?: expression to target type.
        * stdlib/rshift.c [DEBUG] (mpn_rshift): Use assert() instead of
        calling the undeclared abort.
        * time/mktime.c [DEBUG] (DEBUG): Rename to DEBUG_MKTIME.
2016-01-15 11:07:41 -07:00
Joseph Myers f7a9f785e5 Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
Rob Wu b674b82109 resolv: Reset defdname before use in __res_vinit [BZ #19369]
Resetting defdname (default domain name) before use in __res_vinit
ensures that the default domain name is correctly set to a default
value when it is not set by the LOCALDOMAIN environment variable or
the "domain" or "search" parameters in resolv.conf

Tested using the steps from:
https://sourceware.org/bugzilla/show_bug.cgi?id=19369
2015-12-29 13:28:04 -05:00
Florian Weimer 79e0d340a9 Revert "tst-res_hconf_reorder: Set RESOLV_REORDER environment variable"
This reverts commit 731a713b72.

This change is unnecessary because the Makefile already sets up the
environment for the test.
2015-12-04 19:25:59 +01:00
Florian Weimer 731a713b72 tst-res_hconf_reorder: Set RESOLV_REORDER environment variable
Otherwise, the problematic code does not run.
2015-12-04 19:02:12 +01:00
Joseph Myers f1d237df1e Remove GCC version conditionals on -Wmaybe-uninitialized pragmas.
One common case of __GNUC_PREREQ (4, 7) conditionals is use of
diagnostic control pragmas for -Wmaybe-uninitialized, an option
introduced in GCC 4.7 where older GCC needed -Wuninitialized to be
controlled instead if the warning appeared with older GCC.  This patch
removes such conditionals.

(There remain several older uses of -Wno-uninitialized in makefiles
that still need to be converted to diagnostic control pragmas if the
issue is still present with current sources and supported GCC
versions, and it's likely that in most cases those pragmas also will
end up controlling -Wmaybe-uninitialized.)

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch, except for libresolv
since res_send.c contains assertions whose line numbers are changed by
the patch).

	* resolv/res_send.c (send_vc) [__GNUC_PREREQ (4, 7)]: Make code
	unconditional.
	* soft-fp/fmadf4.c [__GNUC_PREREQ (4, 7)]: Likewise.
	[!__GNUC_PREREQ (4, 7)]: Remove conditional code.
	* soft-fp/fmasf4.c [__GNUC_PREREQ (4, 7)]: Make code
	unconditional.
	[!__GNUC_PREREQ (4, 7)]: Remove conditional code.
	* soft-fp/fmatf4.c [__GNUC_PREREQ (4, 7)]: Make code
	unconditional.
	[!__GNUC_PREREQ (4, 7)]: Remove conditional code.
	* stdlib/setenv.c
	[((__GNUC__ << 16) + __GNUC_MINOR__) >= ((4 << 16) + 7)]: Make
	code unconditional.
	[!(((__GNUC__ << 16) + __GNUC_MINOR__) >= ((4 << 16) + 7))]:
	Remove conditional code.
	* sysdeps/ieee754/dbl-64/e_lgamma_r.c
	(__ieee754_lgamma_r) [__GNUC_PREREQ (4, 7)]: Make code
	unconditional.
	(__ieee754_lgamma_r) [!__GNUC_PREREQ (4, 7)]: Remove conditional
	code.
	* sysdeps/ieee754/flt-32/e_lgammaf_r.c
	(__ieee754_lgammaf_r) [__GNUC_PREREQ (4, 7)]: Make code
	unconditional.
	(__ieee754_lgammaf_r) [!__GNUC_PREREQ (4, 7)]: Remove conditional
	code.
	* sysdeps/ieee754/ldbl-128/k_tanl.c
	(__kernel_tanl) [__GNUC_PREREQ (4, 7)]: Make code unconditional.
	(__kernel_tanl) [!__GNUC_PREREQ (4, 7)]: Remove conditional code.
	* sysdeps/ieee754/ldbl-128ibm/k_tanl.c
	(__kernel_tanl) [__GNUC_PREREQ (4, 7)]: Make code unconditional.
	(__kernel_tanl) [!__GNUC_PREREQ (4, 7)]: Remove conditional code.
	* sysdeps/ieee754/ldbl-96/e_lgammal_r.c
	(__ieee754_lgammal_r) [__GNUC_PREREQ (4, 7)]: Make code
	unconditional.
	(__ieee754_lgammal_r) [!__GNUC_PREREQ (4, 7)]: Remove conditional
	code.
	* sysdeps/ieee754/ldbl-96/k_tanl.c
	(__kernel_tanl) [__GNUC_PREREQ (4, 7)]: Make code unconditional.
	(__kernel_tanl) [!__GNUC_PREREQ (4, 7)]: Remove conditional code.
2015-10-27 23:42:20 +00:00
Joseph Myers 85231522bb Convert a few more function definitions to prototype style.
This patch converts a few more function definitions in glibc from
old-style K&R to prototype style.  This is sufficient to build and
test on x86_64 and x86 with -Wold-style-definition (I'll test on some
more architectures before proposing the actual addition of
-Wold-style-definition).

Tested for x86_64 and x86 with -Wold-style-definition in use
(testsuite - this patch affects files containing assertions).

	* io/fts.c (fts_open): Convert to prototype-style function
	definition.
	* malloc/mcheck.c (mcheck): Likewise.
	(mcheck_pedantic): Likewise.
	* posix/regexec.c (re_search_2_stub): Likewise.  Use
	internal_function.
	(re_search_internal): Likewise.
	* resolv/res_init.c [RESOLVSORT] (net_mask): Convert to
	prototype-style function definition.
	* sunrpc/clnt_udp.c (clntudp_call): Likewise.
	* sunrpc/pmap_rmt.c (clnt_broadcast): Likewise.
	* sunrpc/rpcsvc/rusers.x (xdr_utmp): Likewise.
	(xdr_utmpptr): Likewise.
	(xdr_utmparr): Likewise.
	(xdr_utmpidle): Likewise.
	(xdr_utmpidleptr): Likewise.
	(xdr_utmpidlearr): Likewise.
2015-10-21 11:57:23 +00:00
Joseph Myers 9dd346ff43 Convert 113 more function definitions to prototype style (files with assertions).
This mostly automatically-generated patch converts 113 function
definitions in glibc from old-style K&R to prototype-style.  Following
my other recent such patches, this one deals with the case of function
definitions in files that either contain assertions or where grep
suggested they might contain assertions - and thus where it isn't
possible to use a simple object code comparison as a sanity check on
the correctness of the patch, because line numbers are changed.

A few such automatically-generated changes needed to be supplemented
by manual changes for the result to compile.  openat64 had a prototype
declaration with "..." but an old-style definition in
sysdeps/unix/sysv/linux/dl-openat64.c, and "..." needed adding to the
generated prototype in the definition (I've filed
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68024> for diagnosing
such cases in GCC; the old state was undefined behavior not requiring
a diagnostic, but one seems a good idea).  In addition, as Florian has
noted regparm attribute mismatches between declaration and definition
are only diagnosed for prototype definitions, and five functions
needed internal_function added to their definitions (in the case of
__pthread_mutex_cond_lock, via the macro definition of
__pthread_mutex_lock) to compile on i386.

After this patch is in, remaining old-style definitions are probably
most readily fixed manually before we can turn on
-Wold-style-definition for all builds.

Tested for x86_64 and x86 (testsuite).

	* crypt/md5-crypt.c (__md5_crypt_r): Convert to prototype-style
	function definition.
	* crypt/sha256-crypt.c (__sha256_crypt_r): Likewise.
	* crypt/sha512-crypt.c (__sha512_crypt_r): Likewise.
	* debug/backtracesyms.c (__backtrace_symbols): Likewise.
	* elf/dl-minimal.c (_itoa): Likewise.
	* hurd/hurdmalloc.c (malloc): Likewise.
	(free): Likewise.
	(realloc): Likewise.
	* inet/inet6_option.c (inet6_option_space): Likewise.
	(inet6_option_init): Likewise.
	(inet6_option_append): Likewise.
	(inet6_option_alloc): Likewise.
	(inet6_option_next): Likewise.
	(inet6_option_find): Likewise.
	* io/ftw.c (FTW_NAME): Likewise.
	(NFTW_NAME): Likewise.
	(NFTW_NEW_NAME): Likewise.
	(NFTW_OLD_NAME): Likewise.
	* libio/iofwide.c (_IO_fwide): Likewise.
	* libio/strops.c (_IO_str_init_static_internal): Likewise.
	(_IO_str_init_static): Likewise.
	(_IO_str_init_readonly): Likewise.
	(_IO_str_overflow): Likewise.
	(_IO_str_underflow): Likewise.
	(_IO_str_count): Likewise.
	(_IO_str_seekoff): Likewise.
	(_IO_str_pbackfail): Likewise.
	(_IO_str_finish): Likewise.
	* libio/wstrops.c (_IO_wstr_init_static): Likewise.
	(_IO_wstr_overflow): Likewise.
	(_IO_wstr_underflow): Likewise.
	(_IO_wstr_count): Likewise.
	(_IO_wstr_seekoff): Likewise.
	(_IO_wstr_pbackfail): Likewise.
	(_IO_wstr_finish): Likewise.
	* locale/programs/localedef.c (normalize_codeset): Likewise.
	* locale/programs/locarchive.c (add_locale_to_archive): Likewise.
	(add_locales_to_archive): Likewise.
	(delete_locales_from_archive): Likewise.
	* malloc/malloc.c (__libc_mallinfo): Likewise.
	* math/gen-auto-libm-tests.c (init_fp_formats): Likewise.
	* misc/tsearch.c (__tfind): Likewise.
	* nptl/pthread_attr_destroy.c (__pthread_attr_destroy): Likewise.
	* nptl/pthread_attr_getdetachstate.c
	(__pthread_attr_getdetachstate): Likewise.
	* nptl/pthread_attr_getguardsize.c (pthread_attr_getguardsize):
	Likewise.
	* nptl/pthread_attr_getinheritsched.c
	(__pthread_attr_getinheritsched): Likewise.
	* nptl/pthread_attr_getschedparam.c
	(__pthread_attr_getschedparam): Likewise.
	* nptl/pthread_attr_getschedpolicy.c
	(__pthread_attr_getschedpolicy): Likewise.
	* nptl/pthread_attr_getscope.c (__pthread_attr_getscope):
	Likewise.
	* nptl/pthread_attr_getstack.c (__pthread_attr_getstack):
	Likewise.
	* nptl/pthread_attr_getstackaddr.c (__pthread_attr_getstackaddr):
	Likewise.
	* nptl/pthread_attr_getstacksize.c (__pthread_attr_getstacksize):
	Likewise.
	* nptl/pthread_attr_init.c (__pthread_attr_init_2_1): Likewise.
	(__pthread_attr_init_2_0): Likewise.
	* nptl/pthread_attr_setdetachstate.c
	(__pthread_attr_setdetachstate): Likewise.
	* nptl/pthread_attr_setguardsize.c (pthread_attr_setguardsize):
	Likewise.
	* nptl/pthread_attr_setinheritsched.c
	(__pthread_attr_setinheritsched): Likewise.
	* nptl/pthread_attr_setschedparam.c
	(__pthread_attr_setschedparam): Likewise.
	* nptl/pthread_attr_setschedpolicy.c
	(__pthread_attr_setschedpolicy): Likewise.
	* nptl/pthread_attr_setscope.c (__pthread_attr_setscope):
	Likewise.
	* nptl/pthread_attr_setstack.c (__pthread_attr_setstack):
	Likewise.
	* nptl/pthread_attr_setstackaddr.c (__pthread_attr_setstackaddr):
	Likewise.
	* nptl/pthread_attr_setstacksize.c (__pthread_attr_setstacksize):
	Likewise.
	* nptl/pthread_condattr_setclock.c (pthread_condattr_setclock):
	Likewise.
	* nptl/pthread_create.c (__find_in_stack_list): Likewise.
	* nptl/pthread_getattr_np.c (pthread_getattr_np): Likewise.
	* nptl/pthread_mutex_cond_lock.c (__pthread_mutex_lock): Define to
	use internal_function.
	* nptl/pthread_mutex_init.c (__pthread_mutex_init): Convert to
	prototype-style function definition.
	* nptl/pthread_mutex_lock.c (__pthread_mutex_lock): Likewise.
	(__pthread_mutex_cond_lock_adjust): Likewise.  Use
	internal_function.
	* nptl/pthread_mutex_timedlock.c (pthread_mutex_timedlock):
	Convert to prototype-style function definition.
	* nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock):
	Likewise.
	* nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt):
	Likewise.
	(__pthread_mutex_unlock): Likewise.
	* nptl_db/td_ta_clear_event.c (td_ta_clear_event): Likewise.
	* nptl_db/td_ta_set_event.c (td_ta_set_event): Likewise.
	* nptl_db/td_thr_clear_event.c (td_thr_clear_event): Likewise.
	* nptl_db/td_thr_event_enable.c (td_thr_event_enable): Likewise.
	* nptl_db/td_thr_set_event.c (td_thr_set_event): Likewise.
	* nss/makedb.c (process_input): Likewise.
	* posix/fnmatch.c (__strchrnul): Likewise.
	(__wcschrnul): Likewise.
	(fnmatch): Likewise.
	* posix/fnmatch_loop.c (FCT): Likewise.
	* posix/glob.c (globfree): Likewise.
	(__glob_pattern_type): Likewise.
	(__glob_pattern_p): Likewise.
	* posix/regcomp.c (re_compile_pattern): Likewise.
	(re_set_syntax): Likewise.
	(re_compile_fastmap): Likewise.
	(regcomp): Likewise.
	(regerror): Likewise.
	(regfree): Likewise.
	* posix/regexec.c (regexec): Likewise.
	(re_match): Likewise.
	(re_search): Likewise.
	(re_match_2): Likewise.
	(re_search_2): Likewise.
	(re_search_stub): Likewise.  Use internal_function
	(re_copy_regs): Likewise.
	(re_set_registers): Convert to prototype-style function
	definition.
	(prune_impossible_nodes): Likewise.  Use internal_function.
	* resolv/inet_net_pton.c (inet_net_pton): Convert to
	prototype-style function definition.
	(inet_net_pton_ipv4): Likewise.
	* stdlib/strtod_l.c (____STRTOF_INTERNAL): Likewise.
	* sysdeps/pthread/aio_cancel.c (aio_cancel): Likewise.
	* sysdeps/pthread/aio_suspend.c (aio_suspend): Likewise.
	* sysdeps/pthread/timer_delete.c (timer_delete): Likewise.
	* sysdeps/unix/sysv/linux/dl-openat64.c (openat64): Likewise.
	Make variadic.
	* time/strptime_l.c (localtime_r): Convert to prototype-style
	function definition.
	* wcsmbs/mbsnrtowcs.c (__mbsnrtowcs): Likewise.
	* wcsmbs/mbsrtowcs_l.c (__mbsrtowcs_l): Likewise.
	* wcsmbs/wcsnrtombs.c (__wcsnrtombs): Likewise.
	* wcsmbs/wcsrtombs.c (__wcsrtombs): Likewise.
2015-10-20 11:54:09 +00:00
Joseph Myers 41075ae3e7 Convert 29 more function definitions to prototype style (multiple parameters in one K&R parameter declaration).
This automatically-generated patch converts 29 function definitions in
glibc (including one in an example in the manual) from old-style K&R
to prototype-style.  Following my other recent such patches, this one
deals with the case of function definitions where one K&R parameter
declaration declares multiple parameters, as in:

void
foo (a, b)
     int a, *b;
{
}

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

	* crypt/crypt.c (_ufc_doit_r): Convert to prototype-style function
	definition.
	(_ufc_doit_r): Likewise.
	* crypt/crypt_util.c (_ufc_copymem): Likewise.
	(_ufc_output_conversion_r): Likewise.
	* inet/inet_mkadr.c (__inet_makeaddr): Likewise.
	* inet/rcmd.c (rcmd_af): Likewise.
	(rcmd): Likewise.
	(ruserok_af): Likewise.
	(ruserok): Likewise.
	(ruserok2_sa): Likewise.
	(ruserok_sa): Likewise.
	(iruserok_af): Likewise.
	(iruserok): Likewise.
	(__ivaliduser): Likewise.
	(__validuser2_sa): Likewise.
	* inet/rexec.c (rexec_af): Likewise.
	(rexec): Likewise.
	* inet/ruserpass.c (ruserpass): Likewise.
	* locale/programs/xmalloc.c (xcalloc): Likewise.
	* manual/examples/timeval_subtract.c (timeval_subtract): Likewise.
	* math/w_drem.c (__drem): Likewise.
	* math/w_dremf.c (__dremf): Likewise.
	* math/w_dreml.c (__dreml): Likewise.
	* misc/daemon.c (daemon): Likewise.
	* resolv/res_debug.c (p_fqnname): Likewise.
	* stdlib/div.c (div): Likewise.
	* string/memcmp.c (memcmp_bytes): Likewise.
	* sunrpc/pmap_rmt.c (pmap_rmtcall): Likewise.
	* sunrpc/svc_udp.c (svcudp_bufcreate): Likewise.
2015-10-20 11:52:27 +00:00
Joseph Myers d10a3ab273 Do not use -Wno-strict-prototypes.
Two glibc makefiles use -Wno-strict-prototypes.  I don't know if this
was needed before my recent conversion of many function definitions to
prototype style, but it's not needed now; this patch removes it.

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

	* posix/Makefile (CFLAGS-regex.c): Remove variable.
	* resolv/Makefile (+cflags): Do not use -Wno-strict-prototypes.
2015-10-19 21:24:50 +00:00
Mike Frysinger 6ab674ebff use -fstack-protector-strong when available
With gcc-4.9, a new -fstack-protector-strong flag is available that is
between -fstack-protector (pretty weak) and -fstack-protector-all (pretty
strong) that provides good trade-offs between overhead but still providing
good coverage.  Update the places in glibc that use ssp to use this flag
when it's available.

This also kills off the indirection of hardcoding the flag name in the
Makefiles and adding it based on a have-ssp boolean.  Instead, the build
always expands the $(stack-protector) variable to the best ssp setting.
This makes the build logic a bit simpler and allows people to easily set
to a diff flag like:
	make stack-protector=-fstack-protector-all
2015-10-19 15:36:48 -04:00
Florian Weimer 52fb79d6cd Assume that SOCK_CLOEXEC is available and works
This fixes (harmless) data races when accessing the various
__have_sock_cloexec variables.
2015-10-17 12:02:37 +02:00
Joseph Myers 9d46370ca3 Convert 703 function definitions to prototype style.
This automatically-generated patch converts 703 function definitions
in glibc from old-style K&R to prototype-style.

This conversion is deliberately simplistic, excluding any tricky cases
as even a patch covering only simple cases is still very large.
Currently excluded are: sysdeps files (to improve test coverage for
the initial patch); files containing assertions (to avoid line number
changes so that generated libraries can be compared); any cases where
the generated function declaration would involve lines over 79
characters and so need to be wrapped; any cases with array parameters
or other cases where parameter declarators don't end with the
parameter name; any other cases that my script didn't parse.

I didn't try to make the ChangeLog generation indicate when function
definitions are conditional; it just lists the functions changed
without regard to that.

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

	* crypt/cert.c (good_bye): Convert to prototype-style function
	definition.
	(get8): Likewise.
	(put8): Likewise.
	* crypt/crypt-entry.c (crypt): Likewise.
	(__fcrypt): Likewise.
	* crypt/crypt_util.c (_ufc_prbits): Likewise.
	(_ufc_set_bits): Likewise.
	(_ufc_clearmem): Likewise.
	(__init_des_r): Likewise.
	(shuffle_sb): Likewise.
	(shuffle_sb): Likewise.
	(_ufc_setup_salt_r): Likewise.
	(_ufc_mk_keytab_r): Likewise.
	(_ufc_dofinalperm_r): Likewise.
	(encrypt): Likewise.
	(__setkey_r): Likewise.
	(setkey): Likewise.
	* crypt/md5.c (md5_init_ctx): Likewise.
	(md5_read_ctx): Likewise.
	(md5_finish_ctx): Likewise.
	(md5_stream): Likewise.
	(md5_buffer): Likewise.
	(md5_process_bytes): Likewise.
	* crypt/sha256.c (__sha256_init_ctx): Likewise.
	(__sha256_finish_ctx): Likewise.
	(__sha256_process_bytes): Likewise.
	* crypt/sha512.c (__sha512_init_ctx): Likewise.
	(__sha512_finish_ctx): Likewise.
	(__sha512_process_bytes): Likewise.
	* ctype/isctype.c (__isctype): Likewise.
	* debug/backtrace.c (__backtrace): Likewise.
	* debug/backtracesymsfd.c (__backtrace_symbols_fd): Likewise.
	* debug/fgets_chk.c (__fgets_chk): Likewise.
	* debug/fgets_u_chk.c (__fgets_unlocked_chk): Likewise.
	* debug/memcpy_chk.c (__memcpy_chk): Likewise.
	* debug/memmove_chk.c (MEMMOVE_CHK): Likewise.
	* debug/mempcpy_chk.c (__mempcpy_chk): Likewise.
	* debug/memset_chk.c (__memset_chk): Likewise.
	* debug/strcat_chk.c (__strcat_chk): Likewise.
	* debug/strncat_chk.c (__strncat_chk): Likewise.
	* debug/strncpy_chk.c (__strncpy_chk): Likewise.
	* debug/vsprintf_chk.c (_IO_str_chk_overflow): Likewise.
	* dirent/dirfd.c (dirfd): Likewise.
	* dirent/getdents.c (__getdirentries): Likewise.
	* dirent/getdents64.c (getdirentries64): Likewise.
	* dirent/rewinddir.c (__rewinddir): Likewise.
	* dirent/seekdir.c (seekdir): Likewise.
	* dirent/telldir.c (telldir): Likewise.
	* elf/sln.c (makesymlinks): Likewise.
	(makesymlink): Likewise.
	* gmon/gmon.c (__moncontrol): Likewise.
	(__monstartup): Likewise.
	(write_hist): Likewise.
	(write_call_graph): Likewise.
	(write_bb_counts): Likewise.
	* grp/setgroups.c (setgroups): Likewise.
	* inet/inet_lnaof.c (inet_lnaof): Likewise.
	* inet/inet_net.c (inet_network): Likewise.
	* inet/inet_netof.c (inet_netof): Likewise.
	* inet/rcmd.c (rresvport_af): Likewise.
	(rresvport): Likewise.
	* io/access.c (__access): Likewise.
	* io/chdir.c (__chdir): Likewise.
	* io/chmod.c (__chmod): Likewise.
	* io/chown.c (__chown): Likewise.
	* io/close.c (__close): Likewise.
	* io/creat.c (creat): Likewise.
	* io/creat64.c (creat64): Likewise.
	* io/dup.c (__dup): Likewise.
	* io/dup2.c (__dup2): Likewise.
	* io/dup3.c (__dup3): Likewise.
	* io/euidaccess.c (__euidaccess): Likewise.
	* io/faccessat.c (faccessat): Likewise.
	* io/fchmod.c (__fchmod): Likewise.
	* io/fchmodat.c (fchmodat): Likewise.
	* io/fchown.c (__fchown): Likewise.
	* io/fchownat.c (fchownat): Likewise.
	* io/fcntl.c (__fcntl): Likewise.
	* io/flock.c (__flock): Likewise.
	* io/fts.c (fts_load): Likewise.
	(fts_close): Likewise.
	(fts_read): Likewise.
	(fts_set): Likewise.
	(fts_children): Likewise.
	(fts_build): Likewise.
	(fts_stat): Likewise.
	(fts_sort): Likewise.
	(fts_alloc): Likewise.
	(fts_lfree): Likewise.
	(fts_palloc): Likewise.
	(fts_padjust): Likewise.
	(fts_maxarglen): Likewise.
	(fts_safe_changedir): Likewise.
	* io/getwd.c (getwd): Likewise.
	* io/isatty.c (__isatty): Likewise.
	* io/lchown.c (__lchown): Likewise.
	* io/link.c (__link): Likewise.
	* io/linkat.c (linkat): Likewise.
	* io/lseek.c (__libc_lseek): Likewise.
	* io/mkdir.c (__mkdir): Likewise.
	* io/mkdirat.c (mkdirat): Likewise.
	* io/mkfifo.c (mkfifo): Likewise.
	* io/mkfifoat.c (mkfifoat): Likewise.
	* io/open.c (__libc_open): Likewise.
	* io/open64.c (__libc_open64): Likewise.
	* io/readlink.c (__readlink): Likewise.
	* io/readlinkat.c (readlinkat): Likewise.
	* io/rmdir.c (__rmdir): Likewise.
	* io/symlink.c (__symlink): Likewise.
	* io/symlinkat.c (symlinkat): Likewise.
	* io/ttyname.c (ttyname): Likewise.
	* io/ttyname_r.c (__ttyname_r): Likewise.
	* io/umask.c (__umask): Likewise.
	* io/unlink.c (__unlink): Likewise.
	* io/unlinkat.c (unlinkat): Likewise.
	* io/utime.c (utime): Likewise.
	* libio/clearerr.c (clearerr): Likewise.
	* libio/clearerr_u.c (clearerr_unlocked): Likewise.
	* libio/feof.c (_IO_feof): Likewise.
	* libio/feof_u.c (feof_unlocked): Likewise.
	* libio/ferror.c (_IO_ferror): Likewise.
	* libio/ferror_u.c (ferror_unlocked): Likewise.
	* libio/filedoalloc.c (_IO_file_doallocate): Likewise.
	* libio/fileno.c (__fileno): Likewise.
	* libio/fputc.c (fputc): Likewise.
	* libio/fputc_u.c (fputc_unlocked): Likewise.
	* libio/fputwc.c (fputwc): Likewise.
	* libio/fputwc_u.c (fputwc_unlocked): Likewise.
	* libio/freopen.c (freopen): Likewise.
	* libio/freopen64.c (freopen64): Likewise.
	* libio/fseek.c (fseek): Likewise.
	* libio/fseeko.c (fseeko): Likewise.
	* libio/fseeko64.c (fseeko64): Likewise.
	* libio/ftello.c (__ftello): Likewise.
	* libio/ftello64.c (ftello64): Likewise.
	* libio/fwide.c (fwide): Likewise.
	* libio/genops.c (_IO_un_link): Likewise.
	(_IO_link_in): Likewise.
	(_IO_least_marker): Likewise.
	(_IO_switch_to_main_get_area): Likewise.
	(_IO_switch_to_backup_area): Likewise.
	(_IO_switch_to_get_mode): Likewise.
	(_IO_free_backup_area): Likewise.
	(_IO_switch_to_put_mode): Likewise.
	(__overflow): Likewise.
	(__underflow): Likewise.
	(__uflow): Likewise.
	(_IO_setb): Likewise.
	(_IO_doallocbuf): Likewise.
	(_IO_default_underflow): Likewise.
	(_IO_default_uflow): Likewise.
	(_IO_default_xsputn): Likewise.
	(_IO_sgetn): Likewise.
	(_IO_default_xsgetn): Likewise.
	(_IO_sync): Likewise.
	(_IO_default_setbuf): Likewise.
	(_IO_default_seekpos): Likewise.
	(_IO_default_doallocate): Likewise.
	(_IO_init): Likewise.
	(_IO_old_init): Likewise.
	(_IO_default_sync): Likewise.
	(_IO_default_finish): Likewise.
	(_IO_default_seekoff): Likewise.
	(_IO_sputbackc): Likewise.
	(_IO_sungetc): Likewise.
	(_IO_set_column): Likewise.
	(_IO_set_column): Likewise.
	(_IO_adjust_column): Likewise.
	(_IO_get_column): Likewise.
	(_IO_init_marker): Likewise.
	(_IO_remove_marker): Likewise.
	(_IO_marker_difference): Likewise.
	(_IO_marker_delta): Likewise.
	(_IO_seekmark): Likewise.
	(_IO_unsave_markers): Likewise.
	(_IO_nobackup_pbackfail): Likewise.
	(_IO_default_pbackfail): Likewise.
	(_IO_default_seek): Likewise.
	(_IO_default_stat): Likewise.
	(_IO_default_read): Likewise.
	(_IO_default_write): Likewise.
	(_IO_default_showmanyc): Likewise.
	(_IO_default_imbue): Likewise.
	(_IO_iter_next): Likewise.
	(_IO_iter_file): Likewise.
	* libio/getc.c (_IO_getc): Likewise.
	* libio/getwc.c (_IO_getwc): Likewise.
	* libio/iofclose.c (_IO_new_fclose): Likewise.
	* libio/iofdopen.c (_IO_new_fdopen): Likewise.
	* libio/iofflush.c (_IO_fflush): Likewise.
	* libio/iofflush_u.c (__fflush_unlocked): Likewise.
	* libio/iofgetpos.c (_IO_new_fgetpos): Likewise.
	* libio/iofgetpos64.c (_IO_new_fgetpos64): Likewise.
	* libio/iofgets.c (_IO_fgets): Likewise.
	* libio/iofgets_u.c (__fgets_unlocked): Likewise.
	* libio/iofgetws.c (fgetws): Likewise.
	* libio/iofgetws_u.c (fgetws_unlocked): Likewise.
	* libio/iofopen64.c (_IO_fopen64): Likewise.
	* libio/iofopncook.c (_IO_cookie_read): Likewise.
	(_IO_cookie_write): Likewise.
	(_IO_cookie_seek): Likewise.
	(_IO_cookie_close): Likewise.
	(_IO_cookie_seekoff): Likewise.
	(_IO_old_cookie_seek): Likewise.
	* libio/iofputs.c (_IO_fputs): Likewise.
	* libio/iofputs_u.c (__fputs_unlocked): Likewise.
	* libio/iofputws.c (fputws): Likewise.
	* libio/iofputws_u.c (fputws_unlocked): Likewise.
	* libio/iofread.c (_IO_fread): Likewise.
	* libio/iofread_u.c (__fread_unlocked): Likewise.
	* libio/iofsetpos.c (_IO_new_fsetpos): Likewise.
	* libio/iofsetpos64.c (_IO_new_fsetpos64): Likewise.
	* libio/ioftell.c (_IO_ftell): Likewise.
	* libio/iofwrite.c (_IO_fwrite): Likewise.
	* libio/iogetdelim.c (_IO_getdelim): Likewise.
	* libio/iogets.c (_IO_gets): Likewise.
	* libio/iopadn.c (_IO_padn): Likewise.
	* libio/iopopen.c (_IO_new_proc_open): Likewise.
	(_IO_new_popen): Likewise.
	(_IO_new_proc_close): Likewise.
	* libio/ioputs.c (_IO_puts): Likewise.
	* libio/ioseekoff.c (_IO_seekoff_unlocked): Likewise.
	(_IO_seekoff): Likewise.
	* libio/ioseekpos.c (_IO_seekpos_unlocked): Likewise.
	(_IO_seekpos): Likewise.
	* libio/iosetbuffer.c (_IO_setbuffer): Likewise.
	* libio/iosetvbuf.c (_IO_setvbuf): Likewise.
	* libio/ioungetc.c (_IO_ungetc): Likewise.
	* libio/ioungetwc.c (ungetwc): Likewise.
	* libio/iovdprintf.c (_IO_vdprintf): Likewise.
	* libio/iovsscanf.c (_IO_vsscanf): Likewise.
	* libio/iowpadn.c (_IO_wpadn): Likewise.
	* libio/libc_fatal.c (__libc_fatal): Likewise.
	* libio/memstream.c (__open_memstream): Likewise.
	(_IO_mem_sync): Likewise.
	(_IO_mem_finish): Likewise.
	* libio/oldfileops.c (_IO_old_file_init): Likewise.
	(_IO_old_file_close_it): Likewise.
	(_IO_old_file_finish): Likewise.
	(_IO_old_file_fopen): Likewise.
	(_IO_old_file_attach): Likewise.
	(_IO_old_file_setbuf): Likewise.
	(_IO_old_do_write): Likewise.
	(old_do_write): Likewise.
	(_IO_old_file_underflow): Likewise.
	(_IO_old_file_overflow): Likewise.
	(_IO_old_file_sync): Likewise.
	(_IO_old_file_seekoff): Likewise.
	(_IO_old_file_write): Likewise.
	(_IO_old_file_xsputn): Likewise.
	* libio/oldiofclose.c (_IO_old_fclose): Likewise.
	* libio/oldiofdopen.c (_IO_old_fdopen): Likewise.
	* libio/oldiofgetpos.c (_IO_old_fgetpos): Likewise.
	* libio/oldiofgetpos64.c (_IO_old_fgetpos64): Likewise.
	* libio/oldiofopen.c (_IO_old_fopen): Likewise.
	* libio/oldiofsetpos.c (_IO_old_fsetpos): Likewise.
	* libio/oldiofsetpos64.c (_IO_old_fsetpos64): Likewise.
	* libio/oldiopopen.c (_IO_old_proc_open): Likewise.
	(_IO_old_popen): Likewise.
	(_IO_old_proc_close): Likewise.
	* libio/oldpclose.c (__old_pclose): Likewise.
	* libio/pclose.c (__new_pclose): Likewise.
	* libio/peekc.c (_IO_peekc_locked): Likewise.
	* libio/putc.c (_IO_putc): Likewise.
	* libio/putc_u.c (putc_unlocked): Likewise.
	* libio/putchar.c (putchar): Likewise.
	* libio/putchar_u.c (putchar_unlocked): Likewise.
	* libio/putwc.c (putwc): Likewise.
	* libio/putwc_u.c (putwc_unlocked): Likewise.
	* libio/putwchar.c (putwchar): Likewise.
	* libio/putwchar_u.c (putwchar_unlocked): Likewise.
	* libio/rewind.c (rewind): Likewise.
	* libio/setbuf.c (setbuf): Likewise.
	* libio/setlinebuf.c (setlinebuf): Likewise.
	* libio/vasprintf.c (_IO_vasprintf): Likewise.
	* libio/vscanf.c (_IO_vscanf): Likewise.
	* libio/vsnprintf.c (_IO_strn_overflow): Likewise.
	* libio/vswprintf.c (_IO_wstrn_overflow): Likewise.
	* libio/wfiledoalloc.c (_IO_wfile_doallocate): Likewise.
	* libio/wgenops.c (_IO_least_wmarker): Likewise.
	(_IO_switch_to_main_wget_area): Likewise.
	(_IO_switch_to_wbackup_area): Likewise.
	(_IO_wsetb): Likewise.
	(_IO_wdefault_pbackfail): Likewise.
	(_IO_wdefault_finish): Likewise.
	(_IO_wdefault_uflow): Likewise.
	(__woverflow): Likewise.
	(__wuflow): Likewise.
	(__wunderflow): Likewise.
	(_IO_wdefault_xsputn): Likewise.
	(_IO_wdefault_xsgetn): Likewise.
	(_IO_wdoallocbuf): Likewise.
	(_IO_wdefault_doallocate): Likewise.
	(_IO_switch_to_wget_mode): Likewise.
	(_IO_free_wbackup_area): Likewise.
	(_IO_switch_to_wput_mode): Likewise.
	(_IO_sputbackwc): Likewise.
	(_IO_sungetwc): Likewise.
	(_IO_adjust_wcolumn): Likewise.
	(_IO_init_wmarker): Likewise.
	(_IO_wmarker_delta): Likewise.
	(_IO_seekwmark): Likewise.
	(_IO_unsave_wmarkers): Likewise.
	* libio/wmemstream.c (open_wmemstream): Likewise.
	(_IO_wmem_sync): Likewise.
	(_IO_wmem_finish): Likewise.
	* locale/nl_langinfo.c (nl_langinfo): Likewise.
	* locale/nl_langinfo_l.c (__nl_langinfo_l): Likewise.
	* locale/programs/simple-hash.c (init_hash): Likewise.
	(delete_hash): Likewise.
	(insert_entry): Likewise.
	(set_entry): Likewise.
	(next_prime): Likewise.
	(is_prime): Likewise.
	* locale/programs/xmalloc.c (fixup_null_alloc): Likewise.
	(xmalloc): Likewise.
	(xrealloc): Likewise.
	* locale/programs/xstrdup.c (xstrdup): Likewise.
	* localedata/collate-test.c (xstrcoll): Likewise.
	* localedata/xfrm-test.c (xstrcmp): Likewise.
	* login/getlogin_r.c (__getlogin_r): Likewise.
	* login/getpt.c (__posix_openpt): Likewise.
	* login/login_tty.c (login_tty): Likewise.
	* login/setlogin.c (setlogin): Likewise.
	* mach/msg-destroy.c (__mach_msg_destroy): Likewise.
	(mach_msg_destroy_port): Likewise.
	(mach_msg_destroy_memory): Likewise.
	* malloc/mcheck.c (flood): Likewise.
	* misc/acct.c (acct): Likewise.
	* misc/brk.c (__brk): Likewise.
	* misc/chflags.c (chflags): Likewise.
	* misc/chroot.c (chroot): Likewise.
	* misc/fchflags.c (fchflags): Likewise.
	* misc/fstab.c (getfsspec): Likewise.
	(getfsfile): Likewise.
	* misc/fsync.c (fsync): Likewise.
	* misc/ftruncate.c (__ftruncate): Likewise.
	* misc/ftruncate64.c (__ftruncate64): Likewise.
	* misc/getdomain.c (getdomainname): Likewise.
	(getdomainname): Likewise.
	* misc/gethostname.c (__gethostname): Likewise.
	* misc/getpass.c (getpass): Likewise.
	* misc/getttyent.c (skip): Likewise.
	(value): Likewise.
	* misc/gtty.c (gtty): Likewise.
	* misc/hsearch.c (hsearch): Likewise.
	(hcreate): Likewise.
	* misc/hsearch_r.c (__hcreate_r): Likewise.
	(__hdestroy_r): Likewise.
	* misc/ioctl.c (__ioctl): Likewise.
	* misc/mkdtemp.c (mkdtemp): Likewise.
	* misc/mkostemp.c (mkostemp): Likewise.
	* misc/mkostemp64.c (mkostemp64): Likewise.
	* misc/mkostemps.c (mkostemps): Likewise.
	* misc/mkostemps64.c (mkostemps64): Likewise.
	* misc/mkstemp.c (mkstemp): Likewise.
	* misc/mkstemp64.c (mkstemp64): Likewise.
	* misc/mkstemps.c (mkstemps): Likewise.
	* misc/mkstemps64.c (mkstemps64): Likewise.
	* misc/mktemp.c (__mktemp): Likewise.
	* misc/preadv.c (preadv): Likewise.
	* misc/preadv64.c (preadv64): Likewise.
	* misc/pwritev.c (pwritev): Likewise.
	* misc/pwritev64.c (pwritev64): Likewise.
	* misc/readv.c (__readv): Likewise.
	* misc/revoke.c (revoke): Likewise.
	* misc/setdomain.c (setdomainname): Likewise.
	* misc/setegid.c (setegid): Likewise.
	* misc/seteuid.c (seteuid): Likewise.
	* misc/sethostid.c (sethostid): Likewise.
	* misc/sethostname.c (sethostname): Likewise.
	* misc/setregid.c (__setregid): Likewise.
	* misc/setreuid.c (__setreuid): Likewise.
	* misc/sstk.c (sstk): Likewise.
	* misc/stty.c (stty): Likewise.
	* misc/syscall.c (syscall): Likewise.
	* misc/syslog.c (setlogmask): Likewise.
	* misc/truncate.c (__truncate): Likewise.
	* misc/truncate64.c (truncate64): Likewise.
	* misc/ualarm.c (ualarm): Likewise.
	* misc/usleep.c (usleep): Likewise.
	* misc/ustat.c (ustat): Likewise.
	* misc/writev.c (__writev): Likewise.
	* nptl/cleanup_compat.c (_pthread_cleanup_pop): Likewise.
	* nptl/old_pthread_cond_broadcast.c
	(__pthread_cond_broadcast_2_0): Likewise.
	* nptl/old_pthread_cond_destroy.c (__pthread_cond_destroy_2_0):
	Likewise.
	* nptl/old_pthread_cond_signal.c (__pthread_cond_signal_2_0):
	Likewise.
	* nptl/old_pthread_cond_wait.c (__pthread_cond_wait_2_0):
	Likewise.
	* nptl/pt-raise.c (raise): Likewise.
	* nptl/pthread_barrier_destroy.c (pthread_barrier_destroy):
	Likewise.
	* nptl/pthread_barrier_wait.c (__pthread_barrier_wait): Likewise.
	* nptl/pthread_barrierattr_destroy.c
	(pthread_barrierattr_destroy): Likewise.
	* nptl/pthread_barrierattr_init.c (pthread_barrierattr_init):
	Likewise.
	* nptl/pthread_barrierattr_setpshared.c
	(pthread_barrierattr_setpshared): Likewise.
	* nptl/pthread_cond_broadcast.c (__pthread_cond_broadcast):
	Likewise.
	* nptl/pthread_cond_destroy.c (__pthread_cond_destroy): Likewise.
	* nptl/pthread_cond_init.c (__pthread_cond_init): Likewise.
	* nptl/pthread_cond_signal.c (__pthread_cond_signal): Likewise.
	* nptl/pthread_condattr_destroy.c (__pthread_condattr_destroy):
	Likewise.
	* nptl/pthread_condattr_getclock.c (pthread_condattr_getclock):
	Likewise.
	* nptl/pthread_condattr_getpshared.c
	(pthread_condattr_getpshared): Likewise.
	* nptl/pthread_condattr_init.c (__pthread_condattr_init):
	Likewise.
	* nptl/pthread_condattr_setpshared.c
	(pthread_condattr_setpshared): Likewise.
	* nptl/pthread_detach.c (pthread_detach): Likewise.
	* nptl/pthread_equal.c (__pthread_equal): Likewise.
	* nptl/pthread_getcpuclockid.c (pthread_getcpuclockid): Likewise.
	* nptl/pthread_getspecific.c (__pthread_getspecific): Likewise.
	* nptl/pthread_key_delete.c (pthread_key_delete): Likewise.
	* nptl/pthread_mutex_consistent.c (pthread_mutex_consistent):
	Likewise.
	* nptl/pthread_mutex_destroy.c (__pthread_mutex_destroy):
	Likewise.
	* nptl/pthread_mutex_getprioceiling.c
	(pthread_mutex_getprioceiling): Likewise.
	* nptl/pthread_mutexattr_destroy.c (__pthread_mutexattr_destroy):
	Likewise.
	* nptl/pthread_mutexattr_getprotocol.c
	(pthread_mutexattr_getprotocol): Likewise.
	* nptl/pthread_mutexattr_getpshared.c
	(pthread_mutexattr_getpshared): Likewise.
	* nptl/pthread_mutexattr_getrobust.c
	(pthread_mutexattr_getrobust): Likewise.
	* nptl/pthread_mutexattr_gettype.c (pthread_mutexattr_gettype):
	Likewise.
	* nptl/pthread_mutexattr_init.c (__pthread_mutexattr_init):
	Likewise.
	* nptl/pthread_mutexattr_setprioceiling.c
	(pthread_mutexattr_setprioceiling): Likewise.
	* nptl/pthread_mutexattr_setprotocol.c
	(pthread_mutexattr_setprotocol): Likewise.
	* nptl/pthread_mutexattr_setpshared.c
	(pthread_mutexattr_setpshared): Likewise.
	* nptl/pthread_mutexattr_setrobust.c
	(pthread_mutexattr_setrobust): Likewise.
	* nptl/pthread_mutexattr_settype.c (__pthread_mutexattr_settype):
	Likewise.
	* nptl/pthread_rwlock_destroy.c (__pthread_rwlock_destroy):
	Likewise.
	* nptl/pthread_rwlockattr_destroy.c (pthread_rwlockattr_destroy):
	Likewise.
	* nptl/pthread_rwlockattr_getkind_np.c
	(pthread_rwlockattr_getkind_np): Likewise.
	* nptl/pthread_rwlockattr_getpshared.c
	(pthread_rwlockattr_getpshared): Likewise.
	* nptl/pthread_rwlockattr_init.c (pthread_rwlockattr_init):
	Likewise.
	* nptl/pthread_rwlockattr_setkind_np.c
	(pthread_rwlockattr_setkind_np): Likewise.
	* nptl/pthread_rwlockattr_setpshared.c
	(pthread_rwlockattr_setpshared): Likewise.
	* nptl/pthread_setcancelstate.c (__pthread_setcancelstate):
	Likewise.
	* nptl/pthread_setcanceltype.c (__pthread_setcanceltype):
	Likewise.
	* nptl/pthread_setconcurrency.c (pthread_setconcurrency):
	Likewise.
	* nptl/pthread_setschedprio.c (pthread_setschedprio): Likewise.
	* nptl/pthread_setspecific.c (__pthread_setspecific): Likewise.
	* nptl/pthread_spin_destroy.c (pthread_spin_destroy): Likewise.
	* nptl/pthread_tryjoin.c (pthread_tryjoin_np): Likewise.
	* nptl/sem_close.c (sem_close): Likewise.
	* nptl/sem_destroy.c (__new_sem_destroy): Likewise.
	* nptl/sem_init.c (__old_sem_init): Likewise.
	* nptl/sigaction.c (__sigaction): Likewise.
	* nptl/unregister-atfork.c (__unregister_atfork): Likewise.
	* posix/_exit.c (_exit): Likewise.
	* posix/alarm.c (alarm): Likewise.
	* posix/confstr.c (confstr): Likewise.
	* posix/fpathconf.c (__fpathconf): Likewise.
	* posix/getgroups.c (__getgroups): Likewise.
	* posix/getpgid.c (__getpgid): Likewise.
	* posix/group_member.c (__group_member): Likewise.
	* posix/pathconf.c (__pathconf): Likewise.
	* posix/sched_getaffinity.c (sched_getaffinity): Likewise.
	* posix/sched_setaffinity.c (sched_setaffinity): Likewise.
	* posix/setgid.c (__setgid): Likewise.
	* posix/setpgid.c (__setpgid): Likewise.
	* posix/setuid.c (__setuid): Likewise.
	* posix/sleep.c (__sleep): Likewise.
	* posix/sysconf.c (__sysconf): Likewise.
	* posix/times.c (__times): Likewise.
	* posix/uname.c (__uname): Likewise.
	* posix/waitid.c (__waitid): Likewise.
	* pwd/getpw.c (__getpw): Likewise.
	* resolv/base64.c (b64_pton): Likewise.
	* resolv/gai_sigqueue.c (__gai_sigqueue): Likewise.
	* resolv/gethnamaddr.c (Dprintf): Likewise.
	(gethostbyname): Likewise.
	(gethostbyname2): Likewise.
	(gethostbyaddr): Likewise.
	(_sethtent): Likewise.
	(_gethtbyname): Likewise.
	(_gethtbyname2): Likewise.
	(_gethtbyaddr): Likewise.
	(map_v4v6_address): Likewise.
	(map_v4v6_hostent): Likewise.
	(addrsort): Likewise.
	(ht_sethostent): Likewise.
	(ht_gethostbyname): Likewise.
	(ht_gethostbyaddr): Likewise.
	* resolv/inet_net_ntop.c (inet_net_ntop): Likewise.
	(inet_net_ntop_ipv4): Likewise.
	* resolv/inet_neta.c (inet_neta): Likewise.
	* resolv/inet_ntop.c (inet_ntop): Likewise.
	(inet_ntop4): Likewise.
	(inet_ntop6): Likewise.
	* resolv/inet_pton.c (__inet_pton): Likewise.
	(inet_pton4): Likewise.
	(inet_pton6): Likewise.
	* resolv/res_debug.c (loc_aton): Likewise.
	(loc_ntoa): Likewise.
	* resource/getpriority.c (__getpriority): Likewise.
	* resource/getrusage.c (__getrusage): Likewise.
	* resource/nice.c (nice): Likewise.
	* resource/setpriority.c (__setpriority): Likewise.
	* resource/setrlimit64.c (setrlimit64): Likewise.
	* resource/vlimit.c (vlimit): Likewise.
	* resource/vtimes.c (vtimes): Likewise.
	* rt/aio_error.c (aio_error): Likewise.
	* rt/aio_return.c (aio_return): Likewise.
	* rt/aio_sigqueue.c (__aio_sigqueue): Likewise.
	* signal/kill.c (__kill): Likewise.
	* signal/killpg.c (killpg): Likewise.
	* signal/raise.c (raise): Likewise.
	* signal/sigaction.c (__sigaction): Likewise.
	* signal/sigaddset.c (sigaddset): Likewise.
	* signal/sigaltstack.c (sigaltstack): Likewise.
	* signal/sigandset.c (sigandset): Likewise.
	* signal/sigblock.c (__sigblock): Likewise.
	* signal/sigdelset.c (sigdelset): Likewise.
	* signal/sigempty.c (sigemptyset): Likewise.
	* signal/sigfillset.c (sigfillset): Likewise.
	* signal/sighold.c (sighold): Likewise.
	* signal/sigignore.c (sigignore): Likewise.
	* signal/sigintr.c (siginterrupt): Likewise.
	* signal/sigisempty.c (sigisemptyset): Likewise.
	* signal/sigismem.c (sigismember): Likewise.
	* signal/signal.c (signal): Likewise.
	* signal/sigorset.c (sigorset): Likewise.
	* signal/sigpause.c (__sigpause): Likewise.
	* signal/sigpending.c (sigpending): Likewise.
	* signal/sigprocmask.c (__sigprocmask): Likewise.
	* signal/sigrelse.c (sigrelse): Likewise.
	* signal/sigreturn.c (__sigreturn): Likewise.
	* signal/sigset.c (sigset): Likewise.
	* signal/sigsetmask.c (__sigsetmask): Likewise.
	* signal/sigstack.c (sigstack): Likewise.
	* signal/sigsuspend.c (__sigsuspend): Likewise.
	* signal/sigvec.c (sigvec_wrapper_handler): Likewise.
	* signal/sysv_signal.c (__sysv_signal): Likewise.
	* socket/accept.c (accept): Likewise.
	* socket/accept4.c (__libc_accept4): Likewise.
	* socket/bind.c (__bind): Likewise.
	* socket/connect.c (__connect): Likewise.
	* socket/getpeername.c (getpeername): Likewise.
	* socket/getsockname.c (__getsockname): Likewise.
	* socket/getsockopt.c (getsockopt): Likewise.
	* socket/listen.c (__listen): Likewise.
	* socket/recv.c (__recv): Likewise.
	* socket/recvmsg.c (__recvmsg): Likewise.
	* socket/send.c (__send): Likewise.
	* socket/sendmsg.c (__sendmsg): Likewise.
	* socket/shutdown.c (shutdown): Likewise.
	* socket/sockatmark.c (sockatmark): Likewise.
	* socket/socket.c (__socket): Likewise.
	* stdio-common/ctermid.c (ctermid): Likewise.
	* stdio-common/cuserid.c (cuserid): Likewise.
	* stdio-common/printf-prs.c (parse_printf_format): Likewise.
	* stdio-common/remove.c (remove): Likewise.
	* stdio-common/rename.c (rename): Likewise.
	* stdio-common/renameat.c (renameat): Likewise.
	* stdio-common/tempname.c (__gen_tempname): Likewise.
	* stdio-common/xbug.c (InitBuffer): Likewise.
	(AppendToBuffer): Likewise.
	(ReadFile): Likewise.
	* stdlib/a64l.c (a64l): Likewise.
	* stdlib/drand48_r.c (drand48_r): Likewise.
	* stdlib/getcontext.c (getcontext): Likewise.
	* stdlib/getenv.c (getenv): Likewise.
	* stdlib/l64a.c (l64a): Likewise.
	* stdlib/llabs.c (llabs): Likewise.
	* stdlib/lldiv.c (lldiv): Likewise.
	* stdlib/lrand48_r.c (lrand48_r): Likewise.
	* stdlib/mrand48_r.c (mrand48_r): Likewise.
	* stdlib/putenv.c (putenv): Likewise.
	* stdlib/random.c (__srandom): Likewise.
	(__initstate): Likewise.
	(__setstate): Likewise.
	* stdlib/random_r.c (__srandom_r): Likewise.
	(__setstate_r): Likewise.
	(__random_r): Likewise.
	* stdlib/secure-getenv.c (__libc_secure_getenv): Likewise.
	* stdlib/setcontext.c (setcontext): Likewise.
	* stdlib/setenv.c (setenv): Likewise.
	(unsetenv): Likewise.
	* stdlib/srand48.c (srand48): Likewise.
	* stdlib/srand48_r.c (__srand48_r): Likewise.
	* stdlib/swapcontext.c (swapcontext): Likewise.
	* stdlib/system.c (__libc_system): Likewise.
	* stdlib/tst-strtod.c (expand): Likewise.
	* stdlib/tst-strtol.c (expand): Likewise.
	* stdlib/tst-strtoll.c (expand): Likewise.
	* streams/fattach.c (fattach): Likewise.
	* streams/fdetach.c (fdetach): Likewise.
	* streams/getmsg.c (getmsg): Likewise.
	* streams/isastream.c (isastream): Likewise.
	* string/ffs.c (__ffs): Likewise.
	* string/ffsll.c (ffsll): Likewise.
	* string/memcmp.c (memcmp_common_alignment): Likewise.
	(memcmp_not_common_alignment): Likewise.
	(MEMCMP): Likewise.
	* string/memcpy.c (memcpy): Likewise.
	* string/memmove.c (MEMMOVE): Likewise.
	* string/memset.c (memset): Likewise.
	* string/rawmemchr.c (RAWMEMCHR): Likewise.
	* string/strchrnul.c (STRCHRNUL): Likewise.
	* string/strerror.c (strerror): Likewise.
	* string/strndup.c (__strndup): Likewise.
	* string/strverscmp.c (__strverscmp): Likewise.
	* sunrpc/clnt_raw.c (clntraw_freeres): Likewise.
	* sunrpc/clnt_tcp.c (clnttcp_geterr): Likewise.
	(clnttcp_freeres): Likewise.
	* sunrpc/clnt_unix.c (clntunix_freeres): Likewise.
	* sunrpc/pmap_prot.c (xdr_pmap): Likewise.
	* sunrpc/pmap_prot2.c (xdr_pmaplist): Likewise.
	* sunrpc/pmap_rmt.c (xdr_rmtcallres): Likewise.
	* sunrpc/rpc_prot.c (xdr_replymsg): Likewise.
	(xdr_callhdr): Likewise.
	* sunrpc/rpcinfo.c (udpping): Likewise.
	(tcpping): Likewise.
	(pstatus): Likewise.
	(pmapdump): Likewise.
	(brdcst): Likewise.
	(deletereg): Likewise.
	(getprognum): Likewise.
	(getvers): Likewise.
	(get_inet_address): Likewise.
	* sunrpc/svc_raw.c (svcraw_recv): Likewise.
	* sunrpc/svc_udp.c (svcudp_create): Likewise.
	(svcudp_stat): Likewise.
	(svcudp_recv): Likewise.
	(svcudp_reply): Likewise.
	(svcudp_getargs): Likewise.
	(svcudp_freeargs): Likewise.
	(svcudp_destroy): Likewise.
	* sunrpc/xdr.c (xdr_bytes): Likewise.
	(xdr_netobj): Likewise.
	(xdr_string): Likewise.
	(xdr_wrapstring): Likewise.
	* sunrpc/xdr_float.c (xdr_float): Likewise.
	(xdr_double): Likewise.
	* sunrpc/xdr_mem.c (xdrmem_setpos): Likewise.
	* sunrpc/xdr_ref.c (xdr_pointer): Likewise.
	* sysvipc/ftok.c (ftok): Likewise.
	* sysvipc/msgctl.c (msgctl): Likewise.
	* sysvipc/msgget.c (msgget): Likewise.
	* sysvipc/msgrcv.c (msgrcv): Likewise.
	* sysvipc/msgsnd.c (msgsnd): Likewise.
	* sysvipc/semget.c (semget): Likewise.
	* sysvipc/semop.c (semop): Likewise.
	* sysvipc/shmat.c (shmat): Likewise.
	* sysvipc/shmctl.c (shmctl): Likewise.
	* sysvipc/shmdt.c (shmdt): Likewise.
	* sysvipc/shmget.c (shmget): Likewise.
	* termios/cfmakeraw.c (cfmakeraw): Likewise.
	* termios/speed.c (cfgetospeed): Likewise.
	(cfgetispeed): Likewise.
	(cfsetospeed): Likewise.
	(cfsetispeed): Likewise.
	* termios/tcflow.c (tcflow): Likewise.
	* termios/tcflush.c (tcflush): Likewise.
	* termios/tcgetattr.c (__tcgetattr): Likewise.
	* termios/tcgetpgrp.c (tcgetpgrp): Likewise.
	* termios/tcgetsid.c (tcgetsid): Likewise.
	* termios/tcsendbrk.c (tcsendbreak): Likewise.
	* termios/tcsetpgrp.c (tcsetpgrp): Likewise.
	* time/adjtime.c (__adjtime): Likewise.
	* time/dysize.c (dysize): Likewise.
	* time/ftime.c (ftime): Likewise.
	* time/getitimer.c (__getitimer): Likewise.
	* time/gettimeofday.c (__gettimeofday): Likewise.
	* time/gmtime.c (__gmtime_r): Likewise.
	(gmtime): Likewise.
	* time/localtime.c (__localtime_r): Likewise.
	(localtime): Likewise.
	* time/offtime.c (__offtime): Likewise.
	* time/settimeofday.c (__settimeofday): Likewise.
	* time/stime.c (stime): Likewise.
	* time/strftime_l.c (tm_diff): Likewise.
	(iso_week_days): Likewise.
	* time/strptime.c (strptime): Likewise.
	* time/time.c (time): Likewise.
	* time/timespec_get.c (timespec_get): Likewise.
	* time/tzset.c (tzset_internal): Likewise.
	(compute_change): Likewise.
	(__tz_compute): Likewise.
	* wcsmbs/btowc.c (__btowc): Likewise.
	* wcsmbs/mbrlen.c (__mbrlen): Likewise.
	* wcsmbs/mbsinit.c (__mbsinit): Likewise.
	* wcsmbs/mbsrtowcs.c (__mbsrtowcs): Likewise.
	* wcsmbs/wcpcpy.c (__wcpcpy): Likewise.
	* wcsmbs/wcpncpy.c (__wcpncpy): Likewise.
	* wcsmbs/wcscat.c (__wcscat): Likewise.
	* wcsmbs/wcschrnul.c (__wcschrnul): Likewise.
	* wcsmbs/wcscmp.c (WCSCMP): Likewise.
	* wcsmbs/wcscpy.c (WCSCPY): Likewise.
	* wcsmbs/wcscspn.c (wcscspn): Likewise.
	* wcsmbs/wcsdup.c (wcsdup): Likewise.
	* wcsmbs/wcslen.c (__wcslen): Likewise.
	* wcsmbs/wcsncat.c (WCSNCAT): Likewise.
	* wcsmbs/wcsncmp.c (WCSNCMP): Likewise.
	* wcsmbs/wcsncpy.c (__wcsncpy): Likewise.
	* wcsmbs/wcsnlen.c (__wcsnlen): Likewise.
	* wcsmbs/wcspbrk.c (wcspbrk): Likewise.
	* wcsmbs/wcsrchr.c (WCSRCHR): Likewise.
	* wcsmbs/wcsspn.c (wcsspn): Likewise.
	* wcsmbs/wcsstr.c (wcsstr): Likewise.
	* wcsmbs/wcstok.c (wcstok): Likewise.
	* wcsmbs/wctob.c (wctob): Likewise.
	* wcsmbs/wmemchr.c (__wmemchr): Likewise.
	* wcsmbs/wmemcmp.c (WMEMCMP): Likewise.
	* wcsmbs/wmemcpy.c (__wmemcpy): Likewise.
	* wcsmbs/wmemmove.c (__wmemmove): Likewise.
	* wcsmbs/wmempcpy.c (__wmempcpy): Likewise.
	* wcsmbs/wmemset.c (__wmemset): Likewise.
	* wctype/wcfuncs.c (__towlower): Likewise.
	(__towupper): Likewise.
2015-10-16 20:21:49 +00:00
Florian Weimer f463c7b183 Fix double-checked locking in _res_hconf_reorder_addrs [BZ #19074]
[BZ #19074]
	* resolv/res_hconf.c (_res_hconf_reorder_addrs): Use atomics to
	load and store num_ifs.
2015-10-14 16:43:16 +02:00
Wilco Dijkstra 6565fcb6e1 Fix several build failures with GCC6 due to unused static variables.
2015-09-18  Wilco Dijkstra  <wdijkstr@arm.com>

        * resolv/base64.c (rcsid): Remove unused static.
        * sysdeps/ieee754/dbl-64/atnat2.h (qpi1): Remove unused
        static.  (tqpi1): Likewise.
        * sysdeps/ieee754/dbl-64/uexp.h (one): Likewise.
        * sysdeps/ieee754/dbl-64/upow.h (sqrt_2): Likewise.
        * sysdeps/ieee754/flt-32/e_log10f.c (one): Likewise.
        * sysdeps/ieee754/flt-32/s_cosf.c (one): Likewise.
        * sysdeps/ieee754/ldbl-128/e_lgammal_r.c (zero): Likewise.
        * sysdeps/ieee754/ldbl-128/s_erfl.c (half): Likewise.
        * sysdeps/ieee754/ldbl-128/s_log1pl.c (maxlog): Likewise.
        * timezone/private.h (time_t_min): Likewise.  (time_t_max):
        Likewise.
2015-09-18 20:42:54 +01:00
Joseph Myers ec999b8e5e Move bits/libc-lock.h and bits/libc-lockP.h out of bits/ (bug 14912).
It was noted in
<https://sourceware.org/ml/libc-alpha/2012-09/msg00305.html> that the
bits/*.h naming scheme should only be used for installed headers.
This patch renames bits/libc-lock.h to plain libc-lock.h and
bits/libc-lockP.h to plain libc-lockP.h to follow that convention.

Note that I don't know where libc-lockP.h comes from for Hurd (the
Hurd libc-lock.h includes libc-lockP.h, but the only libc-lockP.h in
the glibc source tree is for NPTL) - some unmerged patch? - but I
updated the #include in the Hurd libc-lock.h anyway.

Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by the patch).

	[BZ #14912]
	* bits/libc-lock.h: Move to ...
	* sysdeps/generic/libc-lock.h: ...here.
	(_BITS_LIBC_LOCK_H): Rename macro to _LIBC_LOCK_H.
	* sysdeps/mach/hurd/bits/libc-lock.h: Move to ...
	* sysdeps/mach/hurd/libc-lock.h: ...here.
	(_BITS_LIBC_LOCK_H): Rename macro to _LIBC_LOCK_H.
	[_LIBC]: Include <libc-lockP.h> instead of <bits/libc-lockP.h>.
	* sysdeps/mach/bits/libc-lock.h: Move to ...
	* sysdeps/mach/libc-lock.h: ...here.
	(_BITS_LIBC_LOCK_H): Rename macro to _LIBC_LOCK_H.
	* sysdeps/nptl/bits/libc-lock.h: Move to ...
	* sysdeps/nptl/libc-lock.h: ...here.
	(_BITS_LIBC_LOCK_H): Rename macro to _LIBC_LOCK_H.
	* sysdeps/nptl/bits/libc-lockP.h: Move to ...
	* sysdeps/nptl/libc-lockP.h: ...here.
	(_BITS_LIBC_LOCKP_H): Rename macro to _LIBC_LOCKP_H.
	* crypt/crypt_util.c: Include <libc-lock.h> instead of
	<bits/libc-lock.h>.
	* dirent/scandir-tail.c: Likewise.
	* dlfcn/dlerror.c: Likewise.
	* elf/dl-close.c: Likewise.
	* elf/dl-iteratephdr.c: Likewise.
	* elf/dl-lookup.c: Likewise.
	* elf/dl-open.c: Likewise.
	* elf/dl-support.c: Likewise.
	* elf/dl-writev.h: Likewise.
	* elf/rtld.c: Likewise.
	* grp/fgetgrent.c: Likewise.
	* gshadow/fgetsgent.c: Likewise.
	* gshadow/sgetsgent.c: Likewise.
	* iconv/gconv_conf.c: Likewise.
	* iconv/gconv_db.c: Likewise.
	* iconv/gconv_dl.c: Likewise.
	* iconv/gconv_int.h: Likewise.
	* iconv/gconv_trans.c: Likewise.
	* include/link.h: Likewise.
	* inet/getnameinfo.c: Likewise.
	* inet/getnetgrent.c: Likewise.
	* inet/getnetgrent_r.c: Likewise.
	* intl/bindtextdom.c: Likewise.
	* intl/dcigettext.c: Likewise.
	* intl/finddomain.c: Likewise.
	* intl/gettextP.h: Likewise.
	* intl/loadmsgcat.c: Likewise.
	* intl/localealias.c: Likewise.
	* intl/textdomain.c: Likewise.
	* libidn/idn-stub.c: Likewise.
	* libio/libioP.h: Likewise.
	* locale/duplocale.c: Likewise.
	* locale/freelocale.c: Likewise.
	* locale/newlocale.c: Likewise.
	* locale/setlocale.c: Likewise.
	* login/getutent_r.c: Likewise.
	* login/getutid_r.c: Likewise.
	* login/getutline_r.c: Likewise.
	* login/utmp-private.h: Likewise.
	* login/utmpname.c: Likewise.
	* malloc/mtrace.c: Likewise.
	* misc/efgcvt.c: Likewise.
	* misc/error.c: Likewise.
	* misc/fstab.c: Likewise.
	* misc/getpass.c: Likewise.
	* misc/mntent.c: Likewise.
	* misc/syslog.c: Likewise.
	* nis/nis_call.c: Likewise.
	* nis/nis_callback.c: Likewise.
	* nis/nss-default.c: Likewise.
	* nis/nss_compat/compat-grp.c: Likewise.
	* nis/nss_compat/compat-initgroups.c: Likewise.
	* nis/nss_compat/compat-pwd.c: Likewise.
	* nis/nss_compat/compat-spwd.c: Likewise.
	* nis/nss_nis/nis-alias.c: Likewise.
	* nis/nss_nis/nis-ethers.c: Likewise.
	* nis/nss_nis/nis-grp.c: Likewise.
	* nis/nss_nis/nis-hosts.c: Likewise.
	* nis/nss_nis/nis-network.c: Likewise.
	* nis/nss_nis/nis-proto.c: Likewise.
	* nis/nss_nis/nis-pwd.c: Likewise.
	* nis/nss_nis/nis-rpc.c: Likewise.
	* nis/nss_nis/nis-service.c: Likewise.
	* nis/nss_nis/nis-spwd.c: Likewise.
	* nis/nss_nisplus/nisplus-alias.c: Likewise.
	* nis/nss_nisplus/nisplus-ethers.c: Likewise.
	* nis/nss_nisplus/nisplus-grp.c: Likewise.
	* nis/nss_nisplus/nisplus-hosts.c: Likewise.
	* nis/nss_nisplus/nisplus-initgroups.c: Likewise.
	* nis/nss_nisplus/nisplus-network.c: Likewise.
	* nis/nss_nisplus/nisplus-proto.c: Likewise.
	* nis/nss_nisplus/nisplus-pwd.c: Likewise.
	* nis/nss_nisplus/nisplus-rpc.c: Likewise.
	* nis/nss_nisplus/nisplus-service.c: Likewise.
	* nis/nss_nisplus/nisplus-spwd.c: Likewise.
	* nis/ypclnt.c: Likewise.
	* nptl/libc_pthread_init.c: Likewise.
	* nss/getXXbyYY.c: Likewise.
	* nss/getXXent.c: Likewise.
	* nss/getXXent_r.c: Likewise.
	* nss/nss_db/db-XXX.c: Likewise.
	* nss/nss_db/db-netgrp.c: Likewise.
	* nss/nss_db/nss_db.h: Likewise.
	* nss/nss_files/files-XXX.c: Likewise.
	* nss/nss_files/files-alias.c: Likewise.
	* nss/nsswitch.c: Likewise.
	* posix/regex_internal.h: Likewise.
	* posix/wordexp.c: Likewise.
	* pwd/fgetpwent.c: Likewise.
	* resolv/res_hconf.c: Likewise.
	* resolv/res_libc.c: Likewise.
	* shadow/fgetspent.c: Likewise.
	* shadow/lckpwdf.c: Likewise.
	* shadow/sgetspent.c: Likewise.
	* socket/opensock.c: Likewise.
	* stdio-common/reg-modifier.c: Likewise.
	* stdio-common/reg-printf.c: Likewise.
	* stdio-common/reg-type.c: Likewise.
	* stdio-common/vfprintf.c: Likewise.
	* stdio-common/vfscanf.c: Likewise.
	* stdlib/abort.c: Likewise.
	* stdlib/cxa_atexit.c: Likewise.
	* stdlib/fmtmsg.c: Likewise.
	* stdlib/random.c: Likewise.
	* stdlib/setenv.c: Likewise.
	* string/strsignal.c: Likewise.
	* sunrpc/auth_none.c: Likewise.
	* sunrpc/bindrsvprt.c: Likewise.
	* sunrpc/create_xid.c: Likewise.
	* sunrpc/key_call.c: Likewise.
	* sunrpc/rpc_thread.c: Likewise.
	* sysdeps/arm/backtrace.c: Likewise.
	* sysdeps/generic/ldsodefs.h: Likewise.
	* sysdeps/generic/stdio-lock.h: Likewise.
	* sysdeps/generic/unwind-dw2-fde.c: Likewise.
	* sysdeps/i386/backtrace.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/nldbl-compat.c: Likewise.
	* sysdeps/m68k/backtrace.c: Likewise.
	* sysdeps/mach/hurd/cthreads.c: Likewise.
	* sysdeps/mach/hurd/dirstream.h: Likewise.
	* sysdeps/mach/hurd/malloc-machine.h: Likewise.
	* sysdeps/nptl/malloc-machine.h: Likewise.
	* sysdeps/nptl/stdio-lock.h: Likewise.
	* sysdeps/posix/dirstream.h: Likewise.
	* sysdeps/posix/getaddrinfo.c: Likewise.
	* sysdeps/posix/system.c: Likewise.
	* sysdeps/pthread/aio_suspend.c: Likewise.
	* sysdeps/s390/s390-32/backtrace.c: Likewise.
	* sysdeps/s390/s390-64/backtrace.c: Likewise.
	* sysdeps/unix/sysv/linux/check_pf.c: Likewise.
	* sysdeps/unix/sysv/linux/if_index.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/getutent_r.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/getutid_r.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/getutline_r.c: Likewise.
	* sysdeps/unix/sysv/linux/shm-directory.c: Likewise.
	* sysdeps/unix/sysv/linux/system.c: Likewise.
	* sysdeps/x86_64/backtrace.c: Likewise.
	* time/alt_digit.c: Likewise.
	* time/era.c: Likewise.
	* time/tzset.c: Likewise.
	* wcsmbs/wcsmbsload.c: Likewise.
	* nptl/tst-initializers1.c (do_test): Refer to <libc-lock.h>
	instead of <bits/libc-lock.h> in comment.
2015-09-08 21:11:03 +00:00
Arjun Shankar c1f4108352 Modify several tests to use test-skeleton.c
These tests were skipped by the use-test-skeleton conversion done in
commit 29955b5d because they did not have an `int main (void)'
declaration. Instead their `main' functions were declared with arguments
(i.e. argc, argv) even though they didn't use them.

Remove these arguments and include the test skeleton in these tests.
2015-08-06 02:59:04 -04:00
Roland McGrath b8a9183617 Install a dummy <rpc/netdb.h> when not building sunrpc/. 2015-07-08 13:38:50 -07:00
Roland McGrath e185d57e99 Use unsigned types for counters in getaddrinfo_a code. 2015-06-24 17:58:12 -07:00
Dmitry V. Levin b57525f1a3 Fix potential hanging of gethostbyaddr_r/gethostbyname_r
When "reorder" resolver option is enabled, threads of a multi-threaded process
could hang in gethostbyaddr_r, gethostbyname_r, or gethostbyname2_r.

Due to a trivial bug in _res_hconf_reorder_addrs, simultaneous
invocations of this function in a multi-threaded process could result to
_res_hconf_reorder_addrs returning without releasing the lock it holds,
causing other threads to block indefinitely while waiting for the lock
that is not going to be released.

[BZ #17977]
* resolv/res_hconf.c (_res_hconf_reorder_addrs): Fix unlocking
when initializing interface list, based on the bug analysis
and the patch proposed by Eric Newton.
* resolv/tst-res_hconf_reorder.c: New test.
* resolv/Makefile [$(have-thread-library) = yes] (tests): Add
tst-res_hconf_reorder.
($(objpfx)tst-res_hconf_reorder): Depend on $(libdl)
and $(shared-thread-library).
(tst-res_hconf_reorder-ENV): New variable.
2015-06-23 09:37:28 +00:00
Dmitry V. Levin 47852c972d _res_hconf_reorder_addrs: fix typo in comment
* resolv/res_hconf.c (_res_hconf_reorder_addrs): Fix typo in comment.
2015-06-23 09:33:16 +00:00
Andreas Schwab 6b142b3a1d Record TTL also for DNS PTR queries (bug 18513)
This allows nscd to manage proper TTL for GETHOSTBYADDR[v6] requests.
2015-06-22 14:04:34 +02:00
Joseph Myers 8737be8064 Fix netdb.h addrinfo namespace (bug 18529).
netdb.h declares interfaces such as getaddrinfo if __USE_POSIX,
i.e. POSIX.1:1990 or later.  However, these interfaces were new in the
2001 edition of POSIX, although the header was in XPG4 and UNIX98, so
they should not be declared for XPG4 or UNIX98.  (This produces
spurious linknamespace test failures, although there are other
failures for this header as well for the same standards so this patch
doesn't remove any XFAILs.)  This patch corrects the condition, and
the conform/ test expectations which were similarly wrong.

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

	[BZ #18529]
	* resolv/netdb.h [__USE_POSIX]: Change condition to
	[__USE_XOPEN2K].
	* conform/data/netdb.h-data [XPG4 || UNIX98] (struct addrinfo): Do
	not expect.
	[XPG4 || UNIX98] (AI_PASSIVE): Likewise.
	[XPG4 || UNIX98] (AI_CANONNAME): Likewise.
	[XPG4 || UNIX98] (AI_NUMERICHOST): Likewise.
	[XPG4 || UNIX98] (AI_V4MAPPED): Likewise.
	[XPG4 || UNIX98] (AI_ALL): Likewise.
	[XPG4 || UNIX98] (AI_ADDRCONFIG): Likewise.
	[XPG4 || UNIX98] (AI_NUMERICSERV): Likewise.
	[XPG4 || UNIX98] (NI_NOFQDN): Likewise.
	[XPG4 || UNIX98] (NI_NUMERICHOST): Likewise.
	[XPG4 || UNIX98] (NI_NAMEREQD): Likewise.
	[XPG4 || UNIX98] (NI_NUMERICSERV): Likewise.
	[XPG4 || UNIX98] (NI_DGRAM): Likewise.
	[XPG4 || UNIX98] (EAI_AGAIN): Likewise.
	[XPG4 || UNIX98] (EAI_BADFLAGS): Likewise.
	[XPG4 || UNIX98] (EAI_FAIL): Likewise.
	[XPG4 || UNIX98] (EAI_FAMILY): Likewise.
	[XPG4 || UNIX98] (EAI_MEMORY): Likewise.
	[XPG4 || UNIX98] (EAI_NONAME): Likewise.
	[XPG4 || UNIX98] (EAI_SERVICE): Likewise.
	[XPG4 || UNIX98] (EAI_SOCKTYPE): Likewise.
	[XPG4 || UNIX98] (EAI_SYSTEM): Likewise.
	[XPG4 || UNIX98] (EAI_SYSTEM): Likewise.
	[XPG4 || UNIX98] (freeaddrinfo): Likewise.
	[XPG4 || UNIX98] (gai_strerror): Likewise.
	[XPG4 || UNIX98] (getaddrinfo): Likewise.
	[XPG4 || UNIX98] (getnameinfo): Likewise.
2015-06-12 22:35:07 +00:00
Joseph Myers 9acacaa02f Fix h_errno namespace (bug 18520).
The 2008 edition of POSIX removed h_errno, but some functions still
bring in references to the h_errno external symbol.  As this symbol is
not a part of the public ABI (only __h_errno_location is), this patch
fixes this by renaming the GLIBC_PRIVATE TLS symbol to __h_errno.

Tested for x86_64 and x86 (testsuite, and comparison of installed
shared libraries).  Disassembly of all shared libraries using h_errno
changes because of the renaming (and changes to associated TLS / GOT
offsets in some cases); disassembly of libpthread on x86_64 changes
more substantially because the enlargement of .dynsym affects
subsequent addresses.

	[BZ #18520]
	* inet/herrno.c (h_errno): Rename to __h_errno.
	(__libc_h_errno): Define as alias of __h_errno not h_errno.
	* include/netdb.h [IS_IN_LIB && !IS_IN (libc)] (h_errno): Define
	to __h_errno instead of h_errno.
	* nptl/herrno.c (h_errno): Rename to __h_errno.
	(__h_errno_location): Refer to __h_errno not h_errno.
	* resolv/Versions (h_errno): Rename to __h_errno.
	* conform/Makefile (test-xfail-XOPEN2K8/grp.h/linknamespace):
	Remove variable.
	(test-xfail-XOPEN2K8/pwd.h/linknamespace): Likewise.
2015-06-12 10:10:18 +00:00
Steve Ellcey 2483fa850f * resolv/res_hconf.c (_res_hconf_reorder_addrs): Use a union to
copy data from cur_ifr->ifr_addr and cur_ifr->ifr_netmask.
2015-06-01 09:00:05 -07:00
Andreas Schwab 2212c1420c Simplify handling of nameserver configuration in resolver
Remove use of ext.nsmap member of struct __res_state and always use
an identity mapping betwen the nsaddr_list array and the ext.nsaddrs
array.  The fact that a nameserver has an IPv6 address is signalled by
setting nsaddr_list[].sin_family to zero.
2015-05-21 15:16:37 +02:00
Arjun Shankar 2959eda927 CVE-2015-1781: resolv/nss_dns/dns-host.c buffer overflow [BZ#18287] 2015-04-21 14:06:50 +02:00
Siddhesh Poyarekar 3e3002ffea Skip logging for DNSSEC responses [BZ 14841]
DNSSEC defines a number of response types that one me expect when the
DO bit is set.  We don't process any of them, but since we do allow
setting the DO bit, skip them without logging an error since it is
only a nuisance.

Tested on x86_64.

	[BZ #14841]
	* resolv/gethnamaddr.c (getanswer): Skip logging if
	RES_USE_DNSSEC is set.
	* resolv/nss_dns/dns-host.c (getanswer_r): Likewise.
2015-02-24 13:17:29 +05:30
Roland McGrath 1c6e6f2315 Remove some references to bcopy/bcmp/bzero. 2015-01-13 11:12:55 -08:00
Aurelien Jarno 38949026b3 resolv: fix rotate option
The rotate option doesn't work correctly, and only send the query to the
same server (the second in the list). The rotation code in itself is not
broken, but the nsaddrs structure is reinitialized each time at the
beginning of __libc_res_nsend unless RES_STAYOPEN is enabled.

This is due to a call to __res_iclose from the end of __libc_res_nsend
when answers from the name server have been received. This function
closes all the sockets, but doesn't free the addresses (it can do that,
but in that case the second argument is false).

This patch change the code of __res_iclose to clear statp->_u._ext.nsinit
 only when the addresses are actually freed.

	* resolv/res_init.c (__res_iclose): Only clear nsinit if the
	addresses have been freed.
2015-01-06 09:00:20 -08:00
Aurelien Jarno 5fe55e9c65 resolv: improve comments about nserv and nservall
The current comments concerning nserv and nservall are not really clear
and lead to confusion when reviewing an already complex code. Improve
them, there real meaning have been confirmed by a code analysis.

	* resolv/res_init.c (__res_vinit): Improve comments about nserv
	and nservall.
2015-01-06 09:00:20 -08:00
Joseph Myers b168057aaa Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
Joseph Myers 8ac5a76a99 Fix resolver inet_* namespace (bug 17722).
Parts of the resolver brought in by pthreads (at least) use inet_*
functions that aren't in the 1995/6 edition of POSIX that introduced
pthreads (or in one case, use __inet_aton which is then defined in the
same file as non-weak inet_addr).  This patch fixes this by making the
affected functions into weak alias for __inet_* and using those names
in the problematic resolver code.

Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by the patch).

	[BZ #17722]
	* inet/inet_mkadr.c (inet_makeaddr): Rename to __inet_makeaddr and
	define as weak alias of __inet_makeaddr.
	* resolv/inet_addr.c (inet_addr): Rename to __inet_addr and define
	as weak alias of __inet_addr.
	* resolv/inet_pton.c (inet_pton): Rename to __inet_pton and define
	as weak alias of __inet_pton.  Use libc_hidden_weak.
	* include/arpa/inet.h (__inet_pton): Declare.  Use
	libc_hidden_proto.
	(inet_makeaddr): Don't use libc_hidden_proto.
	(__inet_makeaddr): Declare.  Use libc_hidden_proto.
	* resolv/res_init.c (__res_vinit): Use __inet_pton instead of
	inet_pton.  Use __inet_makeaddr instead of inet_makeaddr.
	* conform/Makefile (test-xfail-POSIX/pthread.h/linknamespace):
	Remove variable.
	(test-xfail-POSIX/sched.h/linknamespace): Likewise.
	(test-xfail-POSIX/time.h/linknamespace): Likewise.
2014-12-17 18:09:11 +00:00
Joseph Myers 9a44d530c4 Fix resolver if_* namespace (bug 17717).
Resolver code, brought in by pthreads (at least), uses if_* interfaces
that weren't in POSIX before 2001, resulting in linknamespace
failures.  This patch changes those interfaces to be weak aliases of
__if_* and makes the resolver use __if_* directly.

Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by this patch).

	[BZ #17717]
	* inet/if_index.c (if_nametoindex): Rename to __if_nametoindex and
	define as weak alias of __if_nametoindex.  Use libc_hidden_weak.
	(if_indextoname): Rename to __if_indextoname and define as weak
	alias of __if_indextoname.  Use libc_hidden_weak.
	(if_freenameindex): Rename to __if_freenameindex and define as
	weak alias of __if_freenameindex.
	(if_nameindex): Rename to __if_nameindex and define as weak alias
	of __if_nameindex.
	* sysdeps/mach/hurd/if_index.c (if_nametoindex): Rename to
	__if_nametoindex and define as weak alias of __if_nametoindex.
	Use libc_hidden_weak.
	(if_freenameindex): Rename to __if_freenameindex and define as
	weak alias of __if_freenameindex.
	(if_nameindex): Rename to __if_nameindex and define as weak alias
	of __if_nameindex.
	(if_indextoname): Rename to __if_indextoname and define as weak
	alias of __if_indextoname.  Use libc_hidden_weak.
	* sysdeps/unix/sysv/linux/if_index.c (if_nametoindex): Rename to
	__if_nametoindex and define as weak alias of __if_nametoindex.
	Use libc_hidden_weak.
	(if_freenameindex): Rename to __if_freenameindex and define as
	weak alias of __if_freenameindex.  Use libc_hidden_weak.
	(if_nameindex_netlink): Use __if_freenameindex instead of
	if_freenameindex.
	(if_nameindex): Rename to __if_nameindex and define as weak alias
	of __if_nameindex.  Use libc_hidden_weak.
	(if_indextoname): Rename to __if_indextoname and define as weak
	alias of __if_indextoname.  Use libc_hidden_weak.
	* include/net/if.h [!_ISOMAC] (__if_nametoindex): Declare and use
	libc_hidden_proto.
	[!_ISOMAC] (__if_freenameindex): Likewise.
	* resolv/res_init.c (__res_vinit): Use __if_nametoindex instead of
	if_nametoindex.
	* conform/Makefile (test-xfail-XPG4/grp.h/linknamespace): Remove
	variable.
	(test-xfail-XPG4/pwd.h/linknamespace): Likewise.
	(test-xfail-UNIX98/aio.h/linknamespace): Likewise.
	(test-xfail-UNIX98/grp.h/linknamespace): Likewise.
	(test-xfail-UNIX98/pthread.h/linknamespace): Likewise.
	(test-xfail-UNIX98/pwd.h/linknamespace): Likewise.
	(test-xfail-UNIX98/sched.h/linknamespace): Likewise.
	(test-xfail-UNIX98/time.h/linknamespace): Likewise.
2014-12-16 18:18:49 +00:00
Siddhesh Poyarekar 0cd8552045 Fix the 'array subscript is above array bounds' warning correctly
Use DIAG_IGNORE_NEEDS_COMMENT instead since the compiler should have
seen that NS never goes beyond MAXNS.
2014-12-16 19:40:47 +05:30
Siddhesh Poyarekar a0d424ef9d Fix 'array subscript is above array bounds' warning in res_send.c
I see this warning in my build on F21 x86_64, which seems to be due to
a weak check for array bounds.  Fixed by making the bounds check
stronger.

This is not an actual bug since nscount is never set to anything
greater than MAXNS.  The compiler however does not know this, so we
need the stronger bounds check to quieten the compiler.
2014-12-16 16:55:23 +05:30
Florian Weimer 11e3417af6 Avoid infinite loop in nss_dns getnetbyname [BZ #17630] 2014-12-16 10:08:29 +01:00
Stefan Liebler 48e435cd93 resolv: Suppress maybe uninitialized warning
In send_vc function at resolv/res_send.c, There is the
following warning on some architectures:

  'resplen' may be used uninitialized in this function
  [-Wmaybe-uninitialized]

And this is a false positive.  This patch suppress the
compiler warning.
2014-12-12 16:30:12 -05:00
Joseph Myers 84e5e75640 Fix fgets_unlocked namespace issues (bug 17664).
Various POSIX functions bring in res_init.o, res_hconf.o or
mntent_r.o, which use fgets_unlocked, which is not a POSIX function.
This patch arranges for them to use __fgets_unlocked instead.  (The
IS_IN (libc) conditional in rec_hconf.c is needed because that file is
also used in nscd.)

Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by the patch except for an assertion line
number).  Note that most of the linknamespace tests that failed
because of fgets_unlocked from the resolver also fail because of other
symbols brought in by the resolver, so the number of XFAILs this
removes is limited.  Also note that fgets_unlocked failures for
unistd.h for XPG3/XPG4 showed up that actually unistd.h is declaring
too much for XPG3/XPG4 (bug 17665) - there is no actual need to make
getusershell.c use __fgets_unlocked (at least as regards formal
standards are concerned; maybe it should still change for
namespace-cleanness of _DEFAULT_SOURCE) because the functions there
aren't actually in any of the supported standards; the correct fix for
those failures will be to stop the *usershell* functions appearing in
unistd.h for XPG3/XPG4.

	[BZ #17664]
	* misc/mntent_r.c (__getmntent_r): Use __fgets_unlocked instead of
	fgets_unlocked.
	* resolv/res_hconf.c [IS_IN (libc)] (fgets_unlocked): Define to
	__fgets_unlocked.
	* resolv/res_init.c (__res_vinit): Use __fgets_unlocked instead of
	fgets_unlocked.
	* conform/Makefile (test-xfail-XPG4/sys/statvfs.h/linknamespace):
	Remove variable.
	(test-xfail-POSIX/sys/mman.h/linknamespace): Likewise.
	(test-xfail-UNIX98/sys/mman.h/linknamespace): Likewise.
	(test-xfail-UNIX98/sys/statvfs.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K/sys/mman.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K/sys/statvfs.h/linknamespace): Likewise.
	(test-xfail-POSIX2008/sys/mman.h/linknamespace): Likewise.
	(test-xfail-POSIX2008/sys/statvfs.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K8/sys/mman.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K8/sys/statvfs.h/linknamespace): Likewise.
2014-12-02 21:31:24 +00:00
Siddhesh Poyarekar 4f41c682f3 Remove NOT_IN_libc
Replace with !IS_IN (libc).  This completes the transition from
the IS_IN/NOT_IN macros to the IN_MODULE macro set.

The generated code is unchanged on x86_64.

	* stdlib/isomac.c (fmt): Replace NOT_IN_libc with IN_MODULE.
	(get_null_defines): Adjust.
	* sunrpc/Makefile: Adjust comment.
	* Makerules (CPPFLAGS-nonlib): Remove NOT_IN_libc.
	* elf/Makefile (CPPFLAGS-sotruss-lib): Likewise.
	(CFLAGS-interp.c): Likewise.
	(CFLAGS-ldconfig.c): Likewise.
	(CPPFLAGS-.os): Likewise.
	* elf/rtld-Rules (rtld-CPPFLAGS): Likewise.
	* extra-lib.mk (CPPFLAGS-$(lib)): Likewise.
	* extra-modules.mk (extra-modules.mk): Likewise.
	* iconv/Makefile (CPPFLAGS-iconvprogs): Likewise.
	* locale/Makefile (CPPFLAGS-locale_programs): Likewise.
	* malloc/Makefile (CPPFLAGS-memusagestat): Likewise.
	* nscd/Makefile (CPPFLAGS-nscd): Likewise.
	* nss/Makefile (CPPFLAGS-nss_test1): Likewise.
	* stdlib/Makefile (CFLAGS-tst-putenvmod.c): Likewise.
	* sysdeps/gnu/Makefile ($(objpfx)errlist-compat.c): Likewise.
	* sysdeps/unix/sysv/linux/Makefile (CPPFLAGS-lddlibc4): Likewise.
	* iconvdata/Makefile (CPPFLAGS): Likewise.
	(cpp-srcs-left): Add libof for all iconvdata routines.
	* bits/stdio-lock.h: Replace NOT_IN_libc with IS_IN.
	* include/assert.h: Likewise.
	* include/ctype.h: Likewise.
	* include/errno.h: Likewise.
	* include/libc-symbols.h: Likewise.
	* include/math.h: Likewise.
	* include/netdb.h: Likewise.
	* include/resolv.h: Likewise.
	* include/stdio.h: Likewise.
	* include/stdlib.h: Likewise.
	* include/string.h: Likewise.
	* include/sys/stat.h: Likewise.
	* include/wctype.h: Likewise.
	* intl/l10nflist.c: Likewise.
	* libidn/idn-stub.c: Likewise.
	* libio/libioP.h: Likewise.
	* nptl/libc_multiple_threads.c: Likewise.
	* nptl/pthreadP.h: Likewise.
	* posix/regex_internal.h: Likewise.
	* resolv/res_hconf.c: Likewise.
	* sysdeps/arm/armv7/multiarch/memcpy.S: Likewise.
	* sysdeps/arm/memmove.S: Likewise.
	* sysdeps/arm/sysdep.h: Likewise.
	* sysdeps/generic/_itoa.h: Likewise.
	* sysdeps/generic/symbol-hacks.h: Likewise.
	* sysdeps/gnu/errlist.awk: Likewise.
	* sysdeps/gnu/errlist.c: Likewise.
	* sysdeps/i386/i586/memcpy.S: Likewise.
	* sysdeps/i386/i586/memset.S: Likewise.
	* sysdeps/i386/i686/memcpy.S: Likewise.
	* sysdeps/i386/i686/memmove.S: Likewise.
	* sysdeps/i386/i686/mempcpy.S: Likewise.
	* sysdeps/i386/i686/memset.S: Likewise.
	* sysdeps/i386/i686/multiarch/bcopy.S: Likewise.
	* sysdeps/i386/i686/multiarch/bzero.S: Likewise.
	* sysdeps/i386/i686/multiarch/memchr-sse2-bsf.S: Likewise.
	* sysdeps/i386/i686/multiarch/memchr-sse2.S: Likewise.
	* sysdeps/i386/i686/multiarch/memchr.S: Likewise.
	* sysdeps/i386/i686/multiarch/memcmp-sse4.S: Likewise.
	* sysdeps/i386/i686/multiarch/memcmp-ssse3.S: Likewise.
	* sysdeps/i386/i686/multiarch/memcmp.S: Likewise.
	* sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S: Likewise.
	* sysdeps/i386/i686/multiarch/memcpy-ssse3.S: Likewise.
	* sysdeps/i386/i686/multiarch/memcpy.S: Likewise.
	* sysdeps/i386/i686/multiarch/memcpy_chk.S: Likewise.
	* sysdeps/i386/i686/multiarch/memmove.S: Likewise.
	* sysdeps/i386/i686/multiarch/memmove_chk.S: Likewise.
	* sysdeps/i386/i686/multiarch/mempcpy.S: Likewise.
	* sysdeps/i386/i686/multiarch/mempcpy_chk.S: Likewise.
	* sysdeps/i386/i686/multiarch/memrchr-c.c: Likewise.
	* sysdeps/i386/i686/multiarch/memrchr-sse2-bsf.S: Likewise.
	* sysdeps/i386/i686/multiarch/memrchr-sse2.S: Likewise.
	* sysdeps/i386/i686/multiarch/memrchr.S: Likewise.
	* sysdeps/i386/i686/multiarch/memset-sse2-rep.S: Likewise.
	* sysdeps/i386/i686/multiarch/memset-sse2.S: Likewise.
	* sysdeps/i386/i686/multiarch/memset.S: Likewise.
	* sysdeps/i386/i686/multiarch/memset_chk.S: Likewise.
	* sysdeps/i386/i686/multiarch/rawmemchr.S: Likewise.
	* sysdeps/i386/i686/multiarch/strcat-sse2.S: Likewise.
	* sysdeps/i386/i686/multiarch/strcat-ssse3.S: Likewise.
	* sysdeps/i386/i686/multiarch/strcat.S: Likewise.
	* sysdeps/i386/i686/multiarch/strchr-sse2-bsf.S: Likewise.
	* sysdeps/i386/i686/multiarch/strchr-sse2.S: Likewise.
	* sysdeps/i386/i686/multiarch/strchr.S: Likewise.
	* sysdeps/i386/i686/multiarch/strcmp-sse4.S: Likewise.
	* sysdeps/i386/i686/multiarch/strcmp-ssse3.S: Likewise.
	* sysdeps/i386/i686/multiarch/strcmp.S: Likewise.
	* sysdeps/i386/i686/multiarch/strcpy-sse2.S: Likewise.
	* sysdeps/i386/i686/multiarch/strcpy-ssse3.S: Likewise.
	* sysdeps/i386/i686/multiarch/strcpy.S: Likewise.
	* sysdeps/i386/i686/multiarch/strcspn.S: Likewise.
	* sysdeps/i386/i686/multiarch/strlen-sse2-bsf.S: Likewise.
	* sysdeps/i386/i686/multiarch/strlen-sse2.S: Likewise.
	* sysdeps/i386/i686/multiarch/strlen.S: Likewise.
	* sysdeps/i386/i686/multiarch/strnlen.S: Likewise.
	* sysdeps/i386/i686/multiarch/strrchr-sse2-bsf.S: Likewise.
	* sysdeps/i386/i686/multiarch/strrchr-sse2.S: Likewise.
	* sysdeps/i386/i686/multiarch/strrchr.S: Likewise.
	* sysdeps/i386/i686/multiarch/strspn.S: Likewise.
	* sysdeps/i386/i686/multiarch/wcschr-c.c: Likewise.
	* sysdeps/i386/i686/multiarch/wcschr-sse2.S: Likewise.
	* sysdeps/i386/i686/multiarch/wcschr.S: Likewise.
	* sysdeps/i386/i686/multiarch/wcscmp-sse2.S: Likewise.
	* sysdeps/i386/i686/multiarch/wcscmp.S: Likewise.
	* sysdeps/i386/i686/multiarch/wcscpy-c.c: Likewise.
	* sysdeps/i386/i686/multiarch/wcscpy-ssse3.S: Likewise.
	* sysdeps/i386/i686/multiarch/wcscpy.S: Likewise.
	* sysdeps/i386/i686/multiarch/wcslen-c.c: Likewise.
	* sysdeps/i386/i686/multiarch/wcslen-sse2.S: Likewise.
	* sysdeps/i386/i686/multiarch/wcslen.S: Likewise.
	* sysdeps/i386/i686/multiarch/wcsrchr-c.c: Likewise.
	* sysdeps/i386/i686/multiarch/wcsrchr-sse2.S: Likewise.
	* sysdeps/i386/i686/multiarch/wcsrchr.S: Likewise.
	* sysdeps/i386/i686/multiarch/wmemcmp-c.c: Likewise.
	* sysdeps/i386/i686/multiarch/wmemcmp.S: Likewise.
	* sysdeps/ia64/fpu/libm-symbols.h: Likewise.
	* sysdeps/nptl/bits/libc-lock.h: Likewise.
	* sysdeps/nptl/bits/libc-lockP.h: Likewise.
	* sysdeps/nptl/bits/stdio-lock.h: Likewise.
	* sysdeps/posix/closedir.c: Likewise.
	* sysdeps/posix/opendir.c: Likewise.
	* sysdeps/posix/readdir.c: Likewise.
	* sysdeps/posix/rewinddir.c: Likewise.
	* sysdeps/powerpc/novmx-sigjmp.c: Likewise.
	* sysdeps/powerpc/powerpc32/__longjmp.S: Likewise.
	* sysdeps/powerpc/powerpc32/bsd-_setjmp.S: Likewise.
	* sysdeps/powerpc/powerpc32/fpu/__longjmp.S: Likewise.
	* sysdeps/powerpc/powerpc32/fpu/setjmp.S: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/bzero.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/memchr.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/memcmp-ppc32.S: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/memcmp.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/memcpy-ppc32.S: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/memcpy.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/memmove.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/mempcpy.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/memrchr-ppc32.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/memrchr.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/memset.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/rawmemchr.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/strcasecmp.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/strcasecmp_l.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/strchr.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/strchrnul.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/strlen-ppc32.S: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/strlen.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/strncase.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/strncase_l.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/strncmp-ppc32.S: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/strncmp.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/strnlen.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-ppc32.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/wcschr.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-ppc32.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr-ppc32.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/wordcopy.c: Likewise.
	* sysdeps/powerpc/powerpc32/power6/memset.S: Likewise.
	* sysdeps/powerpc/powerpc32/setjmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/__longjmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/bzero.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memchr.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memcmp-ppc64.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memcmp.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memcpy-ppc64.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memcpy.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memmove-ppc64.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memmove.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/mempcpy.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memrchr.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memset.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/rawmemchr.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/stpcpy-ppc64.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/stpcpy.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/stpncpy.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcasecmp.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcasecmp_l.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcat.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strchr.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strchrnul.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcmp-ppc64.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcmp.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcpy-ppc64.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcpy.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcspn.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strlen-ppc64.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strlen.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strncase.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strncase_l.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strncat.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strncmp-ppc64.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strncmp.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strncpy-ppc64.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strncpy.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strnlen.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strpbrk.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strrchr-ppc64.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strrchr.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strspn-ppc64.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strspn.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/wcschr.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/wcscpy.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/wcsrchr.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/wordcopy.c: Likewise.
	* sysdeps/powerpc/powerpc64/setjmp.S: Likewise.
	* sysdeps/s390/s390-32/multiarch/ifunc-resolve.c: Likewise.
	* sysdeps/s390/s390-32/multiarch/memcmp.S: Likewise.
	* sysdeps/s390/s390-32/multiarch/memcpy.S: Likewise.
	* sysdeps/s390/s390-32/multiarch/memset.S: Likewise.
	* sysdeps/s390/s390-64/multiarch/ifunc-resolve.c: Likewise.
	* sysdeps/s390/s390-64/multiarch/memcmp.S: Likewise.
	* sysdeps/s390/s390-64/multiarch/memcpy.S: Likewise.
	* sysdeps/s390/s390-64/multiarch/memset.S: Likewise.
	* sysdeps/sparc/sparc64/multiarch/memcpy-niagara1.S: Likewise.
	* sysdeps/sparc/sparc64/multiarch/memcpy-niagara2.S: Likewise.
	* sysdeps/sparc/sparc64/multiarch/memcpy-niagara4.S: Likewise.
	* sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: Likewise.
	* sysdeps/sparc/sparc64/multiarch/memcpy.S: Likewise.
	* sysdeps/sparc/sparc64/multiarch/memset-niagara1.S: Likewise.
	* sysdeps/sparc/sparc64/multiarch/memset-niagara4.S: Likewise.
	* sysdeps/sparc/sparc64/multiarch/memset.S: Likewise.
	* sysdeps/unix/alpha/sysdep.S: Likewise.
	* sysdeps/unix/alpha/sysdep.h: Likewise.
	* sysdeps/unix/make-syscalls.sh: Likewise.
	* sysdeps/unix/sysv/linux/aarch64/sysdep-cancel.h: Likewise.
	* sysdeps/unix/sysv/linux/aarch64/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h: Likewise.
	* sysdeps/unix/sysv/linux/alpha/vfork.S: Likewise.
	* sysdeps/unix/sysv/linux/arm/sysdep-cancel.h: Likewise.
	* sysdeps/unix/sysv/linux/arm/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/getpid.c: Likewise.
	* sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.h: Likewise.
	* sysdeps/unix/sysv/linux/hppa/nptl/sysdep-cancel.h: Likewise.
	* sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/lowlevellock.h: Likewise.
	* sysdeps/unix/sysv/linux/i386/sysdep-cancel.h: Likewise.
	* sysdeps/unix/sysv/linux/i386/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/ia64/lowlevellock.h: Likewise.
	* sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h: Likewise.
	* sysdeps/unix/sysv/linux/ia64/sysdep.S: Likewise.
	* sysdeps/unix/sysv/linux/ia64/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/lowlevellock-futex.h: Likewise.
	* sysdeps/unix/sysv/linux/m68k/bits/m68k-vdso.h: Likewise.
	* sysdeps/unix/sysv/linux/m68k/sysdep-cancel.h: Likewise.
	* sysdeps/unix/sysv/linux/m68k/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/lowlevellock.h: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/sysdep-cancel.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/sysdep-cancel.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/sysdep-cancel.h: Likewise.
	* sysdeps/unix/sysv/linux/not-cancel.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/lowlevellock.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h: Likewise.
	* sysdeps/unix/sysv/linux/s390/longjmp_chk.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/lowlevellock.h: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/vfork.S: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/sysdep.S: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/vfork.S: Likewise.
	* sysdeps/unix/sysv/linux/sh/lowlevellock.S: Likewise.
	* sysdeps/unix/sysv/linux/sh/lowlevellock.h: Likewise.
	* sysdeps/unix/sysv/linux/sh/sysdep-cancel.h: Likewise.
	* sysdeps/unix/sysv/linux/sh/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/sh/vfork.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc/lowlevellock.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/brk.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/tile/lowlevellock.h: Likewise.
	* sysdeps/unix/sysv/linux/tile/sysdep-cancel.h: Likewise.
	* sysdeps/unix/sysv/linux/tile/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/tile/waitpid.S: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/sysdep.h: Likewise.
	* sysdeps/wordsize-32/symbol-hacks.h: Likewise.
	* sysdeps/x86_64/memcpy.S: Likewise.
	* sysdeps/x86_64/memmove.c: Likewise.
	* sysdeps/x86_64/memset.S: Likewise.
	* sysdeps/x86_64/multiarch/init-arch.h: Likewise.
	* sysdeps/x86_64/multiarch/memcmp-sse4.S: Likewise.
	* sysdeps/x86_64/multiarch/memcmp-ssse3.S: Likewise.
	* sysdeps/x86_64/multiarch/memcmp.S: Likewise.
	* sysdeps/x86_64/multiarch/memcpy-avx-unaligned.S: Likewise.
	* sysdeps/x86_64/multiarch/memcpy-ssse3-back.S: Likewise.
	* sysdeps/x86_64/multiarch/memcpy-ssse3.S: Likewise.
	* sysdeps/x86_64/multiarch/memcpy.S: Likewise.
	* sysdeps/x86_64/multiarch/memcpy_chk.S: Likewise.
	* sysdeps/x86_64/multiarch/memmove.c: Likewise.
	* sysdeps/x86_64/multiarch/mempcpy.S: Likewise.
	* sysdeps/x86_64/multiarch/mempcpy_chk.S: Likewise.
	* sysdeps/x86_64/multiarch/memset-avx2.S: Likewise.
	* sysdeps/x86_64/multiarch/memset.S: Likewise.
	* sysdeps/x86_64/multiarch/memset_chk.S: Likewise.
	* sysdeps/x86_64/multiarch/strcat-sse2-unaligned.S: Likewise.
	* sysdeps/x86_64/multiarch/strcat-ssse3.S: Likewise.
	* sysdeps/x86_64/multiarch/strcat.S: Likewise.
	* sysdeps/x86_64/multiarch/strchr-sse2-no-bsf.S: Likewise.
	* sysdeps/x86_64/multiarch/strchr.S: Likewise.
	* sysdeps/x86_64/multiarch/strcmp-ssse3.S: Likewise.
	* sysdeps/x86_64/multiarch/strcmp.S: Likewise.
	* sysdeps/x86_64/multiarch/strcpy-sse2-unaligned.S: Likewise.
	* sysdeps/x86_64/multiarch/strcpy-ssse3.S: Likewise.
	* sysdeps/x86_64/multiarch/strcpy.S: Likewise.
	* sysdeps/x86_64/multiarch/strcspn.S: Likewise.
	* sysdeps/x86_64/multiarch/strspn.S: Likewise.
	* sysdeps/x86_64/multiarch/wcscpy-c.c: Likewise.
	* sysdeps/x86_64/multiarch/wcscpy-ssse3.S: Likewise.
	* sysdeps/x86_64/multiarch/wcscpy.S: Likewise.
	* sysdeps/x86_64/multiarch/wmemcmp-c.c: Likewise.
	* sysdeps/x86_64/multiarch/wmemcmp.S: Likewise.
	* sysdeps/x86_64/strcmp.S: Likewise.
2014-11-24 15:03:45 +05:30
Alexandre Oliva b59d114bd1 BZ#16469: resolv: skip leading dot in domain to search
This should only happen if the domain to search is the root,
represented as "." rather than by an empty string.  Skipping it here
prevents libc_res_nquerydomain from duplicating the trailing dot,
which would cause the domain name compression to fail.

for  ChangeLog

	[BZ #16469]
	* resolv/res_query.c (__libc_res_nsearch): Skip leading dot in
	search domain names.
2014-11-21 03:39:37 -02:00
Alexandre Oliva f3d945d5f2 BZ#16469: don't drop trailing dot in res_nquerydomain(..., name, NULL, ...)
If we drop it here, we will fail to detect a duplicate trailing dot
later on.  Retaining, OTOH, has no ill effects whatsoever, and it even
saves us the trouble of copying the domain name minus the trailing
dot, like we used to do.

for ChangeLog

	[BZ #16469]
	* NEWS: Update.
	* resolv/res_query.c (__libc_res_nquerydomain): Retain
	trailing dot.
	* posix/tst-getaddrinfo5.c: New.
	* posix/Makefile (tests): Add it.
2014-11-21 03:39:37 -02:00
Arjun Shankar 29955b5d96 Modify several tests to use test-skeleton.c
This patch modifies several test cases to use test-skeleton.c.
It was generated by a bash script written for this purpose and
thus excludes several other tests which I deemed worth a visual
inspection before making the change.

I intend to follow up with individual patches to the tests
skipped by the script.

The script itself resides at http://git.io/WODAmg and should
reproduce this very patch when run against master.

ChangeLog:

2014-10-30  Arjun Shankar  <arjun.is@lostca.se>

	* catgets/test-gencat.c: Use test-skeleton.c.
	* catgets/tst-catgets.c: Likewise.
	* csu/tst-empty.c: Likewise.
	* elf/tst-audit2.c: Likewise.
	* elf/tst-global1.c: Likewise.
	* elf/tst-pathopt.c: Likewise.
	* elf/tst-piemod1.c: Likewise.
	* elf/tst-tls10.c: Likewise.
	* elf/tst-tls11.c: Likewise.
	* elf/tst-tls12.c: Likewise.
	* gnulib/tst-gcc.c: Likewise.
	* iconvdata/tst-e2big.c: Likewise.
	* iconvdata/tst-loading.c: Likewise.
	* iconv/tst-iconv1.c: Likewise.
	* iconv/tst-iconv2.c: Likewise.
	* inet/test-inet6_opt.c: Likewise.
	* inet/tst-gethnm.c: Likewise.
	* inet/tst-network.c: Likewise.
	* inet/tst-ntoa.c: Likewise.
	* intl/tst-codeset.c: Likewise.
	* intl/tst-gettext2.c: Likewise.
	* intl/tst-gettext3.c: Likewise.
	* intl/tst-ngettext.c: Likewise.
	* intl/tst-translit.c: Likewise.
	* io/test-stat.c: Likewise.
	* libio/test-fmemopen.c: Likewise.
	* libio/tst-freopen.c: Likewise.
	* libio/tst-sscanf.c: Likewise.
	* libio/tst-ungetwc1.c: Likewise.
	* libio/tst-ungetwc2.c: Likewise.
	* libio/tst-widetext.c: Likewise.
	* localedata/tst-ctype.c: Likewise.
	* localedata/tst-digits.c: Likewise.
	* localedata/tst-leaks.c: Likewise.
	* localedata/tst-mbswcs1.c: Likewise.
	* localedata/tst-mbswcs2.c: Likewise.
	* localedata/tst-mbswcs3.c: Likewise.
	* localedata/tst-mbswcs4.c: Likewise.
	* localedata/tst-mbswcs5.c: Likewise.
	* localedata/tst-setlocale.c: Likewise.
	* localedata/tst-trans.c: Likewise.
	* localedata/tst-wctype.c: Likewise.
	* localedata/tst-xlocale1.c: Likewise.
	* login/tst-grantpt.c: Likewise.
	* malloc/tst-calloc.c: Likewise.
	* malloc/tst-malloc.c: Likewise.
	* malloc/tst-mallocstate.c: Likewise.
	* malloc/tst-mcheck.c: Likewise.
	* malloc/tst-mtrace.c: Likewise.
	* malloc/tst-obstack.c: Likewise.
	* math/atest-exp2.c: Likewise.
	* math/atest-exp.c: Likewise.
	* math/atest-sincos.c: Likewise.
	* math/test-matherr.c: Likewise.
	* math/test-misc.c: Likewise.
	* math/test-powl.c: Likewise.
	* math/tst-definitions.c: Likewise.
	* misc/tst-dirname.c: Likewise.
	* misc/tst-efgcvt.c: Likewise.
	* misc/tst-fdset.c: Likewise.
	* misc/tst-hsearch.c: Likewise.
	* misc/tst-mntent2.c: Likewise.
	* nptl/tst-sem7.c: Likewise.
	* nptl/tst-sem8.c: Likewise.
	* nptl/tst-sem9.c: Likewise.
	* nss/test-netdb.c: Likewise.
	* posix/tst-fnmatch.c: Likewise.
	* posix/tst-getlogin.c: Likewise.
	* posix/tst-gnuglob.c: Likewise.
	* posix/tst-mmap.c: Likewise.
	* pwd/tst-getpw.c: Likewise.
	* resolv/tst-inet_ntop.c: Likewise.
	* rt/tst-timer.c: Likewise.
	* stdio-common/test-fseek.c: Likewise.
	* stdio-common/test-popen.c: Likewise.
	* stdio-common/test-vfprintf.c: Likewise.
	* stdio-common/tst-cookie.c: Likewise.
	* stdio-common/tst-fileno.c: Likewise.
	* stdio-common/tst-gets.c: Likewise.
	* stdio-common/tst-obprintf.c: Likewise.
	* stdio-common/tst-perror.c: Likewise.
	* stdio-common/tst-sprintf2.c: Likewise.
	* stdio-common/tst-sprintf3.c: Likewise.
	* stdio-common/tst-sprintf.c: Likewise.
	* stdio-common/tst-swprintf.c: Likewise.
	* stdio-common/tst-tmpnam.c: Likewise.
	* stdio-common/tst-unbputc.c: Likewise.
	* stdio-common/tst-wc-printf.c: Likewise.
	* stdlib/tst-environ.c: Likewise.
	* stdlib/tst-fmtmsg.c: Likewise.
	* stdlib/tst-limits.c: Likewise.
	* stdlib/tst-rand48-2.c: Likewise.
	* stdlib/tst-rand48.c: Likewise.
	* stdlib/tst-random2.c: Likewise.
	* stdlib/tst-random.c: Likewise.
	* stdlib/tst-strtol.c: Likewise.
	* stdlib/tst-strtoll.c: Likewise.
	* stdlib/tst-tls-atexit.c: Likewise.
	* stdlib/tst-xpg-basename.c: Likewise.
	* string/test-ffs.c: Likewise.
	* string/tst-bswap.c: Likewise.
	* string/tst-inlcall.c: Likewise.
	* string/tst-strtok.c: Likewise.
	* string/tst-strxfrm.c: Likewise.
	* sysdeps/x86_64/tst-audit10.c: Likewise.
	* sysdeps/x86_64/tst-audit3.c: Likewise.
	* sysdeps/x86_64/tst-audit4.c: Likewise.
	* sysdeps/x86_64/tst-audit5.c: Likewise.
	* time/tst-ftime_l.c: Likewise.
	* time/tst-getdate.c: Likewise.
	* time/tst-mktime3.c: Likewise.
	* time/tst-mktime.c: Likewise.
	* time/tst-posixtz.c: Likewise.
	* time/tst-strptime2.c: Likewise.
	* time/tst-strptime3.c: Likewise.
	* wcsmbs/tst-btowc.c: Likewise.
	* wcsmbs/tst-mbrtowc.c: Likewise.
	* wcsmbs/tst-mbsrtowcs.c: Likewise.
	* wcsmbs/tst-wchar-h.c: Likewise.
	* wcsmbs/tst-wcpncpy.c: Likewise.
	* wcsmbs/tst-wcrtomb.c: Likewise.
	* wcsmbs/tst-wcsnlen.c: Likewise.
	* wcsmbs/tst-wcstof.c: Likewise.
2014-11-05 15:24:08 +05:30
Siddhesh Poyarekar e35c53e397 Check value at resplen2 if it is not NULL
There was a typo in the previous patch due to which resplen2 was
checked for non-zero instead of the value at resplen2.  Fix that and
improve the condition by checking resplen2 for non-NULL (instead of
answerp2) and also adding the check in a third place.
2014-07-08 22:52:49 +05:30
Siddhesh Poyarekar e1e041c439 Add comment to gethnamaddr.c to warn that the file is unmaintained 2014-07-02 13:25:55 +05:30
Siddhesh Poyarekar 76985d3e03 Remove MULTI_PTRS_ARE_ALIASES in dns-hosts.c
The code in gethnamaddr.c for gethostbyaddr used and set this macro to
allow multiple PTR records to be added as aliases.  This was useful
for gethostbyaddr since it returns a hostent structure, which can
return aliases.

The gethnamaddr.c source however is unused in glibc since pretty much
forever.  Instead, the DNS lookup bits for gethostbyaddr (as well as
getnameinfo) are implemented in dns-hosts.c and in that implementation
all but one (the first one) of the multiple PTR records are ignored.
Since gethnamaddr.c is essentially dead code, ignore that
implementation and replace the MULTI_PTRS_ARE_ALIASES bit with a
comment mentioning that bind adds PTR records as aliases while we
don't.
2014-07-01 17:23:20 +05:30
Andreas Schwab f9d2d03254 Fix invalid file descriptor reuse while sending DNS query (BZ #15946) 2014-06-03 18:03:39 +02:00
Joseph Myers bb7d033799 Don't mention linuxthreads in Depend files.
I noticed that some of the Depend files, used to determine the
subdirectory build order in sysd-sorted, still mentioned linuxthreads,
although it hasn't been supported for many years.  This patch removes
those references.  In the case of nscd, it substitutes an nptl
reference, since I believe there is a fact a thread library dependence
there; the others already mentioned nptl.

Note that I am not at all confident in the completeness of these
Depend files.

Note also that references to linuxthreads remain in a comment in
sysdeps/unix/sysv/linux/ia64/Versions, and in manual/maint.texi,
manual/signal.texi and scripts/documented.sh.

Tested x86_64 that the installed shared libraries are unchanged by the
patch (as is sysd-sorted).

	* nscd/Depend (linuxthreads): Remove.
	(nptl): Add.
	* resolv/Depend (linuxthreads): Remove.
	* rt/Depend (linuxthreads): Remove.
2014-05-21 16:53:11 +00:00
Siddhesh Poyarekar 16b293a7a6 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 11:48:43 +05:30
Joseph Anthony Pasquale Holsten c12e9f3741 Fix typo in comment in res_query.c 2014-04-11 15:19:49 +05:30
Adhemerval Zanella 27822ce67f Define _STRING_ARCH_unaligned unconditionally
This patch defines _STRING_ARCH_unaligned to 0 on default bits/string.h
header to avoid undefined compiler warnings on platforms that do not
define it.  It also make adjustments in code where tests checked if macro
existed or not.
2014-04-09 15:05:36 -05:00
Joseph Myers 0b20a9e89f Make tests consistently use *.out output files.
This patch systematically renames miscellaneous tests so their outputs
use a *.out name (unless the test is just running some glibc program
with its conventional output file name, rather than a special program
at all, as in catgets tests generating *.cat).  In the case of the
iconv test test-iconvconfig, output is redirected where it wasn't
before.

In various places the "generated" variable is updated to reflect the
revised test names; in iconvdata/Makefile a typo (mmtrace-tst-loading)
is also fixed.  resolv/Makefile sets both "generate" (which appears
unused) and "generated".  Bitrot in the settings of these variables
could no doubt be fixed so that "make clean" after build and testing
leaves results the same as after configure (and indeed the
tests-special / xtests-special variables could be used to simplify
things, by removing those files automatically rather than listing them
manually in these variables), and "make distclean" leaves an empty
build directory, but right now it appears various files don't get
deleted.  I think they are liable to continue to bitrot in the absence
of routine testing that these targets actually work, given that
building in the source directory isn't supported and that was the main
use of such makefile targets.

Tested x86_64.

	* elf/Makefile (tests-special): Rename tests to end with .out.
	($(objpfx)noload-mem): Likewise.
	($(objpfx)tst-leaks1-mem): Likewise.
	($(objpfx)tst-leaks1-static-mem.out): Likewise.
	* iconv/Makefile (xtests-special): Change test-iconvconfig to
	$(objpfx)test-iconvconfig.out.
	(test-iconvconfig): Change to $(objpfx)test-iconvconfig.out.  Use
	set -e inside subshell and redirect output to file.
	* iconvdata/Makefile (generated): Rename tests to end with .out.
	Correct type.
	(tests-special): Rename tests to end with .out.
	($(objpfx)mtrace-tst-loading): Likewise.
	* intl/Makefile (generated): Likewise.
	(tests-special): Likewise.
	($(objpfx)mtrace-tst-gettext): Likewise.
	* misc/Makefile (generated): Likewise.
	(tests-special): Likewise.
	($(objpfx)tst-error1-mem): Likewise.
	* nptl/Makefile (tests-special): Likewise.
	($(objpfx)tst-stack3-mem): Likewise.
	(generated): Likewise.
	* posix/Makefile (generated): Likewise.
	(tests-special): Likewise.
	(xtests-special): Likewise.
	($(objpfx)tst-fnmatch-mem): Likewise.
	($(objpfx)bug-regex2-mem): Likewise.
	($(objpfx)bug-regex14-mem): Likewise.
	($(objpfx)bug-regex21-mem): Likewise.
	($(objpfx)bug-regex31-mem): Likewise.
	($(objpfx)tst-vfork3-mem): Likewise.
	($(objpfx)tst-rxspencer-no-utf8-mem): Likewise.
	($(objpfx)tst-pcre-mem): Likewise.
	($(objpfx)tst-boost-mem): Likewise.
	($(objpfx)bug-ga2-mem): Likewise.
	($(objpfx)bug-glob2-mem): Likewise.
	* resolv/Makefile (generate): Likewise.
	(tests-special): Likewise.
	(xtests-special): Likewise.
	(generated): Likewise.
	($(objpfx)mtrace-tst-leaks): Likewise.
	($(objpfx)mtrace-tst-leaks2): Likewise.

localedata:
	* Makefile (generated): Rename tests to end with .out.
	(tests-special): Likewise.
	($(objpfx)mtrace-tst-leaks): Likewise.
2014-03-07 03:29:23 +00:00
Joseph Myers f214606a0e Enumerate tests with special rules in tests-special variable.
This patch is a revised and updated version of
<https://sourceware.org/ml/libc-alpha/2014-01/msg00196.html>.

In order to generate overall summaries of the results of all tests in
the glibc testsuite, we need to identify and concatenate the files
with the results of individual tests.

Tomas Dohnalek's patch used $(common-objpfx)*/*.test-result for this.
However, the normal glibc approach is explicit enumeration of the
expected set of files with a given property, rather than all files
matching some pattern like that.  Furthermore, we would like to be
able to mark tests as UNRESOLVED if the file with their results is for
some reason missing, and in future we would like to be able to mark
tests as UNSUPPORTED if they are disabled for a particular
configuration (rather than simply having them missing from the list of
tests as at present).  Such handling of tests that were not run or did
not record results requires an explicit enumeration of tests.

For the tests following the default makefile rules, $(tests) (and
$(xtests)) provides such an enumeration.  Others, however, are added
directly as dependencies of the "tests" and "xtests" makefile
targets.  This patch changes the makefiles to put them in variables
tests-special and xtests-special, with appropriate dependencies on the
tests listed there then being added centrally.

Those variables are used in Rules and so need to be set before Rules
is included in a subdirectory makefile, which is often earlier in the
makefile than the dependencies were present before.  We previously
discussed the question of where to include Rules; see the question at
<https://sourceware.org/ml/libc-alpha/2012-11/msg00798.html>, and a
discussion in
<https://sourceware.org/ml/libc-alpha/2013-01/msg00337.html> of why
Rules is included early rather than late in subdirectory makefiles.

It was necessary to avoid an indirection through the check-abi target
and get the check-abi-* targets for individual libraries into the
tests-special variable.  The intl/ test $(objpfx)tst-gettext.out,
previously built only because of dependencies from other tests, was
also added to tests-special for the same reason.

The entries in tests-special are the full makefile targets, complete
with $(objpfx) and .out.  If a future change causes tests to be named
consistently with a .out suffix, this can be changed to include just
the path relative to $(objpfx), without .out.

Tested x86_64, including that the same set of files is generated in
the build directory by a build and testsuite run both before and after
the patch (except for changes to the
elf/tst-null-argv.debug.out.<number> file name), and a build with
run-built-tests=no to verify there aren't any more obvious instances
of the issue Marcus Shawcroft reported with a previous version in
<https://sourceware.org/ml/libc-alpha/2014-01/msg00462.html>.

	* Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	(tests): Depend on $(tests-special).
	* Makerules (check-abi-list): New variable.
	(check-abi): Depend on $(check-abi-list).
	[$(subdir) = elf] (tests-special): Add
	$(objpfx)check-abi-libc.out.
	[$(build-shared) = yes && subdir] (tests-special): Add
	$(check-abi-list).
	[$(build-shared) = yes && subdir] (tests): Do not depend on
	check-abi.
	* Rules (tests): Depend on $(tests-special).
	(xtests): Depend on $(xtests-special).
	* catgets/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	* conform/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	* elf/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	* grp/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	* iconv/Makefile (xtests): Change dependencies to ....
	(xtests-special): ... additions to this variable.
	* iconvdata/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	* intl/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.  Also add
	$(objpfx)tst-gettext.out.
	* io/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	* libio/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	* malloc/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	* misc/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	* nptl/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	* nptl_db/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	* posix/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	(xtests): Change dependencies to ....
	(xtests-special): ... additions to this variable.
	* resolv/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	(xtests): Change dependencies to ....
	(xtests-special): ... additions to this variable.
	* stdio-common/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	(do-tst-unbputc): Remove target.
	(do-tst-printf): Likewise.
	* stdlib/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	* string/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	* sysdeps/x86/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.

localedata:
	* Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
2014-03-06 22:35:33 +00:00
Roland McGrath f08e9a2629 Fix fallout from Joseph's untested Makeconfig change. 2014-02-28 13:00:27 -08:00
Joseph Myers a5f891ac8d Consistently include Makeconfig after defining subdir.
In <https://sourceware.org/ml/libc-alpha/2014-01/msg00196.html> I
noted it was necessary to add includes of Makeconfig early in various
subdirectory makefiles for the tests-special variable settings added
by that patch to be conditional on configuration information.  No-one
commented on the general question there of whether Makeconfig should
always be included immediately after the definition of subdir.

This patch implements that early inclusion of Makeconfig in each
directory (which is a lot easier than consistent placement of includes
of Rules).  Includes are added if needed, or moved up if already
present.  Subdirectory "all:" targets are removed, since Makeconfig
provides one.

There is potential for further cleanups I haven't done.  Rules and
Makerules have code such as

ifneq   "$(findstring env,$(origin headers))" ""
headers :=
endif

to override to empty any value of various variables that came from the
environment.  I think there is a case for Makeconfig setting all the
subdirectory variables (other than subdir) to empty to ensure no
outside value is going to take effect if a subdirectory fails to
define a variable.  (A list of such variables, possibly out of date
and incomplete, is in manual/maint.texi.)  Rules and Makerules would
give errors if Makeconfig hadn't already been included, instead of
including it themselves.  The special code to override values coming
from the environment would then be obsolete and could be removed.

Tested x86_64, including that installed binaries are identical before
and after the patch.

	* argp/Makefile: Include Makeconfig immediately after defining
	subdir.
	* assert/Makefile: Likewise.
	* benchtests/Makefile: Likewise.
	* catgets/Makefile: Likewise.
	* conform/Makefile: Likewise.
	* crypt/Makefile: Likewise.
	* csu/Makefile: Likewise.
	(all): Remove target.
	* ctype/Makefile: Include Makeconfig immediately after defining
	subdir.
	* debug/Makefile: Likewise.
	* dirent/Makefile: Likewise.
	* dlfcn/Makefile: Likewise.
	* gmon/Makefile: Likewise.
	* gnulib/Makefile: Likewise.
	* grp/Makefile: Likewise.
	* gshadow/Makefile: Likewise.
	* hesiod/Makefile: Likewise.
	* hurd/Makefile: Likewise.
	(all): Remove target.
	* iconvdata/Makefile: Include Makeconfig immediately after
	defining subdir.
	* inet/Makefile: Likewise.
	* intl/Makefile: Likewise.
	* io/Makefile: Likewise.
	* libio/Makefile: Likewise.
	(all): Remove target.
	* locale/Makefile: Include Makeconfig immediately after defining
	subdir.
	* login/Makefile: Likewise.
	* mach/Makefile: Likewise.
	(all): Remove target.
	* malloc/Makefile: Include Makeconfig immediately after defining
	subdir.
	(all): Remove target.
	* manual/Makefile: Include Makeconfig immediately after defining
	subdir.
	* math/Makefile: Likewise.
	* misc/Makefile: Likewise.
	* nis/Makefile: Likewise.
	* nss/Makefile: Likewise.
	* po/Makefile: Likewise.
	(all): Remove target.
	* posix/Makefile: Include Makeconfig immediately after defining
	subdir.
	* pwd/Makefile: Likewise.
	* resolv/Makefile: Likewise.
	* resource/Makefile: Likewise.
	* rt/Makefile: Likewise.
	* setjmp/Makefile: Likewise.
	* shadow/Makefile: Likewise.
	* signal/Makefile: Likewise.
	* socket/Makefile: Likewise.
	* soft-fp/Makefile: Likewise.
	* stdio-common/Makefile: Likewise.
	* stdlib/Makefile: Likewise.
	* streams/Makefile: Likewise.
	* string/Makefile: Likewise.
	* sunrpc/Makefile: Likewise.
	(all): Remove target.
	* sysvipc/Makefile: Include Makeconfig immediately after defining
	subdir.
	* termios/Makefile: Likewise.
	* time/Makefile: Likewise.
	* timezone/Makefile: Likewise.
	(all): Remove target.
	* wcsmbs/Makefile: Include Makeconfig immediately after defining
	subdir.
	* wctype/Makefile: Likewise.

libidn/ChangeLog:
	* Makefile: Include Makeconfig immediately after defining subdir.

localedata/ChangeLog:
	* Makefile: Include Makeconfig immediately after defining subdir.
	(all): Remove target.

nptl/ChangeLog:
	* Makefile: Include Makeconfig immediately after defining subdir.

nptl_db/ChangeLog:
	* Makefile: Include Makeconfig immediately after defining subdir.
2014-02-26 23:12:03 +00:00
Roland McGrath 098ad55cf5 Remove unused %include lines from Versions files. 2014-02-22 00:58:54 -08:00
Joseph Myers f0881698bf Generate .test-result files for tests with special rules.
This patch, an updated version of
<https://sourceware.org/ml/libc-alpha/2014-01/msg00194.html> now
proposed for inclusion in glibc, extends the generation of PASS and
FAIL status in .test-result files for individual tests to cover tests
with their own custom makefile rules.  This is just adding
$(evaluate-test) calls to all such rules, since tests with multiple
commands were previously split into separate tests.

Note that the tests the makefiles expect to fail (posix/annexc and
conformtest) currently get FAIL listed in the .test-result file,
rather than XFAIL; a subsequent patch will introduce a better XFAIL
mechanism.

Tested x86_64.

	* Makefile ($(objpfx)c++-types-check.out): Use $(evaluate-test).
	($(objpfx)check-local-headers.out): Likewise.
	($(objpfx)begin-end-check.out): Likewise.
	* Makerules (check-abi-%.out): Likewise.
	* catgets/Makefile ($(objpfx)test1.cat): Likewise.
	($(objpfx)test2.cat): Likewise.
	($(objpfx)de/libc.cat): Likewise.
	($(objpfx)test-gencat.out): Likewise.
	* conform/Makefile ($(objpfx)run-conformtest.out): Likewise.
	* elf/Makefile ($(objpfx)order-cmp.out): Likewise.
	($(objpfx)noload-mem): Likewise.
	($(objpfx)tst-pathopt.out): Likewise.
	($(objpfx)tst-rtld-load-self.out): Likewise.
	($(objpfx)tst-array1-cmp.out): Likewise.
	($(objpfx)tst-array1-static-cmp.out): Likewise.
	($(objpfx)tst-array2-cmp.out): Likewise.
	($(objpfx)tst-array3-cmp.out): Likewise.
	($(objpfx)tst-array4-cmp.out): Likewise.
	($(objpfx)tst-array5-cmp.out): Likewise.
	($(objpfx)tst-array5-static-cmp.out): Likewise.
	($(objpfx)check-textrel.out): Likewise.
	($(objpfx)check-execstack.out): Likewise.
	($(objpfx)check-localplt.out): Likewise.
	($(objpfx)order2-cmp.out): Likewise.
	($(objpfx)tst-leaks1-mem): Likewise.
	($(objpfx)tst-leaks1-static-mem): Likewise.
	($(objpfx)tst-initorder-cmp.out): Likewise.
	($(objpfx)tst-initorder2-cmp.out): Likewise.
	($(objpfx)tst-unused-dep.out): Likewise.
	($(objpfx)tst-unused-dep-cmp.out): Likewise.
	* grp/Makefile ($(objpfx)tst_fgetgrent.out): Likewise.
	* iconv/Makefile (test-iconvconfig): Likewise.
	* iconvdata/Makefile ($(objpfx)mtrace-tst-loading): Likewise.
	($(objpfx)iconv-test.out): Likewise.
	($(objpfx)tst-tables.out): Likewise.
	* intl/Makefile ($(objpfx)mtrace-tst-gettext): Likewise.
	($(objpfx)tst-gettext.out): Likewise.
	($(objpfx)tst-translit.out): Likewise.
	($(objpfx)tst-gettext2.out): Likewise.
	($(objpfx)tst-gettext4.out): Likewise.
	($(objpfx)tst-gettext6.out): Likewise.
	* io/Makefile ($(objpfx)ftwtest.out): Likewise.
	* libio/Makefile ($(objpfx)test-freopen.out): Likewise.
	($(objpfx)tst-fopenloc-cmp.out): Likewise.
	($(objpfx)tst-fopenloc-mem.out): Likewise.
	* malloc/Makefile ($(objpfx)tst-mtrace.out): Likewise.
	* misc/Makefile ($(objpfx)tst-error1-mem): Likewise.
	* posix/Makefile ($(objpfx)globtest.out): Likewise.
	($(objpfx)wordexp-tst.out): Likewise.
	($(objpfx)annexc.out): Likewise.
	($(objpfx)tst-fnmatch-mem): Likewise.
	($(objpfx)bug-regex2-mem): Likewise.
	($(objpfx)bug-regex14-mem): Likewise.
	($(objpfx)bug-regex21-mem): Likewise.
	($(objpfx)bug-regex31-mem): Likewise.
	($(objpfx)tst-vfork3-mem): Likewise.
	($(objpfx)tst-rxspencer-no-utf8-mem): Likewise.
	($(objpfx)tst-pcre-mem): Likewise.
	($(objpfx)tst-boost-mem): Likewise.
	($(objpfx)tst-getconf.out): Likewise.
	($(objpfx)bug-ga2-mem): Likewise.
	($(objpfx)bug-glob2-mem): Likewise.
	* resolv/Makefile ($(objpfx)mtrace-tst-leaks): Likewise.
	($(objpfx)mtrace-tst-leaks2): Likewise.
	* stdio-common/Makefile ($(objpfx)tst-unbputc.out): Likewise.
	($(objpfx)tst-printf.out): Likewise.
	($(objpfx)tst-setvbuf1.out): Likewise.
	($(objpfx)tst-setvbuf1-cmp.out): Likewise.
	* stdlib/Makefile ($(objpfx)isomac.out): Likewise.
	($(objpfx)tst-fmtmsg.out): Likewise.
	* string/Makefile ($(objpfx)tst-svc-cmp.out): Likewise.
	* sysdeps/x86/Makefile ($(objpfx)tst-xmmymm.out): Likewise.

localedata:
	* Makefile ($(objpfx)sort-test.out): Use $(evaluate-test).
	($(objpfx)tst-fmon.out): Likewise.
	($(objpfx)tst-numeric.out): Likewise.
	($(objpfx)tst-locale.out): Likewise.
	($(objpfx)tst-rpmatch.out): Likewise.
	($(objpfx)tst-trans.out): Likewise.
	($(objpfx)tst-mbswcs.out): Likewise.
	($(objpfx)tst-ctype.out): Likewise.
	($(objpfx)tst-wctype.out): Likewise.
	($(objpfx)tst-langinfo.out): Likewise.
	($(objpfx)mtrace-tst-leaks): Likewise.

nptl:
	* Makefile ($(objpfx)tst-stack3-mem): Use $(evaluate-test).
	($(objpfx)tst-tls6.out): Likewise.
	($(objpfx)tst-cleanup0.out): Likewise.
	($(objpfx)tst-cleanup0-cmp.out): Likewise.
	($(objpfx)tst-cancel-wrappers.out): Likewise.
	($(objpfx)tst-oddstacklimit.out): Likewise.

nptl_db:
	* Makefile ($(objpfx)db-symbols.out): Use
	$(evaluate-test).
2014-02-21 21:48:08 +00:00
Joseph Myers acd7f096d7 Complete _BSD_SOURCE / _SVID_source followup cleanup.
This patch completes the headers cleanup consequent on removal of
_BSD_SOURCE and _SVID_SOURCE (apart from any subsequent deprecations):

* #endif conditionals that referred to BSD or SVID are updated.

* Redundant __USE_* tests in cases involving __USE_MISC are removed.
  This includes cases such as __USE_MISC || __USE_ISOC99, where
  __USE_MISC is redundant (because __USE_MISC is only ever defined in
  the default / _DEFAULT_SOURCE / _GNU_SOURCE case, when __USE_ISOC99
  is also defined; the same applies to the non-XSI-extended POSIX
  versions), and cases involving __USE_GNU, where __USE_GNU is
  redundant (because if __USE_GNU is defined, so are the other __USE_*
  macros).  There may well be other cases of __USE_FOO || __USE_BAR
  tests that could be simplified because one macro implies the other;
  this patch only addresses cases involving __USE_MISC.

Tested x86_64.

	* bits/fcntl.h [__USE_MISC]: Remove redundant conditionals.
	* bits/sigaction.h [__USE_MISC]: Likewise.
	* bits/waitstatus.h: Update #endif comments.
	* ctype/ctype.h: Likewise.
	* dirent/dirent.h: Likewise.
	[__USE_MISC]: Remove redundant conditionals.
	* grp/grp.h: Update #endif comments.
	[__USE_GNU]: Remove redundant conditionals.
	[__USE_MISC]: Likewise.
	* inet/netinet/in.h [__USE_GNU]: Likewise.
	* io/sys/stat.h [__USE_MISC]: Likewise.
	* libio/bits/stdio-ldbl.h [__USE_MISC]: Likewise.
	* libio/bits/stdio.h: Update #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	* libio/bits/stdio2.h [__USE_MISC]: Likewise.
	* libio/stdio.h: Update #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	* math/bits/math-finite.h [__USE_MISC]: Likewise.
	* math/bits/mathcalls.h [__USE_MISC]: Likewise.
	* math/math.h: Update #else and #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	* misc/sys/uio.h: Update #endif comments.
	* posix/bits/unistd.h [__USE_MISC]: Remove redundant conditionals.
	* posix/glob.h [__USE_MISC]: Likewise.
	* posix/sys/types.h: Update #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	* posix/sys/wait.h: Update #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	* posix/unistd.h: Update #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	* pwd/pwd.h [__USE_GNU]: Likewise.
	[__USE_MISC]: Likewise.
	* resolv/netdb.h [__USE_GNU]: Likewise.
	* signal/signal.h: Update #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	* stdlib/stdlib.h: Update #else and #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	[__USE_GNU]: Likewise.
	* string/bits/string2.h [__USE_MISC]: Likewise.
	* string/string.h: Update #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	* sysdeps/m68k/m680x0/fpu/bits/mathinline.h [__USE_MISC]:
	Likewise.
	* sysdeps/mach/hurd/bits/fcntl.h [__USE_MISC]: Likewise.
	* sysdeps/mach/hurd/bits/stat.h [__USE_MISC]: Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/sigaction.h [__USE_MISC]:
	Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/stat.h [__USE_MISC]:
	Likewise.
	* sysdeps/unix/sysv/linux/bits/fcntl-linux.h: Update #endif
	comments.
	[__USE_MISC]: Remove redundant conditionals.
	* sysdeps/unix/sysv/linux/bits/in.h [__USE_GNU]: Likewise.
	* sysdeps/unix/sysv/linux/bits/sigaction.h [__USE_MISC]: Likewise.
	* sysdeps/unix/sysv/linux/bits/socket.h [__USE_GNU]: Likewise.
	* sysdeps/unix/sysv/linux/bits/stat.h [__USE_MISC]: Likewise.
	* sysdeps/unix/sysv/linux/ia64/bits/sigaction.h [__USE_MISC]:
	Likewise.
	* sysdeps/unix/sysv/linux/m68k/bits/stat.h [__USE_MISC]: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/sigaction.h [__USE_MISC]:
	Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/stat.h [__USE_MISC]: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/stat.h [__USE_MISC]:
	Likewise.
	* sysdeps/unix/sysv/linux/s390/bits/sigaction.h [__USE_MISC]:
	Likewise.
	* sysdeps/unix/sysv/linux/s390/bits/stat.h [__USE_MISC]: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/sigaction.h [__USE_MISC]:
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/stat.h [__USE_MISC]:
	Likewise.
	* sysdeps/unix/sysv/linux/x86/bits/stat.h [__USE_MISC]: Likewise.
	* sysdeps/x86/bits/string.h: Update #endif comments.
	* sysdeps/x86/fpu/bits/mathinline.h [__USE_MISC]: Remove redundant
	conditionals.
	* time/sys/time.h: Update #endif comments.
	* time/time.h: Likewise.
	[__USE_MISC]: Remove redundant conditionals.
2014-02-21 21:45:26 +00:00
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
Ulrich Drepper 312be3f9f5 Clean up internal fopen uses
No need to ever not use c and e.
2011-11-15 04:24:42 -05:00
Ulrich Drepper 9694fc4479 Avoid unused warning in getaddrinfo_a 2011-11-12 02:30:01 -05:00
Joseph Myers e057a1b593 Link libresolv.so with ld.so for __stack_chk_guard. 2011-09-21 13:27:50 -07:00
Ulrich Drepper d063d16433 Remove support for !USE___THREAD 2011-09-10 16:50:28 -04:00
Ulrich Drepper 3ce1f29594 Cleanup of configuration options
Make several tool features mandatory and simplify the code.
2011-09-10 14:34:15 -04:00
Ulrich Drepper 44f0a71e58 Add rules to build libresolv with SSP flags 2011-08-17 21:36:23 -04:00
Andreas Schwab 9be9bfcc9d Properly tokenize nameserver line for servers with IPv6 address 2011-08-04 15:50:48 -04:00
Andreas Schwab 28b59fca7a Use size_t for strlen results 2011-07-20 11:40:37 -04:00
Andreas Jaeger c75fa153a9 Fix warnings in resolver code 2011-07-06 22:29:45 -04:00
Ulrich Drepper 57912a71cc Fix typo in recent resolver change which causes segvs 2011-06-15 22:43:58 -04:00
Roland McGrath 5615eaf264 Quash some new warnings from GCC 4.6. 2011-06-10 22:44:20 -07:00
Ulrich Drepper 4769ae77fc Handle DNS server failures in case of AF_UNSPEC lookups correctly 2011-05-30 22:48:47 -04:00
Ulrich Drepper 652ffab113 Make resolv.conf parsing more compact 2011-05-29 22:07:49 -04:00
Ulrich Drepper 16985fd0c7 Recognize use-vc option in resolv.conf 2011-05-29 21:43:33 -04:00
Ulrich Drepper f87dfb1f11 Backport BIND code to query name as TLD. 2011-05-07 13:05:19 -04:00
Andreas Schwab 597df64714 Install rpc/netdb.h again 2011-05-06 07:46:42 -04:00
Andreas Schwab 4e34d5f589 Don't use removed rpc headers 2011-05-05 07:36:40 -04:00
Bruno Haible e4ecafe004 Fix getnameinfo flags parameter type. 2011-05-01 21:36:43 -04:00
Andreas Schwab a769081960 Don't ignore zero TTL in DNS answers 2010-11-25 20:50:16 -05:00
Ulrich Drepper e66e7419a6 Actually make it possible to user the default name server. 2010-09-14 00:01:42 -07:00
Ulrich Drepper df24a73ecd Missing server address again leads to localhost being used 2010-08-25 07:43:53 -07:00
Ulrich Drepper ea42a20cae Fix crash on reloading of gai data in nscd. 2010-04-09 21:38:20 -07:00
Ulrich Drepper 4535680d03 Handle DNS timeouts in old-style lookkup code. 2010-04-05 12:21:20 -07:00
Ulrich Drepper 2cd9670885 Declare iruserok and iruserok_af. 2010-04-04 22:01:52 -07:00
Andreas Schwab 94308fd0e0 Fix debug statements in resolver 2010-03-17 06:57:38 -07:00
Yann Droneaud a092b645f8 Fix DEBUG statements in resolv/res_send.c 2010-03-05 16:52:31 -08:00
Ulrich Drepper ace4e23f8c Always use IPv4 sockets for IPv4 addresses. 2010-01-14 22:34:28 -08:00
Ulrich Drepper 52e2ea9a83 Relax visibility of some more declaration. 2010-01-14 13:22:06 -08:00
Ulrich Drepper 63ee841069 Relax condition for resolver constant definition. 2010-01-14 10:05:36 -08:00
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
Ulrich Drepper 65b4743a61 [BZ #5790]
2008-02-25  Jakub Jelinek  <jakub@redhat.com>
	[BZ #5790]
	* resolv/nss_dns/dns-host.c (_nss_dns_gethostbyaddr2_r): Don't
	overwrite *h_errnop/*errnop values from getanswer_r in case of
	failure.
2008-03-04 15:25:19 +00:00
Ulrich Drepper c913639332 [BZ #5737]
2008-02-15  Ulrich Drepper  <drepper@redhat.com>
	[BZ #5737]
	* resolv/netdb.h: Make NI_MAXHOST and NI_MAXSERV available when
	__USE_MISC is defined.
2008-02-15 15:49:15 +00:00