gsasl-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU gsasl branch, master, updated. gsasl-1-3-91-10-g4d22717


From: Simon Josefsson
Subject: [SCM] GNU gsasl branch, master, updated. gsasl-1-3-91-10-g4d22717
Date: Tue, 17 Nov 2009 18:20:32 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU gsasl".

http://git.savannah.gnu.org/cgit/gsasl.git/commit/?id=4d2271701f556e7eb4dc2d271f73ac3c8dec55b8

The branch, master has been updated
       via  4d2271701f556e7eb4dc2d271f73ac3c8dec55b8 (commit)
       via  7aaa8319ded73dba68970e2d257ad1f1499f3d65 (commit)
       via  70356adf98231a734a52c27da9828aae1711de1b (commit)
       via  fc8d929e679f3bcba9e3ab42509b6dc86999ea29 (commit)
       via  5b0fe6acdff006db937399821cb64599eaa6c435 (commit)
       via  c173167d87de1f9efaaa5a5a30c93ea8816bbc11 (commit)
       via  895b858109179211de2b70e3387f81382d3c15b2 (commit)
       via  839873676a85f0cd82cb5503282d8f9f5c1b2f2a (commit)
      from  8230ff6339730ffc872e67712d5256e3c682d17e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 4d2271701f556e7eb4dc2d271f73ac3c8dec55b8
Author: Simon Josefsson <address@hidden>
Date:   Tue Nov 17 19:19:22 2009 +0100

    Generated.

commit 7aaa8319ded73dba68970e2d257ad1f1499f3d65
Author: Simon Josefsson <address@hidden>
Date:   Tue Nov 17 19:13:29 2009 +0100

    Generated.

commit 70356adf98231a734a52c27da9828aae1711de1b
Author: Simon Josefsson <address@hidden>
Date:   Tue Nov 17 19:11:20 2009 +0100

    Version 1.4.0.

commit fc8d929e679f3bcba9e3ab42509b6dc86999ea29
Author: Simon Josefsson <address@hidden>
Date:   Tue Nov 17 19:11:06 2009 +0100

    Add.

commit 5b0fe6acdff006db937399821cb64599eaa6c435
Author: Simon Josefsson <address@hidden>
Date:   Tue Nov 17 19:10:48 2009 +0100

    Add.

commit c173167d87de1f9efaaa5a5a30c93ea8816bbc11
Author: Simon Josefsson <address@hidden>
Date:   Tue Nov 17 18:15:39 2009 +0100

    Bump versions.

commit 895b858109179211de2b70e3387f81382d3c15b2
Author: Simon Josefsson <address@hidden>
Date:   Tue Nov 17 18:11:03 2009 +0100

    Update gnulib files.

commit 839873676a85f0cd82cb5503282d8f9f5c1b2f2a
Author: Simon Josefsson <address@hidden>
Date:   Tue Nov 17 18:05:08 2009 +0100

    Update gnulib files.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                      |   52 ++++++
 NEWS                                           |   14 ++
 configure.ac                                   |    2 +-
 gl/Makefile.am                                 |    8 +-
 gl/intprops.h                                  |   38 +++--
 gl/m4/environ.m4                               |    4 +-
 gl/m4/gnulib-comp.m4                           |    8 +
 gl/m4/putenv.m4                                |   41 ++++
 gl/m4/setenv.m4                                |   53 +++++-
 gl/m4/stdlib_h.m4                              |    3 +-
 gl/m4/unistd_h.m4                              |    7 +-
 gl/printf-args.c                               |    5 +-
 gl/stdlib.in.h                                 |   30 +++-
 gl/unistd.in.h                                 |   37 +++-
 gl/vasnprintf.c                                |   36 ++--
 gl/version-etc.c                               |   12 +-
 gltests/Makefile.am                            |   35 ++++
 gltests/putenv.c                               |  132 +++++++++++++
 gltests/setenv.c                               |   54 +++++-
 gltests/test-setenv.c                          |   60 ++++++
 gltests/test-unsetenv.c                        |   65 +++++++
 gltests/{test-sys_time.c => test-xalloc-die.c} |   11 +-
 gltests/test-xalloc-die.sh                     |   30 +++
 gltests/unsetenv.c                             |   28 +++-
 lib/ChangeLog                                  |   52 ++++++
 lib/NEWS                                       |    7 +
 lib/configure.ac                               |    4 +-
 lib/gl/Makefile.am                             |    8 +-
 lib/gl/gc-pbkdf2-sha1.c                        |   99 +---------
 lib/gl/m4/stdlib_h.m4                          |    3 +-
 lib/gl/m4/unistd_h.m4                          |    7 +-
 lib/gl/printf-args.c                           |    5 +-
 lib/gl/stdlib.in.h                             |   30 +++-
 lib/gl/unistd.in.h                             |   37 +++-
 lib/gl/vasnprintf.c                            |   36 ++--
 lib/gltests/Makefile.am                        |    1 +
 lib/gltests/intprops.h                         |   38 +++--
 lib/gltests/test-base64.c                      |  234 +++++++++++++++---------
 lib/maint.mk                                   |   17 ++
 lib/src/gsasl.h                                |    8 +-
 maint.mk                                       |   17 ++
 41 files changed, 1054 insertions(+), 314 deletions(-)
 create mode 100644 gl/m4/putenv.m4
 create mode 100644 gltests/putenv.c
 create mode 100644 gltests/test-setenv.c
 create mode 100644 gltests/test-unsetenv.c
 copy gltests/{test-sys_time.c => test-xalloc-die.c} (75%)
 create mode 100755 gltests/test-xalloc-die.sh

diff --git a/ChangeLog b/ChangeLog
index f8ff272..b97726e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,55 @@
+2009-11-17  Simon Josefsson <address@hidden>
+
+       * lib/ChangeLog: Generated.
+
+2009-11-17  Simon Josefsson <address@hidden>
+
+       * NEWS, lib/NEWS: Version 1.4.0.
+
+2009-11-17  Simon Josefsson <address@hidden>
+
+       * lib/NEWS: Add.
+
+2009-11-17  Simon Josefsson <address@hidden>
+
+       * NEWS: Add.
+
+2009-11-17  Simon Josefsson <address@hidden>
+
+       * NEWS, configure.ac, lib/NEWS, lib/configure.ac, lib/src/gsasl.h: 
+       Bump versions.
+
+2009-11-17  Simon Josefsson <address@hidden>
+
+       * gl/m4/putenv.m4, gltests/putenv.c, gltests/test-setenv.c,
+       gltests/test-unsetenv.c, gltests/test-xalloc-die.c,
+       gltests/test-xalloc-die.sh: Update gnulib files.
+
+2009-11-17  Simon Josefsson <address@hidden>
+
+       * gl/Makefile.am, gl/intprops.h, gl/m4/environ.m4,
+       gl/m4/gnulib-comp.m4, gl/m4/setenv.m4, gl/m4/stdlib_h.m4,
+       gl/m4/unistd_h.m4, gl/printf-args.c, gl/stdlib.in.h,
+       gl/unistd.in.h, gl/vasnprintf.c, gl/version-etc.c,
+       gltests/Makefile.am, gltests/setenv.c, gltests/unsetenv.c,
+       lib/gl/Makefile.am, lib/gl/gc-pbkdf2-sha1.c, lib/gl/m4/stdlib_h.m4,
+       lib/gl/m4/unistd_h.m4, lib/gl/printf-args.c, lib/gl/stdlib.in.h,
+       lib/gl/unistd.in.h, lib/gl/vasnprintf.c, lib/gltests/Makefile.am,
+       lib/gltests/intprops.h, lib/gltests/test-base64.c, lib/maint.mk,
+       maint.mk: Update gnulib files.
+
+2009-11-09  Simon Josefsson <address@hidden>
+
+       * gltests/test-fseeko.c: Update gnulib files.
+
+2009-11-06  Simon Josefsson <address@hidden>
+
+       * cfg.mk: Commit cyclo/ www dir too.
+
+2009-11-06  Simon Josefsson <address@hidden>
+
+       * ChangeLog: Generated.
+
 2009-11-06  Simon Josefsson <address@hidden>
 
        * lib/ChangeLog: Generated.
diff --git a/NEWS b/NEWS
index 998f577..e3a5a4b 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,20 @@ Note that changes to the GNU SASL Library is documented in 
lib/NEWS.
 This file track changes to the remaining, non-library, parts of GNU
 SASL.  That include the manual, the command line tool, and self tests.
 
+* Version 1.4.0 (released 2009-11-17) [stable]
+
+** No changes since 1.3.91 release candidate.
+The release numbering scheme has changed compared to the last stable
+release.  In the future we will use version numbers X.Y.Z with even Y
+to indicate stable releases and odd Y to indicate experimental
+releases.  Z is incremented by one for every release on a particular
+branch.  For example, the next stable release will either be 1.4.1 or
+1.6.0 and the next experimental release will be 1.5.0.  The intention
+is that the stable branches can be used for security bug fixes if/when
+there is a need.  Other changes or new features will (typically) not
+be back-ported to a stable branch but instead will have to wait for
+the next stable branch to be released.
+
 * Version 1.3.91 (released 2009-11-06) [experimental]
 
 ** doc: Fix doc/cyclo/ output.
diff --git a/configure.ac b/configure.ac
index bd8e383..7e82028 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,7 +18,7 @@ dnl Process this file with autoconf to produce a configure 
script.
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 AC_PREREQ(2.61)
-AC_INIT([GNU SASL], [1.3.91], address@hidden, [gsasl])
+AC_INIT([GNU SASL], [1.4.0], address@hidden, [gsasl])
 AC_CONFIG_AUX_DIR([lib/build-aux])
 AC_CONFIG_MACRO_DIR([m4])
 
diff --git a/gl/Makefile.am b/gl/Makefile.am
index 47305b3..1fce74d 100644
--- a/gl/Makefile.am
+++ b/gl/Makefile.am
@@ -1024,8 +1024,9 @@ stdlib.h: stdlib.in.h
              -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
              -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
              -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \
+             -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \
              -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \
-             -e 's|@''VOID_UNSETENV''@|$(VOID_UNSETENV)|g' \
+             -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              < $(srcdir)/stdlib.in.h; \
        } > address@hidden && \
@@ -1278,6 +1279,7 @@ unistd.h: unistd.in.h
              -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \
              -e 's|@''GNULIB_GETDOMAINNAME''@|$(GNULIB_GETDOMAINNAME)|g' \
              -e 's|@''GNULIB_GETDTABLESIZE''@|$(GNULIB_GETDTABLESIZE)|g' \
+             -e 's|@''GNULIB_GETGROUPS''@|$(GNULIB_GETGROUPS)|g' \
              -e 's|@''GNULIB_GETHOSTNAME''@|$(GNULIB_GETHOSTNAME)|g' \
              -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \
              -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \
@@ -1298,6 +1300,7 @@ unistd.h: unistd.in.h
              -e 's|@''GNULIB_UNLINK''@|$(GNULIB_UNLINK)|g' \
              -e 's|@''GNULIB_UNLINKAT''@|$(GNULIB_UNLINKAT)|g' \
              -e 's|@''GNULIB_WRITE''@|$(GNULIB_WRITE)|g' \
+             -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \
              -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
              -e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \
              -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \
@@ -1307,9 +1310,11 @@ unistd.h: unistd.in.h
              -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \
              -e 's|@''HAVE_GETDOMAINNAME''@|$(HAVE_GETDOMAINNAME)|g' \
              -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \
+             -e 's|@''HAVE_GETGROUPS''@|$(HAVE_GETGROUPS)|g' \
              -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \
              -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \
              -e 's|@''HAVE_GETUSERSHELL''@|$(HAVE_GETUSERSHELL)|g' \
+             -e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \
              -e 's|@''HAVE_LINK''@|$(HAVE_LINK)|g' \
              -e 's|@''HAVE_LINKAT''@|$(HAVE_LINKAT)|g' \
              -e 's|@''HAVE_PIPE2''@|$(HAVE_PIPE2)|g' \
@@ -1330,6 +1335,7 @@ unistd.h: unistd.in.h
              -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
              -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \
              -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
+             -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \
              -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
              -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
              -e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \
