shishi-commit
[Top][All Lists]
Advanced

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

[SCM] GNU shishi branch, master, updated. shishi-0-0-42-23-g48f5fca


From: Simon Josefsson
Subject: [SCM] GNU shishi branch, master, updated. shishi-0-0-42-23-g48f5fca
Date: Mon, 22 Mar 2010 21:46:35 +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 shishi".

http://git.savannah.gnu.org/cgit/shishi.git/commit/?id=48f5fca48b06aa8d34e0000940e25cf8b8cce18f

The branch, master has been updated
       via  48f5fca48b06aa8d34e0000940e25cf8b8cce18f (commit)
       via  fa42ee17f9f223296e4ae6072eb5a508dd1daa07 (commit)
       via  9e876889526491cf00c48fb67c65b6de172ec9bd (commit)
       via  4b1992afbd8e034c3766f91d285143bfb6f55939 (commit)
       via  f6ad0b04fe98d028c71e30e1882b7aab9930c3e2 (commit)
       via  b631be3c97af51a0fff919052c29f17ece8df061 (commit)
       via  d08e7d10f8d2bb03de0d14a43479e4cf75b9915b (commit)
       via  8522b92d483b25d50cdab9f8869559acc3b50631 (commit)
       via  f756ad4c8cbef2126d42440ba241c7c1c8a31f4b (commit)
       via  e129a8e715a897274f3c064ef2787ebf3bef4014 (commit)
       via  75b7aacd0a00865c7f8b4dd4c1f34a109861eaff (commit)
       via  826459fd3d3568722cf7d2d4318c9bbcd340413d (commit)
       via  0e64f662d9641fce0ac778a0fb5c737e54e1e7bc (commit)
       via  5e5f6ff27aafd137c623e7385eae82925c33c629 (commit)
       via  8be5bed706113ed89dc212d502f962a4085c5858 (commit)
       via  21d874608e687a9112bdfa50e7cd154552815b2e (commit)
      from  47be93fee85606ab330c39f408c2ab1528ba4fd5 (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 48f5fca48b06aa8d34e0000940e25cf8b8cce18f
Author: Simon Josefsson <address@hidden>
Date:   Mon Mar 22 22:42:13 2010 +0100

    Generated.

commit fa42ee17f9f223296e4ae6072eb5a508dd1daa07
Author: Simon Josefsson <address@hidden>
Date:   Mon Mar 22 22:40:39 2010 +0100

    Add $(LIBSOCKET), for MinGW.

commit 9e876889526491cf00c48fb67c65b6de172ec9bd
Author: Simon Josefsson <address@hidden>
Date:   Mon Mar 22 22:27:36 2010 +0100

    Update gnulib files.

commit 4b1992afbd8e034c3766f91d285143bfb6f55939
Author: Simon Josefsson <address@hidden>
Date:   Mon Mar 22 22:21:07 2010 +0100

    Add.

commit f6ad0b04fe98d028c71e30e1882b7aab9930c3e2
Author: Simon Josefsson <address@hidden>
Date:   Mon Mar 22 22:05:34 2010 +0100

    Update gnulib files.

commit b631be3c97af51a0fff919052c29f17ece8df061
Author: Simon Josefsson <address@hidden>
Date:   Mon Mar 22 22:04:12 2010 +0100

    Ignore more.

commit d08e7d10f8d2bb03de0d14a43479e4cf75b9915b
Author: Simon Josefsson <address@hidden>
Date:   Mon Mar 22 21:57:36 2010 +0100

    shishid: Support IPv6 by using getaddrinfo.

commit 8522b92d483b25d50cdab9f8869559acc3b50631
Author: Simon Josefsson <address@hidden>
Date:   Mon Mar 22 21:17:03 2010 +0100

    Add error explanation.

commit f756ad4c8cbef2126d42440ba241c7c1c8a31f4b
Author: Simon Josefsson <address@hidden>
Date:   Mon Mar 22 21:16:54 2010 +0100

    Build fixes.

commit e129a8e715a897274f3c064ef2787ebf3bef4014
Author: Simon Josefsson <address@hidden>
Date:   Mon Mar 22 21:16:40 2010 +0100

    Improve retry counter and error codes.

commit 75b7aacd0a00865c7f8b4dd4c1f34a109861eaff
Author: Simon Josefsson <address@hidden>
Date:   Mon Mar 22 17:32:39 2010 +0100

    Add.

commit 826459fd3d3568722cf7d2d4318c9bbcd340413d
Author: Simon Josefsson <address@hidden>
Date:   Mon Mar 22 17:32:02 2010 +0100

    Rewrite network handling to supprt IPv6 and delay name resolution.

commit 0e64f662d9641fce0ac778a0fb5c737e54e1e7bc
Author: Simon Josefsson <address@hidden>
Date:   Mon Mar 22 17:18:05 2010 +0100

    Reduce unnecessary noise.

commit 5e5f6ff27aafd137c623e7385eae82925c33c629
Author: Simon Josefsson <address@hidden>
Date:   Mon Mar 22 14:31:35 2010 +0100

    Const'ify shishi_kdc_sendrecv*.

commit 8be5bed706113ed89dc212d502f962a4085c5858
Author: Simon Josefsson <address@hidden>
Date:   Mon Mar 22 14:29:23 2010 +0100

    Iterate through all KDC addresses for direct sends.

commit 21d874608e687a9112bdfa50e7cd154552815b2e
Author: Simon Josefsson <address@hidden>
Date:   Mon Mar 22 13:53:22 2010 +0100

    Only attempt to use IPv6 if local system has IPv6.

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

Summary of changes:
 .gitignore               |   26 ++
 NEWS                     |    6 +
 db/Makefile.am           |    2 +-
 db/gl/gnulib.mk          |  123 +---------
 db/gl/m4/extensions.m4   |  118 ---------
 db/gl/m4/gnulib-cache.m4 |    4 +-
 db/gl/m4/gnulib-comp.m4  |   28 --
 db/gl/m4/stdbool.m4      |  115 ---------
 db/gl/m4/sys_stat_h.m4   |   82 ------
 db/gl/m4/time_h.m4       |   88 -------
 db/gl/m4/unistd_h.m4     |  153 -----------
 db/gl/stdbool.in.h       |  119 ---------
 db/gl/sys_stat.in.h      |  631 ----------------------------------------------
 db/gl/time.in.h          |  199 ---------------
 doc/Makefile.am          |    2 +
 doc/shishi.texi          |    8 +-
 gl/Makefile.am           |   11 +-
 {db/gl => gl}/m4/dos.m4  |    0
 gl/m4/gnulib-cache.m4    |    3 +-
 gl/m4/gnulib-comp.m4     |    7 +
 {db/gl => gl}/m4/stat.m4 |    0
 {db/gl => gl}/stat.c     |    0
 gl/unistd.in.h           |   29 ++-
 lib/cfg.c                |  129 +++++-----
 lib/cfg.h                |    3 +-
 lib/error.c              |    6 +-
 lib/internal.h           |    8 +-
 lib/netio.c              |  384 ++++++++++++++--------------
 lib/shishi.h             |    4 +-
 lib/starttls.c           |   37 ++--
 lib/starttls.h           |    7 +-
 shishi.conf.in           |    7 +-
 shishi.skel.in           |    7 +-
 src/kdc.h                |   12 +-
 src/server.c             |   76 ++++--
 src/shishid.c            |  121 ++++-----
 36 files changed, 494 insertions(+), 2061 deletions(-)
 delete mode 100644 db/gl/m4/extensions.m4
 delete mode 100644 db/gl/m4/stdbool.m4
 delete mode 100644 db/gl/m4/sys_stat_h.m4
 delete mode 100644 db/gl/m4/time_h.m4
 delete mode 100644 db/gl/m4/unistd_h.m4
 delete mode 100644 db/gl/stdbool.in.h
 delete mode 100644 db/gl/sys_stat.in.h
 delete mode 100644 db/gl/time.in.h
 rename {db/gl => gl}/m4/dos.m4 (100%)
 rename {db/gl => gl}/m4/stat.m4 (100%)
 rename {db/gl => gl}/stat.c (100%)

diff --git a/.gitignore b/.gitignore
index ba5ef82..ac18556 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@ ABOUT-NLS
 INSTALL
 Makefile
 Makefile.in
+TAGS
 aclocal.m4
 asn1/.deps/
 asn1/Makefile
@@ -45,9 +46,11 @@ db/gl/Makefile.in
 db/gl/areadlink.lo
 db/gl/areadlink.o
 db/gl/arg-nonnull.h
+db/gl/c++defs.h
 db/gl/libgnu.la
 db/gl/sys/
 db/gl/time.h
+db/gl/warn-on-use.h
 db/gl/wchar.h
 db/libshisa.la
 db/setup.lo
@@ -67,6 +70,7 @@ doc/reference/sgml-build.stamp
 doc/reference/sgml.stamp
 doc/reference/shishi-decl-list.txt
 doc/reference/shishi-decl.txt
+doc/reference/shishi-decl.txt.bak
 doc/reference/shishi-overrides.txt
 doc/reference/shishi-sections.txt
 doc/reference/shishi-undeclared.txt
@@ -82,14 +86,31 @@ doc/reference/tmpl-build.stamp
 doc/reference/tmpl.stamp
 doc/reference/tmpl/low-crypto.sgml
 doc/reference/tmpl/shishi.sgml
+doc/reference/tmpl/shishi.sgml.bak
 doc/reference/xml/
 doc/shisa.1
 doc/shishi-api-error-labels.texi
 doc/shishi.1
+doc/shishi.aux
+doc/shishi.cp
+doc/shishi.cps
+doc/shishi.dvi
+doc/shishi.fn
+doc/shishi.fns
+doc/shishi.html
 doc/shishi.info
 doc/shishi.info-1
 doc/shishi.info-2
 doc/shishi.info-3
+doc/shishi.ky
+doc/shishi.log
+doc/shishi.pdf
+doc/shishi.pg
+doc/shishi.ps
+doc/shishi.toc
+doc/shishi.tp
+doc/shishi.vr
+doc/shishi.vrs
 doc/shishid.1
 doc/stamp-vti
 doc/texi/
@@ -133,6 +154,7 @@ gl/asnprintf.lo
 gl/asnprintf.o
 gl/base64.lo
 gl/base64.o
+gl/c++defs.h
 gl/c-ctype.lo
 gl/c-ctype.o
 gl/close-hook.lo
@@ -352,6 +374,8 @@ po/shishi.pot
 po/stamp-po
 po/vi.gmo
 shisa.conf
+shishi-*.tar.gz
+shishi-*.tar.gz.sig
 shishi.conf
 shishi.pc
 shishi.skel
@@ -368,6 +392,7 @@ src/gl/.libs/
 src/gl/Makefile
 src/gl/Makefile.in
 src/gl/arg-nonnull.h
+src/gl/c++defs.h
 src/gl/libgnu.la
 src/gl/link-warning.h
 src/gl/locale.h
@@ -375,6 +400,7 @@ src/gl/progname.lo
 src/gl/progname.o
 src/gl/version-etc.lo
 src/gl/version-etc.o
+src/gl/warn-on-use.h
 src/kdc.o
 src/keytab2shishi
 src/keytab2shishi.o
diff --git a/NEWS b/NEWS
index 4232d8b..14200df 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,12 @@ See the end for copying conditions.
 
 * Version 0.0.43 (unreleased)
 
+** libshishi: Make client-side IPv6 support work.
+
+** shishid: Make server-side IPv6 support work.
+
+** doc: Fix spelling typos noticed by lintian.
+
 ** Update gnulib files.
 
 ** API and ABI modifications:
diff --git a/db/Makefile.am b/db/Makefile.am
index da2eaaa..b5ae015 100644
--- a/db/Makefile.am
+++ b/db/Makefile.am
@@ -38,7 +38,7 @@ libshisa_la_SOURCES = libshisa.map \
        setup.c config.c db.c err.c core.c \
        file.c file.h fileutil.h fileutil.c
 libshisa_la_LIBADD = gl/libgnu.la ../lib/libshishi.la  \
-       $(LIB_CLOCK_GETTIME)
+       $(LIB_CLOCK_GETTIME) $(LIBSOCKET)
 # XXX use different libtool version for this library?
 libshisa_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
        -no-undefined
diff --git a/db/gl/gnulib.mk b/db/gl/gnulib.mk
index cec2d7e..3c01b05 100644
--- a/db/gl/gnulib.mk
+++ b/db/gl/gnulib.mk
@@ -9,7 +9,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=db/gl 
--m4-base=db/gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux 
--avoid=absolute-header --avoid=include_next --avoid=link-warning 
--avoid=malloc-posix --avoid=ssize_t --avoid=stdlib --avoid=unistd 
--makefile-name=gnulib.mk --libtool --macro-prefix=gl3 --no-vc-files areadlink
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=db/gl 
--m4-base=db/gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux 
--avoid=absolute-header --avoid=include_next --avoid=link-warning 
--avoid=malloc-posix --avoid=ssize_t --avoid=stat --avoid=stdlib --avoid=unistd 
--makefile-name=gnulib.mk --libtool --macro-prefix=gl3 --no-vc-files areadlink
 
 
 MOSTLYCLEANFILES += core *.stackdump
@@ -87,33 +87,6 @@ EXTRA_libgnu_la_SOURCES += readlink.c
 
 ## end   gnulib module readlink
 
-## begin gnulib module stat
-
-
-EXTRA_DIST += stat.c
-
-EXTRA_libgnu_la_SOURCES += stat.c
-
-## end   gnulib module stat
-
-## begin gnulib module stdbool
-
-BUILT_SOURCES += $(STDBOOL_H)
-
-# We need the following in order to create <stdbool.h> when the system
-# doesn't have one that works.
-stdbool.h: stdbool.in.h
-       $(AM_V_GEN)rm -f address@hidden $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; 
\
-       } > address@hidden && \
-       mv address@hidden $@
-MOSTLYCLEANFILES += stdbool.h stdbool.h-t
-
-EXTRA_DIST += stdbool.in.h
-
-## end   gnulib module stdbool
-
 ## begin gnulib module stddef
 
 BUILT_SOURCES += $(STDDEF_H)
@@ -179,100 +152,6 @@ EXTRA_DIST += stdint.in.h
 
 ## end   gnulib module stdint
 
-## begin gnulib module sys_stat
-
-BUILT_SOURCES += sys/stat.h
-
-# We need the following in order to create <sys/stat.h> when the system
-# has one that is incomplete.
-sys/stat.h: sys_stat.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-       $(AM_V_at)$(MKDIR_P) sys
-       $(AM_V_GEN)rm -f address@hidden $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-             -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \
-             -e 's|@''GNULIB_FCHMODAT''@|$(GNULIB_FCHMODAT)|g' \
-             -e 's|@''GNULIB_FSTATAT''@|$(GNULIB_FSTATAT)|g' \
-             -e 's|@''GNULIB_FUTIMENS''@|$(GNULIB_FUTIMENS)|g' \
-             -e 's|@''GNULIB_LCHMOD''@|$(GNULIB_LCHMOD)|g' \
-             -e 's|@''GNULIB_LSTAT''@|$(GNULIB_LSTAT)|g' \
-             -e 's|@''GNULIB_MKDIRAT''@|$(GNULIB_MKDIRAT)|g' \
-             -e 's|@''GNULIB_MKFIFO''@|$(GNULIB_MKFIFO)|g' \
-             -e 's|@''GNULIB_MKFIFOAT''@|$(GNULIB_MKFIFOAT)|g' \
-             -e 's|@''GNULIB_MKNOD''@|$(GNULIB_MKNOD)|g' \
-             -e 's|@''GNULIB_MKNODAT''@|$(GNULIB_MKNODAT)|g' \
-             -e 's|@''GNULIB_STAT''@|$(GNULIB_STAT)|g' \
-             -e 's|@''GNULIB_UTIMENSAT''@|$(GNULIB_UTIMENSAT)|g' \
-             -e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \
-             -e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \
-             -e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \
-             -e 's|@''HAVE_LCHMOD''@|$(HAVE_LCHMOD)|g' \
-             -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \
-             -e 's|@''HAVE_MKDIRAT''@|$(HAVE_MKDIRAT)|g' \
-             -e 's|@''HAVE_MKFIFO''@|$(HAVE_MKFIFO)|g' \
-             -e 's|@''HAVE_MKFIFOAT''@|$(HAVE_MKFIFOAT)|g' \
-             -e 's|@''HAVE_MKNOD''@|$(HAVE_MKNOD)|g' \
-             -e 's|@''HAVE_MKNODAT''@|$(HAVE_MKNODAT)|g' \
-             -e 's|@''HAVE_UTIMENSAT''@|$(HAVE_UTIMENSAT)|g' \
-             -e 's|@''REPLACE_FSTAT''@|$(REPLACE_FSTAT)|g' \
-             -e 's|@''REPLACE_FSTATAT''@|$(REPLACE_FSTATAT)|g' \
-             -e 's|@''REPLACE_FUTIMENS''@|$(REPLACE_FUTIMENS)|g' \
-             -e 's|@''REPLACE_LSTAT''@|$(REPLACE_LSTAT)|g' \
-             -e 's|@''REPLACE_MKDIR''@|$(REPLACE_MKDIR)|g' \
-             -e 's|@''REPLACE_MKFIFO''@|$(REPLACE_MKFIFO)|g' \
-             -e 's|@''REPLACE_MKNOD''@|$(REPLACE_MKNOD)|g' \
-             -e 's|@''REPLACE_STAT''@|$(REPLACE_STAT)|g' \
-             -e 's|@''REPLACE_UTIMENSAT''@|$(REPLACE_UTIMENSAT)|g' \
-             -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
-             < $(srcdir)/sys_stat.in.h; \
-       } > address@hidden && \
-       mv address@hidden $@
-MOSTLYCLEANFILES += sys/stat.h sys/stat.h-t
-MOSTLYCLEANDIRS += sys
-
-EXTRA_DIST += sys_stat.in.h
-
-## end   gnulib module sys_stat
-
-## begin gnulib module time
-
-BUILT_SOURCES += time.h
-
-# We need the following in order to create <time.h> when the system
-# doesn't have one that works with the given compiler.
-time.h: time.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-       $(AM_V_GEN)rm -f address@hidden $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
-         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-             -e 's|@''NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \
-             -e 's|@''GNULIB_MKTIME''@|$(GNULIB_MKTIME)|g' \
-             -e 's|@''GNULIB_NANOSLEEP''@|$(GNULIB_NANOSLEEP)|g' \
-             -e 's|@''GNULIB_STRPTIME''@|$(GNULIB_STRPTIME)|g' \
-             -e 's|@''GNULIB_TIMEGM''@|$(GNULIB_TIMEGM)|g' \
-             -e 's|@''GNULIB_TIME_R''@|$(GNULIB_TIME_R)|g' \
-             -e 's|@''REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \
-             -e 's|@''REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \
-             -e 's|@''REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \
-             -e 's|@''REPLACE_STRPTIME''@|$(REPLACE_STRPTIME)|g' \
-             -e 's|@''REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \
-             -e 
's|@''SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g'
 \
