Commit Graph

700 Commits

Author SHA1 Message Date
Nobody 790298dd8d glibc with MCST patches (25.014.1) 2022-08-11 21:25:08 +03:00
Florian Weimer 108bc4049f CVE-2016-10739: getaddrinfo: Fully parse IPv4 address strings [BZ #20018]
The IPv4 address parser in the getaddrinfo function is changed so that
it does not ignore trailing whitespace and all characters after it.
For backwards compatibility, the getaddrinfo function still recognizes
legacy name syntax, such as 192.000.002.010 interpreted as 192.0.2.8
(octal).

This commit does not change the behavior of inet_addr and inet_aton.
gethostbyname already had additional sanity checks (but is switched
over to the new __inet_aton_exact function for completeness as well).

To avoid sending the problematic query names over DNS, commit
6ca53a2453 ("resolv: Do not send queries
for non-host-names in nss_dns [BZ #24112]") is needed.
2019-01-21 21:26:03 +01:00
Florian Weimer 6ca53a2453 resolv: Do not send queries for non-host-names in nss_dns [BZ #24112]
Before this commit, nss_dns would send a query which did not contain a
host name as the query name (such as invalid\032name.example.com) and
then reject the answer in getanswer_r and gaih_getanswer_slice, using
a check based on res_hnok.  With this commit, no query is sent, and a
host-not-found error is returned to NSS without network interaction.
2019-01-21 09:26:41 +01:00
Florian Weimer 5e30b8ef07 resolv: Reformat inet_addr, inet_aton to GNU style 2019-01-21 08:59:42 +01:00
Andreas K. Hüttel 5494af04ad resolv: IDNA tests: AAAA (28) is valid, no fallthrough to default 2019-01-10 12:22:56 +01:00
Joseph Myers 04277e02d7 Update copyright dates with scripts/update-copyrights.
* All files with FSF copyright notices: Update copyright dates
	using scripts/update-copyrights.
	* locale/programs/charmap-kw.h: Regenerated.
	* locale/programs/locfile-kw.h: Likewise.
2019-01-01 00:11:28 +00:00
Alexandra Hájková ac8060265b Add an additional test to resolv/tst-resolv-network.c
Test for the infinite loop in getnetbyname, bug #17630.
2018-11-08 13:47:34 +01:00
Andreas Schwab bd3b0fbae3 libanl: properly cleanup if first helper thread creation failed (bug 22927) 2018-11-05 14:48:24 +01:00
Carlos O'Donell 2827ab990a libc: Extend __libc_freeres framework (Bug 23329).
The __libc_freeres framework does not extend to non-libc.so objects.
This causes problems in general for valgrind and mtrace detecting
unfreed objects in both libdl.so and libpthread.so.  This change is
a pre-requisite to properly moving the malloc hooks out of malloc
since such a move now requires precise accounting of all allocated
data before destructors are run.

This commit adds a proper hook in libc.so.6 for both libdl.so and
for libpthread.so, this ensures that shm-directory.c which uses
freeit () to free memory is called properly.  We also remove the
nptl_freeres hook and fall back to using weak-ref-and-check idiom
for a loaded libpthread.so, thus making this process similar for
all DSOs.

Lastly we follow best practice and use explicit free calls for
both libdl.so and libpthread.so instead of the generic hook process
which has undefined order.

Tested on x86_64 with no regressions.

Signed-off-by: DJ Delorie <dj@redhat.com>
Signed-off-by: Carlos O'Donell <carlos@redhat.com>
2018-06-29 22:39:06 -04:00
Florian Weimer 124e025864 Run thread shutdown functions in an explicit order
This removes the __libc_thread_subfreeres hook in favor of explict
calls.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2018-06-26 15:27:12 +02:00
Florian Weimer 7f9f1ecb71 Switch IDNA implementation to libidn2 [BZ #19728] [BZ #19729] [BZ #22247]
This provides an implementation of the IDNA2008 standard and fixes
CVE-2016-6261, CVE-2016-6263, CVE-2017-14062.
2018-05-23 15:27:24 +02:00
Andreas Schwab dae6c43c33 Remove unneeded setting of errno after malloc failure
The errno value has alread been set by malloc.
2018-05-17 15:47:25 +02:00
Florian Weimer 583a27d525 resolv: Fully initialize struct mmsghdr in send_dg [BZ #23037] 2018-04-09 10:08:16 +02:00
Samuel Thibault 33574c17ee hurd: Add hurd thread library
Contributed by

Agustina Arzille <avarzille@riseup.net>
Amos Jeffries <squid3@treenet.co.nz>
David Michael <fedora.dm0@gmail.com>
Marco Gerards <marco@gnu.org>
Marcus Brinkmann <marcus@gnu.org>
Neal H. Walfield <neal@gnu.org>
Pino Toscano <toscano.pino@tiscali.it>
Richard Braun <rbraun@sceen.net>
Roland McGrath <roland@gnu.org>
Samuel Thibault <samuel.thibault@ens-lyon.org>
Thomas DiModica <ricinwich@yahoo.com>
Thomas Schwinge <tschwinge@gnu.org>

	* htl: New directory.
	* sysdeps/htl: New directory.
	* sysdeps/hurd/htl: New directory.
	* sysdeps/i386/htl: New directory.
	* sysdeps/mach/htl: New directory.
	* sysdeps/mach/hurd/htl: New directory.
	* sysdeps/mach/hurd/i386/htl: New directory.
	* nscd/Depend, resolv/Depend, rt/Depend: Add htl dependency.
	* sysdeps/mach/hurd/i386/Implies: Add mach/hurd/i386/htl imply.
	* sysdeps/mach/hurd/i386/libpthread.abilist: New file.
2018-04-02 01:44:14 +02:00
Andreas Schwab f178e59fa5 Fix crash in resolver on memory allocation failure (bug 23005) 2018-03-27 17:26:32 +02:00
Samuel Thibault 3538a4b6c3 hurd: fix warning
* resolv/res-close.c: Include <stdlib.h>.
2018-01-27 16:43:16 +01:00
Florian Weimer 401311cfba resolv: Support binary labels in test framework
The old implementation based on hsearch_r used an ad-hoc C string
encoding and produced an incorrect format on the wire for domain
names which contained bytes which needed escaping when printed.

This commit switches to ns_name_pton for the wire format conversion
(now that we have separate tests for it) and uses a tsearch tree
with a suitable comparison function to locate compression targets.
2018-01-08 20:07:24 +01:00
Joseph Myers ba374b6dec Increase some test timeouts.
This patch increases timeouts on three tests I observed timing out on
slow systems.

	* malloc/tst-malloc-tcache-leak.c (TIMEOUT): Define to 50.
	* posix/tst-glob-tilde.c (TIMEOUT): Define to 200.
	* resolv/tst-resolv-res_ninit.c (TIMEOUT): Define to 50.
2018-01-04 21:58:40 +00:00
Joseph Myers 688903eb3e Update copyright dates with scripts/update-copyrights.
* All files with FSF copyright notices: Update copyright dates
	using scripts/update-copyrights.
	* locale/programs/charmap-kw.h: Regenerated.
	* locale/programs/locfile-kw.h: Likewise.
2018-01-01 00:32:25 +00:00
H.J. Lu 36975e8e7e Replace = with += in CFLAGS-xxx.c/CPPFLAGS-xxx.c
Replace = with += in CFLAGS-xxx.c and CPPFLAGS-xxx.c to allow Makefile
under sysdeps to define CFLAGS-xx.c and CPPFLAGS-xxx.c.

	* argp/Makefile (CFLAGS-argp-help.c): Replace = with +=.
	(CFLAGS-argp-parse.c): Likewise.
	(CFLAGS-argp-fmtstream.c): Likewise.
	* crypt/Makefile (CPPFLAGS-sha256-crypt.c): Likewise.
	(CPPFLAGS-sha512-crypt.c): Likewise.
	(CPPFLAGS-md5-crypt.c): Likewise.
	* debug/Makefile (CFLAGS-stack_chk_fail.c): Likewise.
	(CFLAGS-stack_chk_fail_local.c): Likewise.
	(CFLAGS-backtrace.c): Likewise.
	(CFLAGS-sprintf_chk.c): Likewise.
	(CFLAGS-snprintf_chk.c): Likewise.
	(CFLAGS-vsprintf_chk.c): Likewise.
	(CFLAGS-vsnprintf_chk.c): Likewise.
	(CFLAGS-asprintf_chk.c): Likewise.
	(CFLAGS-vasprintf_chk.c): Likewise.
	(CFLAGS-obprintf_chk.c): Likewise.
	(CFLAGS-dprintf_chk.c): Likewise.
	(CFLAGS-vdprintf_chk.c): Likewise.
	(CFLAGS-printf_chk.c): Likewise.
	(CFLAGS-fprintf_chk.c): Likewise.
	(CFLAGS-vprintf_chk.c): Likewise.
	(CFLAGS-vfprintf_chk.c): Likewise.
	(CFLAGS-gets_chk.c): Likewise.
	(CFLAGS-fgets_chk.c): Likewise.
	(CFLAGS-fgets_u_chk.c): Likewise.
	(CFLAGS-fread_chk.c): Likewise.
	(CFLAGS-fread_u_chk.c): Likewise.
	(CFLAGS-swprintf_chk.c): Likewise.
	(CFLAGS-vswprintf_chk.c): Likewise.
	(CFLAGS-wprintf_chk.c): Likewise.
	(CFLAGS-fwprintf_chk.c): Likewise.
	(CFLAGS-vwprintf_chk.c): Likewise.
	(CFLAGS-vfwprintf_chk.c): Likewise.
	(CFLAGS-fgetws_chk.c): Likewise.
	(CFLAGS-fgetws_u_chk.c): Likewise.
	(CFLAGS-read_chk.c): Likewise.
	(CFLAGS-pread_chk.c): Likewise.
	(CFLAGS-pread64_chk.c): Likewise.
	(CFLAGS-recv_chk.c): Likewise.
	(CFLAGS-recvfrom_chk.c): Likewise.
	(CFLAGS-tst-longjmp_chk.c): Likewise.
	(CPPFLAGS-tst-longjmp_chk.c): Likewise.
	(CFLAGS-tst-longjmp_chk2.c): Likewise.
	(CPPFLAGS-tst-longjmp_chk2.c): Likewise.
	(CFLAGS-tst-longjmp_chk3.c): Likewise.
	(CPPFLAGS-tst-longjmp_chk3.c): Likewise.
	(CFLAGS-tst-chk1.c): Likewise.
	(CFLAGS-tst-chk2.c): Likewise.
	(CFLAGS-tst-chk3.c): Likewise.
	(CFLAGS-tst-chk4.cc): Likewise.
	(CFLAGS-tst-chk5.cc): Likewise.
	(CFLAGS-tst-chk6.cc): Likewise.
	(CFLAGS-tst-lfschk1.c): Likewise.
	(CFLAGS-tst-lfschk2.c): Likewise.
	(CFLAGS-tst-lfschk3.c): Likewise.
	(CFLAGS-tst-lfschk4.cc): Likewise.
	(CFLAGS-tst-lfschk5.cc): Likewise.
	(CFLAGS-tst-lfschk6.cc): Likewise.
	(CFLAGS-tst-ssp-1.c): Likewise.
	* dirent/Makefile (CFLAGS-scandir.c): Likewise.
	(CFLAGS-scandir64.c): Likewise.
	(CFLAGS-scandir-tail.c): Likewise.
	(CFLAGS-scandir64-tail.c): Likewise.
	* elf/Makefile (CPPFLAGS-dl-tunables.c): Likewise.
	(CFLAGS-dl-tunables.c): Likewise.
	(CFLAGS-dl-runtime.c): Likewise.
	(CFLAGS-dl-lookup.c): Likewise.
	(CFLAGS-dl-iterate-phdr.c): Likewise.
	(CFLAGS-vismain.c): Likewise.
	(CFLAGS-tst-linkall-static.c): Likewise.
	(CFLAGS-tst-linkall-static.c): Likewise.
	(CPPFLAGS-dl-load.c): Likewise.
	(CFLAGS-ldconfig.c): Likewise.
	(CFLAGS-dl-cache.c): Likewise.
	(CFLAGS-cache.c): Likewise.
	(CFLAGS-rtld.c): Likewise.
	(CFLAGS-multiload.c): Likewise.
	(CFLAGS-filtmod1.c): Likewise.
	(CFLAGS-tst-align.c): Likewise.
	(CFLAGS-tst-align2.c): Likewise.
	(CFLAGS-tst-alignmod.c): Likewise.
	(CFLAGS-tst-alignmod2.c): Likewise.
	(CPPFLAGS-tst-execstack.c): Likewise.
	(CFLAGS-tst-ptrguard1-static.c): Likewise.
	(CFLAGS-tst-latepthreadmod.c): Likewise.
	* grp/Makefile (CFLAGS-getgrgid_r.c): Likewise.
	(CFLAGS-getgrnam_r.c): Likewise.
	(CFLAGS-getgrent_r.c): Likewise.
	(CFLAGS-getgrent.c): Likewise.
	(CFLAGS-fgetgrent.c): Likewise.
	(CFLAGS-fgetgrent_r.c): Likewise.
	(CFLAGS-putgrent.c): Likewise.
	(CFLAGS-initgroups.c): Likewise.
	(CFLAGS-getgrgid.c): Likewise.
	* gshadow/Makefile (CFLAGS-getsgent_r.c): Likewise.
	(CFLAGS-getsgent.c): Likewise.
	(CFLAGS-fgetsgent.c): Likewise.
	(CFLAGS-fgetsgent_r.c): Likewise.
	(CFLAGS-putsgent.c): Likewise.
	(CFLAGS-getsgnam.c): Likewise.
	(CFLAGS-getsgnam_r.c): Likewise.
	* iconv/Makefile (CFLAGS-iconv_prog.c): Likewise.
	(CFLAGS-iconv_charmap.c): Likewise.
	(CFLAGS-dummy-repertoire.c): Likewise.
	(CFLAGS-charmap.c): Likewise.
	(CFLAGS-linereader.c): Likewise.
	(CFLAGS-simple-hash.c): Likewise.
	(CFLAGS-gconv_conf.c): Likewise.
	(CFLAGS-iconvconfig.c): Likewise.
	* inet/Makefile (CFLAGS-gethstbyad_r.c): Likewise.
	(CFLAGS-gethstbyad.c): Likewise.
	(CFLAGS-gethstbynm_r.c): Likewise.
	(CFLAGS-gethstbynm.c): Likewise.
	(CFLAGS-gethstbynm2_r.c): Likewise.
	(CFLAGS-gethstbynm2.c): Likewise.
	(CFLAGS-gethstent_r.c): Likewise.
	(CFLAGS-gethstent.c): Likewise.
	(CFLAGS-rcmd.c): Likewise.
	(CFLAGS-getnetbynm_r.c): Likewise.
	(CFLAGS-getnetbynm.c): Likewise.
	(CFLAGS-getnetbyad_r.c): Likewise.
	(CFLAGS-getnetbyad.c): Likewise.
	(CFLAGS-getnetent_r.c): Likewise.
	(CFLAGS-getnetent.c): Likewise.
	(CFLAGS-getaliasent_r.c): Likewise.
	(CFLAGS-getaliasent.c): Likewise.
	(CFLAGS-getrpcent_r.c): Likewise.
	(CFLAGS-getrpcent.c): Likewise.
	(CFLAGS-getservent_r.c): Likewise.
	(CFLAGS-getservent.c): Likewise.
	(CFLAGS-getprtent_r.c): Likewise.
	(CFLAGS-getprtent.c): Likewise.
	(CFLAGS-either_ntoh.c): Likewise.
	(CFLAGS-either_hton.c): Likewise.
	(CFLAGS-getnetgrent.c): Likewise.
	(CFLAGS-getnetgrent_r.c): Likewise.
	(CFLAGS-tst-checks-posix.c): Likewise.
	(CFLAGS-tst-sockaddr.c): Likewise.
	* intl/Makefile (CFLAGS-tst-gettext.c): Likewise.
	(CFLAGS-tst-translit.c): Likewise.
	(CFLAGS-tst-gettext2.c): Likewise.
	(CFLAGS-tst-codeset.c): Likewise.
	(CFLAGS-tst-gettext3.c): Likewise.
	(CFLAGS-tst-gettext4.c): Likewise.
	(CFLAGS-tst-gettext5.c): Likewise.
	(CFLAGS-tst-gettext6.c): Likewise.
	* io/Makefile (CFLAGS-open.c): Likewise.
	(CFLAGS-open64.c): Likewise.
	(CFLAGS-creat.c): Likewise.
	(CFLAGS-creat64.c): Likewise.
	(CFLAGS-fcntl.c): Likewise.
	(CFLAGS-poll.c): Likewise.
	(CFLAGS-ppoll.c): Likewise.
	(CFLAGS-lockf.c): Likewise.
	(CFLAGS-statfs.c): Likewise.
	(CFLAGS-fstatfs.c): Likewise.
	(CFLAGS-statvfs.c): Likewise.
	(CFLAGS-fstatvfs.c): Likewise.
	(CFLAGS-fts.c): Likewise.
	(CFLAGS-fts64.c): Likewise.
	(CFLAGS-ftw.c): Likewise.
	(CFLAGS-ftw64.c): Likewise.
	(CFLAGS-lockf.c): Likewise.
	(CFLAGS-posix_fallocate.c): Likewise.
	(CFLAGS-posix_fallocate64.c): Likewise.
	(CFLAGS-fallocate.c): Likewise.
	(CFLAGS-fallocate64.c): Likewise.
	(CFLAGS-read.c): Likewise.
	(CFLAGS-write.c): Likewise.
	(CFLAGS-test-stat.c): Likewise.
	(CFLAGS-test-lfs.c): Likewise.
	* libio/Makefile (CFLAGS-fileops.c): Likewise.
	(CFLAGS-fputc.c): Likewise.
	(CFLAGS-fputwc.c): Likewise.
	(CFLAGS-freopen64.c): Likewise.
	(CFLAGS-freopen.c): Likewise.
	(CFLAGS-fseek.c): Likewise.
	(CFLAGS-fseeko64.c): Likewise.
	(CFLAGS-fseeko.c): Likewise.
	(CFLAGS-ftello64.c): Likewise.
	(CFLAGS-ftello.c): Likewise.
	(CFLAGS-fwide.c): Likewise.
	(CFLAGS-genops.c): Likewise.
	(CFLAGS-getc.c): Likewise.
	(CFLAGS-getchar.c): Likewise.
	(CFLAGS-getwc.c): Likewise.
	(CFLAGS-getwchar.c): Likewise.
	(CFLAGS-iofclose.c): Likewise.
	(CFLAGS-iofflush.c): Likewise.
	(CFLAGS-iofgetpos64.c): Likewise.
	(CFLAGS-iofgetpos.c): Likewise.
	(CFLAGS-iofgets.c): Likewise.
	(CFLAGS-iofgetws.c): Likewise.
	(CFLAGS-iofputs.c): Likewise.
	(CFLAGS-iofputws.c): Likewise.
	(CFLAGS-iofread.c): Likewise.
	(CFLAGS-iofsetpos64.c): Likewise.
	(CFLAGS-iofsetpos.c): Likewise.
	(CFLAGS-ioftell.c): Likewise.
	(CFLAGS-iofwrite.c): Likewise.
	(CFLAGS-iogetdelim.c): Likewise.
	(CFLAGS-iogetline.c): Likewise.
	(CFLAGS-iogets.c): Likewise.
	(CFLAGS-iogetwline.c): Likewise.
	(CFLAGS-ioputs.c): Likewise.
	(CFLAGS-ioseekoff.c): Likewise.
	(CFLAGS-ioseekpos.c): Likewise.
	(CFLAGS-iosetbuffer.c): Likewise.
	(CFLAGS-iosetvbuf.c): Likewise.
	(CFLAGS-ioungetc.c): Likewise.
	(CFLAGS-ioungetwc.c): Likewise.
	(CFLAGS-oldfileops.c): Likewise.
	(CFLAGS-oldiofclose.c): Likewise.
	(CFLAGS-oldiofgetpos64.c): Likewise.
	(CFLAGS-oldiofgetpos.c): Likewise.
	(CFLAGS-oldiofsetpos64.c): Likewise.
	(CFLAGS-oldiofsetpos.c): Likewise.
	(CFLAGS-peekc.c): Likewise.
	(CFLAGS-putc.c): Likewise.
	(CFLAGS-putchar.c): Likewise.
	(CFLAGS-putwc.c): Likewise.
	(CFLAGS-putwchar.c): Likewise.
	(CFLAGS-rewind.c): Likewise.
	(CFLAGS-wfileops.c): Likewise.
	(CFLAGS-wgenops.c): Likewise.
	(CFLAGS-oldiofopen.c): Likewise.
	(CFLAGS-iofopen.c): Likewise.
	(CFLAGS-iofopen64.c): Likewise.
	(CFLAGS-oldtmpfile.c): Likewise.
	(CFLAGS-tst_putwc.c): Likewise.
	* locale/Makefile (CFLAGS-md5.c): Likewise.
	(CFLAGS-charmap.c): Likewise.
	(CFLAGS-locfile.c): Likewise.
	(CFLAGS-charmap-dir.c): Likewise.
	* login/Makefile (CFLAGS-grantpt.c): Likewise.
	(CFLAGS-getpt.c): Likewise.
	(CFLAGS-pt_chown.c): Likewise.
	* malloc/Makefile (CFLAGS-mcheck-init.c): Likewise.
	(CFLAGS-obstack.c): Likewise.
	* math/Makefile (CFLAGS-test-tgmath3.c): Likewise.
	(CFLAGS-test-double-vlen4-wrappers.c): Likewise.
	(CFLAGS-test-double-vlen8-wrappers.c): Likewise.
	(CFLAGS-test-float-vlen8-wrappers.c): Likewise.
	(CFLAGS-test-float-vlen16-wrappers.c): Likewise.
	(CFLAGS-test-tgmath.c): Likewise.
	(CFLAGS-test-tgmath2.c): Likewise.
	(CFLAGS-test-tgmath-ret.c): Likewise.
	(CFLAGS-test-powl.c): Likewise.
	(CFLAGS-test-snan.c): Likewise.
	(CFLAGS-test-signgam-finite.c): Likewise.
	(CFLAGS-test-signgam-finite-c99.c): Likewise.
	(CFLAGS-test-signgam-finite-c11.c): Likewise.
	(CFLAGS-test-signgam-uchar.c): Likewise.
	(CFLAGS-test-signgam-uchar-init.c): Likewise.
	(CFLAGS-test-signgam-uchar-static.c): Likewise.
	(CFLAGS-test-signgam-uchar-init-static.c): Likewise.
	(CFLAGS-test-signgam-uint.c): Likewise.
	(CFLAGS-test-signgam-uint-init.c): Likewise.
	(CFLAGS-test-signgam-uint-static.c): Likewise.
	(CFLAGS-test-signgam-uint-init-static.c): Likewise.
	(CFLAGS-test-signgam-ullong.c): Likewise.
	(CFLAGS-test-signgam-ullong-init.c): Likewise.
	(CFLAGS-test-signgam-ullong-static.c): Likewise.
	(CFLAGS-test-signgam-ullong-init-static.c): Likewise.
	(CFLAGS-test-math-cxx11.cc): Likewise.
	(CFLAGS-test-math-isinff.cc): Likewise.
	(CFLAGS-test-math-iszero.cc): Likewise.
	(CFLAGS-test-math-issignaling.cc): Likewise.
	(CFLAGS-test-math-iscanonical.cc): Likewise.
	(CFLAGS-test-iszero-excess-precision.c): Likewise.
	(CFLAGS-test-iseqsig-excess-precision.c): Likewise.
	(CFLAGS-test-flt-eval-method.c): Likewise.
	(CFLAGS-test-fe-snans-always-signal.c): Likewise.
	(CFLAGS-test-finite-macros.c): Likewise.
	* misc/Makefile (CFLAGS-select.c): Likewise.
	(CFLAGS-tsearch.c): Likewise.
	(CFLAGS-lsearch.c): Likewise.
	(CFLAGS-pselect.c): Likewise.
	(CFLAGS-readv.c): Likewise.
	(CFLAGS-writev.c): Likewise.
	(CFLAGS-preadv.c): Likewise.
	(CFLAGS-preadv64.c): Likewise.
	(CFLAGS-pwritev.c): Likewise.
	(CFLAGS-pwritev64.c): Likewise.
	(CFLAGS-preadv2.c): Likewise.
	(CFLAGS-preadv64v2.c): Likewise.
	(CFLAGS-pwritev2.c): Likewise.
	(CFLAGS-pwritev64v2.c): Likewise.
	(CFLAGS-usleep.c): Likewise.
	(CFLAGS-syslog.c): Likewise.
	(CFLAGS-error.c): Likewise.
	(CFLAGS-getpass.c): Likewise.
	(CFLAGS-mkstemp.c): Likewise.
	(CFLAGS-mkstemp64.c): Likewise.
	(CFLAGS-getsysstats.c): Likewise.
	(CFLAGS-getusershell.c): Likewise.
	(CFLAGS-err.c): Likewise.
	(CFLAGS-tst-tsearch.c): Likewise.
	(CFLAGS-msync.c): Likewise.
	(CFLAGS-fdatasync.c): Likewise.
	(CFLAGS-fsync.c): Likewise.
	* nptl/Makefile (CFLAGS-nptl-init.c): Likewise.
	(CFLAGS-unwind.c): Likewise.
	(CFLAGS-unwind-forcedunwind.c): Likewise.
	(CFLAGS-pthread_cancel.c): Likewise.
	(CFLAGS-pthread_setcancelstate.c): Likewise.
	(CFLAGS-pthread_setcanceltype.c): Likewise.
	(CFLAGS-cancellation.c): Likewise.
	(CFLAGS-libc-cancellation.c): Likewise.
	(CFLAGS-pthread_exit.c): Likewise.
	(CFLAGS-forward.c): Likewise.
	(CFLAGS-pthread_testcancel.c): Likewise.
	(CFLAGS-pthread_join.c): Likewise.
	(CFLAGS-pthread_timedjoin.c): Likewise.
	(CFLAGS-pthread_once.c): Likewise.
	(CFLAGS-pthread_cond_wait.c): Likewise.
	(CFLAGS-sem_wait.c): Likewise.
	(CFLAGS-sem_timedwait.c): Likewise.
	(CFLAGS-fcntl.c): Likewise.
	(CFLAGS-lockf.c): Likewise.
	(CFLAGS-pread.c): Likewise.
	(CFLAGS-pread64.c): Likewise.
	(CFLAGS-pwrite.c): Likewise.
	(CFLAGS-pwrite64.c): Likewise.
	(CFLAGS-wait.c): Likewise.
	(CFLAGS-waitpid.c): Likewise.
	(CFLAGS-sigwait.c): Likewise.
	(CFLAGS-msgrcv.c): Likewise.
	(CFLAGS-msgsnd.c): Likewise.
	(CFLAGS-tcdrain.c): Likewise.
	(CFLAGS-open.c): Likewise.
	(CFLAGS-open64.c): Likewise.
	(CFLAGS-pause.c): Likewise.
	(CFLAGS-recv.c): Likewise.
	(CFLAGS-send.c): Likewise.
	(CFLAGS-accept.c): Likewise.
	(CFLAGS-sendto.c): Likewise.
	(CFLAGS-connect.c): Likewise.
	(CFLAGS-recvfrom.c): Likewise.
	(CFLAGS-recvmsg.c): Likewise.
	(CFLAGS-sendmsg.c): Likewise.
	(CFLAGS-close.c): Likewise.
	(CFLAGS-read.c): Likewise.
	(CFLAGS-write.c): Likewise.
	(CFLAGS-nanosleep.c): Likewise.
	(CFLAGS-sigsuspend.c): Likewise.
	(CFLAGS-msync.c): Likewise.
	(CFLAGS-fdatasync.c): Likewise.
	(CFLAGS-fsync.c): Likewise.
	(CFLAGS-pt-system.c): Likewise.
	(CFLAGS-tst-cleanup2.c): Likewise.
	(CFLAGS-tst-cleanupx2.c): Likewise.
	(CFLAGS-flockfile.c): Likewise.
	(CFLAGS-ftrylockfile.c): Likewise.
	(CFLAGS-funlockfile.c): Likewise.
	(CFLAGS-tst-initializers1.c): Likewise.
	(CFLAGS-tst-initializers1-c89.c): Likewise.
	(CFLAGS-tst-initializers1-c99.c): Likewise.
	(CFLAGS-tst-initializers1-c11.c): Likewise.
	(CFLAGS-tst-initializers1-gnu89.c): Likewise.
	(CFLAGS-tst-initializers1-gnu99.c): Likewise.
	(CFLAGS-tst-initializers1-gnu11.c): Likewise.
	* nscd/Makefile (CFLAGS-nscd_getpw_r.c): Likewise.
	(CFLAGS-nscd_getgr_r.c): Likewise.
	(CFLAGS-nscd_gethst_r.c): Likewise.
	(CFLAGS-nscd_getai.c): Likewise.
	(CFLAGS-nscd_initgroups.c): Likewise.
	* posix/Makefile (CFLAGS-getaddrinfo.c): Likewise.
	(CFLAGS-pause.c): Likewise.
	(CFLAGS-pread.c): Likewise.
	(CFLAGS-pread64.c): Likewise.
	(CFLAGS-pwrite.c): Likewise.
	(CFLAGS-pwrite64.c): Likewise.
	(CFLAGS-sleep.c): Likewise.
	(CFLAGS-wait.c): Likewise.
	(CFLAGS-waitid.c): Likewise.
	(CFLAGS-waitpid.c): Likewise.
	(CFLAGS-getopt.c): Likewise.
	(CFLAGS-wordexp.c): Likewise.
	(CFLAGS-sysconf.c): Likewise.
	(CFLAGS-pathconf.c): Likewise.
	(CFLAGS-fpathconf.c): Likewise.
	(CFLAGS-spawn.c): Likewise.
	(CFLAGS-spawnp.c): Likewise.
	(CFLAGS-spawni.c): Likewise.
	(CFLAGS-glob.c): Likewise.
	(CFLAGS-glob64.c): Likewise.
	(CFLAGS-getconf.c): Likewise.
	(CFLAGS-nanosleep.c): Likewise.
	* pwd/Makefile (CFLAGS-getpwent_r.c): Likewise.
	(CFLAGS-getpwent.c): Likewise.
	(CFLAGS-getpw.c): Likewise.
	(CFLAGS-fgetpwent_r.c): Likewise.
	* resolv/Makefile (CFLAGS-res_hconf.c): Likewise.
	* rt/Makefile (CFLAGS-aio_suspend.c): Likewise.
	(CFLAGS-mq_timedreceive.c): Likewise.
	(CFLAGS-mq_timedsend.c): Likewise.
	(CFLAGS-clock_nanosleep.c): Likewise.
	(CFLAGS-librt-cancellation.c): Likewise.
	* shadow/Makefile (CFLAGS-getspent_r.c): Likewise.
	(CFLAGS-getspent.c): Likewise.
	(CFLAGS-fgetspent.c): Likewise.
	(CFLAGS-fgetspent_r.c): Likewise.
	(CFLAGS-putspent.c): Likewise.
	(CFLAGS-getspnam.c): Likewise.
	(CFLAGS-getspnam_r.c): Likewise.
	* signal/Makefile (CFLAGS-sigpause.c): Likewise.
	(CFLAGS-sigsuspend.c): Likewise.
	(CFLAGS-sigtimedwait.c): Likewise.
	(CFLAGS-sigwait.c): Likewise.
	(CFLAGS-sigwaitinfo.c): Likewise.
	(CFLAGS-sigreturn.c): Likewise.
	* stdio-common/Makefile (CFLAGS-vfprintf.c): Likewise.
	(CFLAGS-vfwprintf.c): Likewise.
	(CFLAGS-tmpfile.c): Likewise.
	(CFLAGS-tmpfile64.c): Likewise.
	(CFLAGS-tempname.c): Likewise.
	(CFLAGS-psignal.c): Likewise.
	(CFLAGS-vprintf.c): Likewise.
	(CFLAGS-cuserid.c): Likewise.
	(CFLAGS-errlist.c): Likewise.
	(CFLAGS-siglist.c): Likewise.
	(CFLAGS-scanf15.c): Likewise.
	(CFLAGS-scanf17.c): Likewise.
	* stdlib/Makefile (CFLAGS-bsearch.c): Likewise.
	(CFLAGS-msort.c): Likewise.
	(CFLAGS-qsort.c): Likewise.
	(CFLAGS-system.c): Likewise.
	(CFLAGS-fmtmsg.c): Likewise.
	(CFLAGS-strfmon.c): Likewise.
	(CFLAGS-strfmon_l.c): Likewise.
	(CFLAGS-strfromd.c): Likewise.
	(CFLAGS-strfromf.c): Likewise.
	(CFLAGS-strfroml.c): Likewise.
	(CFLAGS-tst-bsearch.c): Likewise.
	(CFLAGS-tst-qsort.c): Likewise.
	(CFLAGS-tst-makecontext2.c): Likewise.
	* sunrpc/Makefile (CFLAGS-xbootparam_prot.c): Likewise.
	(CFLAGS-xnlm_prot.c): Likewise.
	(CFLAGS-xrstat.c): Likewise.
	(CFLAGS-xyppasswd.c): Likewise.
	(CFLAGS-xklm_prot.c): Likewise.
	(CFLAGS-xrex.c): Likewise.
	(CFLAGS-xsm_inter.c): Likewise.
	(CFLAGS-xmount.c): Likewise.
	(CFLAGS-xrusers.c): Likewise.
	(CFLAGS-xspray.c): Likewise.
	(CFLAGS-xnfs_prot.c): Likewise.
	(CFLAGS-xrquota.c): Likewise.
	(CFLAGS-xkey_prot.c): Likewise.
	(CFLAGS-auth_unix.c): Likewise.
	(CFLAGS-key_call.c): Likewise.
	(CFLAGS-pmap_rmt.c): Likewise.
	(CFLAGS-clnt_perr.c): Likewise.
	(CFLAGS-openchild.c): Likewise.
	* sysvipc/Makefile (CFLAGS-msgrcv.c): Likewise.
	(CFLAGS-msgsnd.c): Likewise.
	* termios/Makefile (CFLAGS-tcdrain.c): Likewise.
	* time/Makefile (CFLAGS-tzfile.c): Likewise.
	(CFLAGS-tzset.c): Likewise.
	(CFLAGS-getdate.c): Likewise.
	(CFLAGS-test_time.c): Likewise.
	(CPPFLAGS-tst-tzname.c): Likewise.
	* timezone/Makefile (CFLAGS-zdump.c): Likewise.
	(CFLAGS-zic.c): Likewise.
	* wcsmbs/Makefile (CFLAGS-wcwidth.c): Likewise.
	(CFLAGS-wcswidth.c): Likewise.
	(CFLAGS-wcstol.c): Likewise.
	(CFLAGS-wcstoul.c): Likewise.
	(CFLAGS-wcstoll.c): Likewise.
	(CFLAGS-wcstoull.c): Likewise.
	(CFLAGS-wcstod.c): Likewise.
	(CFLAGS-wcstold.c): Likewise.
	(CFLAGS-wcstof128.c): Likewise.
	(CFLAGS-wcstof.c): Likewise.
	(CFLAGS-wcstol_l.c): Likewise.
	(CFLAGS-wcstoul_l.c): Likewise.
	(CFLAGS-wcstoll_l.c): Likewise.
	(CFLAGS-wcstoull_l.c): Likewise.
	(CFLAGS-wcstod_l.c): Likewise.
	(CFLAGS-wcstold_l.c): Likewise.
	(CFLAGS-wcstof128_l.c): Likewise.
	(CFLAGS-wcstof_l.c): Likewise.
	(CPPFLAGS-tst-wchar-h.c): Likewise.
	(CPPFLAGS-wcstold_l.c): Likewise.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
2017-12-11 13:11:33 -08:00
Joseph Myers 754034c429 Obsolete p_secstodate.
This patch, relative to a tree with
<https://sourceware.org/ml/libc-alpha/2017-11/msg00797.html> (pending
review) applied, obsoletes p_secstodate, making the underlying
function __p_secstodate into a compat symbol not available for new
binaries or ports.  The calls in ns_print.c (part of incomplete
handling of TKEY) are changed to use %lu to print times instead of
trying to pretty-print the times any more.

Tested for x86_64.

	* resolv/res_debug.c (p_secstodate): Condition definition on
	[SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_27)].  Define
	directly as __p_secstodate, and as a compat symbol.  Do not use
	libresolv_hidden_def.
	* resolv/resolv.h (p_secstodate): Remove macro and function
	declaration.
	* resolv/ns_print.c (ns_sprintrrf): Print times with %lu, not
	using p_secstodate.
	* include/resolv.h (__p_secstodate): Do not use
	libresolv_hidden_proto.
	* resolv/Makefile (tests): Move tst-p_secstodate to ....
	(tests-internal): ... here.
	* resolv/tst-p_secstodate.c: Include <shlib-compat.h>.  Condition
	all contents on [TEST_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_27)]
	and declare and use __p_secstodate and use compat_symbol_reference
	in that case.
	[!TEST_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_27)] (do_test): Add
	implementation returning 77.
2017-11-22 22:21:10 +00:00
Joseph Myers f120cda607 Fix p_secstodate overflow handling (bug 22463).
The resolv/res_debug.c function p_secstodate (which is a public
function exported from libresolv, taking an unsigned long argument)
does:

        struct tm timebuf;
        time = __gmtime_r(&clock, &timebuf);
        time->tm_year += 1900;
        time->tm_mon += 1;
        sprintf(output, "%04d%02d%02d%02d%02d%02d",
                time->tm_year, time->tm_mon, time->tm_mday,
                time->tm_hour, time->tm_min, time->tm_sec);

If __gmtime_r returns NULL (because the year overflows the range of
int), this will dereference a null pointer.  Otherwise, if the
computed year does not fit in four characters, this will cause a
buffer overrun of the fixed-size 15-byte buffer.  With current GCC
mainline, there is a compilation failure because of the possible
buffer overrun.

I couldn't find a specification for how this function is meant to
behave, but Paul pointed to RFC 4034 as relevant to the cases where
this function is called from within glibc.  The function's interface
is inherently problematic when dates beyond Y2038 might be involved,
because of the ambiguity in how to interpret 32-bit timestamps as such
dates (the RFC suggests interpreting times as being within 68 years of
the present date, which would mean some kind of interface whose
behavior depends on the present date).

This patch works on the basis of making a minimal fix in preparation
for obsoleting the function.  The function is made to handle times in
the interval [0, 0x7fffffff] only, on all platforms, with <overflow>
used as the output string in other cases (and errno set to EOVERFLOW
in such cases).  This seems to be a reasonable state for the function
to be in when made a compat symbol by a future patch, being compatible
with any existing uses for existing timestamps without trying to work
for later timestamps.  Results independent of the range of time_t also
simplify the testcase.

I couldn't persuade GCC to recognize the ranges of the struct tm
fields by adding explicit range checks with a call to
__builtin_unreachable if outside the range (this looks similar to
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80776>), so having added
a range check on the input, this patch then disables the
-Wformat-overflow= warning for the sprintf call (I prefer that to the
use of strftime, as being more transparently correct without knowing
what each of %m and %M etc. is).

I do not know why this build failure should be new with mainline GCC
(that is, I don't know what GCC change might have introduced it, when
the basic functionality for such warnings was already in GCC 7).

I do not know if this is a security issue (that is, if there are
plausible ways in which a date before -999 or after 9999 from an
untrusted source might end up in this function).  The system clock is
arguably an untrusted source (in that e.g. NTP is insecure), but
probably not to that extent (NTP can't communicate such wild
timestamps), and uses from within glibc are limited to 32-bit inputs.

Tested with build-many-glibcs.py that this restores the build for arm
with yesterday's mainline GCC.  Also tested for x86_64 and x86.

	[BZ #22463]
	* resolv/res_debug.c: Include <libc-diag.h>.
	(p_secstodate): Assert time_t at least as wide as u_long.  On
	overflow, use integer seconds since the epoch as output, or use
	"<overflow>" as output and set errno to EOVERFLOW if integer
	seconds since the epoch would be 14 or more characters.
	(p_secstodate) [__GNUC_PREREQ (7, 0)]: Disable -Wformat-overflow=
	for sprintf call.
	* resolv/tst-p_secstodate.c: New file.
	* resolv/Makefile (tests): Add tst-p_secstodate.
	($(objpfx)tst-p_secstodate): Depend on $(objpfx)libresolv.so.
2017-11-22 22:12:07 +00:00
Florian Weimer cae87e64dc support: Add <support/next_to_fault.h>
Based on the implementation in resolv/tst-inet_pton.c.
2017-11-13 19:29:32 +01:00
Florian Weimer c0a25aa92b resolv: More precise checks in res_hnok, res_dnok [BZ #22409] [BZ #22412]
res_hnok rejected some host names used on the Internet, such as
www-.example.com.  res_hnok and res_dnok failed to perform basic syntax
checking on DNS domain names.

Also fix res_mailok, res_ownok.
2017-11-11 11:51:08 +01:00
Florian Weimer 9e0ad3049d resolv: ns_name_pton should report trailing \ as error [BZ #22413] 2017-11-11 11:41:45 +01:00
Florian Weimer e2a9fca810 resolv: Add tst-ns_name_pton 2017-11-11 11:33:32 +01:00
Florian Weimer 5c1a69238f resolv: Add tst-res_hnok 2017-11-11 11:23:40 +01:00
Florian Weimer a19c0a1db5 resolv: Use test framework in tst-resolv-network
The main function was left in place by accident when the
test was imported.
2017-11-11 10:54:56 +01:00
Will Hawkins b9a558e790 resolv: Remove bogus targets that build ga_test
Remove the bogus targets (and source) that supposedly build ga_test.
This code was added to resolv very early in the development process
but does not appear to be an actual test program. The target for
building this file is tests but because the glibc Make system is
built the way it is, the target is overriden by higher-level tests
targets and, therefore, the ga_test program is never built. Removing
the target and the source code makes the resolv/Makefile less confusing.

Tested by building and running 'make check' on 64 bit host running
Kernel 4.10.0-19 configured with
 --prefix=/home/hawkinsw/code/glibc-build/install
 --enable-hardcoded-path-in-tests
 --disable-mathvec

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2017-10-20 09:29:09 -07:00
H.J. Lu 8bcdb7e0c5 Mark internal functions with attribute_hidden [BZ #18822]
Mark internal functions with attribute_hidden to allow direct access to
internal functions within libc.so and libc.a without using GOT nor PLT.

Size comparison of libc.so:

On x86-64:
        text	   data	    bss	    dec	    hex
Before: 1728577	  20584	  17088	1766249	 1af369
After : 1728593	  20584	  17088	1766265	 1af379

The only change is __gconv_release_shlib in iconv/gconv_dl.c is inlined
since it is hidden, which increases the code size of gconv_dl.os by 18
bytes.

On i686:
        text	   data	    bss	    dec	    hex
Before: 1869039	  11444	  11112	1891595	 1cdd0b
After : 1868635	  11444	  11112	1891191	 1cdb77

The code size is decreased by avoiding GOT/PLT for hidden functions.

	[BZ #18822]
	* iconv/gconv_int.h (__gconv_open): Add attribute_hidden.
	(__gconv_close): Likewise.
	(__gconv): Likewise.
	(__gconv_find_transform): Likewise.
	(__gconv_lookup_cache): Likewise.
	(__gconv_compare_alias_cache): Likewise.
	(__gconv_load_cache): Likewise.
	(__gconv_get_path): Likewise.
	(__gconv_close_transform): Likewise.
	(__gconv_release_cache): Likewise.
	(__gconv_find_shlib): Likewise.
	(__gconv_release_shlib): Likewise.
	(__gconv_get_builtin_trans): Likewise.
	(__gconv_compare_alias): Likewise.
	* include/dlfcn.h (_dlerror_run): Likewise.
	* include/stdio.h (__fortify_fail_abort): Likewise.
	* include/time.h (__tz_compute): Likewise.
	(__strptime_internal): Likewise.
	* intl/gettextP.h (_nl_find_domain): Likewise.
	(_nl_load_domain): Likewise.
	(_nl_find_msg): Likewise.
	* intl/plural-exp.h (FREE_EXPRESSION): Likewise.
	(EXTRACT_PLURAL_EXPRESSION): Likewise.
	* locale/coll-lookup.h (__collidx_table_lookup): Likewise.
	* resolv/gai_misc.h (__gai_enqueue_request): Likewise.
	(__gai_find_request): Likewise.
	(__gai_remove_request): Likewise.
	(__gai_notify): Likewise.
	(__gai_notify_only): Likewise.
	* sysdeps/generic/aio_misc.h (__aio_sigqueue): Likewise.
	* sysdeps/generic/ldsodefs.h (_dl_fini): Likewise.
	(_dl_non_dynamic_init): Likewise.
	(_dl_aux_init): Likewise.
	* sysdeps/i386/machine-gmon.h (mcount_internal): Likewise.
	* sysdeps/unix/sysv/linux/i386/olddirent.h (__old_getdents64):
	Likewise.
	* wcsmbs/wcsmbsload.h (__wcsmbs_load_conv): Likewise.
	(__wcsmbs_clone_conv): Likewise.
	(__wcsmbs_named_conv): Likewise.
2017-10-01 15:07:23 -07:00
Florian Weimer 44dade71f3 resolv/Makefile: Fix typo in comment 2017-09-26 13:53:17 +02:00
Florian Weimer eaca16f1b3 resolv/nss_dns/dns-host.c: Fix typo in comment
And only the resolv/map*.h actually contain implementations.
2017-09-26 13:47:48 +02:00
Joseph Myers c10c5267a8 Remove non-add-on Banner files.
Various subdirectories of glibc include Banner files to put some text
in the output of executing libc.so.6, under "Available extensions".

Some of those subdirectories (e.g. crypt) may originally have been
add-ons (and so optional, so a particular glibc build might or might
not have included them), but except for libidn they aren't now (or if
only included in some builds, in the case of soft-fp, the inclusion
depends on the architecture for which glibc is configured rather than
having any glibc configuration for which it's an optional feature),
and it doesn't seem useful for the libc.so.6 output to call out a few
features like that.

This patch removes the non-add-on Banner files, updating contrib.texi
where they noted contributions not otherwise mentioned there.

Tested for x86_64.

	* crypt/Banner: Remove file.
	* nptl/Banner: Likewise.
	* resolv/Banner: Likewise.
	* soft-fp/Banner: Likewise.
	* nptl/Makefile ($(objpfx)banner.h): Remove rule.
	($(objpfx)version.d): Remove dependency on banner.h.
	($(objpfx)version.os): Likewise.
	* nptl/version.c (banner): Do not include banner.h.
	* manual/contrib.texi: Update entries for Richard Henderson, Jakub
	Jelinek and BIND code.
2017-09-21 17:49:51 +00:00
H.J. Lu 78bfa877b3 Use "static const char domain[] ="
* resolv/tst-resolv-qtypes.c (domain): Changed to
	"const char domain[] =".
2017-09-07 13:57:15 -07:00
Florian Weimer a830473081 resolv: __resolv_conf_attach must not free passed conf object [BZ #22096] 2017-09-06 15:32:43 +02:00
Florian Weimer 5670c4ab25 resolv: Fix memory leak with OOM during resolv.conf parsing [BZ #22095] 2017-09-06 15:20:25 +02:00
Florian Weimer c77eb96925 nss_dns: Remove dead PTR IPv4-to-IPv6 mapping code 2017-09-06 15:11:44 +02:00
Florian Weimer 5e9c4d17fe tst-res_use_inet6: Enhance test to cover IPv4-to-IPv6 address mapping
This requires more control over the response data, so it is now
determined by flags embedded in the query name.
2017-09-06 13:45:19 +02:00
Samuel Thibault 6547ec0ad8 hurd: fix resolv/tst-resolv-res_init-skeleton.c build
* resolv/tst-resolv-res_init-skeleton.c (run_res_init)
	[!CLONE_NEWUTS]: Fail as unsupported if hostname is not NULL.
2017-09-03 19:44:07 +02:00
Florian Weimer f4a6be2582 getaddrinfo: Fix error handling in gethosts [BZ #21915] [BZ #21922]
The old code uses errno as the primary indicator for success or
failure.  This is wrong because errno is only set for specific
combinations of the status return value and the h_errno variable.
2017-09-01 09:34:29 +02:00
Florian Weimer 59bd52b087 resolv: Remove internal_function attribute 2017-08-31 16:07:52 +02:00
Adhemerval Zanella 19926de954 Consolidate non cancellable writev call
This patch consolidates all the non cancellable writev calls to use
the __writev_nocancel identifier.  For non cancellable targets it will
be just a macro to call the default respective symbol while on Linux
will be a internal one.

Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.

	* gmon/gmon.c (write_hist): Replace writev_not_cancel_no_status with
	__writev_nocancel_nostatus.
	(write_call_graph): Likewise.
	(write_bb_counts): Likewise.
	* resolv/herror.c (herror): Likewise.
	* sysdeps/generic/not-cancel.h (writev_not_cancel_no_status): Remove
	macro.
	(__writev_nocancel_nostatus): New macro.
	* sysdeps/unix/sysv/linux/not-cancel.h (writev_not_cancel_no_status):
	Remove macro.
	(__writev_nocancel_nostatus): New function.
2017-08-21 15:37:45 -03:00
Adhemerval Zanella c181840c93 Consolidate non cancellable close call
This patch consolidates all the non cancellable close calls to use
the __close_nocancel{_nostatus} identifier.  For non cancellable targets
it will be just a macro to call the default respective symbol while on Linux
will be a internal one.

Also, since it is used on libcrypto it is also exported in GLIBC_PRIVATE
namespace.

Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.

	* sysdeps/generic/not-cancel.h (close_not_cancel): Remove macro.
	(close_not_cancel_no_status): Likewise.
	(__close_nocancel): New macro.
	(__close_nocancel_no_status): Likewise.
	* sysdeps/unix/sysv/linux/not-cancel.h (__close_nocancel): Remove
	macro.
	(close_not_cancel): Likewise.
	(close_not_cancel_no_status): Likewise.
	(__close_nocancel): New prototype.
	(__close_nocancel_no_status): New function.
	* sysdeps/unix/sysv/linux/close.c (__close_nocancel): New function.
	* catgets/open_catalog.c (__open_catalog): Replace
	close_not_cancel{_no_status) with __close_nocancel{_nostatus}.
	* gmon/gmon.c (write_gmon): Likewise.
	* iconv/gconv_cache.c (__gconv_load_cache): Likewise.
	* intl/loadmsgcat.c (close): Likewise.
	* io/ftw.c (open_dir_stream): Likewise.
	(ftw_startup): Likewise.
	* libio/fileops.c (_IO_file_open): Likewise.
	(_IO_file_close_mmap): Likewise.
	(_IO_file_close): Likewise.
	* libio/iopopen.c (_IO_dup2): Likewise.
	* locale/loadarchive.c (_nl_load_locale_from_archive): Likewise.
	* locale/loadlocale.c (_nl_load_locale): Likewise.
	* login/utmp_file.c (pututline_file): Likewise.
	(endutent_file): Likewise.
	* misc/daemon.c (daemon): Likewise.
	* nscd/nscd_getai.c (__nscd_getai): Likewise.
	* nscd/nscd_getgr_r.c (nscd_getgr_r): Likewise.
	* nscd/nscd_gethst_r.c (nscd_gethst_r): Likewise.
	* nscd/nscd_getpw_r.c (nscd_getpw_r): Likewise.
	* nscd/nscd_getserv_r.c (nscd_getserv_r): Likewise.
	* nscd/nscd_helper.c (open_socket): Likewise.
	(__nscd_open_socket): Likewise.
	* nscd/nscd_initgroups.c (__nscd_getgrouplist): Likewise.
	* nscd/nscd_netgroup.c (__nscd_setnetgrent): Likewise.
	(__nscd_innetgr): Likewise.
	* nss/nss_db/db-open.c (internal_setent): Likewise.
	* resolv/res-close.c (__res_iclose): Likewise.
	* sunrpc/pm_getmaps.c (pmap_getmaps): Likewise.
	* sysdeps/posix/closedir.c (__closedir): Likewise.
	* sysdeps/posix/getaddrinfo.c (getaddrinfo): Likewise.
	* sysdeps/posix/getcwd.c (__getcwd): Likewise.
	* sysdeps/posix/opendir.c (tryopen_o_directory): Likewise.
	(opendir_tail): Likewise.
	* sysdeps/posix/spawni.c (__spawni_child): Likewise.
	* sysdeps/unix/sysv/linux/check_native.c (__check_native): Likewise.
	* sysdeps/unix/sysv/linux/check_pf.c (__check_pf): Likewise.
	* sysdeps/unix/sysv/linux/fips-private.h (fips_enabled_p): Likewise.
	* sysdeps/unix/sysv/linux/gethostid.c (sethostid): Likewise.
	(gethostid): Likewise.
	* sysdeps/unix/sysv/linux/getloadavg.c (getloadavg): Likewise.
	* sysdeps/unix/sysv/linux/getlogin_r.c (__getlogin_r_loginuid):
	Likewise.
	* sysdeps/unix/sysv/linux/getsysstats.c (__get_nprocs): Likewise.
	* sysdeps/unix/sysv/linux/grantpt.c (close_all_fds): Likewise.
	* sysdeps/unix/sysv/linux/i386/smp.h (is_smp_system): Likewise.
	* sysdeps/unix/sysv/linux/ia64/has_cpuclock.c (has_cpuclock):
	Likewise.
	* sysdeps/unix/sysv/linux/if_index.c (__if_nametoindex): Likewise.
	* sysdeps/unix/sysv/linux/libc_fatal.c (backtrace_and_maps): Likewise.
	* sysdeps/unix/sysv/linux/malloc-sysdep.h (check_may_shrink_heap):
	Likewise.
	* sysdeps/unix/sysv/linux/mq_notify.c (init_mq_netlink): Likewise.
	* sysdeps/unix/sysv/linux/pthread_getname.c (pthread_getname_np):
	Likewise.
	* sysdeps/unix/sysv/linux/pthread_setname.c (pthread_setname_np):
	Likewise.
	* sysdeps/unix/sysv/linux/spawni.c (__spawni_child): Likewise.
	* sysdeps/unix/sysv/linux/sysconf.c (__sysconf): Likewise.
2017-08-18 18:38:55 -03:00
Joseph Myers d9fee042e2 Consistently use uintN_t not u_intN_t everywhere.
This patch changes the remaining uses of the old nonstandard u_intN_t
types in glibc to use the C99 uintN_t instead, except for the
definitions of those typedefs and the tests of them in the c++-types
test.  This follows the previous such fix for libm, and being
consistent in using uintN_t makes sense as a global cleanup.

Tested for x86_64, and with build-many-glibcs.py.

	* catgets/catgets.c (catgets): Use uintN_t instead of u_intN_t.
	* catgets/catgetsinfo.h (struct catalog_obj): Likewise.
	(struct catalog_info): Likewise.
	* inet/htontest.c (lo): Likewise.
	(foo): 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 (__ivaliduser): Likewise.
	(iruserok): Likewise.
	* locale/loadlocale.c (_nl_intern_locale_data): Likewise.
	* locale/programs/locale-spec.c (locale_special): Likewise.
	* nis/nis_findserv.c (struct findserv_req): Likewise.
	(__nis_findfastest_with_timeout): Likewise.
	* nss/test-netdb.c (test_network): Likewise.
	* resolv/inet_neta.c (inet_neta): Likewise.
	* resolv/ns_date.c (ns_datetosecs): Likewise.
	(SECS_PER_DAY): Likewise.
	* resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r):
	Likewise.
	* resolv/res_comp.c (__putlong): Likewise.
	(__putshort): Likewise.
	(_getlong): Likewise.
	(_getshort): Likewise.
	* resolv/res_debug.c (p_time): Likewise.
	(precsize_ntoa): Likewise.
	(precsize_aton): Likewise.
	(latlon2ul): Likewise.
	(loc_aton): Likewise.
	(loc_ntoa): Likewise.
	* resolv/res_hconf.c (struct netaddr): Likewise.
	(_res_hconf_reorder_addrs): Likewise.
	* sunrpc/clnt_tcp.c (clnttcp_call): Likewise.
	(clnttcp_control): Likewise.
	* sunrpc/clnt_udp.c (clntudp_call): Likewise.
	(clntudp_control): Likewise.
	* sunrpc/clnt_unix.c (clntunix_call): Likewise.
	(clntunix_control): Likewise.
	* sunrpc/pmap_rmt.c (clnt_broadcast): Likewise.
	* sunrpc/rpc/auth.h (union des_block): Likewise.
	* sunrpc/tst-udp-nonblocking.c (do_test): Likewise.
	* sunrpc/xdr_rec.c (struct rec_strm): Likewise.
	(xdrrec_create): Likewise.
	(xdrrec_endofrecord): Likewise.
	(flush_out): Likewise.
	* sunrpc/xdr_stdio.c (xdrstdio_getlong): Likewise.
	(xdrstdio_putlong): Likewise.
	* sysdeps/unix/sysv/linux/errqueue.h (struct sock_extended_err):
	Likewise.
2017-08-07 19:55:34 +00:00
Florian Weimer 9f5a127131 resolv: Deal with non-deterministic address order in tst-resolv-basic 2017-07-06 22:55:53 +02:00
Florian Weimer cb3c27e87b support: Add resolver testing mode which does not patch _res 2017-07-05 19:04:40 +02:00
Florian Weimer d4165eedf5 support: Add support_chroot_create and support_chroot_free 2017-07-05 19:04:40 +02:00
Florian Weimer 4446a885f3 resolv: Fix resolv_conf _res matching
A dot-less host name without an /etc/resolv.conf file caused an
assertion failure in update_from_conf because the function would not
deal correctly with the empty search list case.

Thanks to Andreas Schwab for debugging assistence.
2017-07-04 15:26:05 +02:00
Florian Weimer 89f6307c5d resolv: Fix improper assert in __resolv_conf_attach 2017-07-04 11:18:34 +02:00
Florian Weimer e237357a5a resolv: Introduce free list for resolv_conf index slosts 2017-07-03 21:07:11 +02:00