diff --git a/gl/intprops.h b/gl/intprops.h
index 002161e..325c397 100644
--- a/gl/intprops.h
+++ b/gl/intprops.h
@@ -1,6 +1,7 @@
 /* intprops.h -- properties of integer types
 
-   Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009 Free Software
+   Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -17,37 +18,40 @@
 
 /* Written by Paul Eggert.  */
 
-#include <limits.h>
+#ifndef GL_INTPROPS_H
+# define GL_INTPROPS_H
+
+# include <limits.h>
 
 /* The extra casts in the following macros work around compiler bugs,
    e.g., in Cray C 5.0.3.0.  */
 
 /* True if the arithmetic type T is an integer type.  bool counts as
    an integer.  */
-#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1)
+# define TYPE_IS_INTEGER(t) ((t) 1.5 == 1)
 
 /* True if negative values of the signed integer type T use two's
    complement, ones' complement, or signed magnitude representation,
    respectively.  Much GNU code assumes two's complement, but some
    people like to be portable to all possible C hosts.  */
-#define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1)
-#define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0)
-#define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1)
+# define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1)
+# define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0)
+# define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1)
 
 /* True if the arithmetic type T is signed.  */
-#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
+# define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
 
 /* The maximum and minimum values for the integer type T.  These
    macros have undefined behavior if T is signed and has padding bits.
    If this is a problem for you, please let us know how to fix it for
    your host.  */
-#define TYPE_MINIMUM(t) \
+# define TYPE_MINIMUM(t) \
   ((t) (! TYPE_SIGNED (t) \
        ? (t) 0 \
        : TYPE_SIGNED_MAGNITUDE (t) \
        ? ~ (t) 0 \
        : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
-#define TYPE_MAXIMUM(t) \
+# define TYPE_MAXIMUM(t) \
   ((t) (! TYPE_SIGNED (t) \
        ? (t) -1 \
        : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
@@ -58,20 +62,22 @@
    tighter bound.  Otherwise, it overestimates the true bound by one byte
    when applied to unsigned types of size 2, 4, 16, ... bytes.
    The symbol signed_type_or_expr__ is private to this header file.  */
-#if __GNUC__ >= 2
-# define signed_type_or_expr__(t) TYPE_SIGNED (__typeof__ (t))
-#else
-# define signed_type_or_expr__(t) 1
-#endif
+# if __GNUC__ >= 2
+#  define signed_type_or_expr__(t) TYPE_SIGNED (__typeof__ (t))
+# else
+#  define signed_type_or_expr__(t) 1
+# endif
 
 /* Bound on length of the string representing an integer type or expression T.
    Subtract 1 for the sign bit if T is signed; log10 (2.0) < 146/485;
    add 1 for integer division truncation; add 1 more for a minus sign
    if needed.  */
-#define INT_STRLEN_BOUND(t) \
+# define INT_STRLEN_BOUND(t) \
   ((sizeof (t) * CHAR_BIT - signed_type_or_expr__ (t)) * 146 / 485 \
    + signed_type_or_expr__ (t) + 1)
 
 /* Bound on buffer size needed to represent an integer type or expression T,
    including the terminating null.  */
-#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1)
+# define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1)
+
+#endif /* GL_INTPROPS_H */
diff --git a/gl/m4/environ.m4 b/gl/m4/environ.m4
index b17bb60..1803820 100644
--- a/gl/m4/environ.m4
+++ b/gl/m4/environ.m4
@@ -1,10 +1,10 @@
-# environ.m4 serial 2
+# environ.m4 serial 3
 dnl Copyright (C) 2001-2004, 2006-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
-AC_DEFUN([gl_ENVIRON],
+AC_DEFUN_ONCE([gl_ENVIRON],
 [
   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
   dnl Persuade glibc <unistd.h> to declare environ.
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4
index 2e40957..d1edc33 100644
--- a/gl/m4/gnulib-comp.m4
+++ b/gl/m4/gnulib-comp.m4
@@ -274,6 +274,8 @@ AC_SUBST([LTALLOCA])
   gl_FUNC_PERROR
   gl_STRING_MODULE_INDICATOR([perror])
   AC_CHECK_HEADERS_ONCE([unistd.h sys/wait.h])
+  gl_FUNC_PUTENV
+  gl_STDLIB_MODULE_INDICATOR([putenv])
   gt_LOCALE_FR
   gt_LOCALE_FR_UTF8
   AC_CHECK_HEADERS_ONCE([unistd.h sys/wait.h])
@@ -578,6 +580,7 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/printf-posix.m4
   m4/printf.m4
   m4/progtest.m4
+  m4/putenv.m4
   m4/quote.m4
   m4/quotearg.m4
   m4/readline.m4
@@ -666,6 +669,7 @@ AC_DEFUN([gl_FILE_LIST], [
   tests/test-select-out.sh
   tests/test-select-stdin.c
   tests/test-select.c
+  tests/test-setenv.c
   tests/test-snprintf.c
   tests/test-sockets.c
   tests/test-stdbool.c
@@ -680,6 +684,7 @@ AC_DEFUN([gl_FILE_LIST], [
   tests/test-sys_socket.c
   tests/test-sys_time.c
   tests/test-unistd.c
+  tests/test-unsetenv.c
   tests/test-vasnprintf.c
   tests/test-vc-list-files-cvs.sh
   tests/test-vc-list-files-git.sh
@@ -687,6 +692,8 @@ AC_DEFUN([gl_FILE_LIST], [
   tests/test-version-etc.sh
   tests/test-wchar.c
   tests/test-wctype.c
+  tests/test-xalloc-die.c
+  tests/test-xalloc-die.sh
   tests/zerosize-ptr.h
   tests=lib/accept.c
   tests=lib/bind.c
@@ -698,6 +705,7 @@ AC_DEFUN([gl_FILE_LIST], [
   tests=lib/malloca.h
   tests=lib/malloca.valgrind
   tests=lib/perror.c
+  tests=lib/putenv.c
   tests=lib/setenv.c
   tests=lib/setsockopt.c
   tests=lib/sys_ioctl.in.h
diff --git a/gl/m4/putenv.m4 b/gl/m4/putenv.m4
new file mode 100644
index 0000000..120f5a4
--- /dev/null
+++ b/gl/m4/putenv.m4
@@ -0,0 +1,41 @@
+# putenv.m4 serial 16
+dnl Copyright (C) 2002-2009 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Jim Meyering.
+dnl
+dnl Check whether putenv ("FOO") removes FOO from the environment.
+dnl The putenv in libc on at least SunOS 4.1.4 does *not* do that.
+
+AC_DEFUN([gl_FUNC_PUTENV],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+  AC_CACHE_CHECK([for putenv compatible with GNU and SVID],
+   [gl_cv_func_svid_putenv],
+   [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],[[
+    /* Put it in env.  */
+    if (putenv ("CONFTEST_putenv=val"))
+      return 1;
+
+    /* Try to remove it.  */
+    if (putenv ("CONFTEST_putenv"))
+      return 1;
+
+    /* Make sure it was deleted.  */
+    if (getenv ("CONFTEST_putenv") != 0)
+      return 1;
+
+    return 0;
+             ]])],
+            gl_cv_func_svid_putenv=yes,
+            gl_cv_func_svid_putenv=no,
+            dnl When crosscompiling, assume putenv is broken.
+            gl_cv_func_svid_putenv=no)
+   ])
+  if test $gl_cv_func_svid_putenv = no; then
+    REPLACE_PUTENV=1
+    AC_LIBOBJ([putenv])
+  fi
+])
diff --git a/gl/m4/setenv.m4 b/gl/m4/setenv.m4
index e28407e..a5df034 100644
--- a/gl/m4/setenv.m4
+++ b/gl/m4/setenv.m4
@@ -1,4 +1,4 @@
-# setenv.m4 serial 11
+# setenv.m4 serial 13
 dnl Copyright (C) 2001-2004, 2006-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -6,12 +6,9 @@ dnl with or without modifications, as long as this notice is 
preserved.
 
 AC_DEFUN([gl_FUNC_SETENV],
 [
-  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
-  AC_CHECK_FUNCS_ONCE([setenv])
-  if test $ac_cv_func_setenv = no; then
-    HAVE_SETENV=0
+  AC_REQUIRE([gl_FUNC_SETENV_SEPARATE])
+  if test $HAVE_SETENV$REPLACE_SETENV != 10; then
     AC_LIBOBJ([setenv])
-    gl_PREREQ_SETENV
   fi
 ])
 
@@ -22,6 +19,24 @@ AC_DEFUN([gl_FUNC_SETENV_SEPARATE],
   AC_CHECK_FUNCS_ONCE([setenv])
   if test $ac_cv_func_setenv = no; then
     HAVE_SETENV=0
+  else
+    AC_CACHE_CHECK([whether setenv validates arguments],
+      [gl_cv_func_setenv_works],
+      [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+       #include <stdlib.h>
+       #include <errno.h>
+      ]], [[
+       if (setenv (NULL, "", 0) != -1) return 1;
+       if (errno != EINVAL) return 2;
+       if (setenv ("a", "=", 1) != 0) return 3;
+       if (strcmp (getenv ("a"), "=") != 0) return 4;
+      ]])],
+      [gl_cv_func_setenv_works=yes], [gl_cv_func_setenv_works=no],
+      [gl_cv_func_setenv_works="guessing no"])])
+    if test "$gl_cv_func_setenv_works" != yes; then
+      REPLACE_SETENV=1
+      AC_LIBOBJ([setenv])
+    fi
   fi
   gl_PREREQ_SETENV
 ])
@@ -35,6 +50,7 @@ AC_DEFUN([gl_FUNC_UNSETENV],
     AC_LIBOBJ([unsetenv])
     gl_PREREQ_UNSETENV
   else
+    dnl Some BSDs return void, failing to do error checking.
     AC_CACHE_CHECK([for unsetenv() return type], [gt_cv_func_unsetenv_ret],
       [AC_TRY_COMPILE([#include <stdlib.h>
 extern
@@ -48,7 +64,30 @@ int unsetenv();
 #endif
 ], , gt_cv_func_unsetenv_ret='int', gt_cv_func_unsetenv_ret='void')])
     if test $gt_cv_func_unsetenv_ret = 'void'; then
-      VOID_UNSETENV=1
+      AC_DEFINE([VOID_UNSETENV], [1], [Define to 1 if unsetenv returns void
+       instead of int.])
+      REPLACE_UNSETENV=1
+      AC_LIBOBJ([unsetenv])
+    fi
+
+    dnl Solaris 10 unsetenv does not remove all copies of a name.
+    AC_CACHE_CHECK([whether unsetenv works on duplicates],
+      [gl_cv_func_unsetenv_works],
+      [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+       #include <stdlib.h>
+      ]], [[
+       char entry[] = "b=2";
+       if (putenv ("a=1")) return 1;
+       if (putenv (entry)) return 2;
+       entry[0] = 'a';
+       unsetenv ("a");
+       if (getenv ("a")) return 3;
+      ]])],
+      [gl_cv_func_unsetenv_works=yes], [gl_cv_func_unsetenv_works=no],
+      [gl_cv_func_unsetenv_works="guessing no"])])
+    if test "$gl_cv_func_unsetenv_works" != yes; then
+      REPLACE_UNSETENV=1
+      AC_LIBOBJ([unsetenv])
     fi
   fi
 ])
diff --git a/gl/m4/stdlib_h.m4 b/gl/m4/stdlib_h.m4
index 4556ac0..10e010e 100644
--- a/gl/m4/stdlib_h.m4
+++ b/gl/m4/stdlib_h.m4
@@ -80,6 +80,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   REPLACE_MKSTEMP=0;         AC_SUBST([REPLACE_MKSTEMP])
   REPLACE_PUTENV=0;          AC_SUBST([REPLACE_PUTENV])
   REPLACE_REALPATH=0;        AC_SUBST([REPLACE_REALPATH])
+  REPLACE_SETENV=0;          AC_SUBST([REPLACE_SETENV])
   REPLACE_STRTOD=0;          AC_SUBST([REPLACE_STRTOD])
-  VOID_UNSETENV=0;           AC_SUBST([VOID_UNSETENV])
+  REPLACE_UNSETENV=0;        AC_SUBST([REPLACE_UNSETENV])
 ])