-             -e 
's|@''TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
-             -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
-             < $(srcdir)/time.in.h; \
-       } > address@hidden && \
-       mv address@hidden $@
-MOSTLYCLEANFILES += time.h time.h-t
-
-EXTRA_DIST += time.in.h
-
-## end   gnulib module time
-
 ## begin gnulib module warn-on-use
 
 BUILT_SOURCES += warn-on-use.h
diff --git a/db/gl/m4/extensions.m4 b/db/gl/m4/extensions.m4
deleted file mode 100644
index 7d9458a..0000000
--- a/db/gl/m4/extensions.m4
+++ /dev/null
@@ -1,118 +0,0 @@
-# serial 9  -*- Autoconf -*-
-# Enable extensions on systems that normally disable them.
-
-# Copyright (C) 2003, 2006-2010 Free Software Foundation, Inc.
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS
-# Autoconf.  Perhaps we can remove this once we can assume Autoconf
-# 2.62 or later everywhere, but since CVS Autoconf mutates rapidly
-# enough in this area it's likely we'll need to redefine
-# AC_USE_SYSTEM_EXTENSIONS for quite some time.
-
-# If autoconf reports a warning
-#     warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
-# or  warning: AC_RUN_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
-# the fix is
-#   1) to ensure that AC_USE_SYSTEM_EXTENSIONS is never directly invoked
-#      but always AC_REQUIREd,
-#   2) to ensure that for each occurrence of
-#        AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
-#      or
-#        AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-#      the corresponding gnulib module description has 'extensions' among
-#      its dependencies. This will ensure that the gl_USE_SYSTEM_EXTENSIONS
-#      invocation occurs in gl_EARLY, not in gl_INIT.
-
-# AC_USE_SYSTEM_EXTENSIONS
-# ------------------------
-# Enable extensions on systems that normally disable them,
-# typically due to standards-conformance issues.
-# Remember that #undef in AH_VERBATIM gets replaced with #define by
-# AC_DEFINE.  The goal here is to define all known feature-enabling
-# macros, then, if reports of conflicts are made, disable macros that
-# cause problems on some platforms (such as __EXTENSIONS__).
-AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS],
-[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
-AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
-
-  AC_REQUIRE([AC_CANONICAL_HOST])
-
-  AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=])
-  if test "$MINIX" = yes; then
-    AC_DEFINE([_POSIX_SOURCE], [1],
-      [Define to 1 if you need to in order for `stat' and other
-       things to work.])
-    AC_DEFINE([_POSIX_1_SOURCE], [2],
-      [Define to 2 if the system does not provide POSIX.1 features
-       except with this defined.])
-    AC_DEFINE([_MINIX], [1],
-      [Define to 1 if on MINIX.])
-  fi
-
-  dnl HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to 500,
-  dnl regardless of whether the flags -Ae or _D_HPUX_SOURCE=1 are already
-  dnl provided.
-  case "$host_os" in
-    hpux*)
-      AC_DEFINE([_XOPEN_SOURCE], [500],
-        [Define to 500 only on HP-UX.])
-      ;;
-  esac
-
-  AH_VERBATIM([__EXTENSIONS__],
-[/* Enable extensions on AIX 3, Interix.  */
-#ifndef _ALL_SOURCE
-# undef _ALL_SOURCE
-#endif
-/* Enable GNU extensions on systems that have them.  */
-#ifndef _GNU_SOURCE
-# undef _GNU_SOURCE
-#endif
-/* Enable threading extensions on Solaris.  */
-#ifndef _POSIX_PTHREAD_SEMANTICS
-# undef _POSIX_PTHREAD_SEMANTICS
-#endif
-/* Enable extensions on HP NonStop.  */
-#ifndef _TANDEM_SOURCE
-# undef _TANDEM_SOURCE
-#endif
-/* Enable general extensions on Solaris.  */
-#ifndef __EXTENSIONS__
-# undef __EXTENSIONS__
-#endif
-])
-  AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
-    [ac_cv_safe_to_define___extensions__],
-    [AC_COMPILE_IFELSE(
-       [AC_LANG_PROGRAM([[
-#         define __EXTENSIONS__ 1
-          ]AC_INCLUDES_DEFAULT])],
-       [ac_cv_safe_to_define___extensions__=yes],
-       [ac_cv_safe_to_define___extensions__=no])])
-  test $ac_cv_safe_to_define___extensions__ = yes &&
-    AC_DEFINE([__EXTENSIONS__])
-  AC_DEFINE([_ALL_SOURCE])
-  AC_DEFINE([_GNU_SOURCE])
-  AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
-  AC_DEFINE([_TANDEM_SOURCE])
-])# AC_USE_SYSTEM_EXTENSIONS
-
-# gl_USE_SYSTEM_EXTENSIONS
-# ------------------------
-# Enable extensions on systems that normally disable them,
-# typically due to standards-conformance issues.
-AC_DEFUN_ONCE([gl_USE_SYSTEM_EXTENSIONS],
-[
-  dnl Require this macro before AC_USE_SYSTEM_EXTENSIONS.
-  dnl gnulib does not need it. But if it gets required by third-party macros
-  dnl after AC_USE_SYSTEM_EXTENSIONS is required, autoconf 2.62..2.63 emit a
-  dnl warning: "AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS".
-  dnl Note: We can do this only for one of the macros AC_AIX, AC_GNU_SOURCE,
-  dnl AC_MINIX. If people still use AC_AIX or AC_MINIX, they are out of luck.
-  AC_REQUIRE([AC_GNU_SOURCE])
-
-  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
-])
diff --git a/db/gl/m4/gnulib-cache.m4 b/db/gl/m4/gnulib-cache.m4
index 9774273..c440403 100644
--- a/db/gl/m4/gnulib-cache.m4
+++ b/db/gl/m4/gnulib-cache.m4
@@ -15,14 +15,14 @@
 
 
 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --lib=libgnu --source-base=db/gl 
--m4-base=db/gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux 
--avoid=absolute-header --avoid=include_next --avoid=link-warning 
--avoid=malloc-posix --avoid=ssize_t --avoid=stdlib --avoid=unistd 
--makefile-name=gnulib.mk --libtool --macro-prefix=gl3 --no-vc-files areadlink
+#   gnulib-tool --import --dir=. --lib=libgnu --source-base=db/gl 
--m4-base=db/gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux 
--avoid=absolute-header --avoid=include_next --avoid=link-warning 
--avoid=malloc-posix --avoid=ssize_t --avoid=stat --avoid=stdlib --avoid=unistd 
--makefile-name=gnulib.mk --libtool --macro-prefix=gl3 --no-vc-files areadlink
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([])
 gl_MODULES([
   areadlink
 ])
-gl_AVOID([absolute-header include_next link-warning malloc-posix ssize_t 
stdlib unistd])
+gl_AVOID([absolute-header include_next link-warning malloc-posix ssize_t stat 
stdlib unistd])
 gl_SOURCE_BASE([db/gl])
 gl_M4_BASE([db/gl/m4])
 gl_PO_BASE([])
diff --git a/db/gl/m4/gnulib-comp.m4 b/db/gl/m4/gnulib-comp.m4
index b03cbb0..a41ec6d 100644
--- a/db/gl/m4/gnulib-comp.m4
+++ b/db/gl/m4/gnulib-comp.m4
@@ -28,16 +28,10 @@ AC_DEFUN([gl3_EARLY],
   # Code from module areadlink:
   # Code from module arg-nonnull:
   # Code from module c++defs:
-  # Code from module extensions:
-  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
   # Code from module multiarch:
   # Code from module readlink:
-  # Code from module stat:
-  # Code from module stdbool:
   # Code from module stddef:
   # Code from module stdint:
-  # Code from module sys_stat:
-  # Code from module time:
   # Code from module warn-on-use:
   # Code from module wchar:
 ])
@@ -58,26 +52,15 @@ AC_DEFUN([gl3_INIT],
   # Code from module areadlink:
   # Code from module arg-nonnull:
   # Code from module c++defs:
-  # Code from module extensions:
   # Code from module multiarch:
   gl_MULTIARCH
   # Code from module readlink:
   gl_FUNC_READLINK
   gl_UNISTD_MODULE_INDICATOR([readlink])
-  # Code from module stat:
-  gl_FUNC_STAT
-  gl_SYS_STAT_MODULE_INDICATOR([stat])
-  # Code from module stdbool:
-  AM_STDBOOL_H
   # Code from module stddef:
   gl_STDDEF_H
   # Code from module stdint:
   gl_STDINT_H
-  # Code from module sys_stat:
-  gl_HEADER_SYS_STAT_H
-  AC_PROG_MKDIR_P
-  # Code from module time:
-  gl_HEADER_TIME_H
   # Code from module warn-on-use:
   # Code from module wchar:
   gl_WCHAR_H
@@ -216,27 +199,16 @@ AC_DEFUN([gl3_FILE_LIST], [
   lib/areadlink.c
   lib/areadlink.h
   lib/readlink.c
-  lib/stat.c
-  lib/stdbool.in.h
   lib/stddef.in.h
   lib/stdint.in.h
-  lib/sys_stat.in.h
-  lib/time.in.h
   lib/wchar.in.h
   m4/00gnulib.m4
-  m4/dos.m4
-  m4/extensions.m4
   m4/gnulib-common.m4
   m4/longlong.m4
   m4/multiarch.m4
   m4/readlink.m4
-  m4/stat.m4
-  m4/stdbool.m4
   m4/stddef_h.m4
   m4/stdint.m4
-  m4/sys_stat_h.m4
-  m4/time_h.m4
-  m4/unistd_h.m4
   m4/warn-on-use.m4
   m4/wchar_h.m4
   m4/wchar_t.m4
diff --git a/db/gl/m4/stdbool.m4 b/db/gl/m4/stdbool.m4
deleted file mode 100644
index 3d672d7..0000000
--- a/db/gl/m4/stdbool.m4
+++ /dev/null
@@ -1,115 +0,0 @@
-# Check for stdbool.h that conforms to C99.
-
-dnl Copyright (C) 2002-2006, 2009-2010 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.
-
-# Prepare for substituting <stdbool.h> if it is not supported.
-
-AC_DEFUN([AM_STDBOOL_H],
-[
-  AC_REQUIRE([AC_HEADER_STDBOOL])
-
-  # Define two additional variables used in the Makefile substitution.
-
-  if test "$ac_cv_header_stdbool_h" = yes; then
-    STDBOOL_H=''
-  else
-    STDBOOL_H='stdbool.h'
-  fi
-  AC_SUBST([STDBOOL_H])
-
-  if test "$ac_cv_type__Bool" = yes; then
-    HAVE__BOOL=1
-  else
-    HAVE__BOOL=0
-  fi
-  AC_SUBST([HAVE__BOOL])
-])
-
-# AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future.
-AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H])
-
-# This macro is only needed in autoconf <= 2.59.  Newer versions of autoconf
-# have this macro built-in.
-
-AC_DEFUN([AC_HEADER_STDBOOL],
-  [AC_CACHE_CHECK([for stdbool.h that conforms to C99],
-     [ac_cv_header_stdbool_h],
-     [AC_TRY_COMPILE(
-        [
-          #include <stdbool.h>
-          #ifndef bool
-           "error: bool is not defined"
-          #endif
-          #ifndef false
-           "error: false is not defined"
-          #endif
-          #if false
-           "error: false is not 0"
-          #endif
-          #ifndef true
-           "error: true is not defined"
-          #endif
-          #if true != 1
-           "error: true is not 1"
-          #endif
-          #ifndef __bool_true_false_are_defined
-           "error: __bool_true_false_are_defined is not defined"
-          #endif
-
-          struct s { _Bool s: 1; _Bool t; } s;
-
-          char a[true == 1 ? 1 : -1];
-          char b[false == 0 ? 1 : -1];
-          char c[__bool_true_false_are_defined == 1 ? 1 : -1];
-          char d[(bool) 0.5 == true ? 1 : -1];
-          bool e = &s;
-          char f[(_Bool) 0.0 == false ? 1 : -1];
-          char g[true];
-          char h[sizeof (_Bool)];
-          char i[sizeof s.t];
-          enum { j = false, k = true, l = false * true, m = true * 256 };
-          _Bool n[m];
-          char o[sizeof n == m * sizeof n[0] ? 1 : -1];
-          char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
-          #if defined __xlc__ || defined __GNUC__
-           /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
-              reported by James Lemley on 2005-10-05; see
-              
http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
-              This test is not quite right, since xlc is allowed to
-              reject this program, as the initializer for xlcbug is
-              not one of the forms that C requires support for.
-              However, doing the test right would require a run-time
-              test, and that would make cross-compilation harder.
-              Let us hope that IBM fixes the xlc bug, and also adds
-              support for this kind of constant expression.  In the
-              meantime, this test will reject xlc, which is OK, since
-              our stdbool.h substitute should suffice.  We also test
-              this with GCC, where it should work, to detect more
-              quickly whether someone messes up the test in the
-              future.  */
-           char digs[] = "0123456789";
-           int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
-          #endif
-          /* Catch a bug in an HP-UX C compiler.  See
-             http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
-             
http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
-           */
-          _Bool q = true;
-          _Bool *pq = &q;
-        ],
-        [
-          *pq |= q;
-          *pq |= ! q;
-          /* Refer to every declared value, to avoid compiler optimizations.  
*/
-          return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
-                  + !m + !n + !o + !p + !q + !pq);
-        ],
-        [ac_cv_header_stdbool_h=yes],
-        [ac_cv_header_stdbool_h=no])])
-   AC_CHECK_TYPES([_Bool])
-   if test $ac_cv_header_stdbool_h = yes; then
-     AC_DEFINE([HAVE_STDBOOL_H], [1], [Define to 1 if stdbool.h conforms to 
C99.])
-   fi])
diff --git a/db/gl/m4/sys_stat_h.m4 b/db/gl/m4/sys_stat_h.m4
deleted file mode 100644
index 54d74ca..0000000
--- a/db/gl/m4/sys_stat_h.m4
+++ /dev/null
@@ -1,82 +0,0 @@
-# sys_stat_h.m4 serial 23   -*- Autoconf -*-
-dnl Copyright (C) 2006-2010 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 Eric Blake.
-dnl Provide a GNU-like <sys/stat.h>.
-
-AC_DEFUN([gl_HEADER_SYS_STAT_H],
-[
-  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
-
-  dnl For the mkdir substitute.
-  AC_REQUIRE([AC_C_INLINE])
-
-  dnl Check for broken stat macros.
-  AC_REQUIRE([AC_HEADER_STAT])
-
-  gl_CHECK_NEXT_HEADERS([sys/stat.h])
-
-  dnl Define types that are supposed to be defined in <sys/types.h> or
-  dnl <sys/stat.h>.
-  AC_CHECK_TYPE([nlink_t], [],
-    [AC_DEFINE([nlink_t], [int],
-       [Define to the type of st_nlink in struct stat, or a supertype.])],
-    [#include <sys/types.h>
-     #include <sys/stat.h>])
-
-  dnl Check for declarations of anything we want to poison if the
-  dnl corresponding gnulib module is not in use.
-  gl_WARN_ON_USE_PREPARE([[#include <sys/stat.h>
-    ]], [fchmodat fstatat futimens lchmod lstat mkdirat mkfifo mkfifoat
-    mknod mknodat stat utimensat])
-]) # gl_HEADER_SYS_STAT_H
-
-AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR],
-[
-  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
-  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
-  
GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
-  dnl Define it also as a C macro, for the benefit of the unit tests.
-  gl_MODULE_INDICATOR([$1])
-])
-
-AC_DEFUN([gl_SYS_STAT_H_DEFAULTS],
-[
-  AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR
-  GNULIB_FCHMODAT=0;    AC_SUBST([GNULIB_FCHMODAT])
-  GNULIB_FSTATAT=0;     AC_SUBST([GNULIB_FSTATAT])
-  GNULIB_FUTIMENS=0;    AC_SUBST([GNULIB_FUTIMENS])
-  GNULIB_LCHMOD=0;      AC_SUBST([GNULIB_LCHMOD])
-  GNULIB_LSTAT=0;       AC_SUBST([GNULIB_LSTAT])
-  GNULIB_MKDIRAT=0;     AC_SUBST([GNULIB_MKDIRAT])
-  GNULIB_MKFIFO=0;      AC_SUBST([GNULIB_MKFIFO])
-  GNULIB_MKFIFOAT=0;    AC_SUBST([GNULIB_MKFIFOAT])
-  GNULIB_MKNOD=0;       AC_SUBST([GNULIB_MKNOD])
-  GNULIB_MKNODAT=0;     AC_SUBST([GNULIB_MKNODAT])
-  GNULIB_STAT=0;        AC_SUBST([GNULIB_STAT])
-  GNULIB_UTIMENSAT=0;   AC_SUBST([GNULIB_UTIMENSAT])
-  dnl Assume proper GNU behavior unless another module says otherwise.
-  HAVE_FCHMODAT=1;      AC_SUBST([HAVE_FCHMODAT])
-  HAVE_FSTATAT=1;       AC_SUBST([HAVE_FSTATAT])
-  HAVE_FUTIMENS=1;      AC_SUBST([HAVE_FUTIMENS])
-  HAVE_LCHMOD=1;        AC_SUBST([HAVE_LCHMOD])
-  HAVE_LSTAT=1;         AC_SUBST([HAVE_LSTAT])
-  HAVE_MKDIRAT=1;       AC_SUBST([HAVE_MKDIRAT])
-  HAVE_MKFIFO=1;        AC_SUBST([HAVE_MKFIFO])
-  HAVE_MKFIFOAT=1;      AC_SUBST([HAVE_MKFIFOAT])
-  HAVE_MKNOD=1;         AC_SUBST([HAVE_MKNOD])
-  HAVE_MKNODAT=1;       AC_SUBST([HAVE_MKNODAT])
-  HAVE_UTIMENSAT=1;     AC_SUBST([HAVE_UTIMENSAT])
-  REPLACE_FSTAT=0;      AC_SUBST([REPLACE_FSTAT])
-  REPLACE_FSTATAT=0;    AC_SUBST([REPLACE_FSTATAT])
-  REPLACE_FUTIMENS=0;   AC_SUBST([REPLACE_FUTIMENS])
-  REPLACE_LSTAT=0;      AC_SUBST([REPLACE_LSTAT])
-  REPLACE_MKDIR=0;      AC_SUBST([REPLACE_MKDIR])
-  REPLACE_MKFIFO=0;     AC_SUBST([REPLACE_MKFIFO])
-  REPLACE_MKNOD=0;      AC_SUBST([REPLACE_MKNOD])
-  REPLACE_STAT=0;       AC_SUBST([REPLACE_STAT])
-  REPLACE_UTIMENSAT=0;  AC_SUBST([REPLACE_UTIMENSAT])
-])
diff --git a/db/gl/m4/time_h.m4 b/db/gl/m4/time_h.m4
deleted file mode 100644
index f572b85..0000000
--- a/db/gl/m4/time_h.m4
+++ /dev/null
@@ -1,88 +0,0 @@
-# Configure a more-standard replacement for <time.h>.
-
-# Copyright (C) 2000-2001, 2003-2007, 2009-2010 Free Software Foundation, Inc.
-
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# Written by Paul Eggert and Jim Meyering.
-
-AC_DEFUN([gl_HEADER_TIME_H],
-[
-  dnl Use AC_REQUIRE here, so that the default behavior below is expanded
-  dnl once only, before all statements that occur in other macros.
-  AC_REQUIRE([gl_HEADER_TIME_H_BODY])
-])
-
-AC_DEFUN([gl_HEADER_TIME_H_BODY],
-[
-  AC_REQUIRE([AC_C_RESTRICT])
-  AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
-  gl_CHECK_NEXT_HEADERS([time.h])
-  AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC])
-])
-
-dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared
-dnl in time.h or sys/time.h.
-
-AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
-[
-  AC_CHECK_HEADERS_ONCE([sys/time.h])
-  AC_CACHE_CHECK([for struct timespec in <time.h>],
-    [gl_cv_sys_struct_timespec_in_time_h],
-    [AC_COMPILE_IFELSE(
-       [AC_LANG_PROGRAM(
-          [[#include <time.h>
-          ]],
-          [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
-       [gl_cv_sys_struct_timespec_in_time_h=yes],
-       [gl_cv_sys_struct_timespec_in_time_h=no])])
-
-  TIME_H_DEFINES_STRUCT_TIMESPEC=0
-  SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=0
-  if test $gl_cv_sys_struct_timespec_in_time_h = yes; then
-    TIME_H_DEFINES_STRUCT_TIMESPEC=1
-  else
-    AC_CACHE_CHECK([for struct timespec in <sys/time.h>],
-      [gl_cv_sys_struct_timespec_in_sys_time_h],
-      [AC_COMPILE_IFELSE(
-         [AC_LANG_PROGRAM(
-            [[#include <sys/time.h>
-            ]],
-            [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
-         [gl_cv_sys_struct_timespec_in_sys_time_h=yes],
-         [gl_cv_sys_struct_timespec_in_sys_time_h=no])])
-    if test $gl_cv_sys_struct_timespec_in_sys_time_h = yes; then
-      SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=1
-    fi
-  fi
-  AC_SUBST([TIME_H_DEFINES_STRUCT_TIMESPEC])
-  AC_SUBST([SYS_TIME_H_DEFINES_STRUCT_TIMESPEC])
-])
-
-AC_DEFUN([gl_TIME_MODULE_INDICATOR],
-[
-  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
-  AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
-  
GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
-  dnl Define it also as a C macro, for the benefit of the unit tests.
-  gl_MODULE_INDICATOR([$1])
-])
-
-AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS],
-[
-  GNULIB_MKTIME=0;                       AC_SUBST([GNULIB_MKTIME])
-  GNULIB_NANOSLEEP=0;                    AC_SUBST([GNULIB_NANOSLEEP])
-  GNULIB_STRPTIME=0;                     AC_SUBST([GNULIB_STRPTIME])
-  GNULIB_TIMEGM=0;                       AC_SUBST([GNULIB_TIMEGM])
-  GNULIB_TIME_R=0;                       AC_SUBST([GNULIB_TIME_R])
-  dnl If another module says to replace or to not replace, do that.
-  dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK;
-  dnl this lets maintainers check for portability.
-  REPLACE_LOCALTIME_R=GNULIB_PORTCHECK;  AC_SUBST([REPLACE_LOCALTIME_R])
-  REPLACE_MKTIME=GNULIB_PORTCHECK;       AC_SUBST([REPLACE_MKTIME])
-  REPLACE_NANOSLEEP=GNULIB_PORTCHECK;    AC_SUBST([REPLACE_NANOSLEEP])
-  REPLACE_STRPTIME=GNULIB_PORTCHECK;     AC_SUBST([REPLACE_STRPTIME])
-  REPLACE_TIMEGM=GNULIB_PORTCHECK;       AC_SUBST([REPLACE_TIMEGM])
-])
diff --git a/db/gl/m4/unistd_h.m4 b/db/gl/m4/unistd_h.m4
deleted file mode 100644
index 61c5f33..0000000
--- a/db/gl/m4/unistd_h.m4
+++ /dev/null
@@ -1,153 +0,0 @@
-# unistd_h.m4 serial 42
-dnl Copyright (C) 2006-2010 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 Written by Simon Josefsson, Bruno Haible.
-
-AC_DEFUN([gl_UNISTD_H],
-[
-  dnl Use AC_REQUIRE here, so that the default behavior below is expanded
-  dnl once only, before all statements that occur in other macros.
-  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
-  AC_REQUIRE([AC_C_INLINE])
-
-  gl_CHECK_NEXT_HEADERS([unistd.h])
-
-  AC_CHECK_HEADERS_ONCE([unistd.h])
-  if test $ac_cv_header_unistd_h = yes; then
-    HAVE_UNISTD_H=1
-  else
-    HAVE_UNISTD_H=0
-  fi
-  AC_SUBST([HAVE_UNISTD_H])
-
-  dnl Check for declarations of anything we want to poison if the
-  dnl corresponding gnulib module is not in use.
-  gl_WARN_ON_USE_PREPARE([[#include <unistd.h>
-/* Some systems declare various items in the wrong headers.  */
-#ifndef __GLIBC__
-# include <fcntl.h>
-# include <stdio.h>
-# include <stdlib.h>
-# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-#  include <io.h>
-# endif
-#endif
-    ]], [chown dup2 dup3 environ euidaccess faccessat fchdir fchownat
-    fsync ftruncate getcwd getdomainname getdtablesize getgroups
-    gethostname getlogin getlogin_r getpagesize getusershell setusershell
-    endusershell lchown link linkat lseek pipe2 pread readlink readlinkat
-    rmdir sleep symlink symlinkat ttyname_r unlink unlinkat usleep])
-])
-
-AC_DEFUN([gl_UNISTD_MODULE_INDICATOR],
-[
-  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
-  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
-  
GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
-  dnl Define it also as a C macro, for the benefit of the unit tests.
-  gl_MODULE_INDICATOR([$1])
-])
-
-AC_DEFUN([gl_UNISTD_H_DEFAULTS],
-[
-  GNULIB_CHOWN=0;            AC_SUBST([GNULIB_CHOWN])
-  GNULIB_CLOSE=0;            AC_SUBST([GNULIB_CLOSE])
-  GNULIB_DUP2=0;             AC_SUBST([GNULIB_DUP2])
-  GNULIB_DUP3=0;             AC_SUBST([GNULIB_DUP3])
-  GNULIB_ENVIRON=0;          AC_SUBST([GNULIB_ENVIRON])
-  GNULIB_EUIDACCESS=0;       AC_SUBST([GNULIB_EUIDACCESS])
-  GNULIB_FACCESSAT=0;        AC_SUBST([GNULIB_FACCESSAT])
-  GNULIB_FCHDIR=0;           AC_SUBST([GNULIB_FCHDIR])
-  GNULIB_FCHOWNAT=0;         AC_SUBST([GNULIB_FCHOWNAT])
-  GNULIB_FSYNC=0;            AC_SUBST([GNULIB_FSYNC])
-  GNULIB_FTRUNCATE=0;        AC_SUBST([GNULIB_FTRUNCATE])
-  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=0;         AC_SUBST([GNULIB_GETLOGIN])
-  GNULIB_GETLOGIN_R=0;       AC_SUBST([GNULIB_GETLOGIN_R])
-  GNULIB_GETPAGESIZE=0;      AC_SUBST([GNULIB_GETPAGESIZE])
-  GNULIB_GETUSERSHELL=0;     AC_SUBST([GNULIB_GETUSERSHELL])
-  GNULIB_LCHOWN=0;           AC_SUBST([GNULIB_LCHOWN])
-  GNULIB_LINK=0;             AC_SUBST([GNULIB_LINK])
-  GNULIB_LINKAT=0;           AC_SUBST([GNULIB_LINKAT])
-  GNULIB_LSEEK=0;            AC_SUBST([GNULIB_LSEEK])
-  GNULIB_PIPE2=0;            AC_SUBST([GNULIB_PIPE2])
-  GNULIB_PREAD=0;            AC_SUBST([GNULIB_PREAD])
-  GNULIB_READLINK=0;         AC_SUBST([GNULIB_READLINK])
-  GNULIB_READLINKAT=0;       AC_SUBST([GNULIB_READLINKAT])
-  GNULIB_RMDIR=0;            AC_SUBST([GNULIB_RMDIR])
-  GNULIB_SLEEP=0;            AC_SUBST([GNULIB_SLEEP])
-  GNULIB_SYMLINK=0;          AC_SUBST([GNULIB_SYMLINK])
-  GNULIB_SYMLINKAT=0;        AC_SUBST([GNULIB_SYMLINKAT])
-  GNULIB_TTYNAME_R=0;        AC_SUBST([GNULIB_TTYNAME_R])
-  GNULIB_UNISTD_H_GETOPT=0;  AC_SUBST([GNULIB_UNISTD_H_GETOPT])
-  GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE])
-  GNULIB_UNLINK=0;           AC_SUBST([GNULIB_UNLINK])
-  GNULIB_UNLINKAT=0;         AC_SUBST([GNULIB_UNLINKAT])
-  GNULIB_USLEEP=0;           AC_SUBST([GNULIB_USLEEP])
-  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])
-  HAVE_FACCESSAT=1;       AC_SUBST([HAVE_FACCESSAT])
-  HAVE_FCHOWNAT=1;        AC_SUBST([HAVE_FCHOWNAT])
-  HAVE_FSYNC=1;           AC_SUBST([HAVE_FSYNC])
-  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_GETLOGIN=1;        AC_SUBST([HAVE_GETLOGIN])
-  HAVE_GETPAGESIZE=1;     AC_SUBST([HAVE_GETPAGESIZE])
-  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])
-  HAVE_PREAD=1;           AC_SUBST([HAVE_PREAD])
-  HAVE_READLINK=1;        AC_SUBST([HAVE_READLINK])
-  HAVE_READLINKAT=1;      AC_SUBST([HAVE_READLINKAT])
-  HAVE_SLEEP=1;           AC_SUBST([HAVE_SLEEP])
-  HAVE_SYMLINK=1;         AC_SUBST([HAVE_SYMLINK])
-  HAVE_SYMLINKAT=1;       AC_SUBST([HAVE_SYMLINKAT])
-  HAVE_TTYNAME_R=1;       AC_SUBST([HAVE_TTYNAME_R])
-  HAVE_UNLINKAT=1;        AC_SUBST([HAVE_UNLINKAT])
-  HAVE_USLEEP=1;          AC_SUBST([HAVE_USLEEP])
-  HAVE_DECL_ENVIRON=1;    AC_SUBST([HAVE_DECL_ENVIRON])
-  HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R])
-  HAVE_DECL_GETUSERSHELL=1; AC_SUBST([HAVE_DECL_GETUSERSHELL])
-  HAVE_OS_H=0;            AC_SUBST([HAVE_OS_H])
-  HAVE_SYS_PARAM_H=0;     AC_SUBST([HAVE_SYS_PARAM_H])
-  REPLACE_CHOWN=0;        AC_SUBST([REPLACE_CHOWN])
-  REPLACE_CLOSE=0;        AC_SUBST([REPLACE_CLOSE])
-  REPLACE_DUP=0;          AC_SUBST([REPLACE_DUP])
-  REPLACE_DUP2=0;         AC_SUBST([REPLACE_DUP2])
-  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])
-  REPLACE_LINKAT=0;       AC_SUBST([REPLACE_LINKAT])
-  REPLACE_LSEEK=0;        AC_SUBST([REPLACE_LSEEK])
-  REPLACE_PREAD=0;        AC_SUBST([REPLACE_PREAD])
-  REPLACE_READLINK=0;     AC_SUBST([REPLACE_READLINK])
-  REPLACE_RMDIR=0;        AC_SUBST([REPLACE_RMDIR])
-  REPLACE_SLEEP=0;        AC_SUBST([REPLACE_SLEEP])
-  REPLACE_SYMLINK=0;      AC_SUBST([REPLACE_SYMLINK])
-  REPLACE_UNLINK=0;       AC_SUBST([REPLACE_UNLINK])
-  REPLACE_UNLINKAT=0;     AC_SUBST([REPLACE_UNLINKAT])
-  REPLACE_USLEEP=0;       AC_SUBST([REPLACE_USLEEP])
-  REPLACE_WRITE=0;        AC_SUBST([REPLACE_WRITE])
-  UNISTD_H_HAVE_WINSOCK2_H=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H])
-  UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0;
-                           AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS])
-])
diff --git a/db/gl/stdbool.in.h b/db/gl/stdbool.in.h
deleted file mode 100644
index e2312ec..0000000
--- a/db/gl/stdbool.in.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/* Copyright (C) 2001-2003, 2006-2010 Free Software Foundation, Inc.
-   Written by Bruno Haible <address@hidden>, 2001.
-
-   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, 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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-#ifndef _GL_STDBOOL_H
-#define _GL_STDBOOL_H
-
-/* ISO C 99 <stdbool.h> for platforms that lack it.  */
-
-/* Usage suggestions:
-
-   Programs that use <stdbool.h> should be aware of some limitations
-   and standards compliance issues.
-
-   Standards compliance:
-
-       - <stdbool.h> must be #included before 'bool', 'false', 'true'
-         can be used.
-
-       - You cannot assume that sizeof (bool) == 1.
-
-       - Programs should not undefine the macros bool, true, and false,
-         as C99 lists that as an "obsolescent feature".
-
-   Limitations of this substitute, when used in a C89 environment:
-
-       - <stdbool.h> must be #included before the '_Bool' type can be used.
-
-       - You cannot assume that _Bool is a typedef; it might be a macro.
-
-       - Bit-fields of type 'bool' are not supported.  Portable code
-         should use 'unsigned int foo : 1;' rather than 'bool foo : 1;'.
-
-       - In C99, casts and automatic conversions to '_Bool' or 'bool' are
-         performed in such a way that every nonzero value gets converted
-         to 'true', and zero gets converted to 'false'.  This doesn't work
-         with this substitute.  With this substitute, only the values 0 and 1
-         give the expected result when converted to _Bool' or 'bool'.
-
-   Also, it is suggested that programs use 'bool' rather than '_Bool';
-   this isn't required, but 'bool' is more common.  */
-
-
-/* 7.16. Boolean type and values */
-
-/* BeOS <sys/socket.h> already #defines false 0, true 1.  We use the same
-   definitions below, but temporarily we have to #undef them.  */
-#if defined __BEOS__ && !defined __HAIKU__
-# include <OS.h> /* defines bool but not _Bool */
-# undef false
-# undef true
-#endif
-
-/* For the sake of symbolic names in gdb, we define true and false as
-   enum constants, not only as macros.
-   It is tempting to write
-      typedef enum { false = 0, true = 1 } _Bool;
-   so that gdb prints values of type 'bool' symbolically. But if we do
-   this, values of type '_Bool' may promote to 'int' or 'unsigned int'
-   (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int'
-   (see ISO C 99 6.3.1.1.(2)).  So we add a negative value to the
-   enum; this ensures that '_Bool' promotes to 'int'.  */
-#if defined __cplusplus || (defined __BEOS__ && !defined __HAIKU__)
-  /* A compiler known to have 'bool'.  */
-  /* If the compiler already has both 'bool' and '_Bool', we can assume they
-     are the same types.  */
-# if address@hidden@
-typedef bool _Bool;
-# endif
-#else
-# if !defined __GNUC__
-   /* If @HAVE__BOOL@:
-        Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when
-        the built-in _Bool type is used.  See
-          http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
-          http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
-          http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
-        Similar bugs are likely with other compilers as well; this file
-        wouldn't be used if <stdbool.h> was working.
-        So we override the _Bool type.
-      If address@hidden@:
-        Need to define _Bool ourselves. As 'signed char' or as an enum type?
-        Use of a typedef, with SunPRO C, leads to a stupid
-          "warning: _Bool is a keyword in ISO C99".
-        Use of an enum type, with IRIX cc, leads to a stupid
-          "warning(1185): enumerated type mixed with another type".
-        Even the existence of an enum type, without a typedef,
-          "Invalid enumerator. (badenum)" with HP-UX cc on Tru64.
-        The only benefit of the enum, debuggability, is not important
-        with these compilers.  So use 'signed char' and no enum.  */
-#  define _Bool signed char
-# else
-   /* With this compiler, trust the _Bool type if the compiler has it.  */
-#  if address@hidden@
-typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool;
-#  endif
-# endif
-#endif
-#define bool _Bool
-
-/* The other macros must be usable in preprocessor directives.  */
-#define false 0
-#define true 1
-#define __bool_true_false_are_defined 1
-
-#endif /* _GL_STDBOOL_H */
diff --git a/db/gl/sys_stat.in.h b/db/gl/sys_stat.in.h
deleted file mode 100644
index 8bd3f29..0000000
--- a/db/gl/sys_stat.in.h
+++ /dev/null
@@ -1,631 +0,0 @@
-/* Provide a more complete sys/stat header file.
-   Copyright (C) 2005-2010 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, 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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-/* Written by Eric Blake, Paul Eggert, and Jim Meyering.  */
-
-/* This file is supposed to be used on platforms where <sys/stat.h> is
-   incomplete.  It is intended to provide definitions and prototypes
-   needed by an application.  Start with what the system provides.  */
-
-#if __GNUC__ >= 3
address@hidden@
-#endif
-
-#if defined __need_system_sys_stat_h
-/* Special invocation convention.  */
-
address@hidden@ @NEXT_SYS_STAT_H@
-
-#else
-/* Normal invocation convention.  */
-
-#ifndef _GL_SYS_STAT_H
-
-/* Get nlink_t.  */
-#include <sys/types.h>
-
-/* Get struct timespec.  */
-#include <time.h>
-
-/* The include_next requires a split double-inclusion guard.  */
address@hidden@ @NEXT_SYS_STAT_H@
-
-#ifndef _GL_SYS_STAT_H
-#define _GL_SYS_STAT_H
-
-/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
-
-/* The definition of _GL_ARG_NONNULL is copied here.  */
-
-/* The definition of _GL_WARN_ON_USE is copied here.  */
-
-/* Before doing "#define mkdir rpl_mkdir" below, we need to include all
-   headers that may declare mkdir().  */
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-# include <io.h>
-#endif
-
-#ifndef S_IFMT
-# define S_IFMT 0170000
-#endif
-
-#if STAT_MACROS_BROKEN
-# undef S_ISBLK
-# undef S_ISCHR
-# undef S_ISDIR
-# undef S_ISFIFO
-# undef S_ISLNK
-# undef S_ISNAM
-# undef S_ISMPB
-# undef S_ISMPC
-# undef S_ISNWK
-# undef S_ISREG
-# undef S_ISSOCK
-#endif
-
-#ifndef S_ISBLK
-# ifdef S_IFBLK
-#  define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
-# else
-#  define S_ISBLK(m) 0
-# endif
-#endif
-
-#ifndef S_ISCHR
-# ifdef S_IFCHR
-#  define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
-# else
-#  define S_ISCHR(m) 0
-# endif
-#endif
-
-#ifndef S_ISDIR
-# ifdef S_IFDIR
-#  define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
-# else
-#  define S_ISDIR(m) 0
-# endif
-#endif
-
-#ifndef S_ISDOOR /* Solaris 2.5 and up */
-# define S_ISDOOR(m) 0
-#endif
-
-#ifndef S_ISFIFO
-# ifdef S_IFIFO
-#  define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
-# else
-#  define S_ISFIFO(m) 0
-# endif
-#endif
-
-#ifndef S_ISLNK
-# ifdef S_IFLNK
-#  define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
-# else
-#  define S_ISLNK(m) 0
-# endif
-#endif
-
-#ifndef S_ISMPB /* V7 */
-# ifdef S_IFMPB
-#  define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
-#  define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
-# else
-#  define S_ISMPB(m) 0
-#  define S_ISMPC(m) 0
-# endif
-#endif
-
-#ifndef S_ISNAM /* Xenix */
-# ifdef S_IFNAM
-#  define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
-# else
-#  define S_ISNAM(m) 0
-# endif
-#endif
-
-#ifndef S_ISNWK /* HP/UX */
-# ifdef S_IFNWK
-#  define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
-# else
-#  define S_ISNWK(m) 0
-# endif
-#endif
-
-#ifndef S_ISPORT /* Solaris 10 and up */
-# define S_ISPORT(m) 0
-#endif
-
-#ifndef S_ISREG
-# ifdef S_IFREG
-#  define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
-# else
-#  define S_ISREG(m) 0
-# endif
-#endif
-
-#ifndef S_ISSOCK
-# ifdef S_IFSOCK
-#  define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
-# else
-#  define S_ISSOCK(m) 0
-# endif
-#endif
-
-
-#ifndef S_TYPEISMQ
-# define S_TYPEISMQ(p) 0
-#endif
-
-#ifndef S_TYPEISTMO
-# define S_TYPEISTMO(p) 0
-#endif
-
-
-#ifndef S_TYPEISSEM
-# ifdef S_INSEM
-#  define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
-# else
-#  define S_TYPEISSEM(p) 0
-# endif
-#endif
-
-#ifndef S_TYPEISSHM
-# ifdef S_INSHD
-#  define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
-# else
-#  define S_TYPEISSHM(p) 0
-# endif
-#endif
-
-/* high performance ("contiguous data") */
-#ifndef S_ISCTG
-# define S_ISCTG(p) 0
-#endif
-
-/* Cray DMF (data migration facility): off line, with data  */
-#ifndef S_ISOFD
-# define S_ISOFD(p) 0
-#endif
-
-/* Cray DMF (data migration facility): off line, with no data  */
-#ifndef S_ISOFL
-# define S_ISOFL(p) 0
-#endif
-
-/* 4.4BSD whiteout */
-#ifndef S_ISWHT
-# define S_ISWHT(m) 0
-#endif
-
-/* If any of the following are undefined,
-   define them to their de facto standard values.  */
-#if !S_ISUID
-# define S_ISUID 04000
-#endif
-#if !S_ISGID
-# define S_ISGID 02000
-#endif
-
-/* S_ISVTX is a common extension to POSIX.  */
-#ifndef S_ISVTX
-# define S_ISVTX 01000
-#endif
-
-#if !S_IRUSR && S_IREAD
-# define S_IRUSR S_IREAD
-#endif
-#if !S_IRUSR
-# define S_IRUSR 00400
-#endif
-#if !S_IRGRP
-# define S_IRGRP (S_IRUSR >> 3)
-#endif
-#if !S_IROTH
-# define S_IROTH (S_IRUSR >> 6)
-#endif
-
-#if !S_IWUSR && S_IWRITE
-# define S_IWUSR S_IWRITE
-#endif
-#if !S_IWUSR
-# define S_IWUSR 00200
-#endif
-#if !S_IWGRP
-# define S_IWGRP (S_IWUSR >> 3)
-#endif
-#if !S_IWOTH
-# define S_IWOTH (S_IWUSR >> 6)
-#endif
-
-#if !S_IXUSR && S_IEXEC
-# define S_IXUSR S_IEXEC
-#endif
-#if !S_IXUSR
-# define S_IXUSR 00100
-#endif
-#if !S_IXGRP
-# define S_IXGRP (S_IXUSR >> 3)
-#endif
-#if !S_IXOTH
-# define S_IXOTH (S_IXUSR >> 6)
-#endif
-
-#if !S_IRWXU
-# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
-#endif
-#if !S_IRWXG
-# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
-#endif
-#if !S_IRWXO
-# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
-#endif
-
-/* S_IXUGO is a common extension to POSIX.  */
-#if !S_IXUGO
-# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
-#endif
-
-#ifndef S_IRWXUGO
-# define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
-#endif
-
-/* Macros for futimens and utimensat.  */
-#ifndef UTIME_NOW
-# define UTIME_NOW (-1)
-# define UTIME_OMIT (-2)
-#endif
-
-
-#if @GNULIB_FCHMODAT@
-# if address@hidden@
-_GL_FUNCDECL_SYS (fchmodat, int,
-                  (int fd, char const *file, mode_t mode, int flag)
-                  _GL_ARG_NONNULL ((2)));
-# endif
-_GL_CXXALIAS_SYS (fchmodat, int,
-                  (int fd, char const *file, mode_t mode, int flag));
-_GL_CXXALIASWARN (fchmodat);
-#elif defined GNULIB_POSIXCHECK
-# undef fchmodat
-# if HAVE_RAW_DECL_FCHMODAT
-_GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
-                 "use gnulib module openat for portability");
-# endif
-#endif
-
-
-#if @REPLACE_FSTAT@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#  define fstat rpl_fstat
-# endif
-_GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL 
((2)));
-_GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
-#else
-_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
-#endif
-_GL_CXXALIASWARN (fstat);
-
-
-#if @GNULIB_FSTATAT@
-# if @REPLACE_FSTATAT@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef fstatat
-#   define fstatat rpl_fstatat
-#  endif
-_GL_FUNCDECL_RPL (fstatat, int,
-                  (int fd, char const *name, struct stat *st, int flags)
-                  _GL_ARG_NONNULL ((2, 3)));
-_GL_CXXALIAS_RPL (fstatat, int,
-                  (int fd, char const *name, struct stat *st, int flags));
-# else
-#  if address@hidden@
-_GL_FUNCDECL_SYS (fstatat, int,
-                  (int fd, char const *name, struct stat *st, int flags)
-                  _GL_ARG_NONNULL ((2, 3)));
-#  endif
-_GL_CXXALIAS_SYS (fstatat, int,
-                  (int fd, char const *name, struct stat *st, int flags));
-# endif
-_GL_CXXALIASWARN (fstatat);
-#elif defined GNULIB_POSIXCHECK
-# undef fstatat
-# if HAVE_RAW_DECL_FSTATAT
-_GL_WARN_ON_USE (fstatat, "fstatat is not portable - "
-                 "use gnulib module openat for portability");
-# endif
-#endif
-
-
-#if @GNULIB_FUTIMENS@
-# if @REPLACE_FUTIMENS@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef futimens
-#   define futimens rpl_futimens
-#  endif
-_GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2]));
-_GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2]));
-# else
-#  if address@hidden@
-_GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2]));
-#  endif
-_GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2]));
-# endif
-_GL_CXXALIASWARN (futimens);
-#elif defined GNULIB_POSIXCHECK
-# undef futimens
-# if HAVE_RAW_DECL_FUTIMENS
-_GL_WARN_ON_USE (futimens, "futimens is not portable - "
-                 "use gnulib module futimens for portability");
-# endif
-#endif
-
-
-#if @GNULIB_LCHMOD@
-/* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
-   denotes a symbolic link.  */
-# if address@hidden@
-/* The lchmod replacement follows symbolic links.  Callers should take
-   this into account; lchmod should be applied only to arguments that
-   are known to not be symbolic links.  On hosts that lack lchmod,
-   this can lead to race conditions between the check and the
-   invocation of lchmod, but we know of no workarounds that are
-   reliable in general.  You might try requesting support for lchmod
-   from your operating system supplier.  */
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define lchmod chmod
-#  endif
-_GL_CXXALIAS_RPL_1 (lchmod, chmod, int, (const char *filename, mode_t mode));
-# else
-#  if 0 /* assume already declared */
-_GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode)
-                               _GL_ARG_NONNULL ((1)));
-#  endif
-_GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode));
-# endif
-_GL_CXXALIASWARN (lchmod);
-#elif defined GNULIB_POSIXCHECK
-# undef lchmod
-# if HAVE_RAW_DECL_LCHMOD
-_GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
-                 "use gnulib module lchmod for portability");
-# endif
-#endif
-
-
-#if @GNULIB_LSTAT@
-# if ! @HAVE_LSTAT@
-/* mingw does not support symlinks, therefore it does not have lstat.  But
-   without links, stat does just fine.  */
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define lstat stat
-#  endif
-_GL_CXXALIAS_RPL_1 (lstat, stat, int, (const char *name, struct stat *buf));
-# elif @REPLACE_LSTAT@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef lstat
-#   define lstat rpl_lstat
-#  endif
-_GL_FUNCDECL_RPL (lstat, int, (const char *name, struct stat *buf)
-                              _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (lstat, int, (const char *name, struct stat *buf));
-# else
-_GL_CXXALIAS_SYS (lstat, int, (const char *name, struct stat *buf));
-# endif
-_GL_CXXALIASWARN (lstat);
-#elif defined GNULIB_POSIXCHECK
-# undef lstat
-# if HAVE_RAW_DECL_LSTAT
-_GL_WARN_ON_USE (lstat, "lstat is unportable - "
-                 "use gnulib module lstat for portability");
-# endif
-#endif
-
-
-#if @REPLACE_MKDIR@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#  undef mkdir
-#  define mkdir rpl_mkdir
-# endif
-_GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode)
-                              _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
-#else
-/* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
-   Additionally, it declares _mkdir (and depending on compile flags, an
-   alias mkdir), only in the nonstandard <io.h>, which is included above.  */
-# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-
-static inline int
-rpl_mkdir (char const *name, mode_t mode)
-{
-  return _mkdir (name);
-}
-
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define mkdir rpl_mkdir
-#  endif
-_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
-# else
-_GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
-# endif
-#endif
-_GL_CXXALIASWARN (mkdir);
-
-
-#if @GNULIB_MKDIRAT@
-# if address@hidden@
-_GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)
-                                _GL_ARG_NONNULL ((2)));
-# endif
-_GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode));
-_GL_CXXALIASWARN (mkdirat);
-#elif defined GNULIB_POSIXCHECK
-# undef mkdirat
-# if HAVE_RAW_DECL_MKDIRAT
-_GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - "
-                 "use gnulib module openat for portability");
-# endif
-#endif
-
-
-#if @GNULIB_MKFIFO@
-# if @REPLACE_MKFIFO@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef mkfifo
-#   define mkfifo rpl_mkfifo
-#  endif
-_GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode)
-                               _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode));
-# else
-#  if address@hidden@
-_GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode)
-                               _GL_ARG_NONNULL ((1)));
-#  endif
-_GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode));
-# endif
-_GL_CXXALIASWARN (mkfifo);
-#elif defined GNULIB_POSIXCHECK
-# undef mkfifo
-# if HAVE_RAW_DECL_MKFIFO
-_GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - "
-                 "use gnulib module mkfifo for portability");
-# endif
-#endif
-
-
-#if @GNULIB_MKFIFOAT@
-# if address@hidden@
-_GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)
-                                 _GL_ARG_NONNULL ((2)));
-# endif
-_GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode));
-_GL_CXXALIASWARN (mkfifoat);
-#elif defined GNULIB_POSIXCHECK
-# undef mkfifoat
-# if HAVE_RAW_DECL_MKFIFOAT
-_GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - "
-                 "use gnulib module mkfifoat for portability");
-# endif
-#endif
-
-
-#if @GNULIB_MKNOD@
-# if @REPLACE_MKNOD@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef mknod
-#   define mknod rpl_mknod
-#  endif
-_GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)
-                              _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev));
-# else
-#  if address@hidden@
-_GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev)
-                              _GL_ARG_NONNULL ((1)));
-#  endif
-_GL_CXXALIAS_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev));
-# endif
-_GL_CXXALIASWARN (mknod);
-#elif defined GNULIB_POSIXCHECK
-# undef mknod
-# if HAVE_RAW_DECL_MKNOD
-_GL_WARN_ON_USE (mknod, "mknod is not portable - "
-                 "use gnulib module mknod for portability");
-# endif
-#endif
-
-
-#if @GNULIB_MKNODAT@
-# if address@hidden@
-_GL_FUNCDECL_SYS (mknodat, int,
-                  (int fd, char const *file, mode_t mode, dev_t dev)
-                  _GL_ARG_NONNULL ((2)));
-# endif
-_GL_CXXALIAS_SYS (mknodat, int,
-                  (int fd, char const *file, mode_t mode, dev_t dev));
-_GL_CXXALIASWARN (mknodat);
-#elif defined GNULIB_POSIXCHECK
-# undef mknodat
-# if HAVE_RAW_DECL_MKNODAT
-_GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
-                 "use gnulib module mkfifoat for portability");
-# endif
-#endif
-
-
-#if @GNULIB_STAT@
-# if @REPLACE_STAT@
-/* We can't use the object-like #define stat rpl_stat, because of
-   struct stat.  This means that rpl_stat will not be used if the user
-   does (stat)(a,b).  Oh well.  */
-#  undef stat
-#  ifdef _LARGE_FILES
-    /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
-       so we have to replace stat64() instead of stat(). */
-#   define stat stat64
-#   undef stat64
-#   define stat64(name, st) rpl_stat (name, st)
-#  else /* !_LARGE_FILES */
-#   define stat(name, st) rpl_stat (name, st)
-#  endif /* !_LARGE_FILES */
-_GL_EXTERN_C int stat (const char *name, struct stat *buf) _GL_ARG_NONNULL 
((1, 2));
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef stat
-# if HAVE_RAW_DECL_STAT
-_GL_WARN_ON_USE (stat, "stat is unportable - "
-                 "use gnulib module stat for portability");
-# endif
-#endif
-
-
-#if @GNULIB_UTIMENSAT@
-# if @REPLACE_UTIMENSAT@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef utimensat
-#   define utimensat rpl_utimensat
-#  endif
-_GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name,
-                                   struct timespec const times[2], int flag)
-                                  _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name,
-                                   struct timespec const times[2], int flag));
-# else
-#  if address@hidden@
-_GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name,
-                                   struct timespec const times[2], int flag)
-                                  _GL_ARG_NONNULL ((2)));
-#  endif
-_GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name,
-                                   struct timespec const times[2], int flag));
-# endif
-_GL_CXXALIASWARN (utimensat);
-#elif defined GNULIB_POSIXCHECK
-# undef utimensat
-# if HAVE_RAW_DECL_UTIMENSAT
-_GL_WARN_ON_USE (utimensat, "utimensat is not portable - "
-                 "use gnulib module utimensat for portability");
-# endif
-#endif
-
-
-#endif /* _GL_SYS_STAT_H */
-#endif /* _GL_SYS_STAT_H */
-#endif
diff --git a/db/gl/time.in.h b/db/gl/time.in.h
deleted file mode 100644
index bb4c106..0000000
--- a/db/gl/time.in.h
+++ /dev/null
@@ -1,199 +0,0 @@
-/* A more-standard <time.h>.
-
-   Copyright (C) 2007-2010 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, 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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-#if __GNUC__ >= 3
address@hidden@
-#endif
-
-/* Don't get in the way of glibc when it includes time.h merely to
-   declare a few standard symbols, rather than to declare all the
-   symbols.  Also, Solaris 8 <time.h> eventually includes itself
-   recursively; if that is happening, just include the system <time.h>
-   without adding our own declarations.  */
-#if (defined __need_time_t || defined __need_clock_t \
-     || defined __need_timespec \
-     || defined _GL_TIME_H)
-
-# @INCLUDE_NEXT@ @NEXT_TIME_H@
-
-#else
-
-# define _GL_TIME_H
-
-# @INCLUDE_NEXT@ @NEXT_TIME_H@
-
-/* NetBSD 5.0 mis-defines NULL.  */
-#include <stddef.h>
-
-/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
-
-/* The definition of _GL_ARG_NONNULL is copied here.  */
-
-/* The definition of _GL_WARN_ON_USE is copied here.  */
-
-/* Some systems don't define struct timespec (e.g., AIX 4.1, Ultrix 4.3).
-   Or they define it with the wrong member names or define it in <sys/time.h>
-   (e.g., FreeBSD circa 1997).  */
-# if ! @TIME_H_DEFINES_STRUCT_TIMESPEC@
-#  if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
-#   include <sys/time.h>
-#  else
-
-#   ifdef __cplusplus
-extern "C" {
-#   endif
-
-#   undef timespec
-#   define timespec rpl_timespec
-struct timespec
-{
-  time_t tv_sec;
-  long int tv_nsec;
-};
-
-#   ifdef __cplusplus
-}
-#   endif
-
-#  endif
-# endif
-
-/* Sleep for at least RQTP seconds unless interrupted,  If interrupted,
-   return -1 and store the remaining time into RMTP.  See
-   <http://www.opengroup.org/susv3xsh/nanosleep.html>.  */
-# if @GNULIB_NANOSLEEP@
-#  if @REPLACE_NANOSLEEP@
-#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#    define nanosleep rpl_nanosleep
-#   endif
-_GL_FUNCDECL_RPL (nanosleep, int,
-                  (struct timespec const *__rqtp, struct timespec *__rmtp)
-                  _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (nanosleep, int,
-                  (struct timespec const *__rqtp, struct timespec *__rmtp));
-#  else
-_GL_CXXALIAS_SYS (nanosleep, int,
-                  (struct timespec const *__rqtp, struct timespec *__rmtp));
-#  endif
-_GL_CXXALIASWARN (nanosleep);
-# endif
-
-/* Return the 'time_t' representation of TP and normalize TP.  */
-# if @GNULIB_MKTIME@
-#  if @REPLACE_MKTIME@
-#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#    define mktime rpl_mktime
-#   endif
-_GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp));
-#  else
-_GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp));
-#  endif
-_GL_CXXALIASWARN (mktime);
-# endif
-
-/* Convert TIMER to RESULT, assuming local time and UTC respectively.  See
-   <http://www.opengroup.org/susv3xsh/localtime_r.html> and
-   <http://www.opengroup.org/susv3xsh/gmtime_r.html>.  */
-# if @GNULIB_TIME_R@
-#  if @REPLACE_LOCALTIME_R@
-#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#    undef localtime_r
-#    define localtime_r rpl_localtime_r
-#   endif
-_GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
-                                             struct tm *restrict __result)
-                                            _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
-                                             struct tm *restrict __result));
-#  else
-_GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
-                                             struct tm *restrict __result));
-#  endif
-_GL_CXXALIASWARN (localtime_r);
-#  if @REPLACE_LOCALTIME_R@
-#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#    undef gmtime_r
-#    define gmtime_r rpl_gmtime_r
-#   endif
-_GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
-                                          struct tm *restrict __result)
-                                         _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
-                                          struct tm *restrict __result));
-#  else
-_GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
-                                          struct tm *restrict __result));
-#  endif
-_GL_CXXALIASWARN (gmtime_r);
-# endif
-
-/* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store
-   the resulting broken-down time into TM.  See
-   <http://www.opengroup.org/susv3xsh/strptime.html>.  */
-# if @GNULIB_STRPTIME@
-#  if @REPLACE_STRPTIME@
-#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#    undef strptime
-#    define strptime rpl_strptime
-#   endif
-_GL_FUNCDECL_RPL (strptime, char *, (char const *restrict __buf,
-                                     char const *restrict __format,
-                                     struct tm *restrict __tm)
-                                    _GL_ARG_NONNULL ((1, 2, 3)));
-_GL_CXXALIAS_RPL (strptime, char *, (char const *restrict __buf,
-                                     char const *restrict __format,
-                                     struct tm *restrict __tm));
-#  else
-_GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf,
-                                     char const *restrict __format,
-                                     struct tm *restrict __tm));
-#  endif
-_GL_CXXALIASWARN (strptime);
-# endif
-
-/* Convert TM to a time_t value, assuming UTC.  */
-# if @GNULIB_TIMEGM@
-#  if @REPLACE_TIMEGM@
-#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#    undef timegm
-#    define timegm rpl_timegm
-#   endif
-_GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm));
-#  else
-_GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm));
-#  endif
-_GL_CXXALIASWARN (timegm);
-# endif
-
-/* Encourage applications to avoid unsafe functions that can overrun
-   buffers when given outlandish struct tm values.  Portable
-   applications should use strftime (or even sprintf) instead.  */
-# if GNULIB_PORTCHECK
-#  undef asctime
-#  define asctime eschew_asctime
-#  undef asctime_r
-#  define asctime_r eschew_asctime_r
-#  undef ctime
-#  define ctime eschew_ctime
-#  undef ctime_r
-#  define ctime_r eschew_ctime_r
-# endif
-
-#endif
diff --git a/doc/Makefile.am b/doc/Makefile.am
index d3021a9..189f90a 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -533,6 +533,8 @@ gdoc_MANS += man/shishi_des.3
 gdoc_MANS += man/shishi_3des.3
 gdoc_MANS += man/shishi_aes_cts.3
 gdoc_MANS += man/shishi_pbkdf2_sha1.3
+gdoc_MANS += man/shishi_kdc_sendrecv_hint.3
+gdoc_MANS += man/shishi_kdc_sendrecv.3
 gdoc_MANS += man/shishi_prompt_password_callback_set.3
 gdoc_MANS += man/shishi_prompt_password_callback_get.3
 gdoc_MANS += man/shishi_prompt_password.3
diff --git a/doc/shishi.texi b/doc/shishi.texi
index 7cbedfa..8279f9f 100644
--- a/doc/shishi.texi
+++ b/doc/shishi.texi
@@ -1663,7 +1663,7 @@ ports.
 
 By default, Shishid listens on the @samp{kerberos} service port
 (typically translated to 88 via @file{/etc/services}) on the UDP and
-TCP protocols via IPv4 and (if your machine support it) IPv6 on all
+TCP transports via IPv4 and (if your machine support it) IPv6 on all
 interfaces on your machine.  Here is a typical startup.
 
 @example
@@ -2975,12 +2975,12 @@ verbose-noise
 @anchor{realm-kdc}
 
 Specify KDC addresses for realms.  Value is
address@hidden,KDCADDRESS[/PROTOCOL][,KDCADDRESS[/PROTOCOL]...]}.
address@hidden,KDCADDRESS[/TRANSPORT][,KDCADDRESS[/TRANSPORT]...]}.
 
 KDCADDRESS is the hostname or IP address of KDC.
 
-Optional PROTOCOL is udp for UDP, tcp for TCP, and TLS for TLS
-connections.  By default UDP is tried first, and TCP used as a
+Optional TRANSPORT is ``udp'' for UDP, ``tcp'' for TCP, and ``tls''
+for TLS connections.  By default UDP is tried first, and TCP used as a
 fallback if the KRB_ERR_RESPONSE_TOO_BIG error is received.
 
 If not specified, Shishi tries to locate the KDC using SRV RRs,
diff --git a/gl/Makefile.am b/gl/Makefile.am
index 0e4957d..ffafe9b 100644
--- a/gl/Makefile.am
+++ b/gl/Makefile.am
@@ -9,7 +9,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl/override 
--lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc 
--tests-base=gl/tests --aux-dir=build-aux --avoid=xalloc-die --libtool 
--macro-prefix=gl --no-vc-files arpa_inet autobuild base64 bind close connect 
crc crypto/arcfour crypto/gc-des crypto/gc-hmac-md5 crypto/gc-hmac-sha1 
crypto/gc-md4 crypto/gc-md5 crypto/gc-pbkdf2-sha1 crypto/gc-random fcntl 
fdl-1.3 gendocs getaddrinfo getdate getline getpass getsubopt gnupload gpl-3.0 
lib-msvc-compat lib-symbol-versions maintainer-makefile manywarnings minmax 
netinet_in read-file recvfrom select sendto shutdown signal socket sockets 
socklen stdint strcase strerror strndup strtok_r strverscmp sys_select 
sys_socket sys_stat sys_time time timegm unistd vasnprintf vasprintf warnings 
xalloc xgetdomainname xgethostname xstrndup xvasprintf
+# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl/override 
--lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc 
--tests-base=gl/tests --aux-dir=build-aux --avoid=xalloc-die --libtool 
--macro-prefix=gl --no-vc-files arpa_inet autobuild base64 bind close connect 
crc crypto/arcfour crypto/gc-des crypto/gc-hmac-md5 crypto/gc-hmac-sha1 
crypto/gc-md4 crypto/gc-md5 crypto/gc-pbkdf2-sha1 crypto/gc-random fcntl 
fdl-1.3 gendocs getaddrinfo getdate getline getpass getsubopt gnupload gpl-3.0 
lib-msvc-compat lib-symbol-versions maintainer-makefile manywarnings minmax 
netinet_in read-file recvfrom select sendto shutdown signal socket sockets 
socklen stat stdint strcase strerror strndup strtok_r strverscmp sys_select 
sys_socket sys_stat sys_time time timegm unistd vasnprintf vasprintf warnings 
xalloc xgetdomainname xgethostname xstrndup xvasprintf
 
 AUTOMAKE_OPTIONS = 1.5 gnits
 
@@ -809,6 +809,15 @@ EXTRA_DIST += w32sock.h
 
 ## end   gnulib module sockets
 
+## begin gnulib module stat
+
+
+EXTRA_DIST += stat.c
+
+EXTRA_libgnu_la_SOURCES += stat.c
+
+## end   gnulib module stat
+
 ## begin gnulib module stdarg
 
 BUILT_SOURCES += $(STDARG_H)
diff --git a/db/gl/m4/dos.m4 b/gl/m4/dos.m4
similarity index 100%
rename from db/gl/m4/dos.m4
rename to gl/m4/dos.m4
diff --git a/gl/m4/gnulib-cache.m4 b/gl/m4/gnulib-cache.m4
index 366ae7e..62b4928 100644
--- a/gl/m4/gnulib-cache.m4
+++ b/gl/m4/gnulib-cache.m4
@@ -15,7 +15,7 @@
 
 
 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu 
--source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests 
--aux-dir=build-aux --avoid=xalloc-die --libtool --macro-prefix=gl 
--no-vc-files arpa_inet autobuild base64 bind close connect crc crypto/arcfour 
crypto/gc-des crypto/gc-hmac-md5 crypto/gc-hmac-sha1 crypto/gc-md4 
crypto/gc-md5 crypto/gc-pbkdf2-sha1 crypto/gc-random fcntl fdl-1.3 gendocs 
getaddrinfo getdate getline getpass getsubopt gnupload gpl-3.0 lib-msvc-compat 
lib-symbol-versions maintainer-makefile manywarnings minmax netinet_in 
read-file recvfrom select sendto shutdown signal socket sockets socklen stdint 
strcase strerror strndup strtok_r strverscmp sys_select sys_socket sys_stat 
sys_time time timegm unistd vasnprintf vasprintf warnings xalloc xgetdomainname 
xgethostname xstrndup xvasprintf
+#   gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu 
--source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests 
--aux-dir=build-aux --avoid=xalloc-die --libtool --macro-prefix=gl 
--no-vc-files arpa_inet autobuild base64 bind close connect crc crypto/arcfour 
crypto/gc-des crypto/gc-hmac-md5 crypto/gc-hmac-sha1 crypto/gc-md4 
crypto/gc-md5 crypto/gc-pbkdf2-sha1 crypto/gc-random fcntl fdl-1.3 gendocs 
getaddrinfo getdate getline getpass getsubopt gnupload gpl-3.0 lib-msvc-compat 
lib-symbol-versions maintainer-makefile manywarnings minmax netinet_in 
read-file recvfrom select sendto shutdown signal socket sockets socklen stat 
stdint strcase strerror strndup strtok_r strverscmp sys_select sys_socket 
sys_stat sys_time time timegm unistd vasnprintf vasprintf warnings xalloc 
xgetdomainname xgethostname xstrndup xvasprintf
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([gl/override])
@@ -60,6 +60,7 @@ gl_MODULES([
   socket
   sockets
   socklen
+  stat
   stdint
   strcase
   strerror
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4
index 047dc49..46df2f8 100644
--- a/gl/m4/gnulib-comp.m4
+++ b/gl/m4/gnulib-comp.m4
@@ -113,6 +113,7 @@ AC_DEFUN([gl_EARLY],
   # Code from module socket:
   # Code from module sockets:
   # Code from module socklen:
+  # Code from module stat:
   # Code from module stdarg:
   dnl Some compilers (e.g., AIX 5.3 cc) need to be in c99 mode
   dnl for the builtin va_copy to work.  With Autoconf 2.60 or later,
@@ -415,6 +416,9 @@ AC_SUBST([LTALLOCA])
   gl_SOCKETS
   # Code from module socklen:
   gl_TYPE_SOCKLEN_T
+  # Code from module stat:
+  gl_FUNC_STAT
+  gl_SYS_STAT_MODULE_INDICATOR([stat])
   # Code from module stdarg:
   gl_STDARG_H
   # Code from module stdbool:
@@ -744,6 +748,7 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/socket.c
   lib/sockets.c
   lib/sockets.h
+  lib/stat.c
   lib/stdarg.in.h
   lib/stdbool.in.h
   lib/stddef.in.h
@@ -803,6 +808,7 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/close.m4
   m4/crc.m4
   m4/des.m4
+  m4/dos.m4
   m4/dup2.m4
   m4/eealloc.m4
   m4/environ.m4
@@ -876,6 +882,7 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/sockets.m4
   m4/socklen.m4
   m4/sockpfaf.m4
+  m4/stat.m4
   m4/stdarg.m4
   m4/stdbool.m4
   m4/stddef_h.m4
diff --git a/db/gl/m4/stat.m4 b/gl/m4/stat.m4
similarity index 100%
rename from db/gl/m4/stat.m4
rename to gl/m4/stat.m4
diff --git a/db/gl/stat.c b/gl/stat.c
similarity index 100%
rename from db/gl/stat.c
rename to gl/stat.c
diff --git a/gl/unistd.in.h b/gl/unistd.in.h
index 22a031e..22fefda 100644
--- a/gl/unistd.in.h
+++ b/gl/unistd.in.h
@@ -15,7 +15,23 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
-#ifndef _GL_UNISTD_H
+/* Special invocation convention:
+   - On mingw, several headers, including <winsock2.h>, include <unistd.h>,
+     but we need to ensure that both the system <unistd.h> and <winsock2.h>
+     are completely included before we replace gethostname.  */
+#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \
+  && !defined _GL_WINSOCK2_H_WITNESS && defined _WINSOCK2_H
+/* <unistd.h> is being indirectly included for the first time from
+   <winsock2.h>; avoid declaring any overrides.  */
+# if @HAVE_UNISTD_H@
+#  @INCLUDE_NEXT@ @NEXT_UNISTD_H@
+# else
+#  error unexpected; report this to address@hidden
+# endif
+# define _GL_WINSOCK2_H_WITNESS
+
+/* Normal invocation.  */
+#elif !defined _GL_UNISTD_H
 
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
@@ -26,7 +42,15 @@
 # @INCLUDE_NEXT@ @NEXT_UNISTD_H@
 #endif
 
-#ifndef _GL_UNISTD_H
+/* Get all possible declarations of gethostname().  */
+#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \
+  && !defined _GL_INCLUDING_WINSOCK2_H
+# define _GL_INCLUDING_WINSOCK2_H
+# include <winsock2.h>
+# undef _GL_INCLUDING_WINSOCK2_H
+#endif
+
+#if !defined _GL_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H
 #define _GL_UNISTD_H
 
 /* NetBSD 5.0 mis-defines NULL.  Also get size_t.  */
@@ -76,7 +100,6 @@
 #if @GNULIB_GETHOSTNAME@
 /* Get all possible declarations of gethostname().  */
 # if @UNISTD_H_HAVE_WINSOCK2_H@
-#  include <winsock2.h>
 #  if !defined _GL_SYS_SOCKET_H
 #   undef socket
 #   define socket               socket_used_without_including_sys_socket_h
diff --git a/lib/cfg.c b/lib/cfg.c
index 2e691e4..ef4afe2 100644
--- a/lib/cfg.c
+++ b/lib/cfg.c
@@ -27,8 +27,6 @@
 
 #include "low-crypto.h"
 
-#define KDC_SERVICE_PORT "\x6b\x65\x72\x62\x65\x72\x6f\x73"
-
 enum
 {
   DEFAULT_REALM_OPTION = 0,
@@ -183,26 +181,34 @@ shishi_cfg (Shishi * handle, const char *option)
          break;
 
        case REALM_KDC_OPTION:
-         realm = xstrdup (value);
-         for (i = 0; i < handle->nrealminfos; i++)
-           if (strcmp (realm, handle->realminfos[i].name) == 0)
+         {
+           int add_realm = 1;
+
+           realm = xstrdup (value);
+           for (i = 0; i < handle->nrealminfos; i++)
+             if (strcmp (realm, handle->realminfos[i].name) == 0)
+               {
+                 if (handle->realminfos[i].nkdcaddresses > 0 ||
+                     handle->realminfos[i].kdcaddresses)
+                   {
+                     free (handle->realminfos[i].kdcaddresses);
+                     handle->realminfos[i].kdcaddresses = NULL;
+                     handle->realminfos[i].nkdcaddresses = 0;
+                     add_realm = 0;
+                   }
+                 break;
+               }
+           if (add_realm)
              {
-               if (handle->realminfos[i].nkdcaddresses > 0 ||
-                   handle->realminfos[i].kdcaddresses)
-                 {
-                   free (handle->realminfos[i].kdcaddresses);
-                   handle->realminfos[i].kdcaddresses = NULL;
-                   handle->realminfos[i].nkdcaddresses = 0;
-                 }
-               break;
+               handle->realminfos = xrealloc (handle->realminfos,
+                                              (handle->nrealminfos + 1) *
+                                              sizeof (*handle->realminfos));
+               memset (&handle->realminfos[handle->nrealminfos], 0,
+                       sizeof (handle->realminfos[handle->nrealminfos]));
+               handle->realminfos[handle->nrealminfos].name = realm;
+               handle->nrealminfos++;
              }
-         handle->realminfos = xrealloc (handle->realminfos,
-                                        (handle->nrealminfos + 1) *
-                                        sizeof (*handle->realminfos));
-         memset (&handle->realminfos[handle->nrealminfos], 0,
-                 sizeof (handle->realminfos[handle->nrealminfos]));
-         handle->realminfos[handle->nrealminfos].name = realm;
-         handle->nrealminfos++;
+         }
          break;
 
        case SERVER_REALM_OPTION:
@@ -270,71 +276,41 @@ shishi_cfg (Shishi * handle, const char *option)
          if (!value)
            break;
          for (i = 0; i < handle->nrealminfos; i++)
-           if (realm && handle->realminfos[i].name == realm)
+           if (realm && strcmp (handle->realminfos[i].name, realm) == 0)
              {
                struct Shishi_realminfo *ri = &handle->realminfos[i];
-               struct sockaddr_in *sinaddr;
-               struct hostent *he;
-               struct servent *se;
                char *protstr;
-               int protocol = UDP;
-               int port = -1;
+               int transport = UDP;
 
                if ((protstr = strchr (value, '/')))
                  {
                    *protstr = '\0';
                    protstr++;
                    if (strcasecmp (protstr, "udp") == 0)
-                     protocol = UDP;
+                     transport = UDP;
                    else if (strcasecmp (protstr, "tcp") == 0)
-                     protocol = TCP;
+                     transport = TCP;
                    else if (strcasecmp (protstr, "tls") == 0)
-                     protocol = TLS;
+                     transport = TLS;
                    else
-                     shishi_warn (handle,
-                                  "Ignoring unknown KDC parameter: %s",
+                     shishi_warn (handle, "Ignoring unknown KDC transport: %s",
                                   protstr);
                  }
 
-               if ((protstr = strchr (value, ':')))
-                 {
-                   *protstr = '\0';
-                   protstr++;
-                   port = atoi (protstr);
-                 }
-
-               he = gethostbyname (value);     /* XXX move to netio.c */
-               if (he == NULL ||
-                   he->h_addr_list[0] == NULL || he->h_addrtype != AF_INET)
-                 {
-                   shishi_warn (handle,
-                                "Unknown KDC host `%s' (h_errno %d)",
-                                value, h_errno);
-                   break;
-                 }
-
                ri->kdcaddresses = xrealloc (ri->kdcaddresses,
                                             (ri->nkdcaddresses + 1) *
                                             sizeof (*ri->kdcaddresses));
