Commit Graph

30316 Commits

Author SHA1 Message Date
Florian Weimer 5171f3079f CVE-2016-1234: glob: Do not copy d_name field of struct dirent [BZ #19779]
Instead, we store the data we need from the return value of
readdir in an object of the new type struct readdir_result.
This type is independent of the layout of struct dirent.
2016-05-04 12:09:35 +02:00
Joseph Myers 2faba597ec Fix sys/time.h timespec namespace (bug 20041).
For UNIX98 and older standards, sys/time.h should not define struct
timespec, but does so via the inclusion of sys/select.h (which is a
new header in the 2001 edition of POSIX, and defines struct timespec
because of the declaration of pselect, a new function in the 2001
edition of POSIX).  In turn, this affects some other headers that
themselves include sys/time.h.

This patch fixes this by conditioning the __need_timespec definition
in sys/select.h on __USE_XOPEN2K, the same condition used there for
the declaration of pselect (this has no effect on direct uses of
sys/select.h with feature test macros for any standard that includes
that header, since such standards result in __USE_XOPEN2K being
defined).

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

	[BZ #20041]
	* misc/sys/select.h (__need_timespec): Only define if
	[__USE_XOPEN2K].
	* conform/Makefile (test-xfail-XPG4/sys/time.h/conform): Remove
	variable.
	(test-xfail-XPG4/utmpx.h/conform): Likewise.
	(test-xfail-UNIX98/sys/time.h/conform): Likewise.
	(test-xfail-UNIX98/utmpx.h/conform): Likewise.
2016-05-03 23:36:18 +00:00
Paul E. Murphy cbc06bc486 powerpc: Add missing insn in swapcontext [BZ #20004]
A missing instruction was discovered in the compat version of
swapcontext while running the GCC test suite.
2016-05-03 10:45:51 -05:00
Joseph Myers 35281b18b8 Fix fcntl.h timespec namespace (bug 20023).
fcntl.h defines struct timespec if __USE_XOPEN || __USE_XOPEN2K8.  But
(a) the subsequent bits/stat.h include only needs it if __USE_XOPEN2K8
and (b) older standards did not allow struct timespec here.  (It's
allowed for newer standards by virtue of the permission to include
symbols from sys/stat.h.  But sys/stat.h is only required to provide
struct timespec from the 2008 edition of POSIX onwards, and permitted
by the 2004 TC to the 2001 edition in anticipation of the addition of
nanosecond timestamp support to struct stat in the 2008 edition.)

This patch limits the timespec definition to the __USE_XOPEN2K8 case,
that being the only case where it is actually needed for the
<bits/stat.h> include.

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

	[BZ #20023]
	* io/fcntl.h [__USE_XOPEN && !__USE_XOPEN2K8]: Do not include
	<time.h>.
	* conform/Makefile (test-xfail-UNIX98/fcntl.h/conform): Remove
	variable.
	(test-xfail-XOPEN2K/fcntl.h/conform): Likewise.
2016-05-02 23:20:33 +00:00
Adhemerval Zanella 230528c467 powerpc: Fix clone CLONE_VM compare
This patch fixes the clone CLONE_VM change from 0cb313f (BZ#19957)
where the commit changed the register that contains the save flags
argument to compare with (from r28 to r29).  This patch changes
back to correct register.

Tested on powerpc32 (thanks to Tulio Magno Quites Machado Filho).

	* sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S (__clone): Fix
	flags CLONE_VM compare.
2016-05-02 17:44:00 -03:00
Florian Weimer 8a03ccbb77 hesiod: Avoid heap overflow in get_txt_records [BZ #20031] 2016-05-02 16:04:32 +02:00
Florian Weimer 5018f16c62 hesiod: Always use thread-local resolver state [BZ #19573]
The Hesiod implementation imported into glibc was enhanced
to support caller-supplied resolver states.  But its only
consumer is nss_hesiod, and it supplies the thread-local
resolver state.  Therefore, this commit changes the Hesiod
implementation to use the thread-local resolver state (_res)
directly.  This fixes bug 19573 because the Hesiod
implementation no longer has to initialize and free any
resolver state.

To avoid any risk of interposition of ABI-incompatible Hesiod
function implementations, this commit marks the Hesiod functions
as hidden.  (They were already hidden using a linker version
script.)
2016-05-02 15:25:20 +02:00
Florian Weimer 46cb402c6d hesiod: Remove DEF_RHS
No functional change because DEF_RHS was already disabled before.
2016-05-02 15:11:02 +02:00
Florian Weimer dbdc657dc0 hesiod: Remove RCS keywords 2016-05-02 12:07:09 +02:00
Arnas Udovičius c2fc6747ec localedata: sgs_LT: new locale [BZ #12450]
Need to also update the database to include the new code.
2016-05-01 15:18:04 -04:00
Andreas Schwab 8a9ea3ccc5 m68k: use large PIC model for gcrt1.o 2016-04-30 18:51:43 +02:00
Andreas Schwab 4816d802ff m68k: avoid local labels in symbol table 2016-04-30 18:50:39 +02:00
Stephen Gallagher ced8f89336 NSS: Implement group merging support.
https://sourceware.org/glibc/wiki/Proposals/GroupMerging

== Justification ==
It is common today for users to rely on centrally-managed user stores for
handling their user accounts. However, much software existing today does
not have an innate understanding of such accounts. Instead, they commonly
rely on membership in known groups for managing access-control (for
example the "wheel" group on Fedora and RHEL systems or the "adm" group
on Debian-derived systems). In the present incarnation of nsswitch, the
only way to have such groups managed by a remote user store such as
FreeIPA or Active Directory would be to manually remove the groups from
/etc/group on the clients so that nsswitch would then move past nss_files
and into the SSSD, nss-ldap or other remote user database.

== Solution ==
With this patch, a new action is introduced for nsswitch:
NSS_ACTION_MERGE. To take advantage of it, one will add [SUCCESS=merge]
between two database entries in the nsswitch.conf file. When a group is
located in the first of the two group entries, processing will continue
on to the next one. If the group is also found in the next entry (and the
group name and GID are an exact match), the member list of the second
entry will be added to the group object to be returned.

== Implementation ==
After each DL_LOOKUP_FN() returns, the next action is checked. If the
function returned NSS_STATUS_SUCCESS and the next action is
NSS_ACTION_MERGE, a copy of the result buffer is saved for the next pass
through the loop. If on this next pass through the loop the database
returns another instance of a group matching both the group name and GID,
the member list is added to the previous list and it is returned as a
single object. If the following database does not contain the same group,
then the original is copied back into the destination buffer.

This patch implements merge functionality only for the group database.
For other databases, there is a default implementation that will return
the EINVAL errno if a merge is requested. The merge functionality can be
implemented for other databases at a later time if such is needed. Each
database must provide a unique implementation of the deep-copy and merge
functions.

If [SUCCESS=merge] is present in nsswitch.conf for a glibc version that
does not support it, glibc will process results up until that operation,
at which time it will return results if it has found them or else will
simply return an error. In practical terms, this ends up behaving like
the remainder of the nsswitch.conf line does not exist.

== Iterators ==
This feature does not modify the iterator functionality from its current
behavior. If getgrnam() or getgrgid() is called, glibc will iterate
through all entries in the `group` line in nsswitch.conf and display the
list of members without attempting to merge them. This is consistent with
the behavior of nss_files where if two separate lines are specified for
the same group in /etc/groups, getgrnam()/getgrgid() will display both.
Clients are already expected to handle this gracefully.

== No Premature Optimizations ==
The following is a list of places that might be eligible for
optimization, but were not overengineered for this initial contribution:
 * Any situation where a merge may occur will result in one malloc() of
   the same size as the input buffer.
 * Any situation where a merge does occur will result in a second
   malloc() to hold the list of pointers to member name strings.
 * The list of members is simply concatenated together and is not tested
   for uniqueness (which is identical to the behavior for nss_files,
   which will simply return identical values if they both exist on the
   line in the file. This could potentially be optimized to reduce space
   usage in the buffer, but it is both complex and computationally
   expensive to do so.

== Testing ==
I performed testing by running the getent utility against my newly-built
glibc and configuring /etc/nsswitch.conf with the following entry:
group: group:      files [SUCCESS=merge] sss

In /etc/group I included the line:
wheel10:sgallagh

I then configured my local SSSD using the id_provider=local to respond
with:
wheel:*:10:localuser,localuser2

I then ran `getent group wheel` against the newly-built glibc in
multiple situations and received the expected output as described
above:
 * When SSSD was running.
 * When SSSD was configured in nsswitch.conf but the daemon was not
   running.
 * When SSSD was configured in nsswitch.conf but nss_sss.so.2 was not
   installed on the system.
 * When the order of 'sss' and 'files' was reversed.
 * All of the above with the [SUCCESS=merge] removed (to ensure no
   regressions).
 * All of the above with `getent group 10`.
 * All of the above with `getent group` with and without
   `enumerate=true` set in SSSD.
 * All of the above with and without nscd enabled on the system.
2016-04-29 22:18:21 -04:00
Adhemerval Zanella b65b205fbc libio: Fix fmemopen append mode failure (BZ# 20012)
The fmemopen implementation does not account the file position correctly in
append mode. The following example shows the failure:

===
int main ()
{
  char buf[10] = "test";
  FILE *fp = fmemopen (buf, 10, "a+");
  fseek (fp, 0, SEEK_SET);

  int gr;
  if ((gr = getc (fp)) != 't' ||
      (gr = getc (fp)) != 'e' ||
      (gr = getc (fp)) != 's' ||
      (gr = getc (fp)) != 't' ||
      (gr = getc (fp)) != EOF)
    {
      printf ("%s: getc failed returned %i\n", __FUNCTION__, gr);
      return 1;
    }

  return 0;
}
===

This is due both how read and write operation update the buffer position,
taking in consideration buffer lenght instead of maximum position defined
by the open mode.  This patch fixes it and also fixes fseek not returning
EINVAL for invalid whence modes.

Tested on x86_64 and i686.

	[BZ #20012]
	* libio/fmemopen.c (fmemopen_read): Use buffer maximum position, not
	length to calculate the buffer to read.
	(fmemopen_write): Set the buffer position based on bytes written.
	(fmemopen_seek): Return EINVAL for invalid whence modes.
2016-04-29 19:25:17 -03:00
Adhemerval Zanella 0cb313f7cb Fix clone (CLONE_VM) pid/tid reset (BZ#19957)
As discussed in libc-alpha [1] current clone with CLONE_VM (without
CLONE_THREAD set) will reset the pthread pid/tid fields to -1.  The
issue is since memory is shared between the parent and child it will
clobber parent's cached pid/tid leading to internal inconsistencies
if the value is not restored.

And even it is restored it may lead to racy conditions when between
set/restore a thread might invoke pthread function that validate the
pthread with INVALID_TD_P/INVALID_NOT_TERMINATED_TD_P and thus get
wrong results.

As stated in BZ19957, previously reports of this behaviour was close
with EWONTFIX due the fact usage of clone outside glibc is tricky
since glibc requires consistent internal pthread, while using clone
directly may not provide it. However since now posix_spawn uses
clone (CLONE_VM) to fixes various issues related to previous vfork
usage this issue requires fixing.

The vfork implementation also does something similar, but instead
it negates and restores only the *pid* field and functions that
might access its value know to handle such case (getpid, raise
and pthread ones that uses INVALID_TD_P/INVALID_NOT_TERMINATED_TD_P
macros that check only *tid* field).  Also vfork does not call
__clone directly, instead calling either __NR_vfork or __NR_clone
directly.

So this patch removes this clone behavior by avoiding setting
the pthread pid/tid field for CLONE_VM. There is no need to
check for CLONE_THREAD, since the minimum supported kernel in all
architecture implies that CLONE_VM must be used with CLONE_THREAD,
otherwise clone returns EINVAL.

Instead of current approach of:

   int clone(int (*fn)(void *), void *child_stack, int flags, ...)
      [...]
      if (flags & CLONE_THREAD)
        goto do_syscall;
      pid_t new_value;
      if (flags & CLONE_VM)
        new_value = -1;
      else
        new_value = getpid ();
      THREAD_SETMEM (THREAD_SELF, pid, new_value);
      THREAD_SETMEM (THREAD_SELF, tid, new_value);

    do_syscall:
      [...]

The new approach uses:

   int clone(int (*fn)(void *), void *child_stack, int flags, ...)
      [...]
      if (flags & CLONE_VM)
        goto do_syscall;
      pid_t new_value = getpid ();
      THREAD_SETMEM (THREAD_SELF, pid, new_value);
      THREAD_SETMEM (THREAD_SELF, tid, new_value);

    do_syscall:
      [...]

It also removes the linux tst-getpid2.c test which expects the previous
behavior and instead add another clone test.

Tested on x86_64, i686, x32, powerpc64le, aarch64, armhf, s390, and
s390x. I also did limited check on mips32 and sparc64 (using the new
added test).

I also got reviews from both m68k, hppa, and tile.  So I presume for
these architecture the patch works.

The fixes for alpha, microblaze, sh, ia64, and nio2 have not been
tested.

[1] https://sourceware.org/ml/libc-alpha/2016-04/msg00307.html

	* sysdeps/unix/sysv/linux/Makefile [$(subdir) == nptl] (test): Remove
	tst-getpid2.
	(test): Add tst-clone2.
	* sysdeps/unix/sysv/linux/tst-clone2.c: New file.
	* sysdeps/unix/sysv/linux/aarch64/clone.S (__clone): Do not change
	pid/tid fields for CLONE_VM.
	* sysdeps/unix/sysv/linux/arm/clone.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/clone.S: Likewise.
	* sysdeps/unix/sysv/linux/mips/clone.S: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/clone.S: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/clone.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/clone.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/clone.S: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/clone.S: Likewise.
	* sysdeps/unix/sysv/linux/tst-getpid2.c: Remove file.
2016-04-29 18:19:30 -03:00
Florian Weimer 2dce81a319 getnameinfo: Refactor and fix memory leak [BZ #19642]
Split getnameinfo into separate functions for host and service
lookups, and for different address families.
2016-04-29 17:08:06 +02:00
Gabriel F. T. Gomes 72c11b353e powerpc: Zero pad using memset in strncpy/stpncpy
Call __memset_power8 to pad, with zeros, the remaining bytes in the
dest string on __strncpy_power8 and __stpncpy_power8.  This improves
performance when n is larger than the input string, giving ~30% gain for
larger strings without impacting much shorter strings.
2016-04-29 10:05:33 -03:00
Florian Weimer f5b3338d70 NEWS entry for CVE-2016-3075 2016-04-29 10:47:40 +02:00
Florian Weimer 4ab2ab03d4 CVE-2016-3706: getaddrinfo: stack overflow in hostent conversion [BZ #20010]
When converting a struct hostent response to struct gaih_addrtuple, the
gethosts macro (which is called from gaih_inet) used alloca, without
malloc fallback for large responses.  This commit changes this code to
use calloc unconditionally.

This commit also consolidated a second hostent-to-gaih_addrtuple
conversion loop (in gaih_inet) to use the new conversion function.
2016-04-29 10:35:34 +02:00
Florian Weimer 137fe72eca glob: Simplify the interface for the GLOB_ALTDIRFUNC callback gl_readdir
Previously, application code had to set up the d_namlen member if
the target supported it, involving conditional compilation.  After
this change, glob will use the length of the string in d_name instead
of d_namlen to determine the file name length.  All glibc targets
provide the d_type and d_ino members, and setting them as needed for
gl_readdir is straightforward.

Changing the behavior with regards to d_ino is left to a future
cleanup.
2016-04-29 09:35:30 +02:00
Joseph Myers a7657f3012 Fix stdio.h namespace for pre-threads POSIX (bug 20014).
stdio.h declares flockfile, ftrylockfile, funlockfile, getc_unlocked,
getchar_unlocked, putc_unlocked and putchar_unlocked if __USE_POSIX,
with comments "These are defined in POSIX.1:1996.".  But __USE_POSIX
is actually POSIX.1:1990, and these functions should not be declared
for 1990 / 1992 / 1993 POSIX, XPG3 or XPG4.  This patch fixes stdio.h
to use __USE_POSIX199506 instead for those conditionals, as that is
the correct conditional for the version of POSIX that introduced
threads, and with threads those functions.

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

	[BZ #20014]
	* libio/stdio.h (getc_unlocked): Declare if [__USE_POSIX199506],
	not [__USE_POSIX].
	(getchar_unlocked): Likewise.
	(putc_unlocked): Likewise.
	(putchar_unlocked): Likewise.
	(flockfile): Likewise.
	(ftrylockfile): Likewise.
	(funlockfile): Likewise.
	* conform/Makefile (test-xfail-XPG3/stdio.h/conform): Remove
	variable.
	(test-xfail-XPG4/stdio.h/conform): Likewise.
2016-04-28 22:01:04 +00:00
Joseph Myers 022d239b5d conformtest: Add langinfo.h expectations for YESSTR, NOSTR.
The conformtest expectations for langinfo.h fail to include the YESSTR
and NOSTR constants that were present in UNIX98 and earlier XPG
standards.  This patch adds those expectations, so fixing three
XFAILs.

Tested for x86_64 and x86.

	* conform/data/langinfo.h-data [XPG3 || XPG4 || UNIX98] (YESSTR):
	Expect constant.
	[XPG3 || XPG4 || UNIX98] (NOSTR): Likewise.
	* conform/Makefile (test-xfail-XPG3/langinfo.h/conform): Remove
	variable.
	(test-xfail-XPG4/langinfo.h/conform): Likewise.
	(test-xfail-UNIX98/langinfo.h/conform): Likewise.
2016-04-28 17:19:53 +00:00
Joseph Myers 10b8108aec Also define off_t in stdio.h for UNIX98.
Similar to my previous fix for XOPEN2K
<https://sourceware.org/ml/libc-alpha/2016-04/msg00631.html>, now that
bugs in the conformtest expectations for stdio.h for UNIX98 have been
corrected, that case too fails because fseeko and ftello are now
correctly expected, but off_t is not defined.  As in that fix, it
seems appropriate to define off_t in stdio.h for this standard as
well, and this patch does so.

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

	* libio/stdio.h (off_t): Also define if [__USE_UNIX98].
	[__USE_LARGEFILE64] (off64_t): Likewise.
	* conform/Makefile (test-xfail-UNIX98/stdio.h/conform): Remove
	variable.
2016-04-28 17:00:52 +00:00
Florian Weimer 2b54cbce2c getnameinfo: Do not preserve errno
POSIX does not require it, the companion getaddrinfo implementation
does not do it, and this behavior is not documented in the manual
page, either.
2016-04-28 17:41:49 +02:00
Florian Weimer ed3c7876cc resolv: Reindent preprocessor conditionals following cleanups 2016-04-28 16:53:56 +02:00
Florian Weimer e01eef67ba resolv: Assorted preprocessor cleanups 2016-04-28 13:58:18 +02:00
Florian Weimer ecfda0fc25 resolv: Remove SUNSECURITY preprocessor conditionals
The macro is never defined.
2016-04-28 13:56:39 +02:00
Florian Weimer c40226cb4c resolv: Remove BSD compatibility conditionals and header 2016-04-28 13:56:39 +02:00
Florian Weimer e5a0ec981c resolv: Remove __BIND_NOSTATIC conditionals
The macro is never defined.
2016-04-28 13:56:38 +02:00
Florian Weimer 687c1c0ce2 resolv: Remove traces of ULTRIX support 2016-04-28 13:56:38 +02:00
Florian Weimer 18b36f5dcf resolv: Remove RFC1535 conditionals 2016-04-28 12:53:51 +02:00
Florian Weimer 74a6983155 resolv: Remove RESOLVSORT preprocess conditionals 2016-04-28 12:53:51 +02:00
Florian Weimer 561905e137 resolv: Remove BIND_UPDATE preprocessor conditionals 2016-04-28 12:53:50 +02:00
Florian Weimer 283952c4a8 inet: Remove SCCS keywords 2016-04-28 12:53:50 +02:00
Florian Weimer c99c925b8b resolv: Remove _LIBC conditionals 2016-04-28 12:53:49 +02:00
Florian Weimer 1f32be054b resolv: Remove SCCS and RCS keywords 2016-04-28 12:53:49 +02:00
Florian Weimer 6b255f411b Fix ChangeLog date to reflect commit date 2016-04-28 12:52:53 +02:00
Joseph Myers 9a018860a7 conformtest: Correct stdio.h expectations for fdopen.
The conform/ test of stdio.h wrongly does not expect fdopen for XPG3
and XPG4.  fdopen is in those standards; this patch corrects the
expectations.

Tested for x86_64 and x86.

	* conform/data/stdio.h-data (fdopen): Expect also for
	[XPG3 || XPG4].
2016-04-27 21:28:58 +00:00
Joseph Myers 1876dfe4c3 conformtest: Correct some stdio.h expectations for UNIX98.
The conform/ test of stdio.h for UNIX98 fails with surious namespace
errors for functions that are correctly declared for that standard.
This patch fixes the expectations to expect those functions also for
UNIX98.  (This does not by itself fix the XFAIL of that test, and is
not based a full review of the header expectations so there could
still be other bugs in the expectations for this header for UNIX98.)

Tested for x86_64 and x86.

	* conform/data/stdio.h-data (flockfile): Also expect for [UNIX98].
	(fseeko): Likewise.
	(ftello): Likewise.
	(ftrylockfile): Likewise.
	(funlockfile): Likewise.
	(getc_unlocked): Likewise.
	(getchar_unlocked): Likewise.
	(putc_unlocked): Likewise.
	(putchar_unlocked): Likewise.
2016-04-27 21:17:00 +00:00
Florian Weimer a12f9431b3 nss_dns: Skip over non-PTR records in the netent code [BZ #19868]
This requires additional checks for the RDATA length and the
availability of record metadata.
2016-04-27 17:15:57 +02:00
Florian Weimer c3bae689d3 nss_dns: Remove custom offsetof macro definition 2016-04-27 16:48:45 +02:00
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
Joseph Myers 9f57e65c93 conformtest: Correct some signal.h expectations for XOPEN2K.
The conformtest expectations for signal.h have various declarations
that are expected for POSIX (1996) and all later standards, except,
wrongly, for XOPEN2K.  This shows up as failures of tests for two
other headers, which are allowed to make visible symbols from
signal.h, because of an incorrect namespace failure for sigval
(required in signal.h in XOPEN2K, so should be allowed for those other
headers); signal.h tests for various standards fail anyway because of
other problems in the header.  This patch fixes the incorrect
expectations and removes the two XFAILs that this fixes.

Tested for x86_64 and x86.

	* conform/data/signal.h-data (union sigval): Expect also if
	[XOPEN2K].
	(struct sigevent): Likewise.
	(SIGEV_NONE): Likewise.
	(SIGEV_SIGNAL): Likewise.
	(SIGEV_THREAD): Likewise.
	(SIGRTMIN): Likewise.
	(SIGRTMAX): Likewise.
	* conform/Makefile (test-xfail-XOPEN2K/aio.h/conform): Remove
	variable.
	(test-xfail-XOPEN2K/mqueue.h/conform): Likewise.
2016-04-27 14:03:14 +00: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
Stefan Liebler b06549a5e6 Add missing iucv related defines.
this patch adds the missing SOL_IUCV socket level definition
and socket options SO_IPRMDATA_MSG, SO_MSGLIMIT, SO_MSGSIZE
which can be used with get/setsockopt().
SCM_IUCV_TRGCLS is needed to send/receive ancillary data with send/recvmsg().

The defines are copied from kernel-source:
include/net/iucv/af_iucv.h
include/linux/socket.h
2016-04-27 09:08:29 +02:00
Mike Frysinger 045cd3190a localedata: add more translit entries
Some of the newer symbols we're using are missing translit entries which
causes troubles when generating the locales with older encodings.

tr_TR: ₺ -> "TL"
uz_UZ: ʻ -> "'"
common:
  ֏ -> "AMD"
  ₪ -> "ILS"
  ₱ -> "PHP"
  ₸ -> "KZT"
  ₾ -> "GEL"
2016-04-27 01:09:20 -04:00
Adhemerval Zanella f9123b5003 libio: Update internal fmemopen position after write (BZ #20005)
Current GLIBC fmemopen fails with a simple testcase:

  char buffer[500] = "x";
  FILE *stream;
  stream = fmemopen(buffer, 500, "r+");
  fwrite("fish",sizeof(char),5,stream);
  printf("pos-1:%ld\n",ftell(stream));
  fflush(stream);
  printf("pos-2:%ld\n",ftell(stream));

It returns:

  pos-1:5
  pos-2:0

Where it should return:

  pos-1:5
  pos-2:5

This is due the internal write function does not correctly update the internal
object position state and then the seek operation returns a wrong value.  This
patch fixes it.

It fixes both BZ #20005 and BZ #19230 (marked as duplicated). A new test is
added to check for such case.

Tested on x86_64 and i686.

	* libio/fmemopen.c (fmemopen_write): Update internal position after
	write.
	* stdio-common/Makefile (tests): Add tst-fmemopen4.c.
	* stdio-common/tst-fmemopen4.c: New file..
2016-04-26 17:40:25 -03:00
Joseph Myers 085bbece2c Fix langinfo.h nl_langinfo_l namespace (bug 19996).
langinfo.h declares nl_langinfo_l if __USE_XOPEN2K.  But this function
was new in the 2008 edition of POSIX.  This patch fixes the condition
accordingly.

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

	[BZ #19996]
	* locale/langinfo.h (nl_langinfo_l): Declare if [__USE_XOPEN2K8],
	not [__USE_XOPEN2K].
	* conform/Makefile (test-xfail-XOPEN2K/langinfo.h/conform): Remove
	variable.
2016-04-26 15:02:26 +00:00