diff --git a/gl/m4/unistd_h.m4 b/gl/m4/unistd_h.m4
index 5aa39ae..88e60a0 100644
--- a/gl/m4/unistd_h.m4
+++ b/gl/m4/unistd_h.m4
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 31
+# unistd_h.m4 serial 34
 dnl Copyright (C) 2006-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -46,6 +46,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   GNULIB_GETCWD=0;           AC_SUBST([GNULIB_GETCWD])
   GNULIB_GETDOMAINNAME=0;    AC_SUBST([GNULIB_GETDOMAINNAME])
   GNULIB_GETDTABLESIZE=0;    AC_SUBST([GNULIB_GETDTABLESIZE])
+  GNULIB_GETGROUPS=0;        AC_SUBST([GNULIB_GETGROUPS])
   GNULIB_GETHOSTNAME=0;      AC_SUBST([GNULIB_GETHOSTNAME])
   GNULIB_GETLOGIN_R=0;       AC_SUBST([GNULIB_GETLOGIN_R])
   GNULIB_GETPAGESIZE=0;      AC_SUBST([GNULIB_GETPAGESIZE])
@@ -67,6 +68,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   GNULIB_UNLINKAT=0;         AC_SUBST([GNULIB_UNLINKAT])
   GNULIB_WRITE=0;            AC_SUBST([GNULIB_WRITE])
   dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_CHOWN=1;           AC_SUBST([HAVE_CHOWN])
   HAVE_DUP2=1;            AC_SUBST([HAVE_DUP2])
   HAVE_DUP3=1;            AC_SUBST([HAVE_DUP3])
   HAVE_EUIDACCESS=1;      AC_SUBST([HAVE_EUIDACCESS])
@@ -76,9 +78,11 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   HAVE_FTRUNCATE=1;       AC_SUBST([HAVE_FTRUNCATE])
   HAVE_GETDOMAINNAME=1;   AC_SUBST([HAVE_GETDOMAINNAME])
   HAVE_GETDTABLESIZE=1;   AC_SUBST([HAVE_GETDTABLESIZE])
+  HAVE_GETGROUPS=1;       AC_SUBST([HAVE_GETGROUPS])
   HAVE_GETHOSTNAME=1;     AC_SUBST([HAVE_GETHOSTNAME])
   HAVE_GETPAGESIZE=1;     AC_SUBST([HAVE_GETPAGESIZE])
   HAVE_GETUSERSHELL=1;    AC_SUBST([HAVE_GETUSERSHELL])
+  HAVE_LCHOWN=1;          AC_SUBST([HAVE_LCHOWN])
   HAVE_LINK=1;            AC_SUBST([HAVE_LINK])
   HAVE_LINKAT=1;          AC_SUBST([HAVE_LINKAT])
   HAVE_PIPE2=1;           AC_SUBST([HAVE_PIPE2])
@@ -99,6 +103,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   REPLACE_FCHDIR=0;       AC_SUBST([REPLACE_FCHDIR])
   REPLACE_FCHOWNAT=0;     AC_SUBST([REPLACE_FCHOWNAT])
   REPLACE_GETCWD=0;       AC_SUBST([REPLACE_GETCWD])
+  REPLACE_GETGROUPS=0;    AC_SUBST([REPLACE_GETGROUPS])
   REPLACE_GETPAGESIZE=0;  AC_SUBST([REPLACE_GETPAGESIZE])
   REPLACE_LCHOWN=0;       AC_SUBST([REPLACE_LCHOWN])
   REPLACE_LINK=0;         AC_SUBST([REPLACE_LINK])
diff --git a/gl/printf-args.c b/gl/printf-args.c
index 871c720..dabce04 100644
--- a/gl/printf-args.c
+++ b/gl/printf-args.c
@@ -1,5 +1,6 @@
 /* Decomposed printf argument list.
-   Copyright (C) 1999, 2002-2003, 2005-2007 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002-2003, 2005-2007, 2009 Free Software
+   Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -89,7 +90,7 @@ PRINTF_FETCHARGS (va_list args, arguments *a)
           where wint_t is 'unsigned short'.  */
        ap->a.a_wide_char =
          (sizeof (wint_t) < sizeof (int)
-          ? va_arg (args, int)
+          ? (wint_t) va_arg (args, int)
           : va_arg (args, wint_t));
        break;
 #endif
diff --git a/gl/stdlib.in.h b/gl/stdlib.in.h
index e2c6bbf..dd15ac0 100644
--- a/gl/stdlib.in.h
+++ b/gl/stdlib.in.h
@@ -384,11 +384,21 @@ extern int rpmatch (const char *response);
 #endif
 
 #if @GNULIB_SETENV@
-# if address@hidden@
+# if @REPLACE_SETENV@
+#  undef setenv
+#  define setenv rpl_setenv
+# endif
+# if address@hidden@ || @REPLACE_SETENV@
 /* Set NAME to VALUE in the environment.
    If REPLACE is nonzero, overwrite an existing value.  */
 extern int setenv (const char *name, const char *value, int replace);
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef setenv
+# define setenv(n,v,o)                                                  \
+    (GL_LINK_WARNING ("setenv is unportable - "                         \
+                      "use gnulib module setenv for portability"),      \
+     setenv (n, v, o))
 #endif
 
 #if @GNULIB_STRTOD@
@@ -448,16 +458,20 @@ extern unsigned long long strtoull (const char *string, 
char **endptr, int base)
 #endif
 
 #if @GNULIB_UNSETENV@
-# if @HAVE_UNSETENV@
-#  if @VOID_UNSETENV@
-/* On some systems, unsetenv() returns void.
-   This is the case for MacOS X 10.3, FreeBSD 4.8, NetBSD 1.6, OpenBSD 3.4.  */
-#   define unsetenv(name) ((unsetenv)(name), 0)
-#  endif
-# else
+# if @REPLACE_UNSETENV@
+#  undef unsetenv
+#  define unsetenv rpl_unsetenv
+# endif
+# if address@hidden@ || @REPLACE_UNSETENV@
 /* Remove the variable NAME from the environment.  */
 extern int unsetenv (const char *name);
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef unsetenv
+# define unsetenv(n)                                                    \
+    (GL_LINK_WARNING ("unsetenv is unportable - "                       \
+                      "use gnulib module unsetenv for portability"),    \
+     unsetenv (n))
 #endif
 
 #ifdef __cplusplus