-               ri->kdcaddresses[ri->nkdcaddresses].name = xstrdup (value);
-               ri->kdcaddresses[ri->nkdcaddresses].protocol = protocol;
-               sinaddr = (struct sockaddr_in *)
-                 &ri->kdcaddresses[ri->nkdcaddresses].sockaddress;
-               memset (sinaddr, 0, sizeof (struct sockaddr));
-               ri->nkdcaddresses++;
-
-               sinaddr->sin_family = he->h_addrtype;
-               memcpy (&sinaddr->sin_addr, he->h_addr_list[0], he->h_length);
-               if (port == -1)
+               ri->kdcaddresses[ri->nkdcaddresses].transport = transport;
+               ri->kdcaddresses[ri->nkdcaddresses].hostname = xstrdup (value);
+               if ((protstr = strchr (value, ':')))
                  {
-                   se = getservbyname (KDC_SERVICE_PORT, NULL);
-                   if (se)
-                     sinaddr->sin_port = se->s_port;
-                   else
-                     sinaddr->sin_port = htons (88);
+                   *protstr = '\0';
+                   protstr++;
+                   ri->kdcaddresses[ri->nkdcaddresses].port = protstr;
                  }
                else
-                 sinaddr->sin_port = htons (port);
+                 ri->kdcaddresses[ri->nkdcaddresses].port = NULL;
+               ri->nkdcaddresses++;
              }
          if (realm)
            break;