diff --git a/gl/unistd.in.h b/gl/unistd.in.h
index c755467..73a4d8e 100644
--- a/gl/unistd.in.h
+++ b/gl/unistd.in.h
@@ -126,18 +126,16 @@ extern "C" {
 
 #if @GNULIB_CHOWN@
 # if @REPLACE_CHOWN@
-#  ifndef REPLACE_CHOWN
-#   define REPLACE_CHOWN 1
-#  endif
-#  if REPLACE_CHOWN
+#  undef chown
+#  define chown rpl_chown
+# endif
+# if address@hidden@ || @REPLACE_CHOWN@
 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
    to GID (if GID is not -1).  Follow symbolic links.
    Return 0 if successful, otherwise -1 and errno set.
    See the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/chown.html>.  */
-#   define chown rpl_chown
 extern int chown (const char *file, uid_t uid, gid_t gid);
-#  endif
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef chown
@@ -406,6 +404,28 @@ extern int getdtablesize (void);
 #endif
 
 
+#if @GNULIB_GETGROUPS@
+# if @REPLACE_GETGROUPS@
+#  undef getgroups
+#  define getgroups rpl_getgroups
+# endif
+# if address@hidden@ || @REPLACE_GETGROUPS@
+/* Return the supplemental groups that the current process belongs to.
+   It is unspecified whether the effective group id is in the list.
+   If N is 0, return the group count; otherwise, N describes how many
+   entries are available in GROUPS.  Return -1 and set errno if N is
+   not 0 and not large enough.  Fails with ENOSYS on some systems.  */
+int getgroups (int n, gid_t *groups);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getgroups
+# define getgroups(n,g)                                                 \
+    (GL_LINK_WARNING ("getgroups is unportable - "                      \
+                      "use gnulib module getgroups for portability"),   \
+     getgroups (n, g))
+#endif
+
+
 #if @GNULIB_GETHOSTNAME@
 /* Return the standard host name of the machine.
    WARNING! The host name may or may not be fully qualified.
@@ -545,12 +565,15 @@ extern void endusershell (void);
 
 #if @GNULIB_LCHOWN@
 # if @REPLACE_LCHOWN@
+#  undef lchown
+#  define lchown rpl_lchown
+# endif
+# if address@hidden@ || @REPLACE_LCHOWN@
 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
    to GID (if GID is not -1).  Do not follow symbolic links.
    Return 0 if successful, otherwise -1 and errno set.
    See the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/lchown.html>.  */
-#  define lchown rpl_lchown
 extern int lchown (char const *file, uid_t owner, gid_t group);
 # endif
 #elif defined GNULIB_POSIXCHECK
diff --git a/gl/vasnprintf.c b/gl/vasnprintf.c
index e47e00c..d0e3f00 100644
--- a/gl/vasnprintf.c
+++ b/gl/vasnprintf.c
@@ -2375,16 +2375,16 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                      characters = 0;
                      while (precision > 0)
                        {
-                         char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                         char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
                          int count;
 
                          if (*arg_end == 0)
                            /* Found the terminating null wide character.  */
                            break;
 #  if HAVE_WCRTOMB
-                         count = wcrtomb (buf, *arg_end, &state);
+                         count = wcrtomb (cbuf, *arg_end, &state);
 #  else
-                         count = wctomb (buf, *arg_end);
+                         count = wctomb (cbuf, *arg_end);
 #  endif
                          if (count < 0)
                            {
@@ -2420,16 +2420,16 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                      characters = 0;
                      for (;;)
                        {
-                         char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                         char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
                          int count;
 
                          if (*arg_end == 0)
                            /* Found the terminating null wide character.  */
                            break;
 #  if HAVE_WCRTOMB
-                         count = wcrtomb (buf, *arg_end, &state);
+                         count = wcrtomb (cbuf, *arg_end, &state);
 #  else
-                         count = wctomb (buf, *arg_end);
+                         count = wctomb (cbuf, *arg_end);
 #  endif
                          if (count < 0)
                            {
@@ -2470,20 +2470,20 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
 #   endif
                    for (remaining = characters; remaining > 0; )
                      {
-                       char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                       char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
                        int count;
 
                        if (*arg == 0)
                          abort ();
 #   if HAVE_WCRTOMB
-                       count = wcrtomb (buf, *arg, &state);
+                       count = wcrtomb (cbuf, *arg, &state);
 #   else
-                       count = wctomb (buf, *arg);
+                       count = wctomb (cbuf, *arg);
 #   endif
                        if (count <= 0)
                          /* Inconsistency.  */
                          abort ();
-                       memcpy (tmpptr, buf, count);
+                       memcpy (tmpptr, cbuf, count);
                        tmpptr += count;
                        arg++;
                        remaining -= count;
@@ -2552,20 +2552,20 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                      ENSURE_ALLOCATION (xsum (length, characters));
                      for (remaining = characters; remaining > 0; )
                        {
-                         char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                         char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
                          int count;
 
                          if (*arg == 0)
                            abort ();
 #   if HAVE_WCRTOMB
-                         count = wcrtomb (buf, *arg, &state);
+                         count = wcrtomb (cbuf, *arg, &state);
 #   else
-                         count = wctomb (buf, *arg);
+                         count = wctomb (cbuf, *arg);
 #   endif
                          if (count <= 0)
                            /* Inconsistency.  */
                            abort ();
-                         memcpy (result + length, buf, count);
+                         memcpy (result + length, cbuf, count);
                          length += count;
                          arg++;
                          remaining -= count;
@@ -2581,21 +2581,21 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
 #   endif
                      while (arg < arg_end)
                        {
-                         char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                         char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
                          int count;
 
                          if (*arg == 0)
                            abort ();
 #   if HAVE_WCRTOMB
-                         count = wcrtomb (buf, *arg, &state);
+                         count = wcrtomb (cbuf, *arg, &state);
 #   else
-                         count = wctomb (buf, *arg);
+                         count = wctomb (cbuf, *arg);
 #   endif
                          if (count <= 0)
                            /* Inconsistency.  */
                            abort ();
                          ENSURE_ALLOCATION (xsum (length, count));
-                         memcpy (result + length, buf, count);
+                         memcpy (result + length, cbuf, count);
                          length += count;
                          arg++;
                        }
diff --git a/gl/version-etc.c b/gl/version-etc.c
index a580140..bf67c37 100644
--- a/gl/version-etc.c
+++ b/gl/version-etc.c
@@ -236,13 +236,17 @@ emit_bug_reporting_address (void)
      for this package.  Please add _another line_ saying
      "Report translation bugs to <...>\n" with the address for translation
      bugs (typically your translation team's web or email address).  */
-  printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
+  printf (_("\nReport bugs to: %s\n"), PACKAGE_BUGREPORT);
 #ifdef PACKAGE_PACKAGER_BUG_REPORTS
-  printf (_("Report %s bugs to <%s>.\n"), PACKAGE_PACKAGER,
+  printf (_("Report %s bugs to: %s\n"), PACKAGE_PACKAGER,
          PACKAGE_PACKAGER_BUG_REPORTS);
 #endif
-  printf (_("%s home page: <http://www.gnu.org/software/%s/>.\n"),
+#ifdef PACKAGE_URL
+  printf (_("%s home page: <%s>\n"), PACKAGE_NAME, PACKAGE_URL);
+#else
+  printf (_("%s home page: <http://www.gnu.org/software/%s/>\n"),
          PACKAGE_NAME, PACKAGE);
-  fputs (_("General help using GNU software: 
<http://www.gnu.org/gethelp/>.\n"),
+#endif
+  fputs (_("General help using GNU software: <http://www.gnu.org/gethelp/>\n"),
         stdout);
 }
diff --git a/gltests/Makefile.am b/gltests/Makefile.am
index 734c3d6..8bd179a 100644
--- a/gltests/Makefile.am
+++ b/gltests/Makefile.am
@@ -14,6 +14,7 @@ AUTOMAKE_OPTIONS = 1.5 foreign
 
 SUBDIRS =
 TESTS =
+XFAIL_TESTS =
 TESTS_ENVIRONMENT =
 noinst_PROGRAMS =
 check_PROGRAMS =
@@ -370,6 +371,15 @@ EXTRA_DIST += test-poll.c
 
 ## end   gnulib module poll-tests
 
+## begin gnulib module putenv
+
+
+EXTRA_DIST += putenv.c
+
+EXTRA_libtests_a_SOURCES += putenv.c
+
+## end   gnulib module putenv
+
 ## begin gnulib module quotearg-tests
 
 TESTS += test-quotearg.sh
@@ -403,6 +413,14 @@ EXTRA_libtests_a_SOURCES += setenv.c
 
 ## end   gnulib module setenv
 
+## begin gnulib module setenv-tests
+
+TESTS += test-setenv
+check_PROGRAMS += test-setenv
+EXTRA_DIST += test-setenv.c
+
+## end   gnulib module setenv-tests
+
 ## begin gnulib module setsockopt
 
 
@@ -575,6 +593,14 @@ EXTRA_libtests_a_SOURCES += unsetenv.c
 
 ## end   gnulib module unsetenv
 
+## begin gnulib module unsetenv-tests
+
+TESTS += test-unsetenv
+check_PROGRAMS += test-unsetenv
+EXTRA_DIST += test-unsetenv.c
+
+## end   gnulib module unsetenv-tests
+
 ## begin gnulib module vasnprintf-tests
 
 TESTS += test-vasnprintf
@@ -636,6 +662,15 @@ EXTRA_DIST += test-wctype.c
 
 ## end   gnulib module wctype-tests
 
+## begin gnulib module xalloc-die-tests
+
+TESTS += test-xalloc-die.sh
+TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
+check_PROGRAMS += test-xalloc-die
+EXTRA_DIST += test-xalloc-die.c test-xalloc-die.sh
+
+## end   gnulib module xalloc-die-tests
+
 # Clean up after Solaris cc.
 clean-local:
        rm -rf SunWS_cache
diff --git a/gltests/putenv.c b/gltests/putenv.c
new file mode 100644
index 0000000..cc14b93
--- /dev/null
+++ b/gltests/putenv.c
@@ -0,0 +1,132 @@
+/* Copyright (C) 1991, 1994, 1997-1998, 2000, 2003-2008
+   Free Software Foundation, Inc.
+
+   NOTE: The canonical source of this file is maintained with the GNU C
+   Library.  Bugs can be reported to address@hidden
+
+   This program is free software: you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 3 of the License, or any
+   later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdlib.h>
+
+#include <stddef.h>
+
+/* Include errno.h *after* sys/types.h to work around header problems
+   on AIX 3.2.5.  */
+#include <errno.h>
+#ifndef __set_errno
+# define __set_errno(ev) ((errno) = (ev))
+#endif
+
+#include <string.h>
+#include <unistd.h>
+
+#if HAVE_GNU_LD
+# define environ __environ
+#else
+extern char **environ;
+#endif
+
+#if _LIBC
+/* This lock protects against simultaneous modifications of `environ'.  */
+# include <bits/libc-lock.h>
+__libc_lock_define_initialized (static, envlock)
+# define LOCK  __libc_lock_lock (envlock)
+# define UNLOCK        __libc_lock_unlock (envlock)
+#else
+# define LOCK
+# define UNLOCK
+#endif
+
+static int
+_unsetenv (const char *name)
+{
+  size_t len;
+  char **ep;
+
+  if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  len = strlen (name);
+
+  LOCK;
+
+  ep = environ;
+  while (*ep != NULL)
+    if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
+      {
+       /* Found it.  Remove this pointer by moving later ones back.  */
+       char **dp = ep;
+
+       do
+         dp[0] = dp[1];
+       while (*dp++);
+       /* Continue the loop in case NAME appears again.  */
+      }
+    else
+      ++ep;
+
+  UNLOCK;
+
+  return 0;
+}
+
+
+/* Put STRING, which is of the form "NAME=VALUE", in the environment.
+   If STRING contains no `=', then remove STRING from the environment.  */
+int
+putenv (char *string)
+{
+  const char *const name_end = strchr (string, '=');
+  register size_t size;
+  register char **ep;
+
+  if (name_end == NULL)
+    {
+      /* Remove the variable from the environment.  */
+      return _unsetenv (string);
+    }
+
+  size = 0;
+  for (ep = environ; *ep != NULL; ++ep)
+    if (!strncmp (*ep, string, name_end - string) &&
+       (*ep)[name_end - string] == '=')
+      break;
+    else
+      ++size;
+
+  if (*ep == NULL)
+    {
+      static char **last_environ = NULL;
+      char **new_environ = (char **) malloc ((size + 2) * sizeof (char *));
+      if (new_environ == NULL)
+       return -1;
+      (void) memcpy ((void *) new_environ, (void *) environ,
+                    size * sizeof (char *));
+      new_environ[size] = (char *) string;
+      new_environ[size + 1] = NULL;
+      free (last_environ);
+      last_environ = new_environ;
+      environ = new_environ;
+    }
+  else
+    *ep = string;
+
+  return 0;
+}
diff --git a/gltests/setenv.c b/gltests/setenv.c
index 83b52b8..0df5b21 100644
--- a/gltests/setenv.c
+++ b/gltests/setenv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992,1995-1999,2000-2003,2005-2008 Free Software Foundation, 
Inc.
+/* Copyright (C) 1992,1995-1999,2000-2003,2005-2009 Free Software Foundation, 
Inc.
    This file is part of the GNU C Library.
 
    This program is free software: you can redistribute it and/or modify
@@ -32,12 +32,12 @@
 # include <unistd.h>
 #endif
 
-#if _LIBC || !HAVE_SETENV
-
 #if !_LIBC
 # include "malloca.h"
 #endif
 
+#if _LIBC || !HAVE_SETENV
+
 #if !_LIBC
 # define __environ     environ
 #endif
@@ -281,6 +281,12 @@ __add_to_environ (const char *name, const char *value, 
const char *combined,
 int
 setenv (const char *name, const char *value, int replace)
 {
+  if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
   return __add_to_environ (name, value, NULL, replace);
 }
 
@@ -328,3 +334,45 @@ weak_alias (__clearenv, clearenv)
 #endif
 
 #endif /* _LIBC || !HAVE_SETENV */
+
+/* The rest of this file is called into use when replacing an existing
+   but buggy setenv.  Known bugs include failure to diagnose invalid
+   name, and consuming a leading '=' from value.  */
+#if HAVE_SETENV
+
+# undef setenv
+# define STREQ(a, b) (strcmp (a, b) == 0)
+
+int
+rpl_setenv (const char *name, const char *value, int replace)
+{
+  int result;
+  if (!name || !*name || strchr (name, '='))
+    {
+      errno = EINVAL;
+      return -1;
+    }
+  /* Call the real setenv even if replace is 0, in case implementation
+     has underlying data to update, such as when environ changes.  */
+  result = setenv (name, value, replace);
+  if (result == 0 && replace && *value == '=')
+    {
+      char *tmp = getenv (name);
+      if (!STREQ (tmp, value))
+        {
+          int saved_errno;
+          size_t len = strlen (value);
+          tmp = malloca (len + 2);
+          /* Since leading '=' is eaten, double it up.  */
+          *tmp = '=';
+          memcpy (tmp + 1, value, len + 1);
+          result = setenv (name, tmp, replace);
+          saved_errno = errno;
+          freea (tmp);
+          errno = saved_errno;
+        }
+    }
+  return result;
+}
+
+#endif /* HAVE_SETENV */
diff --git a/gltests/test-setenv.c b/gltests/test-setenv.c
new file mode 100644
index 0000000..61be838
--- /dev/null
+++ b/gltests/test-setenv.c
@@ -0,0 +1,60 @@
+/* Tests of setenv.
+   Copyright (C) 2009 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <address@hidden>, 2009.  */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#define ASSERT(expr) \
+  do                                                                         \
+    {                                                                        \
+      if (!(expr))                                                           \
+        {                                                                    \
+          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__);  \
+          fflush (stderr);                                                   \
+          abort ();                                                          \
+        }                                                                    \
+    }                                                                        \
+  while (0)
+
+int
+main (void)
+{
+  /* Test overwriting.  */
+  ASSERT (setenv ("a", "==", -1) == 0);
+  ASSERT (setenv ("a", "2", 0) == 0);
+  ASSERT (strcmp (getenv ("a"), "==") == 0);
+
+  /* Required to fail with EINVAL.  */
+  errno = 0;
+  ASSERT (setenv ("", "", 1) == -1);
+  ASSERT (errno == EINVAL);
+  errno = 0;
+  ASSERT (setenv ("a=b", "", 0) == -1);
+  ASSERT (errno == EINVAL);
+  errno = 0;
+  ASSERT (setenv (NULL, "", 0) == -1);
+  ASSERT (errno == EINVAL);
+
+  return 0;
+}
diff --git a/gltests/test-unsetenv.c b/gltests/test-unsetenv.c
new file mode 100644
index 0000000..11af82c
--- /dev/null
+++ b/gltests/test-unsetenv.c
@@ -0,0 +1,65 @@
+/* Tests of unsetenv.
+   Copyright (C) 2009 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <address@hidden>, 2009.  */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#define ASSERT(expr) \
+  do                                                                         \
+    {                                                                        \
+      if (!(expr))                                                           \
+        {                                                                    \
+          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__);  \
+          fflush (stderr);                                                   \
+          abort ();                                                          \
+        }                                                                    \
+    }                                                                        \
+  while (0)
+
+int
+main (void)
+{
+  char entry[] = "b=2";
+
+  /* Test removal when multiple entries present.  */
+  ASSERT (putenv ("a=1") == 0);
+  ASSERT (putenv (entry) == 0);
+  entry[0] = 'a'; /* Unspecified what getenv("a") would be at this point.  */
+  ASSERT (unsetenv ("a") == 0); /* Both entries will be removed.  */
+  ASSERT (getenv ("a") == NULL);
+  ASSERT (unsetenv ("a") == 0);
+
+  /* Required to fail with EINVAL.  */
+  errno = 0;
+  ASSERT (unsetenv ("") == -1);
+  ASSERT (errno == EINVAL);
+  errno = 0;
+  ASSERT (unsetenv ("a=b") == -1);
+  ASSERT (errno == EINVAL);
+  errno = 0;
+  ASSERT (unsetenv (NULL) == -1);
+  ASSERT (errno == EINVAL);
+
+  return 0;
+}
diff --git a/gltests/test-sys_time.c b/gltests/test-xalloc-die.c
similarity index 75%
copy from gltests/test-sys_time.c
copy to gltests/test-xalloc-die.c
index 74f35ac..88461e8 100644
--- a/gltests/test-sys_time.c
+++ b/gltests/test-xalloc-die.c
@@ -1,5 +1,5 @@
-/* Test of <sys/time.h> substitute.
-   Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+/* Test of xalloc_die() function.
+   Copyright (C) 2009 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -14,16 +14,17 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-/* Written by Bruno Haible <address@hidden>, 2007.  */
+/* Written by Simon Josefsson <address@hidden>, 2009.  */
 
 #include <config.h>
 
-#include <sys/time.h>
+#include "xalloc.h"
 
-struct timeval a;
+char *program_name = "test-xalloc-die";
 
 int
 main (void)
 {
+  xalloc_die ();
   return 0;
 }
diff --git a/gltests/test-xalloc-die.sh b/gltests/test-xalloc-die.sh
new file mode 100755
index 0000000..b181ccb
--- /dev/null
+++ b/gltests/test-xalloc-die.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+tmpfiles=""
+trap '__st=$?; rm -fr $tmpfiles; exit $__st' 0
+trap '__st=$?; (exit $__st); exit $__st' 1 2 3 15
+
+if ( diff --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then
+  compare() { diff -u "$@"; }
+elif ( cmp --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then
+  compare() { cmp -s "$@"; }
+else
+  compare() { cmp "$@"; }
+fi
+
+tmpfiles="t-xalloc-die.tmp"
+PATH=".:$PATH"
+export PATH
+test-xalloc-die${EXEEXT} 2> t-xalloc-die.tmp
+case $? in
+  1) ;;
+  *) (exit 1); exit 1 ;;
+esac
+
+compare - t-xalloc-die.tmp <<\EOF || { (exit 1); exit 1; }
+test-xalloc-die: memory exhausted
+EOF
+
+rm -fr $tmpfiles
+
+exit 0
diff --git a/gltests/unsetenv.c b/gltests/unsetenv.c
index 73ea878..21fb199 100644
--- a/gltests/unsetenv.c
+++ b/gltests/unsetenv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992,1995-1999,2000-2002,2005-2008 Free Software Foundation, 
Inc.
+/* Copyright (C) 1992,1995-1999,2000-2002,2005-2009 Free Software Foundation, 
Inc.
    This file is part of the GNU C Library.
 
    This program is free software: you can redistribute it and/or modify
@@ -47,6 +47,7 @@ __libc_lock_define_initialized (static, envlock)
 # define unsetenv __unsetenv
 #endif
 
+#if _LIBC || !HAVE_UNSETENV
 
 int
 unsetenv (const char *name)
@@ -88,3 +89,28 @@ unsetenv (const char *name)
 # undef unsetenv
 weak_alias (__unsetenv, unsetenv)
 #endif
+
+#else /* HAVE_UNSETENV */
+
+# undef unsetenv
+
+/* Call the underlying unsetenv, in case there is hidden bookkeeping
+   that needs updating beyond just modifying environ.  */
+int
+rpl_unsetenv (const char *name)
+{
+  int result = 0;
+  if (!name || !*name || strchr (name, '='))
+    {
+      errno = EINVAL;
+      return -1;
+    }
+  while (getenv (name))
+# if !VOID_UNSETENV
+    result =
+# endif
+      unsetenv (name);
+  return result;
+}
+
+#endif /* HAVE_UNSETENV */
diff --git a/lib/ChangeLog b/lib/ChangeLog
index 357bbe3..8fb40df 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,3 +1,55 @@
+2009-11-17  Simon Josefsson <address@hidden>
+
+       * NEWS, lib/NEWS: Version 1.4.0.
+
+2009-11-17  Simon Josefsson <address@hidden>
+
+       * lib/NEWS: Add.
+
+2009-11-17  Simon Josefsson <address@hidden>
+
+       * NEWS: Add.
+
+2009-11-17  Simon Josefsson <address@hidden>
+
+       * NEWS, configure.ac, lib/NEWS, lib/configure.ac, lib/src/gsasl.h: 
+       Bump versions.
+
+2009-11-17  Simon Josefsson <address@hidden>
+
+       * gl/m4/putenv.m4, gltests/putenv.c, gltests/test-setenv.c,
+       gltests/test-unsetenv.c, gltests/test-xalloc-die.c,
+       gltests/test-xalloc-die.sh: Update gnulib files.
+
+2009-11-17  Simon Josefsson <address@hidden>
+
+       * gl/Makefile.am, gl/intprops.h, gl/m4/environ.m4,
+       gl/m4/gnulib-comp.m4, gl/m4/setenv.m4, gl/m4/stdlib_h.m4,
+       gl/m4/unistd_h.m4, gl/printf-args.c, gl/stdlib.in.h,
+       gl/unistd.in.h, gl/vasnprintf.c, gl/version-etc.c,
+       gltests/Makefile.am, gltests/setenv.c, gltests/unsetenv.c,
+       lib/gl/Makefile.am, lib/gl/gc-pbkdf2-sha1.c, lib/gl/m4/stdlib_h.m4,
+       lib/gl/m4/unistd_h.m4, lib/gl/printf-args.c, lib/gl/stdlib.in.h,
+       lib/gl/unistd.in.h, lib/gl/vasnprintf.c, lib/gltests/Makefile.am,
+       lib/gltests/intprops.h, lib/gltests/test-base64.c, lib/maint.mk,
+       maint.mk: Update gnulib files.
+
+2009-11-09  Simon Josefsson <address@hidden>
+
+       * gltests/test-fseeko.c: Update gnulib files.
+
+2009-11-06  Simon Josefsson <address@hidden>
+
+       * cfg.mk: Commit cyclo/ www dir too.
+
+2009-11-06  Simon Josefsson <address@hidden>
+
+       * ChangeLog: Generated.
+
+2009-11-06  Simon Josefsson <address@hidden>
+
+       * lib/ChangeLog: Generated.
+
 2009-11-06  Simon Josefsson <address@hidden>
 
        * NEWS, lib/NEWS: Version 1.3.91.
diff --git a/lib/NEWS b/lib/NEWS
index 5b51211..bbf744a 100644
--- a/lib/NEWS
+++ b/lib/NEWS
@@ -2,6 +2,13 @@ GNU SASL LIBRARY NEWS -- History of user-visible changes.
 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Simon Josefsson
 See the end for copying conditions.
 
+* Version 1.4.0 (released 2009-11-17) [stable]
+
+** No changes since 1.3.91 release candidate.
+
+** API and ABI modifications.
+No changes since last version.
+
 * Version 1.3.91 (released 2009-11-06) [experimental]
 
 ** Fix Visual Studio project files to work with SCRAM.
diff --git a/lib/configure.ac b/lib/configure.ac
index 3fad058..a3c185b 100644
--- a/lib/configure.ac
+++ b/lib/configure.ac
@@ -20,7 +20,7 @@ dnl Process this file with autoconf to produce a configure 
script.
 # MA 02110-1301, USA.
 
 AC_PREREQ(2.61)
-AC_INIT([libgsasl], [1.3.91], address@hidden)
+AC_INIT([libgsasl], [1.4.0], address@hidden)
 AC_CONFIG_AUX_DIR([build-aux])
 AC_CONFIG_MACRO_DIR([m4])
 
@@ -29,7 +29,7 @@ AC_CONFIG_MACRO_DIR([m4])
 # Interfaces added:                             AGE++
 # Interfaces removed:                           AGE=0
 AC_SUBST(LT_CURRENT, 14)
-AC_SUBST(LT_REVISION, 1)
+AC_SUBST(LT_REVISION, 2)
 AC_SUBST(LT_AGE, 7)
 
 # Used when creating libgsasl-XX.def.
diff --git a/lib/gl/Makefile.am b/lib/gl/Makefile.am
index 82851ec..b92c1e3 100644
--- a/lib/gl/Makefile.am
+++ b/lib/gl/Makefile.am
@@ -541,8 +541,9 @@ stdlib.h: stdlib.in.h
              -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
              -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
              -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \
+             -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \
              -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \
-             -e 's|@''VOID_UNSETENV''@|$(VOID_UNSETENV)|g' \
+             -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              < $(srcdir)/stdlib.in.h; \
        } > address@hidden && \
@@ -671,6 +672,7 @@ unistd.h: unistd.in.h
              -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \
              -e 's|@''GNULIB_GETDOMAINNAME''@|$(GNULIB_GETDOMAINNAME)|g' \
              -e 's|@''GNULIB_GETDTABLESIZE''@|$(GNULIB_GETDTABLESIZE)|g' \
+             -e 's|@''GNULIB_GETGROUPS''@|$(GNULIB_GETGROUPS)|g' \
              -e 's|@''GNULIB_GETHOSTNAME''@|$(GNULIB_GETHOSTNAME)|g' \
              -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \
              -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \
@@ -691,6 +693,7 @@ unistd.h: unistd.in.h
              -e 's|@''GNULIB_UNLINK''@|$(GNULIB_UNLINK)|g' \
              -e 's|@''GNULIB_UNLINKAT''@|$(GNULIB_UNLINKAT)|g' \
              -e 's|@''GNULIB_WRITE''@|$(GNULIB_WRITE)|g' \
+             -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \
              -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
              -e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \
              -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \
@@ -700,9 +703,11 @@ unistd.h: unistd.in.h
              -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \
              -e 's|@''HAVE_GETDOMAINNAME''@|$(HAVE_GETDOMAINNAME)|g' \
              -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \
+             -e 's|@''HAVE_GETGROUPS''@|$(HAVE_GETGROUPS)|g' \
              -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \
              -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \
              -e 's|@''HAVE_GETUSERSHELL''@|$(HAVE_GETUSERSHELL)|g' \
+             -e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \
              -e 's|@''HAVE_LINK''@|$(HAVE_LINK)|g' \
              -e 's|@''HAVE_LINKAT''@|$(HAVE_LINKAT)|g' \
              -e 's|@''HAVE_PIPE2''@|$(HAVE_PIPE2)|g' \
@@ -723,6 +728,7 @@ unistd.h: unistd.in.h
              -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
              -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \
              -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
+             -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \
              -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
              -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
              -e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \
diff --git a/lib/gl/gc-pbkdf2-sha1.c b/lib/gl/gc-pbkdf2-sha1.c
index 364bf1d..75796d6 100644
--- a/lib/gl/gc-pbkdf2-sha1.c
+++ b/lib/gl/gc-pbkdf2-sha1.c
@@ -1,5 +1,5 @@
 /* gc-pbkdf2-sha1.c --- Password-Based Key Derivation Function a'la PKCS#5
-   Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004, 2005, 2006, 2009 Free Software Foundation, 
Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -15,8 +15,7 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
-/* Written by Simon Josefsson.  The comments in this file are taken
-   from RFC 2898.  */
+/* Written by Simon Josefsson. */
 
 #include <config.h>
 
@@ -25,32 +24,12 @@
 #include <stdlib.h>
 #include <string.h>
 
-/*
- * 5.2 PBKDF2
- *
- *  PBKDF2 applies a pseudorandom function (see Appendix B.1 for an
- *  example) to derive keys. The length of the derived key is essentially
- *  unbounded. (However, the maximum effective search space for the
- *  derived key may be limited by the structure of the underlying
- *  pseudorandom function. See Appendix B.1 for further discussion.)
- *  PBKDF2 is recommended for new applications.
- *
- *  PBKDF2 (P, S, c, dkLen)
- *
- *  Options:        PRF        underlying pseudorandom function (hLen
- *                             denotes the length in octets of the
- *                             pseudorandom function output)
- *
- *  Input:          P          password, an octet string (ASCII or UTF-8)
- *                  S          salt, an octet string
- *                  c          iteration count, a positive integer
- *                  dkLen      intended length in octets of the derived
- *                             key, a positive integer, at most
- *                             (2^32 - 1) * hLen
- *
- *  Output:         DK         derived key, a dkLen-octet string
- */
-
+/* Implement PKCS#5 PBKDF2 as per RFC 2898.  The PRF to use is hard
+   coded to be HMAC-SHA1.  Inputs are the password P of length PLEN,
+   the salt S of length SLEN, the iteration counter C (> 0), and the
+   desired derived output length DKLEN.  Output buffer is DK which
+   must have room for at least DKLEN octets.  The output buffer will
+   be filled with the derived data.  */
 Gc_rc
 gc_pbkdf2_sha1 (const char *P, size_t Plen,
                const char *S, size_t Slen,
@@ -75,74 +54,12 @@ gc_pbkdf2_sha1 (const char *P, size_t Plen,
   if (dkLen == 0)
     return GC_PKCS5_INVALID_DERIVED_KEY_LENGTH;
 
-  /*
-   *
-   *  Steps:
-   *
-   *     1. If dkLen > (2^32 - 1) * hLen, output "derived key too long" and
-   *        stop.
-   */
-
   if (dkLen > 4294967295U)
     return GC_PKCS5_DERIVED_KEY_TOO_LONG;
 
-  /*
-   *     2. Let l be the number of hLen-octet blocks in the derived key,
-   *        rounding up, and let r be the number of octets in the last
-   *        block:
-   *
-   *                  l = CEIL (dkLen / hLen) ,
-   *                  r = dkLen - (l - 1) * hLen .
-   *
-   *        Here, CEIL (x) is the "ceiling" function, i.e. the smallest
-   *        integer greater than, or equal to, x.
-   */
-
   l = ((dkLen - 1) / hLen) + 1;
   r = dkLen - (l - 1) * hLen;
 
-  /*
-   *     3. For each block of the derived key apply the function F defined
-   *        below to the password P, the salt S, the iteration count c, and
-   *        the block index to compute the block:
-   *
-   *                  T_1 = F (P, S, c, 1) ,
-   *                  T_2 = F (P, S, c, 2) ,
-   *                  ...
-   *                  T_l = F (P, S, c, l) ,
-   *
-   *        where the function F is defined as the exclusive-or sum of the
-   *        first c iterates of the underlying pseudorandom function PRF
-   *        applied to the password P and the concatenation of the salt S
-   *        and the block index i:
-   *
-   *                  F (P, S, c, i) = U_1 \xor U_2 \xor ... \xor U_c
-   *
-   *        where
-   *
-   *                  U_1 = PRF (P, S || INT (i)) ,
-   *                  U_2 = PRF (P, U_1) ,
-   *                  ...
-   *                  U_c = PRF (P, U_{c-1}) .
-   *
-   *        Here, INT (i) is a four-octet encoding of the integer i, most
-   *        significant octet first.
-   *
-   *     4. Concatenate the blocks and extract the first dkLen octets to
-   *        produce a derived key DK:
-   *
-   *                  DK = T_1 || T_2 ||  ...  || T_l<0..r-1>
-   *
-   *     5. Output the derived key DK.
-   *
-   *  Note. The construction of the function F follows a "belt-and-
-   *  suspenders" approach. The iterates U_i are computed recursively to
-   *  remove a degree of parallelism from an opponent; they are exclusive-
-   *  ored together to reduce concerns about the recursion degenerating
-   *  into a small set of values.
-   *
-   */
-
   tmp = malloc (tmplen);
   if (tmp == NULL)
     return GC_MALLOC_ERROR;
diff --git a/lib/gl/m4/stdlib_h.m4 b/lib/gl/m4/stdlib_h.m4
index 4556ac0..10e010e 100644
--- a/lib/gl/m4/stdlib_h.m4
+++ b/lib/gl/m4/stdlib_h.m4
@@ -80,6 +80,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   REPLACE_MKSTEMP=0;         AC_SUBST([REPLACE_MKSTEMP])
   REPLACE_PUTENV=0;          AC_SUBST([REPLACE_PUTENV])
   REPLACE_REALPATH=0;        AC_SUBST([REPLACE_REALPATH])
+  REPLACE_SETENV=0;          AC_SUBST([REPLACE_SETENV])
   REPLACE_STRTOD=0;          AC_SUBST([REPLACE_STRTOD])
-  VOID_UNSETENV=0;           AC_SUBST([VOID_UNSETENV])
+  REPLACE_UNSETENV=0;        AC_SUBST([REPLACE_UNSETENV])
 ])
diff --git a/lib/gl/m4/unistd_h.m4 b/lib/gl/m4/unistd_h.m4
index 5aa39ae..88e60a0 100644
--- a/lib/gl/m4/unistd_h.m4
+++ b/lib/gl/m4/unistd_h.m4
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 31
+# unistd_h.m4 serial 34
 dnl Copyright (C) 2006-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -46,6 +46,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   GNULIB_GETCWD=0;           AC_SUBST([GNULIB_GETCWD])
   GNULIB_GETDOMAINNAME=0;    AC_SUBST([GNULIB_GETDOMAINNAME])
   GNULIB_GETDTABLESIZE=0;    AC_SUBST([GNULIB_GETDTABLESIZE])
+  GNULIB_GETGROUPS=0;        AC_SUBST([GNULIB_GETGROUPS])
   GNULIB_GETHOSTNAME=0;      AC_SUBST([GNULIB_GETHOSTNAME])
   GNULIB_GETLOGIN_R=0;       AC_SUBST([GNULIB_GETLOGIN_R])
   GNULIB_GETPAGESIZE=0;      AC_SUBST([GNULIB_GETPAGESIZE])
@@ -67,6 +68,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   GNULIB_UNLINKAT=0;         AC_SUBST([GNULIB_UNLINKAT])
   GNULIB_WRITE=0;            AC_SUBST([GNULIB_WRITE])
   dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_CHOWN=1;           AC_SUBST([HAVE_CHOWN])
   HAVE_DUP2=1;            AC_SUBST([HAVE_DUP2])
   HAVE_DUP3=1;            AC_SUBST([HAVE_DUP3])
   HAVE_EUIDACCESS=1;      AC_SUBST([HAVE_EUIDACCESS])
@@ -76,9 +78,11 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   HAVE_FTRUNCATE=1;       AC_SUBST([HAVE_FTRUNCATE])
   HAVE_GETDOMAINNAME=1;   AC_SUBST([HAVE_GETDOMAINNAME])
   HAVE_GETDTABLESIZE=1;   AC_SUBST([HAVE_GETDTABLESIZE])
+  HAVE_GETGROUPS=1;       AC_SUBST([HAVE_GETGROUPS])
   HAVE_GETHOSTNAME=1;     AC_SUBST([HAVE_GETHOSTNAME])
   HAVE_GETPAGESIZE=1;     AC_SUBST([HAVE_GETPAGESIZE])
   HAVE_GETUSERSHELL=1;    AC_SUBST([HAVE_GETUSERSHELL])
+  HAVE_LCHOWN=1;          AC_SUBST([HAVE_LCHOWN])
   HAVE_LINK=1;            AC_SUBST([HAVE_LINK])
   HAVE_LINKAT=1;          AC_SUBST([HAVE_LINKAT])
   HAVE_PIPE2=1;           AC_SUBST([HAVE_PIPE2])
@@ -99,6 +103,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   REPLACE_FCHDIR=0;       AC_SUBST([REPLACE_FCHDIR])
   REPLACE_FCHOWNAT=0;     AC_SUBST([REPLACE_FCHOWNAT])
   REPLACE_GETCWD=0;       AC_SUBST([REPLACE_GETCWD])
+  REPLACE_GETGROUPS=0;    AC_SUBST([REPLACE_GETGROUPS])
   REPLACE_GETPAGESIZE=0;  AC_SUBST([REPLACE_GETPAGESIZE])
   REPLACE_LCHOWN=0;       AC_SUBST([REPLACE_LCHOWN])
   REPLACE_LINK=0;         AC_SUBST([REPLACE_LINK])
diff --git a/lib/gl/printf-args.c b/lib/gl/printf-args.c
index bf2e60b..4c48e4f 100644
--- a/lib/gl/printf-args.c
+++ b/lib/gl/printf-args.c
@@ -1,5 +1,6 @@
 /* Decomposed printf argument list.
-   Copyright (C) 1999, 2002-2003, 2005-2007 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002-2003, 2005-2007, 2009 Free Software
+   Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -89,7 +90,7 @@ PRINTF_FETCHARGS (va_list args, arguments *a)
           where wint_t is 'unsigned short'.  */
        ap->a.a_wide_char =
          (sizeof (wint_t) < sizeof (int)
-          ? va_arg (args, int)
+          ? (wint_t) va_arg (args, int)
           : va_arg (args, wint_t));
        break;
 #endif
diff --git a/lib/gl/stdlib.in.h b/lib/gl/stdlib.in.h
index 6ef8504..438f568 100644
--- a/lib/gl/stdlib.in.h
+++ b/lib/gl/stdlib.in.h
@@ -384,11 +384,21 @@ extern int rpmatch (const char *response);
 #endif
 
 #if @GNULIB_SETENV@
-# if address@hidden@
+# if @REPLACE_SETENV@
+#  undef setenv
+#  define setenv rpl_setenv
+# endif
+# if address@hidden@ || @REPLACE_SETENV@
 /* Set NAME to VALUE in the environment.
    If REPLACE is nonzero, overwrite an existing value.  */
 extern int setenv (const char *name, const char *value, int replace);
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef setenv
+# define setenv(n,v,o)                                                  \
+    (GL_LINK_WARNING ("setenv is unportable - "                         \
+                      "use gnulib module setenv for portability"),      \
+     setenv (n, v, o))
 #endif
 
 #if @GNULIB_STRTOD@
@@ -448,16 +458,20 @@ extern unsigned long long strtoull (const char *string, 
char **endptr, int base)
 #endif
 
 #if @GNULIB_UNSETENV@
-# if @HAVE_UNSETENV@
-#  if @VOID_UNSETENV@
-/* On some systems, unsetenv() returns void.
-   This is the case for MacOS X 10.3, FreeBSD 4.8, NetBSD 1.6, OpenBSD 3.4.  */
-#   define unsetenv(name) ((unsetenv)(name), 0)
-#  endif
-# else
+# if @REPLACE_UNSETENV@
+#  undef unsetenv
+#  define unsetenv rpl_unsetenv
+# endif
+# if address@hidden@ || @REPLACE_UNSETENV@
 /* Remove the variable NAME from the environment.  */
 extern int unsetenv (const char *name);
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef unsetenv
+# define unsetenv(n)                                                    \
+    (GL_LINK_WARNING ("unsetenv is unportable - "                       \
+                      "use gnulib module unsetenv for portability"),    \
+     unsetenv (n))
 #endif
 
 #ifdef __cplusplus
diff --git a/lib/gl/unistd.in.h b/lib/gl/unistd.in.h
index c7a0dc9..49883e7 100644
--- a/lib/gl/unistd.in.h
+++ b/lib/gl/unistd.in.h
@@ -126,18 +126,16 @@ extern "C" {
 
 #if @GNULIB_CHOWN@
 # if @REPLACE_CHOWN@
-#  ifndef REPLACE_CHOWN
-#   define REPLACE_CHOWN 1
-#  endif
-#  if REPLACE_CHOWN
+#  undef chown
+#  define chown rpl_chown
+# endif
+# if address@hidden@ || @REPLACE_CHOWN@
 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
    to GID (if GID is not -1).  Follow symbolic links.
    Return 0 if successful, otherwise -1 and errno set.
    See the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/chown.html>.  */
-#   define chown rpl_chown
 extern int chown (const char *file, uid_t uid, gid_t gid);
-#  endif
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef chown
@@ -406,6 +404,28 @@ extern int getdtablesize (void);
 #endif
 
 
+#if @GNULIB_GETGROUPS@
+# if @REPLACE_GETGROUPS@
+#  undef getgroups
+#  define getgroups rpl_getgroups
+# endif
+# if address@hidden@ || @REPLACE_GETGROUPS@
+/* Return the supplemental groups that the current process belongs to.
+   It is unspecified whether the effective group id is in the list.
+   If N is 0, return the group count; otherwise, N describes how many
+   entries are available in GROUPS.  Return -1 and set errno if N is
+   not 0 and not large enough.  Fails with ENOSYS on some systems.  */
+int getgroups (int n, gid_t *groups);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getgroups
+# define getgroups(n,g)                                                 \
+    (GL_LINK_WARNING ("getgroups is unportable - "                      \
+                      "use gnulib module getgroups for portability"),   \
+     getgroups (n, g))
+#endif
+
+
 #if @GNULIB_GETHOSTNAME@
 /* Return the standard host name of the machine.
    WARNING! The host name may or may not be fully qualified.
@@ -545,12 +565,15 @@ extern void endusershell (void);
 
 #if @GNULIB_LCHOWN@
 # if @REPLACE_LCHOWN@
+#  undef lchown
+#  define lchown rpl_lchown
+# endif
+# if address@hidden@ || @REPLACE_LCHOWN@
 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
    to GID (if GID is not -1).  Do not follow symbolic links.
    Return 0 if successful, otherwise -1 and errno set.
    See the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/lchown.html>.  */
-#  define lchown rpl_lchown
 extern int lchown (char const *file, uid_t owner, gid_t group);
 # endif
 #elif defined GNULIB_POSIXCHECK
diff --git a/lib/gl/vasnprintf.c b/lib/gl/vasnprintf.c
index 6f1b466..11a40df 100644
--- a/lib/gl/vasnprintf.c
+++ b/lib/gl/vasnprintf.c
@@ -2375,16 +2375,16 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                      characters = 0;
                      while (precision > 0)
                        {
-                         char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                         char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
                          int count;
 
                          if (*arg_end == 0)
                            /* Found the terminating null wide character.  */
                            break;
 #  if HAVE_WCRTOMB
-                         count = wcrtomb (buf, *arg_end, &state);
+                         count = wcrtomb (cbuf, *arg_end, &state);
 #  else
-                         count = wctomb (buf, *arg_end);
+                         count = wctomb (cbuf, *arg_end);
 #  endif
                          if (count < 0)
                            {
@@ -2420,16 +2420,16 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                      characters = 0;
                      for (;;)
                        {
-                         char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                         char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
                          int count;
 
                          if (*arg_end == 0)
                            /* Found the terminating null wide character.  */
                            break;
 #  if HAVE_WCRTOMB
-                         count = wcrtomb (buf, *arg_end, &state);
+                         count = wcrtomb (cbuf, *arg_end, &state);
 #  else
-                         count = wctomb (buf, *arg_end);
+                         count = wctomb (cbuf, *arg_end);
 #  endif
                          if (count < 0)
                            {
@@ -2470,20 +2470,20 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
 #   endif
                    for (remaining = characters; remaining > 0; )
                      {
-                       char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                       char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
                        int count;
 
                        if (*arg == 0)
                          abort ();
 #   if HAVE_WCRTOMB
-                       count = wcrtomb (buf, *arg, &state);
+                       count = wcrtomb (cbuf, *arg, &state);
 #   else
-                       count = wctomb (buf, *arg);
+                       count = wctomb (cbuf, *arg);
 #   endif
                        if (count <= 0)
                          /* Inconsistency.  */
                          abort ();
-                       memcpy (tmpptr, buf, count);
+                       memcpy (tmpptr, cbuf, count);
                        tmpptr += count;
                        arg++;
                        remaining -= count;
@@ -2552,20 +2552,20 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                      ENSURE_ALLOCATION (xsum (length, characters));
                      for (remaining = characters; remaining > 0; )
                        {
-                         char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                         char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
                          int count;
 
                          if (*arg == 0)
                            abort ();
 #   if HAVE_WCRTOMB
-                         count = wcrtomb (buf, *arg, &state);
+                         count = wcrtomb (cbuf, *arg, &state);
 #   else
-                         count = wctomb (buf, *arg);
+                         count = wctomb (cbuf, *arg);
 #   endif
                          if (count <= 0)
                            /* Inconsistency.  */
                            abort ();
-                         memcpy (result + length, buf, count);
+                         memcpy (result + length, cbuf, count);
                          length += count;
                          arg++;
                          remaining -= count;
@@ -2581,21 +2581,21 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
 #   endif
                      while (arg < arg_end)
                        {
-                         char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                         char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
                          int count;
 
                          if (*arg == 0)
                            abort ();
 #   if HAVE_WCRTOMB
-                         count = wcrtomb (buf, *arg, &state);
+                         count = wcrtomb (cbuf, *arg, &state);
 #   else
-                         count = wctomb (buf, *arg);
+                         count = wctomb (cbuf, *arg);
 #   endif
                          if (count <= 0)
                            /* Inconsistency.  */
                            abort ();
                          ENSURE_ALLOCATION (xsum (length, count));
-                         memcpy (result + length, buf, count);
+                         memcpy (result + length, cbuf, count);
                          length += count;
                          arg++;
                        }
diff --git a/lib/gltests/Makefile.am b/lib/gltests/Makefile.am
index c81b6c0..4ef293a 100644
--- a/lib/gltests/Makefile.am
+++ b/lib/gltests/Makefile.am
@@ -14,6 +14,7 @@ AUTOMAKE_OPTIONS = 1.5 foreign
 
 SUBDIRS =
 TESTS =
+XFAIL_TESTS =
 TESTS_ENVIRONMENT =
 noinst_PROGRAMS =
 check_PROGRAMS =
diff --git a/lib/gltests/intprops.h b/lib/gltests/intprops.h
index 002161e..325c397 100644
--- a/lib/gltests/intprops.h
+++ b/lib/gltests/intprops.h
@@ -1,6 +1,7 @@
 /* intprops.h -- properties of integer types
 
-   Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009 Free Software
+   Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -17,37 +18,40 @@
 
 /* Written by Paul Eggert.  */
 
-#include <limits.h>
+#ifndef GL_INTPROPS_H
+# define GL_INTPROPS_H
+
+# include <limits.h>
 
 /* The extra casts in the following macros work around compiler bugs,
    e.g., in Cray C 5.0.3.0.  */
 
 /* True if the arithmetic type T is an integer type.  bool counts as
    an integer.  */
-#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1)
+# define TYPE_IS_INTEGER(t) ((t) 1.5 == 1)
 
 /* True if negative values of the signed integer type T use two's
    complement, ones' complement, or signed magnitude representation,
    respectively.  Much GNU code assumes two's complement, but some
    people like to be portable to all possible C hosts.  */
-#define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1)
-#define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0)
-#define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1)
+# define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1)
+# define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0)
+# define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1)
 
 /* True if the arithmetic type T is signed.  */
-#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
+# define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
 
 /* The maximum and minimum values for the integer type T.  These
    macros have undefined behavior if T is signed and has padding bits.
    If this is a problem for you, please let us know how to fix it for
    your host.  */
-#define TYPE_MINIMUM(t) \
+# define TYPE_MINIMUM(t) \
   ((t) (! TYPE_SIGNED (t) \
        ? (t) 0 \
        : TYPE_SIGNED_MAGNITUDE (t) \
        ? ~ (t) 0 \
        : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
-#define TYPE_MAXIMUM(t) \
+# define TYPE_MAXIMUM(t) \
   ((t) (! TYPE_SIGNED (t) \
        ? (t) -1 \
        : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
@@ -58,20 +62,22 @@
    tighter bound.  Otherwise, it overestimates the true bound by one byte
    when applied to unsigned types of size 2, 4, 16, ... bytes.
    The symbol signed_type_or_expr__ is private to this header file.  */
-#if __GNUC__ >= 2
-# define signed_type_or_expr__(t) TYPE_SIGNED (__typeof__ (t))
-#else
-# define signed_type_or_expr__(t) 1
-#endif
+# if __GNUC__ >= 2
+#  define signed_type_or_expr__(t) TYPE_SIGNED (__typeof__ (t))
+# else
+#  define signed_type_or_expr__(t) 1
+# endif
 
 /* Bound on length of the string representing an integer type or expression T.
    Subtract 1 for the sign bit if T is signed; log10 (2.0) < 146/485;
    add 1 for integer division truncation; add 1 more for a minus sign
    if needed.  */
-#define INT_STRLEN_BOUND(t) \
+# define INT_STRLEN_BOUND(t) \
   ((sizeof (t) * CHAR_BIT - signed_type_or_expr__ (t)) * 146 / 485 \
    + signed_type_or_expr__ (t) + 1)
 
 /* Bound on buffer size needed to represent an integer type or expression T,
    including the terminating null.  */
-#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1)
+# define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1)
+
+#endif /* GL_INTPROPS_H */
diff --git a/lib/gltests/test-base64.c b/lib/gltests/test-base64.c
index 7440e8c..8d4a0c6 100644
--- a/lib/gltests/test-base64.c
+++ b/lib/gltests/test-base64.c
@@ -20,10 +20,24 @@
 #include <stddef.h>
 #include <stdio.h>
 #include <stdbool.h>
+#include <stdlib.h>
 #include <string.h>
+#include <stdint.h>
 
 #include "base64.h"
 
+#define ASSERT(expr)                                                   \
+  do                                                                   \
+    {                                                                  \
+      if (!(expr))                                                     \
+       {                                                               \
+         fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+         fflush (stderr);                                              \
+         abort ();                                                     \
+       }                                                               \
+    }                                                                  \
+  while (0)
+
 int
 main (void)
 {
@@ -32,148 +46,196 @@ main (void)
   char out[255];
   size_t len;
   bool ok;
+  char *p;
 
   memset (out, 0x42, sizeof (out));
   base64_encode (in, 0, out, 0);
-  if (out[0] != '\x42')
-    fprintf (stderr, "failure\n");
+  ASSERT(out[0] == '\x42');
 
   memset (out, 0x42, sizeof (out));
   base64_encode (in, 1, out, 1);
-  if (memcmp (out, "YQ==", 1) != 0)
-    {
-      out[4] = '\0';
-      fprintf (stderr, "failure (%s)\n", out);
-    }
+  ASSERT (memcmp (out, "YQ==", 1) == 0);
 
   memset (out, 0x42, sizeof (out));
   base64_encode (in, 1, out, 2);
-  if (memcmp (out, "YQ==", 2) != 0)
-    {
-      out[4] = '\0';
-      fprintf (stderr, "failure (%s)\n", out);
-    }
+  ASSERT (memcmp (out, "YQ==", 2) == 0);
 
   memset (out, 0x42, sizeof (out));
   base64_encode (in, 1, out, 3);
-  if (memcmp (out, "YQ==", 3) != 0)
-    {
-      out[4] = '\0';
-      fprintf (stderr, "failure (%s)\n", out);
-    }
+  ASSERT (memcmp (out, "YQ==", 3) == 0);
 
   memset (out, 0x42, sizeof (out));
   base64_encode (in, 1, out, 4);
-  if (memcmp (out, "YQ==", 4) != 0)
-    {
-      out[4] = '\0';
-      fprintf (stderr, "failure (%s)\n", out);
-    }
+  ASSERT (memcmp (out, "YQ==", 4) == 0);
 
   memset (out, 0x42, sizeof (out));
   base64_encode (in, 1, out, 8);
-  if (memcmp (out, "YQ==", 4) != 0)
-    {
-      out[4] = '\0';
-      fprintf (stderr, "failure (%s)\n", out);
-    }
+  ASSERT (memcmp (out, "YQ==", 4) == 0);
 
   memset (out, 0x42, sizeof (out));
   base64_encode (in, 2, out, 4);
-  if (memcmp (out, "YWI=", 4) != 0)
-    {
-      out[4] = '\0';
-      fprintf (stderr, "failure (%s)\n", out);
-    }
+  ASSERT (memcmp (out, "YWI=", 4) == 0);
 
   memset (out, 0x42, sizeof (out));
   base64_encode (in, 3, out, 4);
-  if (memcmp (out, "YWJj", 4) != 0)
-    {
-      out[4] = '\0';
-      fprintf (stderr, "failure (%s)\n", out);
-    }
+  ASSERT (memcmp (out, "YWJj", 4) == 0);
 
   memset (out, 0x42, sizeof (out));
   base64_encode (in, 4, out, 5);
-  if (memcmp (out, "YWJjZA==", 5) != 0)
-    {
-      out[5] = '\0';
-      fprintf (stderr, "failure (%s)\n", out);
-    }
+  ASSERT (memcmp (out, "YWJjZA==", 5) == 0);
 
   memset (out, 0x42, sizeof (out));
   base64_encode (in, 4, out, 100);
-  if (memcmp (out, "YWJjZA==", 6) != 0)
-    {
-      out[6] = '\0';
-      fprintf (stderr, "failure (%s)\n", out);
-    }
+  ASSERT (memcmp (out, "YWJjZA==", 6) == 0);
 
   /* Decode. */
 
   memset (out, 0x42, sizeof (out));
   len = 0;
   ok = base64_decode (b64in, 4, out, &len);
-  if (!ok)
-    fprintf (stderr, "decode failed\n");
-  if (len != 0)
-    fprintf (stderr, "failure (%lu)\n", (unsigned long) len);
+  ASSERT (ok);
+  ASSERT (len == 0);
 
   memset (out, 0x42, sizeof (out));
   len = 1;
   ok = base64_decode (b64in, 4, out, &len);
-  if (!ok)
-    fprintf (stderr, "decode failed\n");
-  if (len != 1 || memcmp (out, "abcdefg", 1) != 0)
-    {
-      out[2] = '\0';
-      fprintf (stderr, "failure (%lu: %s)\n", (unsigned long) len, out);
-    }
+  ASSERT (ok);
+  ASSERT (len == 1);
+  ASSERT (memcmp (out, "abcdefg", 1) == 0);
 
   memset (out, 0x42, sizeof (out));
   len = 2;
   ok = base64_decode (b64in, 4, out, &len);
-  if (!ok)
-    fprintf (stderr, "decode failed\n");
-  if (len != 2 || memcmp (out, "abcdefg", 2) != 0)
-    {
-      out[3] = '\0';
-      fprintf (stderr, "failure (%lu: %s)\n", (unsigned long) len, out);
-    }
+  ASSERT (ok);
+  ASSERT (len == 2);
+  ASSERT (memcmp (out, "abcdefg", 2) == 0);
 
   memset (out, 0x42, sizeof (out));
   len = 3;
   ok = base64_decode (b64in, 4, out, &len);
-  if (!ok)
-    fprintf (stderr, "decode failed\n");
-  if (len != 3 || memcmp (out, "abcdefg", 3) != 0)
-    {
-      out[4] = '\0';
-      fprintf (stderr, "failure (%lu: %s)\n", (unsigned long) len, out);
-    }
+  ASSERT (ok);
+  ASSERT (len == 3);
+  ASSERT (memcmp (out, "abcdefg", 3) == 0);
 
   memset (out, 0x42, sizeof (out));
   len = 4;
   ok = base64_decode (b64in, 4, out, &len);
-  if (!ok)
-    fprintf (stderr, "decode failed\n");
-  if (len != 3 || memcmp (out, "abcdefg", 3) != 0)
-    {
-      out[3] = '\0';
-      fprintf (stderr, "failure (%lu: %s)\n", (unsigned long) len, out);
-    }
+  ASSERT (ok);
+  ASSERT (len == 3);
+  ASSERT (memcmp (out, "abcdefg", 3) == 0);
 
   memset (out, 0x42, sizeof (out));
   len = 100;
   ok = base64_decode (b64in, strlen (b64in), out, &len);
-  if (!ok)
-    fprintf (stderr, "decode failed\n");
-  if (len != 7 || memcmp (out, "abcdefg", 7) != 0)
-    {
-      out[7] = '\0';
-      fprintf (stderr, "failure (%lu: %s)\n", (unsigned long) len, out);
-    }
+  ASSERT (ok);
+  ASSERT (len == 7);
+  ASSERT (memcmp (out, "abcdefg", 7) == 0);
+
+  /* Allocating encode */
+
+  len = base64_encode_alloc (in, strlen (in), &p);
+  ASSERT (len == 24);
+  ASSERT (strcmp (p, "YWJjZGVmZ2hpamtsbW5vcA==") == 0);
+  free (p);
+
+  len = base64_encode_alloc (in, SIZE_MAX - 5, &p);
+  ASSERT (len == 0);
+
+  /* Decode context function */
+  {
+    struct base64_decode_context ctx;
+
+    base64_decode_ctx_init (&ctx);
+
+    len = sizeof (out);
+    ok = base64_decode_ctx (&ctx, b64in, strlen (b64in), out, &len);
+    ASSERT (ok);
+    ASSERT (len == 7);
+    ASSERT (memcmp (out, "abcdefg", len) == 0);
+  }
+
+  /* Allocating decode context function */
+
+  ok = base64_decode_alloc_ctx (NULL, b64in, strlen (b64in), &p, &len);
+  ASSERT (ok);
+  ASSERT (len == 7);
+  ASSERT (memcmp (out, "abcdefg", len) == 0);
+
+  {
+    struct base64_decode_context ctx;
+    const char *newlineb64 = "YWJjZG\nVmZ2hp\namtsbW5vcA==";
+
+    base64_decode_ctx_init (&ctx);
+
+    ok = base64_decode_alloc_ctx (&ctx, newlineb64, strlen (newlineb64), &p, 
&len);
+    ASSERT (ok);
+    ASSERT (len == strlen (in));
+    ASSERT (memcmp (p, in, len) == 0);
+  }
+
+  {
+    struct base64_decode_context ctx;
+    base64_decode_ctx_init (&ctx);
+
+    ok = base64_decode_alloc_ctx (&ctx, "YW\nJjZGVmZ2hp", 13, &p, &len);
+    ASSERT (ok);
+    ASSERT (len == 9);
+    ASSERT (memcmp (p, "abcdefghi", len) == 0);
+
+    base64_decode_ctx_init (&ctx);
+
+    ok = base64_decode_alloc_ctx (&ctx, "YW\n", 3, &p, &len);
+    ASSERT (ok);
+    ASSERT (len == 0);
+
+    ok = base64_decode_alloc_ctx (&ctx, "JjZGVmZ2", 8, &p, &len);
+    ASSERT (ok);
+    ASSERT (len == 6);
+    ASSERT (memcmp (p, "abcdef", len) == 0);
+
+    ok = base64_decode_alloc_ctx (&ctx, "hp", 2, &p, &len);
+    ASSERT (ok);
+    ASSERT (len == 2);
+    /* Actually this looks buggy.  Shouldn't output be 'ghi'? */
+    ASSERT (memcmp (p, "gh", len) == 0);
+    ok = base64_decode_alloc_ctx (&ctx, "", 0, &p, &len);
+    ASSERT (ok);
+  }
+
+  {
+    struct base64_decode_context ctx;
+    const char *newlineb64 = "\n\n\n\n\n";
+
+    base64_decode_ctx_init (&ctx);
+
+    ok = base64_decode_alloc_ctx (&ctx, newlineb64, strlen (newlineb64), &p, 
&len);
+    ASSERT (ok);
+    ASSERT (len == 0);
+  }
+
+  ok = base64_decode_alloc_ctx (NULL, " ! ", 3, &p, &len);
+  ASSERT (!ok);
+
+  ok = base64_decode_alloc_ctx (NULL, "abc\ndef", 7, &p, &len);
+  ASSERT (!ok);
+
+  ok = base64_decode_alloc_ctx (NULL, "aa", 2, &p, &len);
+  ASSERT (!ok);
+
+  ok = base64_decode_alloc_ctx (NULL, "aa=", 3, &p, &len);
+  ASSERT (!ok);
+
+  ok = base64_decode_alloc_ctx (NULL, "aax", 3, &p, &len);
+  ASSERT (!ok);
+
+  ok = base64_decode_alloc_ctx (NULL, "aa=X", 4, &p, &len);
+  ASSERT (!ok);
+
+  ok = base64_decode_alloc_ctx (NULL, "aa=X", 4, &p, &len);
+  ASSERT (!ok);
+
+  ok = base64_decode_alloc_ctx (NULL, "aax=X", 5, &p, &len);
+  ASSERT (!ok);
 
   return 0;
 }
diff --git a/lib/maint.mk b/lib/maint.mk
index 73ea8ea..34d66e1 100644
--- a/lib/maint.mk
+++ b/lib/maint.mk
@@ -289,6 +289,23 @@ sc_prohibit_error_without_use:
        re='\<error(_at_line|_print_progname|_one_per_line|_message_count)? 
*\('\
          $(_header_without_use)
 
+# Don't include xalloc.h unless you use one of its functions.
+# Consider these symbols:
+# perl -lne '/^# *define (\w+)\(/ and print $1' lib/xalloc.h|grep -v '^__';
+# perl -lne '/^(?:extern )?(?:void|char) \*?(\w+) \(/ and print $1' 
lib/xalloc.h
+# Divide into two sets on case, and filter each through this:
+# | sort | perl -MRegexp::Assemble -le \
+#  'print Regexp::Assemble->new(file => "/dev/stdin")->as_string'|sed 
's/\?://g'
+# Note this was produced by the above:
+# _xa1 = x(alloc_(oversized|die)|([cz]|2?re)alloc|m(alloc|emdup)|strdup)
+# But we can do better:
+_xa1 = x(alloc_(oversized|die)|([cmz]|2?re)alloc|(mem|str)dup)
+_xa2 = X([CZ]|N?M)ALLOC
+sc_prohibit_xalloc_without_use:
+       @h='"xalloc.h"' \
+       re='\<($(_xa1)|$(_xa2)) *\('\
+         $(_header_without_use)
+
 sc_prohibit_safe_read_without_use:
        @h='"safe-read.h"' re='(\<SAFE_READ_ERROR\>|\<safe_read *\()' \
          $(_header_without_use)
diff --git a/lib/src/gsasl.h b/lib/src/gsasl.h
index 287f057..9c0e563 100644
--- a/lib/src/gsasl.h
+++ b/lib/src/gsasl.h
@@ -51,7 +51,7 @@ extern "C"
    * version number.  Used together with gsasl_check_version() to
    * verify header file and run-time library consistency.
    */
-# define GSASL_VERSION "1.3.91"
+# define GSASL_VERSION "1.4.0"
 
   /**
    * GSASL_VERSION_MAJOR
@@ -73,7 +73,7 @@ extern "C"
    *
    * Since: 1.1
    */
-# define GSASL_VERSION_MINOR 3
+# define GSASL_VERSION_MINOR 4
 
   /**
    * GSASL_VERSION_PATCH
@@ -84,7 +84,7 @@ extern "C"
    *
    * Since: 1.1
    */
-# define GSASL_VERSION_PATCH 91
+# define GSASL_VERSION_PATCH 0
 
   /**
    * GSASL_VERSION_NUMBER
@@ -95,7 +95,7 @@ extern "C"
    *
    * Since: 1.1
    */
-# define GSASL_VERSION_NUMBER 0x01035b
+# define GSASL_VERSION_NUMBER 0x010400
 
   /* RFC 2222: SASL mechanisms are named by strings, from 1 to 20
    * characters in length, consisting of upper-case letters, digits,
diff --git a/maint.mk b/maint.mk
index 73ea8ea..34d66e1 100644
--- a/maint.mk
+++ b/maint.mk
@@ -289,6 +289,23 @@ sc_prohibit_error_without_use:
        re='\<error(_at_line|_print_progname|_one_per_line|_message_count)? 
*\('\
          $(_header_without_use)
 
+# Don't include xalloc.h unless you use one of its functions.
+# Consider these symbols:
+# perl -lne '/^# *define (\w+)\(/ and print $1' lib/xalloc.h|grep -v '^__';
+# perl -lne '/^(?:extern )?(?:void|char) \*?(\w+) \(/ and print $1' 
lib/xalloc.h
+# Divide into two sets on case, and filter each through this:
+# | sort | perl -MRegexp::Assemble -le \
+#  'print Regexp::Assemble->new(file => "/dev/stdin")->as_string'|sed 
's/\?://g'
+# Note this was produced by the above:
+# _xa1 = x(alloc_(oversized|die)|([cz]|2?re)alloc|m(alloc|emdup)|strdup)
+# But we can do better:
+_xa1 = x(alloc_(oversized|die)|([cmz]|2?re)alloc|(mem|str)dup)
+_xa2 = X([CZ]|N?M)ALLOC
+sc_prohibit_xalloc_without_use:
+       @h='"xalloc.h"' \
+       re='\<($(_xa1)|$(_xa2)) *\('\
+         $(_header_without_use)
+
 sc_prohibit_safe_read_without_use:
        @h='"safe-read.h"' re='(\<SAFE_READ_ERROR\>|\<safe_read *\()' \
          $(_header_without_use)


hooks/post-receive
-- 
GNU gsasl




reply via email to

[Prev in Thread] Current Thread [Next in Thread]