@@ -414,6 +390,19 @@ shishi_cfg_from_file (Shishi * handle, const char *cfg)
   return SHISHI_OK;
 }
 
+const char *
+_shishi_transport2string (int transport)
+{
+  if (transport == UDP)
+    return "UDP";
+  else if (transport == TCP)
+    return "TCP";
+  else if (transport == TLS)
+    return "TLS";
+  else
+    return "UNKNOWN";
+}
+
 /**
  * shishi_cfg_print:
  * @handle: Shishi library handle create by shishi_init().
@@ -438,7 +427,6 @@ shishi_cfg_print (Shishi * handle, FILE * fh)
   for (i = 0; i < handle->nclientkdcetypes; i++)
     fprintf (fh, " %s", shishi_cipher_name (handle->clientkdcetypes[i]));
   fprintf (fh, "\n");
-  fprintf (fh, "\tKDC: %s\n", handle->kdc ? handle->kdc : "(NULL)");
   fprintf (fh, "\tVerbose: %d\n", handle->verbose);
   tmp = now + handle->ticketlife;
   fprintf (fh, "\tTicket life: %d seconds. %s",
@@ -448,12 +436,13 @@ shishi_cfg_print (Shishi * handle, FILE * fh)
           handle->renewlife, ctime (&tmp));
   for (i = 0; i < handle->nrealminfos; i++)
     {
-      fprintf (fh, "\tRealm %s's KDCs:", handle->realminfos[i].name);
+      fprintf (fh, "\tKDCs for realm %s:\n", handle->realminfos[i].name);
       for (j = 0; j < handle->realminfos[i].nkdcaddresses; j++)
-       fprintf (fh, " %s (%s)", handle->realminfos[i].kdcaddresses[j].name,
-                inet_ntoa (((struct sockaddr_in *) &handle->realminfos[i].
-                            kdcaddresses[j].sockaddress)->sin_addr));
-      fprintf (fh, "\n");
+       fprintf (fh, "\t\tTransport %s host %s port %s\n",
+                _shishi_transport2string (handle->realminfos[i].
+                                          kdcaddresses[j].transport),
+                handle->realminfos[i].kdcaddresses[j].hostname,
+                handle->realminfos[i].kdcaddresses[j].port);
     }
 
   return SHISHI_OK;
diff --git a/lib/cfg.h b/lib/cfg.h
index 86fd15f..6e97a67 100644
--- a/lib/cfg.h
+++ b/lib/cfg.h
@@ -1,5 +1,5 @@
 /* cfg.h --- Configuration file prototypes.
- * Copyright (C) 2002, 2003, 2007  Simon Josefsson
+ * Copyright (C) 2002, 2003, 2007, 2010  Simon Josefsson
  *
  * This file is part of Shishi.
  *
@@ -24,3 +24,4 @@ extern struct Shishi_realminfo *_shishi_realminfo (Shishi * 
handle,
                                                   const char *realm);
 extern struct Shishi_realminfo *_shishi_realminfo_new (Shishi * handle,
                                                       char *realm);
+extern const char *_shishi_transport2string (int transport);
diff --git a/lib/error.c b/lib/error.c
index 7248921..b639483 100644
--- a/lib/error.c
+++ b/lib/error.c
@@ -1,5 +1,5 @@
 /* error.c --- Error handling functions.
- * Copyright (C) 2002, 2003, 2004, 2006, 2007, 2008  Simon Josefsson
+ * Copyright (C) 2002, 2003, 2004, 2006, 2007, 2008, 2010  Simon Josefsson
  *
  * This file is part of Shishi.
  *
@@ -55,6 +55,8 @@ static const struct shishi_error_msgs 
_shishi_error_messages[] = {
   {SHISHI_CRYPTO_ERROR,
    N_("Low-level cryptographic primitive failed.  This usually indicates "
       "bad password or data corruption.")},
+  {SHISHI_RECVFROM_ERROR,
+   N_("Error receiving data from server")},
   {SHISHI_KDC_TIMEOUT,
    N_("Timedout talking to KDC. This usually indicates a network "
       "or KDC address problem.")},
@@ -172,7 +174,7 @@ shishi_error_set (Shishi * handle, const char *errstr)
     {
       strncpy (handle->error, errstr, sizeof (handle->error));
 
-      if (VERBOSE (handle))
+      if (VERBOSENOISE (handle))
        puts (handle->error);
     }
   else
diff --git a/lib/internal.h b/lib/internal.h
index a65a2c7..4333ba3 100644
--- a/lib/internal.h
+++ b/lib/internal.h
@@ -115,6 +115,7 @@
                  SHISHI_VERBOSE_CRYPTO_NOISE)
 #define VERBOSE(h) (h->verbose & ~VERBOSES)
 
+/* Transports */
 enum
 {
   UDP,
@@ -124,9 +125,9 @@ enum
 
 struct Shishi_kdcinfo
 {
-  char *name;
-  struct sockaddr sockaddress;
-  int protocol;
+  int transport;
+  char *hostname;
+  char *port;
 };
 
 struct Shishi_realminfo
@@ -155,7 +156,6 @@ struct Shishi
   size_t nauthorizationtypes;
   struct Shishi_realminfo *realminfos;
   size_t nrealminfos;
-  char *kdc;
   char error[1024];
   char gztime_buf[40];
   char *userdirectory;
diff --git a/lib/netio.c b/lib/netio.c
index 86f4b00..58adc8e 100644
--- a/lib/netio.c
+++ b/lib/netio.c
@@ -32,52 +32,45 @@
 #include "cfg.h"
 
 static int
-shishi_sendrecv_udp (Shishi * handle,
-                    struct sockaddr *addr,
-                    const char *indata, int inlen,
-                    char **outdata, size_t * outlen, size_t timeout)
+sendrecv_udp (Shishi * handle,
+             struct addrinfo *ai,
+             const char *indata, int inlen,
+             char **outdata, size_t * outlen)
 {
-  struct sockaddr_in lsa;
   char tmpbuf[BUFSIZ];         /* XXX can we do without it?
                                   MSG_PEEK|MSG_TRUNC doesn't work for udp.. */
   int sockfd;
   int bytes_sent;
-  struct sockaddr_storage from_sa;
-  socklen_t length = sizeof (struct sockaddr_storage);
   fd_set readfds;
   struct timeval tout;
-  int rc;
   ssize_t slen;
+  int rc;
 
-  memset (&lsa, 0, sizeof (lsa));
-  lsa.sin_family = AF_INET;
-  lsa.sin_addr.s_addr = htonl (INADDR_ANY);
-
-  sockfd = socket (AF_INET, SOCK_DGRAM, 0);
+  sockfd = socket (ai->ai_family, ai->ai_socktype, ai->ai_protocol);
   if (sockfd < 0)
     {
       shishi_error_set (handle, strerror (errno));
       return SHISHI_SOCKET_ERROR;
     }
 
-  if (bind (sockfd, (struct sockaddr *) &lsa, sizeof (lsa)) != 0)
+  if (connect (sockfd, ai->ai_addr, ai->ai_addrlen) != 0)
     {
       shishi_error_set (handle, strerror (errno));
       close (sockfd);
       return SHISHI_BIND_ERROR;
     }
 
-  bytes_sent = sendto (sockfd, (const void *) indata, inlen,
-                      0, addr, sizeof (*addr));
+  bytes_sent = write (sockfd, indata, inlen);
   if (bytes_sent != inlen)
     {
       shishi_error_set (handle, strerror (errno));
+      close (sockfd);
       return SHISHI_SENDTO_ERROR;
     }
 
   FD_ZERO (&readfds);
   FD_SET (sockfd, &readfds);
-  tout.tv_sec = timeout;
+  tout.tv_sec = handle->kdctimeout;
   tout.tv_usec = 0;
   if ((rc = select (sockfd + 1, &readfds, NULL, NULL, &tout)) != 1)
     {
@@ -85,22 +78,22 @@ shishi_sendrecv_udp (Shishi * handle,
        shishi_error_set (handle, strerror (errno));
       else
        shishi_error_clear (handle);
+      close (sockfd);
       return SHISHI_KDC_TIMEOUT;
     }
 
   *outlen = sizeof (tmpbuf);
-  slen = recvfrom (sockfd, tmpbuf, *outlen, 0,
-                  (struct sockaddr *) &from_sa, &length);
-
+  slen = read (sockfd, tmpbuf, *outlen);
   if (slen == -1)
     {
       shishi_error_set (handle, strerror (errno));
+      close (sockfd);
       return SHISHI_RECVFROM_ERROR;
     }
 
-  *outdata = xmalloc (*outlen);
+  *outdata = xmalloc (slen);
   *outlen = slen;
-  memcpy (*outdata, tmpbuf, *outlen);
+  memcpy (*outdata, tmpbuf, slen);
 
   if (close (sockfd) != 0)
     {
@@ -112,10 +105,10 @@ shishi_sendrecv_udp (Shishi * handle,
 }
 
 static int
-shishi_sendrecv_tcp (Shishi * handle,
-                    struct sockaddr *addr,
-                    const char *indata, int inlen,
-                    char **outdata, size_t * outlen, size_t timeout)
+sendrecv_tcp (Shishi * handle,
+             struct addrinfo *ai,
+             const char *indata, int inlen,
+             char **outdata, size_t * outlen)
 {
   char tmpbuf[BUFSIZ];         /* XXX can we do without it?
                                   MSG_PEEK|MSG_TRUNC doesn't work for udp.. */
@@ -128,18 +121,18 @@ shishi_sendrecv_tcp (Shishi * handle,
   int rc;
   ssize_t slen;
 
-  sockfd = socket (AF_INET, SOCK_STREAM, 0);
+  sockfd = socket (ai->ai_family, ai->ai_socktype, ai->ai_protocol);
   if (sockfd < 0)
     {
       shishi_error_set (handle, strerror (errno));
       return SHISHI_SOCKET_ERROR;
     }
 
-  if (connect (sockfd, addr, sizeof (*addr)) != 0)
+  if (connect (sockfd, ai->ai_addr, ai->ai_addrlen) != 0)
     {
       shishi_error_set (handle, strerror (errno));
       close (sockfd);
-      return SHISHI_CONNECT_ERROR;
+      return SHISHI_BIND_ERROR;
     }
 
   tmpbuf[3] = inlen & 0xFF;
@@ -148,6 +141,11 @@ shishi_sendrecv_tcp (Shishi * handle,
   tmpbuf[0] = (inlen >> 24) & 0xFF;
 
   bytes_sent = write (sockfd, tmpbuf, 4);
+  if (bytes_sent != 4)
+    {
+      shishi_error_set (handle, strerror (errno));
+      return SHISHI_SENDTO_ERROR;
+    }
 
   bytes_sent = write (sockfd, (const void *) indata, inlen);
   if (bytes_sent != inlen)
@@ -158,7 +156,7 @@ shishi_sendrecv_tcp (Shishi * handle,
 
   FD_ZERO (&readfds);
   FD_SET (sockfd, &readfds);
-  tout.tv_sec = timeout;
+  tout.tv_sec = handle->kdctimeout;
   tout.tv_usec = 0;
   if ((rc = select (sockfd + 1, &readfds, NULL, NULL, &tout)) != 1)
     {
@@ -180,16 +178,16 @@ shishi_sendrecv_tcp (Shishi * handle,
 
   *outlen = sizeof (tmpbuf);
   slen = recvfrom (sockfd, tmpbuf, *outlen, 0,
-                     (struct sockaddr *) &from_sa, &length);
+                  (struct sockaddr *) &from_sa, &length);
   if (slen == -1)
     {
       shishi_error_set (handle, strerror (errno));
       return SHISHI_RECVFROM_ERROR;
     }
 
-  *outdata = xmalloc (*outlen);
+  *outdata = xmalloc (slen);
   *outlen = slen;
-  memcpy (*outdata, tmpbuf, *outlen);
+  memcpy (*outdata, tmpbuf, slen);
 
   if (close (sockfd) != 0)
     {
@@ -201,106 +199,79 @@ shishi_sendrecv_tcp (Shishi * handle,
 }
 
 static int
-shishi_kdc_sendrecv_1 (Shishi * handle, struct Shishi_kdcinfo *ki,
-                      const char *indata, size_t inlen,
-                      char **outdata, size_t * outlen,
-                      Shishi_tkts_hint * hint)
+sendrecv_host (Shishi * handle,
+              int transport, const char *host, const char *port,
+              const char *indata, size_t inlen,
+              char **outdata, size_t * outlen)
 {
-  const char *protname;
+  struct addrinfo hints;
+  struct addrinfo *ai;
   int rc;
 
-  switch (ki->protocol)
-    {
-#ifdef USE_STARTTLS
-    case TLS:
-      protname = "tls";
-      break;
-#endif
-
-    case TCP:
-      protname = "tcp";
-      break;
-
-    default:
-    case UDP:
-      protname = "udp";
-      break;
-    }
+  memset (&hints, 0, sizeof (hints));
+  if (transport == TCP || transport == TLS)
+    hints.ai_socktype = SOCK_STREAM;
+  else
+    hints.ai_socktype = SOCK_DGRAM;
+  hints.ai_flags = AI_ADDRCONFIG;
 
-  shishi_verbose (handle, "Sending to %s (%s) via %s", ki->name,
-                 inet_ntoa (((struct sockaddr_in *)
-                             &ki->sockaddress)->sin_addr),
-                 protname);
+  if (port == NULL)
+    port = "88";
 
-  switch (ki->protocol)
+  rc = getaddrinfo (host, port, &hints, &ai);
+  if (rc != 0)
     {
-#ifdef USE_STARTTLS
-    case TLS:
-      rc = _shishi_sendrecv_tls (handle, &ki->sockaddress,
-                                indata, inlen, outdata, outlen,
-                                handle->kdctimeout, hint);
-      break;
-#endif
-
-    case TCP:
-      rc = shishi_sendrecv_tcp (handle, &ki->sockaddress,
-                               indata, inlen, outdata, outlen,
-                               handle->kdctimeout);
-      break;
-
-    case UDP:
-    default:
-      rc = shishi_sendrecv_udp (handle, &ki->sockaddress,
-                               indata, inlen, outdata, outlen,
-                               handle->kdctimeout);
-      break;
+      shishi_error_printf (handle, "Cannot find host %s", host);
+      return SHISHI_KDC_NOT_KNOWN_FOR_REALM;
     }
 
-  return rc;
-}
+  do
+    {
+      char nodename[NI_MAXHOST];
+      size_t j = 0;
 
-static int
-shishi_kdc_sendrecv_static (Shishi * handle, char *realm,
-                           const char *indata, size_t inlen,
-                           char **outdata, size_t * outlen,
-                           Shishi_tkts_hint * hint)
-{
-  struct Shishi_realminfo *ri;
-  size_t j, k;
-  int rc;
+      rc = getnameinfo (ai->ai_addr, ai->ai_addrlen,
+                       nodename, sizeof (nodename),
+                       NULL, 0, NI_NUMERICHOST);
+      shishi_verbose (handle, "Sending to %s (%s) port %s transport %s",
+                     host, rc == 0 ? nodename : "unknown address", port,
+                     _shishi_transport2string (transport));
 
-  ri = _shishi_realminfo (handle, realm);
-  if (!ri)
-    {
-      shishi_error_printf (handle, "No KDC defined for realm %s", realm);
-      return SHISHI_KDC_NOT_KNOWN_FOR_REALM;
+      do
+       {
+         if (transport == TCP)
+           rc = sendrecv_tcp (handle, ai, indata, inlen, outdata, outlen);
+         else if (transport == TLS)
+           rc = _shishi_sendrecv_tls (handle, ai, indata, inlen,
+                                      outdata, outlen);
+         else
+           rc = sendrecv_udp (handle, ai, indata, inlen, outdata, outlen);
+
+         if (rc != SHISHI_OK)
+           shishi_verbose (handle, "Error sending to KDC: %s",
+                           shishi_strerror (rc));
+       }
+      while (rc == SHISHI_KDC_TIMEOUT && ++j < handle->kdcretries);
     }
+  while (rc != SHISHI_OK && (ai = ai->ai_next));
 
-  for (j = 0; j < handle->kdcretries; j++)
-    for (k = 0; k < ri->nkdcaddresses; k++)
-      {
-       rc = shishi_kdc_sendrecv_1 (handle, &ri->kdcaddresses[k],
-                                   indata, inlen, outdata, outlen, hint);
-       if (rc != SHISHI_KDC_TIMEOUT)
-         return rc;
-      }
-
-  shishi_error_clear (handle);
-  return SHISHI_KDC_TIMEOUT;
+  return rc;
 }
 
 static int
-shishi_kdc_sendrecv_srv_1 (Shishi * handle, char *realm,
-                          const char *indata, size_t inlen,
-                          char **outdata, size_t * outlen, Shishi_dns rrs)
+sendrecv_srv3 (Shishi * handle,
+              int transport,
+              const char *realm,
+              const char *indata, size_t inlen,
+              char **outdata, size_t * outlen,
+              Shishi_dns rrs,
+              bool *found_srv_records)
 {
-  int rc;
+  int rc = SHISHI_KDC_NOT_KNOWN_FOR_REALM;
 
   for (; rrs; rrs = rrs->next)
     {
       Shishi_dns_srv srv = rrs->rr;
-      struct addrinfo hints;
-      struct addrinfo *ai;
       char *port;
 
       if (rrs->class != SHISHI_DNS_IN)
@@ -308,63 +279,50 @@ shishi_kdc_sendrecv_srv_1 (Shishi * handle, char *realm,
       if (rrs->type != SHISHI_DNS_SRV)
        continue;
 
-      shishi_verbose (handle, "Located SRV RRs server %s:%d",
+      shishi_verbose (handle, "Found SRV host %s port %d",
                      srv->name, srv->port);
+      *found_srv_records = true;
 
-      memset (&hints, 0, sizeof (hints));
-      hints.ai_socktype = SOCK_DGRAM;
       port = xasprintf ("%d", srv->port);
-      rc = getaddrinfo (srv->name, port, &hints, &ai);
+      rc = sendrecv_host (handle, transport,
+                         srv->name, port,
+                         indata, inlen,
+                         outdata, outlen);
       free (port);
 
-      if (rc != 0)
-       {
-         shishi_warn (handle, "Unknown KDC host `%s' (gai rc %d)",
-                      srv->name, rc);
-         continue;
-       }
-
-      shishi_verbose (handle, "Sending to %s:%d (%s)",
-                     srv->name, srv->port,
-                     inet_ntoa (((struct sockaddr_in *)
-                                 ai->ai_addr)->sin_addr));
-
-      rc = shishi_sendrecv_udp (handle, ai->ai_addr,
-                               indata, inlen, outdata, outlen,
-                               handle->kdctimeout);
-
-      freeaddrinfo (ai);
-
-      if (rc != SHISHI_KDC_TIMEOUT)
+      if (rc == SHISHI_OK)
        return rc;
     }
 
-  return SHISHI_KDC_TIMEOUT;
+  return rc;
 }
 
 static int
-shishi_kdc_sendrecv_srv (Shishi * handle, char *realm,
-                        const char *indata, size_t inlen,
-                        char **outdata, size_t * outlen)
+sendrecv_srv2 (Shishi * handle,
+              int transport,
+              const char *realm,
+              const char *indata, size_t inlen,
+              char **outdata, size_t * outlen,
+              bool *found_srv_records)
 {
   Shishi_dns rrs;
   char *tmp;
   int rc;
 
-  shishi_verbose (handle, "Finding SRV RRs for %s", realm);
+  if (transport != UDP && transport != TCP)
+    return SHISHI_KDC_NOT_KNOWN_FOR_REALM;
 
-  tmp = xasprintf ("_kerberos._udp.%s", realm);
+  tmp = xasprintf ("_kerberos._%s.%s", transport == UDP ? "udp" : "tcp",
+                  realm);
+  shishi_verbose (handle, "Looking up SRV for %s", tmp);
   rrs = shishi_resolv (tmp, SHISHI_DNS_SRV);
   free (tmp);
 
   if (rrs)
-    rc = shishi_kdc_sendrecv_srv_1 (handle, realm, indata, inlen,
-                                   outdata, outlen, rrs);
+    rc = sendrecv_srv3 (handle, transport, realm, indata, inlen,
+                       outdata, outlen, rrs, found_srv_records);
   else
-    {
-      shishi_error_printf (handle, "No KDC SRV RRs for realm %s", realm);
-      rc = SHISHI_KDC_NOT_KNOWN_FOR_REALM;
-    }
+    rc = SHISHI_KDC_NOT_KNOWN_FOR_REALM;
 
   shishi_resolv_free (rrs);
 
@@ -372,72 +330,116 @@ shishi_kdc_sendrecv_srv (Shishi * handle, char *realm,
 }
 
 static int
-shishi_kdc_sendrecv_direct (Shishi * handle, char *realm,
-                           const char *indata, size_t inlen,
-                           char **outdata, size_t * outlen)
+sendrecv_srv (Shishi * handle, const char *realm,
+             const char *indata, size_t inlen,
+             char **outdata, size_t * outlen,
+             bool *found_srv_records)
 {
-  struct servent *se;
-  struct addrinfo hints;
-  struct addrinfo *ai;
-  char *port;
-  int rc;
-
-  shishi_verbose (handle, "Trying direct realm host mapping for %s", realm);
-
-  se = getservbyname ("kerberos", NULL);
-  if (se)
-    port = xasprintf ("%d", ntohs (se->s_port));
-  else
-    port = xasprintf ("%d", 88);
+  int rc = sendrecv_srv2 (handle, UDP, realm, indata, inlen,
+                         outdata, outlen, found_srv_records);
+  if (rc == SHISHI_OK)
+    return rc;
+  return sendrecv_srv2 (handle, TCP, realm, indata, inlen,
+                       outdata, outlen, found_srv_records);
+}
 
-  memset (&hints, 0, sizeof (hints));
-  hints.ai_socktype = SOCK_DGRAM;
-  rc = getaddrinfo (realm, port, &hints, &ai);
+static int
+sendrecv_static (Shishi * handle, const char *realm,
+                const char *indata, size_t inlen,
+                char **outdata, size_t * outlen)
+{
+  struct Shishi_realminfo *ri;
+  size_t k;
+  int rc;
 
-  if (rc != 0)
+  ri = _shishi_realminfo (handle, realm);
+  if (!ri || ri->nkdcaddresses == 0)
     {
-      shishi_error_printf (handle, "No direct realm host for realm %s",
-                          realm);
-      free (port);
+      shishi_error_printf (handle, "No KDC configured for %s", realm);
       return SHISHI_KDC_NOT_KNOWN_FOR_REALM;
     }
 
-  shishi_verbose (handle, "Sending to %s:%s (%s)", realm, port,
-                 inet_ntoa (((struct sockaddr_in *) ai->ai_addr)->sin_addr));
-
-  free (port);
-
-  rc = shishi_sendrecv_udp (handle, ai->ai_addr,
-                           indata, inlen, outdata, outlen,
-                           handle->kdctimeout);
-
-  freeaddrinfo (ai);
+  rc = SHISHI_KDC_NOT_KNOWN_FOR_REALM;
+  for (k = 0; k < ri->nkdcaddresses; k++)
+    {
+      rc = sendrecv_host (handle,
+                         ri->kdcaddresses[k].transport,
+                         ri->kdcaddresses[k].hostname,
+                         ri->kdcaddresses[k].port,
+                         indata, inlen, outdata, outlen);
+      if (rc == SHISHI_OK)
+       return rc;
+    }
 
   return rc;
 }
 
+/**
+ * shishi_kdc_sendrecv_hint:
+ * @handle: Shishi library handle create by shishi_init().
+ * @realm: string with realm name.
+ * @indata: Packet to send to KDC.
+ * @inlen: Length of @indata.
+ * @outdata: Newly allocated string with data returned from KDC.
+ * @outlen: Length of @outdata.
+ * @hint: a #Shishi_tkts_hint structure with flags.
+ *
+ * Send packet to KDC for realm and receive response.  The code finds
+ * KDC addresses from configuration file, then by querying for SRV
+ * records for the realm, and finally by using the realm name as a
+ * hostname.
+ *
+ * Returns: %SHISHI_OK on success, %SHISHI_KDC_TIMEOUT if a timeout
+ *   was reached, or other errors.
+ **/
 int
-shishi_kdc_sendrecv_hint (Shishi * handle, char *realm,
+shishi_kdc_sendrecv_hint (Shishi * handle, const char *realm,
                          const char *indata, size_t inlen,
                          char **outdata, size_t * outlen,
                          Shishi_tkts_hint * hint)
 {
+  struct Shishi_realminfo *ri;
+  bool found_srv_records = false;
   int rc;
 
-  rc = shishi_kdc_sendrecv_static (handle, realm, indata, inlen,
-                                  outdata, outlen, hint);
-  if (rc == SHISHI_KDC_TIMEOUT || rc == SHISHI_KDC_NOT_KNOWN_FOR_REALM)
-    rc = shishi_kdc_sendrecv_srv (handle, realm,
-                                 indata, inlen, outdata, outlen);
-  if (rc == SHISHI_KDC_TIMEOUT || rc == SHISHI_KDC_NOT_KNOWN_FOR_REALM)
-    rc = shishi_kdc_sendrecv_direct (handle, realm,
-                                    indata, inlen, outdata, outlen);
+  ri = _shishi_realminfo (handle, realm);
+  if (ri && ri->nkdcaddresses > 0)
+    /* If we have configured KDCs, never use DNS or direct method. */
+    return sendrecv_static (handle, realm, indata, inlen,
+                           outdata, outlen);
+
+  rc = sendrecv_srv (handle, realm, indata, inlen, outdata, outlen,
+                    &found_srv_records);
+  if (rc != SHISHI_OK && !found_srv_records)
+    {
+      shishi_verbose (handle, "No SRV RRs, trying realm host mapping for %s",
+                     realm);
+      rc = sendrecv_host (handle, UDP, realm, NULL,
+                         indata, inlen, outdata, outlen);
+    }
 
   return rc;
 }
 
+/**
+ * shishi_kdc_sendrecv:
+ * @handle: Shishi library handle create by shishi_init().
+ * @realm: string with realm name.
+ * @indata: Packet to send to KDC.
+ * @inlen: Length of @indata.
+ * @outdata: Newly allocated string with data returned from KDC.
+ * @outlen: Length of @outdata.
+ *
+ * Send packet to KDC for realm and receive response.  The code finds
+ * KDC addresses from configuration file, then by querying for SRV
+ * records for the realm, and finally by using the realm name as a
+ * hostname.
+ *
+ * Returns: %SHISHI_OK on success, %SHISHI_KDC_TIMEOUT if a timeout
+ *   was reached, or other errors.
+ **/
 int
-shishi_kdc_sendrecv (Shishi * handle, char *realm,
+shishi_kdc_sendrecv (Shishi * handle, const char *realm,
                     const char *indata, size_t inlen,
                     char **outdata, size_t * outlen)
 {
diff --git a/lib/shishi.h b/lib/shishi.h
index cfe4abb..f49c5dc 100644
--- a/lib/shishi.h
+++ b/lib/shishi.h
@@ -2086,10 +2086,10 @@ extern int shishi_aprep_get_enc_part_etype (Shishi * 
handle,
                                            int32_t * etype);
 
 /* netio.c */
-extern int shishi_kdc_sendrecv (Shishi * handle, char *realm,
+extern int shishi_kdc_sendrecv (Shishi * handle, const char *realm,
                                const char *indata, size_t inlen,
                                char **outdata, size_t * outlen);
-extern int shishi_kdc_sendrecv_hint (Shishi * handle, char *realm,
+extern int shishi_kdc_sendrecv_hint (Shishi * handle, const char *realm,
                                     const char *indata, size_t inlen,
                                     char **outdata, size_t * outlen,
                                     Shishi_tkts_hint * hint);
diff --git a/lib/starttls.c b/lib/starttls.c
index 78ef611..75a1c98 100644
--- a/lib/starttls.c
+++ b/lib/starttls.c
@@ -1,5 +1,5 @@
 /* starttls.c --- Network I/O functions for Shishi over TLS.
- * Copyright (C) 2002, 2003, 2004, 2006, 2007, 2008  Simon Josefsson
+ * Copyright (C) 2002, 2003, 2004, 2006, 2007, 2008, 2010  Simon Josefsson
  *
  * This file is part of Shishi.
  *
@@ -224,10 +224,9 @@ _shishi_sendrecv_tls1 (Shishi * handle,
 /* Send request to KDC over TLS, receive reply, and disconnect. */
 int
 _shishi_sendrecv_tls (Shishi * handle,
-                     struct sockaddr *addr,
+                     struct addrinfo *ai,
                      const char *indata, size_t inlen,
-                     char **outdata, size_t * outlen,
-                     size_t timeout, Shishi_tkts_hint * hint)
+                     char **outdata, size_t * outlen)
 {
   const int kx_prio[] = { GNUTLS_KX_RSA, GNUTLS_KX_DHE_DSS,
     GNUTLS_KX_DHE_RSA, GNUTLS_KX_ANON_DH, 0
@@ -241,6 +240,20 @@ _shishi_sendrecv_tls (Shishi * handle,
   const char *certfile = shishi_x509cert_default_file (handle);
   const char *keyfile = shishi_x509key_default_file (handle);
 
+  sockfd = socket (ai->ai_family, ai->ai_socktype, ai->ai_protocol);
+  if (sockfd < 0)
+    {
+      shishi_error_set (handle, strerror (errno));
+      return SHISHI_SOCKET_ERROR;
+    }
+
+  if (connect (sockfd, ai->ai_addr, ai->ai_addrlen) != 0)
+    {
+      shishi_error_set (handle, strerror (errno));
+      close (sockfd);
+      return SHISHI_BIND_ERROR;
+    }
+
   ret = gnutls_init (&session, GNUTLS_CLIENT);
   if (ret != GNUTLS_E_SUCCESS)
     {
@@ -319,23 +332,9 @@ _shishi_sendrecv_tls (Shishi * handle,
       return SHISHI_CRYPTO_ERROR;
     }
 
-  sockfd = socket (AF_INET, SOCK_STREAM, 0);
-  if (sockfd < 0)
-    {
-      shishi_error_set (handle, strerror (errno));
-      return SHISHI_SOCKET_ERROR;
-    }
-
-  if (connect (sockfd, addr, sizeof (*addr)) != 0)
-    {
-      shishi_error_set (handle, strerror (errno));
-      close (sockfd);
-      return SHISHI_CONNECT_ERROR;
-    }
-
   /* Core part. */
   outerr = _shishi_sendrecv_tls1 (handle, sockfd, session, indata, inlen,
-                                 outdata, outlen, timeout);
+                                 outdata, outlen, handle->kdctimeout);
 
   ret = shutdown (sockfd, SHUT_RDWR);
   if (ret != 0)
diff --git a/lib/starttls.h b/lib/starttls.h
index 54f9f94..b1e22cd 100644
--- a/lib/starttls.h
+++ b/lib/starttls.h
@@ -1,5 +1,5 @@
 /* starttls.h --- Network I/O functions for Shishi over TLS.
- * Copyright (C) 2002, 2003, 2004, 2007  Simon Josefsson
+ * Copyright (C) 2002, 2003, 2004, 2007, 2010  Simon Josefsson
  *
  * This file is part of Shishi.
  *
@@ -23,7 +23,6 @@
 extern int _shishi_tls_init (Shishi * handle);
 extern int _shishi_tls_done (Shishi * handle);
 extern int _shishi_sendrecv_tls (Shishi * handle,
-                                struct sockaddr *addr,
+                                struct addrinfo *ai,
                                 const char *indata, size_t inlen,
-                                char **outdata, size_t *outlen,
-                                size_t timeout, Shishi_tkts_hint * hint);
+                                char **outdata, size_t *outlen);
diff --git a/shishi.conf.in b/shishi.conf.in
index da109a7..6351d21 100644
--- a/shishi.conf.in
+++ b/shishi.conf.in
@@ -57,14 +57,15 @@
 #verbose-crypto-noise
 
 # Specify KDC addresses for realms.
-# Value is REALM,KDCADDRESS[/PROTOCOL][,KDCADDRESS[/PROTOCOL]...]
+# Value is REALM,KDCADDRESS[/TRANSPORT][,KDCADDRESS[/TRANSPORT]...]
 # KDCADDRESS is the hostname or IP address of KDC.
-# Optional PROTOCOL is "udp" for UDP, "tcp" for TCP, and "tls" for TLS
+# Optional TRANSPORT is "udp" for UDP, "tcp" for TCP, and "tls" for TLS
 # connections.  By default UDP is tried first, and TCP used as a
 # fallback if the KRB_ERR_RESPONSE_TOO_BIG error is received.  If not
 # specified, Shishi tries to locate the KDC using SRV RRs, which is
 # recommended.  This option should normally only be used during
-# experiments, or to access badly maintained realms.
+# experiments, to access badly maintained realms, or to make sure
+# you are not vulnerable to DNS redirection attacks.
 #realm-kdc=JOSEFSSON.ORG,ristretto.josefsson.org
 
 # Specify realm for servers.
diff --git a/shishi.skel.in b/shishi.skel.in
index 67c05e0..3e13678 100644
--- a/shishi.skel.in
+++ b/shishi.skel.in
@@ -59,14 +59,15 @@
 #verbose-crypto-noise
 
 # Specify KDC addresses for realms.
-# Value is REALM,KDCADDRESS[/PROTOCOL][,KDCADDRESS[/PROTOCOL]...]
+# Value is REALM,KDCADDRESS[/TRANSPORT][,KDCADDRESS[/TRANSPORT]...]
 # KDCADDRESS is the hostname or IP address of KDC.
-# Optional PROTOCOL is "udp" for UDP, "tcp" for TCP, and "tls" for TLS
+# Optional TRANSPORT is "udp" for UDP, "tcp" for TCP, and "tls" for TLS
 # connections.  By default UDP is tried first, and TCP used as a
 # fallback if the KRB_ERR_RESPONSE_TOO_BIG error is received.  If not
 # specified, Shishi tries to locate the KDC using SRV RRs, which is
 # recommended.  This option should normally only be used during
-# experiments, or to access badly maintained realms.
+# experiments, to access badly maintained realms, or to make sure
+# you are not vulnerable to DNS redirection attacks.
 #realm-kdc=JOSEFSSON.ORG,ristretto.josefsson.org
 
 # Specify realm for servers.
diff --git a/src/kdc.h b/src/kdc.h
index 2d596f0..00685e0 100644
--- a/src/kdc.h
+++ b/src/kdc.h
@@ -1,5 +1,5 @@
 /* kdc.h --- Header file with common definitions for Shishid.
- * Copyright (C) 2002, 2003, 2004, 2006, 2007, 2008  Simon Josefsson
+ * Copyright (C) 2002, 2003, 2004, 2006, 2007, 2008, 2010  Simon Josefsson
  *
  * This file is part of Shishi.
  *
@@ -107,11 +107,11 @@ struct listenspec
   char *str;
   int family;
   int listening;
-  struct sockaddr listenaddr;
-  struct sockaddr addr;
-  socklen_t addrlen;
-  struct sockaddr_in *sin;
-  int port;
+  struct addrinfo *ai;
+  char addrname[NI_MAXHOST];
+  struct sockaddr_storage udpclientaddr;
+  socklen_t udpclientaddrlen;
+  char clientaddrname[NI_MAXHOST];
   int type;
   int sockfd;
   char buf[BUFSIZ];            /* XXX */
diff --git a/src/server.c b/src/server.c
index 7b5fa7a..07b82e7 100644
--- a/src/server.c
+++ b/src/server.c
@@ -30,6 +30,9 @@ static void
 kdc_accept (struct listenspec *ls)
 {
   struct listenspec *newls;
+  struct sockaddr addr;
+  socklen_t addrlen;
+  int rc;
 
   newls = xzalloc (sizeof (*newls));
   newls->next = ls->next;
@@ -37,11 +40,15 @@ kdc_accept (struct listenspec *ls)
 
   newls->bufpos = 0;
   newls->type = ls->type;
-  newls->addrlen = sizeof (newls->addr);
-  newls->sockfd = accept (ls->sockfd, &newls->addr, &newls->addrlen);
-  newls->sin = (struct sockaddr_in *) &newls->addr;
-  asprintf (&newls->str, "%s peer %s", ls->str,
-           inet_ntoa (newls->sin->sin_addr));
+  addrlen = sizeof (addr);
+  newls->sockfd = accept (ls->sockfd, &addr, &addrlen);
+
+  rc = getnameinfo (&addr, addrlen,
+                   newls->addrname, sizeof (newls->addrname),
+                   NULL, 0, NI_NUMERICHOST);
+  if (rc != 0)
+    strcpy (newls->addrname, "unknown address");
+  asprintf (&newls->str, "%s (%s)", newls->addrname, ls->str);
 
   syslog (LOG_DEBUG, "Accepted socket %d from socket %d as %s",
          newls->sockfd, ls->sockfd, newls->str);
@@ -105,8 +112,12 @@ kdc_send1 (struct listenspec *ls)
       sent_bytes = gnutls_record_send (ls->session, ls->buf, ls->bufpos);
     else
 #endif
-      sent_bytes = sendto (ls->sockfd, ls->buf, ls->bufpos,
-                          0, &ls->addr, ls->addrlen);
+      if (ls->type == SOCK_DGRAM)
+       sent_bytes = sendto (ls->sockfd, ls->buf, ls->bufpos, 0,
+                            (struct sockaddr *) &ls->udpclientaddr,
+                            ls->udpclientaddrlen);
+      else
+       sent_bytes = send (ls->sockfd, ls->buf, ls->bufpos, 0);
   while (sent_bytes == -1 && errno == EAGAIN);
 
   if (sent_bytes < 0)
@@ -127,7 +138,7 @@ kdc_send (struct listenspec *ls)
 {
   if (ls->type == SOCK_DGRAM)
     syslog (LOG_DEBUG, "Sending %d bytes to %s socket %d via UDP",
-           ls->bufpos, ls->str, ls->sockfd);
+           ls->bufpos, ls->addrname, ls->sockfd);
   else
     {
       syslog (LOG_DEBUG, "Sending %d bytes to %s socket %d via %s",
@@ -164,7 +175,6 @@ kdc_read (struct listenspec *ls)
 {
   ssize_t read_bytes;
 
-  ls->addrlen = sizeof (ls->addr);
 #ifdef USE_STARTTLS
   if (ls->usetls)
     read_bytes = gnutls_record_recv (ls->session,
@@ -172,9 +182,18 @@ kdc_read (struct listenspec *ls)
                                     sizeof (ls->buf) - ls->bufpos);
   else
 #endif
-    read_bytes = recvfrom (ls->sockfd, ls->buf + ls->bufpos,
-                          sizeof (ls->buf) - ls->bufpos, 0,
-                          &ls->addr, &ls->addrlen);
+    if (ls->type == SOCK_DGRAM)
+      {
+       ls->udpclientaddrlen = sizeof (ls->udpclientaddr);
+       read_bytes = recvfrom (ls->sockfd, ls->buf + ls->bufpos,
+                              sizeof (ls->buf) - ls->bufpos, 0,
+                              (struct sockaddr *) &ls->udpclientaddr,
+                              &ls->udpclientaddrlen);
+      }
+    else
+      read_bytes = recv (ls->sockfd, ls->buf + ls->bufpos,
+                        sizeof (ls->buf) - ls->bufpos, 0);
+
   if (read_bytes < 0)
     {
 #ifdef USE_STARTTLS
@@ -198,8 +217,21 @@ kdc_read (struct listenspec *ls)
 
   ls->bufpos += read_bytes;
 
-  syslog (LOG_DEBUG, "Has %d bytes from %s on socket %d\n",
-         ls->bufpos, ls->str, ls->sockfd);
+  if (ls->type == SOCK_DGRAM)
+    {
+      int rc = getnameinfo ((struct sockaddr *) &ls->udpclientaddr,
+                           ls->udpclientaddrlen,
+                           ls->addrname, sizeof (ls->addrname),
+                           NULL, 0, NI_NUMERICHOST);
+      if (rc != 0)
+       strcpy (ls->addrname, "unknown address");
+
+      syslog (LOG_DEBUG, "Read %d bytes from %s on socket %d\n",
+             ls->bufpos, ls->addrname, ls->sockfd);
+    }
+  else
+    syslog (LOG_DEBUG, "Read %d bytes from %s on socket %d\n",
+           ls->bufpos, ls->str, ls->sockfd);
 
   return 0;
 }
@@ -215,7 +247,6 @@ kdc_ready (struct listenspec *ls)
 {
   size_t waitfor = ls->bufpos >= 4 ? C2I (ls->buf) : 4;
 
-
   if (ls->type == SOCK_DGRAM && ls->bufpos > 0)
     return 1;
   else if (ls->bufpos > 4 && waitfor + 4 == ls->bufpos)
@@ -235,8 +266,8 @@ kdc_process (struct listenspec *ls)
   char *p;
   ssize_t plen;
 
-  syslog (LOG_DEBUG, "Processing %d from %s on socket %d",
-         ls->bufpos, ls->str, ls->sockfd);
+  syslog (LOG_DEBUG, "Processing %d bytes on socket %d",
+         ls->bufpos, ls->sockfd);
 
   if (ls->type == SOCK_DGRAM)
     plen = process (ls->buf, ls->bufpos, &p);
@@ -245,8 +276,7 @@ kdc_process (struct listenspec *ls)
 
   if (plen <= 0)
     {
-      syslog (LOG_ERR, "Processing request failed for %s on socket %d (%d)",
-             ls->str, ls->sockfd, plen);
+      syslog (LOG_ERR, "Processing request failed on socket %d", ls->sockfd);
       memcpy (ls->buf, fatal_krberror, fatal_krberror_len);
       ls->bufpos = fatal_krberror_len;
     }
@@ -257,8 +287,8 @@ kdc_process (struct listenspec *ls)
       free (p);
     }
 
-  syslog (LOG_DEBUG, "Have %d bytes for %s on socket %d",
-         ls->bufpos, ls->str, ls->sockfd);
+  syslog (LOG_DEBUG, "Generated %d bytes response for socket %d",
+         ls->bufpos, ls->sockfd);
 }
 
 int quit = 0;
@@ -303,8 +333,8 @@ kdc_loop (void)
                {
                  maxfd = MAX (maxfd, ls->sockfd + 1);
                  if (!arg.quiet_flag)
-                   syslog (LOG_DEBUG, "Listening on %s socket %d\n",
-                           ls->str, ls->sockfd);
+                   syslog (LOG_DEBUG, "Listening on %s (%s) socket %d\n",
+                           ls->str, ls->addrname, ls->sockfd);
                  FD_SET (ls->sockfd, &readfds);
                }
            }
diff --git a/src/shishid.c b/src/shishid.c
index c7f111b..3076659 100644
--- a/src/shishid.c
+++ b/src/shishid.c
@@ -51,15 +51,41 @@ kdc_listen (void)
 
   for (ls = listenspec; ls; ls = ls->next)
     {
-      if (!arg.quiet_flag)
-       printf ("Listening on %s...\n", ls->str);
+      struct addrinfo *rp;
+
+      for (rp = ls->ai; rp != NULL; rp = rp->ai_next)
+       {
+         ls->sockfd = socket (ls->family, rp->ai_socktype, rp->ai_protocol);
+         if (ls->sockfd == -1)
+           {
+             error (0, errno, "Cannot listen on %s because socket failed",
+                    ls->str);
+             continue;
+           }
+
+         if (bind (ls->sockfd, rp->ai_addr, rp->ai_addrlen) != 0)
+           {
+             error (0, errno, "Cannot listen on %s because bind failed",
+                    ls->str);
+             close (ls->sockfd);
+             ls->sockfd = -1;
+             continue;
+           }
+
+         break; /* Success */
+       }
 
-      ls->sockfd = socket (ls->family, ls->type, 0);
       if (ls->sockfd < 0)
+       goto error;
+
+      if (!arg.quiet_flag)
        {
-         error (0, errno, "Cannot listen on %s because socket failed",
-                ls->str);
-         goto error;
+         int rc = getnameinfo (rp->ai_addr, rp->ai_addrlen,
+                               ls->addrname, sizeof (ls->addrname),
+                               NULL, 0, NI_NUMERICHOST);
+         if (rc != 0)
+           strcpy (ls->addrname, "unknown address");
+         printf ("Listening on %s (%s)...\n", ls->str, ls->addrname);
        }
 
       yes = 1;
@@ -71,13 +97,6 @@ kdc_listen (void)
          goto errorclose;
        }
 
-      if (bind (ls->sockfd, &ls->listenaddr, sizeof (ls->listenaddr)) != 0)
-       {
-         error (0, errno, "Cannot listen on %s because bind failed",
-                ls->str);
-         goto errorclose;
-       }
-
       if (ls->type == SOCK_STREAM && listen (ls->sockfd, SOMAXCONN) != 0)
        {
          error (0, errno, "Cannot listen on %s because listen failed",
@@ -370,13 +389,7 @@ parse_listen (char *listenstr)
                               ", \t", &ptrptr)); i++)
     {
       char *service, *proto;
-      struct servent *se;
-      struct hostent *he;
       struct listenspec *ls;
-      struct sockaddr_in *sockin;
-#ifdef WITH_IPV6
-      struct sockaddr_in6 *sockin6;
-#endif
 
       ls = xzalloc (sizeof (*ls));
       ls->next = listenspec;
@@ -385,10 +398,6 @@ parse_listen (char *listenstr)
       ls->str = strdup (val);
       ls->bufpos = 0;
       ls->listening = 1;
-      sockin = (struct sockaddr_in *) &ls->listenaddr;
-#ifdef WITH_IPV6
-      sockin6 = (struct sockaddr_in6 *) &ls->listenaddr;
-#endif
 
       proto = strrchr (val, '/');
       if (proto == NULL)
@@ -409,24 +418,6 @@ parse_listen (char *listenstr)
       *service = '\0';
       service++;
 
-      se = getservbyname (service, proto);
-      if (se)
-       ls->port = ntohs (se->s_port);
-      else if (strcmp (service, "kerberos") == 0)
-       ls->port = 88;
-      else if (atoi (service) != 0)
-       ls->port = atoi (service);
-      else
-       error (EXIT_FAILURE, 0, "Unknown service `%s' in listen spec: `%s'",
-              service, ls->str);
-
-#ifdef WITH_IPV6
-      if (ls->family == AF_INET6)
-       sockin6->sin6_port = htons (ls->port);
-      else
-#endif
-       sockin->sin_port = htons (ls->port);
-
       if (strncmp (val, FAMILY_IPV4 ":", strlen (FAMILY_IPV4 ":")) == 0)
        {
          ls->family = AF_INET;
@@ -444,35 +435,33 @@ parse_listen (char *listenstr)
 
       if (strcmp (val, "*") == 0)
        {
-#ifdef WITH_IPV6
-         if (ls->family == AF_INET6)
-           sockin6->sin6_addr = in6addr_any;
-         else
-#endif
-           sockin->sin_addr.s_addr = htonl (INADDR_ANY);
+         struct addrinfo hints;
+         int rc;
+
+         memset (&hints, 0, sizeof (hints));
+         hints.ai_family = ls->family;
+         hints.ai_socktype = ls->type;
+         hints.ai_flags = AI_PASSIVE;
+         rc = getaddrinfo (NULL, "kerberos", &hints, &ls->ai);
+         if (rc != 0)
+           error (EXIT_FAILURE, errno, "Cannot get listen socket for %s",
+                  ls->str);
        }
-      else if ((he = gethostbyname (val)))
+      else
        {
-         if (he->h_addrtype == AF_INET)
-           {
-             sockin->sin_family = AF_INET;
-             memcpy (&sockin->sin_addr, he->h_addr_list[0], he->h_length);
-           }
-#ifdef WITH_IPV6
-         else if (he->h_addrtype == AF_INET6)
-           {
-             sockin6->sin6_family = AF_INET6;
-             memcpy (&sockin6->sin6_addr, he->h_addr_list[0], he->h_length);
-           }
-#endif
-         else
-           error (EXIT_FAILURE, 0, "Unknown protocol family (%d) returned "
-                  "by gethostbyname(\"%s\"): `%s'", he->h_addrtype,
+         struct addrinfo hints;
+         int rc;
+
+         memset (&hints, 0, sizeof (hints));
+         hints.ai_family = ls->family;
+         hints.ai_socktype = ls->type;
+         hints.ai_flags = AI_PASSIVE;
+         rc = getaddrinfo (val, "kerberos", &hints, &ls->ai);
+         if (rc != 0)
+           error (EXIT_FAILURE, errno,
+                  "Cannot get host %s listen socket for %s",
                   val, ls->str);
        }
-      else
-       error (EXIT_FAILURE, 0, "Unknown host `%s' in listen spec: `%s'",
-              val, ls->str);
     }
 }
 


hooks/post-receive
-- 
GNU shishi




reply via email to

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