Import Upstream version 0.69.0 upstream upstream/0.69.0
authorClinton Ebadi <clinton@unknownlamer.org>
Sun, 16 Feb 2020 03:12:26 +0000 (22:12 -0500)
committerClinton Ebadi <clinton@unknownlamer.org>
Sun, 16 Feb 2020 03:12:26 +0000 (22:12 -0500)
106 files changed:
ChangeLog
Makefile.am
Makefile.in
README_authlib.html.in
aclocal.m4
auth.h
auth_enumerate.3
auth_generic.3
auth_getoption.3
auth_getuserinfo.3
auth_login.3
auth_mkhomedir.3
auth_passwd.3
auth_sasl.3
authconfigfile.cpp [new file with mode: 0644]
authconfigfile.h [new file with mode: 0644]
authcustom.c
authdaemond.c
authdaemondcpp.cpp [new file with mode: 0644]
authdaemonrc.in
authgetconfig.c [deleted file]
authldap.c
authldap.h
authldaplib.c [deleted file]
authldaplib.cpp [new file with mode: 0644]
authldaprc
authlib.3.in
authmysql.cpp [moved from authmysql.c with 60% similarity]
authmysql.h
authmysqllib.c [deleted file]
authmysqllib.cpp [new file with mode: 0644]
authmysqlrc
authpasswd.1
authpgsql.c
authpgsql.h
authpgsqllib.c [deleted file]
authpgsqllib.cpp [new file with mode: 0644]
authpgsqlrc
authsasl.c
authsaslclient.h
authsqlite.cpp [moved from authsqlite.c with 56% similarity]
authsqlite.h
authsqlitelib.c [deleted file]
authsqlitelib.cpp [new file with mode: 0644]
authsqliterc
authtest.1
authuserdb.c
authuserdbpwd.c
checkpassword.c
compile
config.guess
config.sub
configure
configure.ac
courier-authlib.lpspec
courier-authlib.spec
courier-authlib.spec.in
courier_auth_config.h
courier_auth_config.h.in
courierauth.h
cramlib.c
cramlib.h [deleted file]
cryptpassword.c
depcomp
liblog/Makefile.in
liblog/aclocal.m4
libs/bdbobj/Makefile.in
libs/bdbobj/aclocal.m4
libs/gdbmobj/Makefile.in
libs/gdbmobj/aclocal.m4
libs/libhmac/Makefile.in
libs/libhmac/aclocal.m4
libs/liblock/Makefile.am
libs/liblock/Makefile.in
libs/liblock/aclocal.m4
libs/liblock/lockmail.1
libs/makedat/Makefile.in
libs/makedat/aclocal.m4
libs/makedat/makedat.in
libs/md5/Makefile.in
libs/md5/aclocal.m4
libs/numlib/Makefile.in
libs/numlib/aclocal.m4
libs/random128/Makefile.in
libs/random128/aclocal.m4
libs/rfc822/Makefile.am
libs/rfc822/Makefile.in
libs/rfc822/aclocal.m4
libs/rfc822/configure
libs/rfc822/configure.ac
libs/rfc822/rfc2047.c
libs/rfc822/rfc2047u.c
libs/sha1/Makefile.in
libs/sha1/aclocal.m4
ltmain.sh
missing
preauthmysql.c [deleted file]
preauthmysql.cpp [new file with mode: 0644]
preauthpgsql.c [deleted file]
preauthsqlite.c [deleted file]
userdb/Makefile.in
userdb/aclocal.m4
userdb/makeuserdb.8.in
userdb/userdb.8.in
userdb/userdbpw.8.in
userdb/userdbpw.c

index 85a02a6..4d32c65 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,68 @@
+0.69.0
+
+2018-08-16  Sam Varshavchik  <mrsam@courier-mta.com>
+
+       * authdaemond.c: set FD_CLOEXEC on socket file descriptors, to avoid
+       leaks to child processes.
+
+2018-05-25  Sam Varshavchik  <mrsam@courier-mta.com>
+
+       * authldaplib.cpp: improve automatic reconnection logic to the LDAP
+       server.
+
+2017-11-27  Sam Varshavchik  <mrsam@courier-mta.com>
+
+       * rpm packaging fixes.
+
+2017-09-08  Sam Varshavchik  <mrsam@courier-mta.com>
+
+       * courier-authlib.spec.in: Fix several problems with the package
+       scripts. Remove 'authdaemond stop' from %preun. Add explicit
+       systemctl daemon-reload to %post and %postun
+
+2017-07-23  Sam Varshavchik  <mrsam@courier-mta.com>
+
+       * authsaslclient.h (SASL_LIST): Reorder SASL methods, strongest
+       first.
+
+0.68.0
+
+2017-03-16  Sam Varshavchik  <mrsam@courier-mta.com>
+
+       * configure.ac: Rebuild against updated courier-unicode API.
+
+0.67.0
+
+2017-01-27  Sam Varshavchik  <mrsam@courier-mta.com>
+
+       * courierauth.h: Move declarations from cramlib.h into courierauth.h,
+       exporting them as part of the public API.
+
+2016-09-04  Giovanni Bechis <giovanni@paclan.it>
+
+       * userdb/userdbpw.c (main): Use bcrypt_gensalt() on OpenBSD
+
+2016-05-07  Sam Varshavchik  <mrsam@courier-mta.com>
+
+       * authsqlite, authmysql, authpgsql: Rewrite these modules in
+       modern C++. Autodetect and automatically reload the configuration
+       file when it's changed, no server restart is needed.
+
+2016-03-20  Giovanni Bechis <giovanni@openbsd.org>
+
+       * checkpassword.c (do_authcheckpassword): Check for a null return
+       value from crypt().
+
+2016-01-17  Sam Varshavchik  <mrsam@courier-mta.com>
+
+       * authldaplib.cpp (operator): Fix compilation warning.
+
+2016-01-04  Sam Varshavchik  <mrsam@courier-mta.com>
+
+       * authldaplib.cpp: Rewrite authldap in modern C++. Autodetect
+       and automatically reload authldaprc when it is changed. No server
+       restart is required.
+
 0.66.4
 
 2015-11-14 "Hanno Böck" <hanno@hboeck.de>
index 7f4c09b..4e11ae8 100644 (file)
@@ -17,8 +17,8 @@ pkglibexecdir=$(libexecdir)/courier-authlib
 pkglibexec_SCRIPTS=authsystem.passwd
 
 pkglib_LTLIBRARIES=libcourierauth.la \
-       libcourierauthsasl.la libcourierauthsaslclient.la \
-       libcourierauthcommon.la $(modules)
+       libcourierauthcommon.la libcourierauthsasl.la libcourierauthsaslclient.la \
+       $(modules)
 sbin_SCRIPTS=authdaemond
 sbin_PROGRAMS=authtest authenumerate authpasswd
 bin_PROGRAMS=courierauthconfig
@@ -48,13 +48,14 @@ commonlibadd=libcourierauthcommon.la
 libcourierauthcommon_t=@CRYPTLIBS@
 libcourierauthcommon_la_SOURCES= \
        auth.h courierauth.h \
-       authgetconfig.c \
+       authconfigfile.cpp \
+       authconfigfile.h \
        authpwdenumerate.c \
        authsaslfrombase64.c authsasltobase64.c \
        courierauthstaticlist.h \
        authsyschangepwd.c authsyscommon.c \
        authldapescape.c \
-       cramlib.c cramlib.h \
+       cramlib.c \
        checkpassword.c cryptpassword.c \
        checkpasswordmd5.c checkpasswordsha1.c
 
@@ -108,13 +109,11 @@ libauthshadow_la_LDFLAGS=$(commonldflags)
 
 libauthpgsql_t=@PGSQL_LIBS@ @LIBM@ @NETLIBS@
 
-libauthpgsql_la_SOURCES=authpgsql.c preauthpgsql.c authpgsqllib.c authpgsql.h
+libauthpgsql_la_SOURCES=authpgsql.c authpgsqllib.cpp authpgsql.h
 libauthpgsql_la_DEPENDENCIES=$(commonlibdep)
 libauthpgsql_la_LIBADD=$(commonlibadd) $(libauthpgsql_t)
 libauthpgsql_la_LDFLAGS=$(commonldflags)
 
-authpgsqllib.lo: authpgsqllib.c authpgsqlrc.h
-
 if HAVE_AUTHPGSQL
 
 install-authpgsqlrc:
@@ -143,13 +142,11 @@ authpgsqlrc.h:
 # The authldap module
 
 libauthldap_t=@LDAPLIBS@ @NETLIBS@
-libauthldap_la_SOURCES=authldap.c preauthldap.c authldaplib.c authldap.h
+libauthldap_la_SOURCES=authldap.c preauthldap.c authldaplib.cpp authldap.h
 libauthldap_la_DEPENDENCIES=$(commonlibdep)
 libauthldap_la_LIBADD=$(commonlibadd) $(libauthldap_t)
 libauthldap_la_LDFLAGS=$(commonldflags)
 
-authldaplib.lo: authldaplib.c authldaprc.h
-
 if HAVE_LDAP
 
 install-authldaprc:
@@ -177,13 +174,11 @@ authldaprc.h:
 
 libauthmysql_t=@MYSQL_LIBS@ @LIBM@ @NETLIBS@
 
-libauthmysql_la_SOURCES=authmysql.c preauthmysql.c authmysqllib.c authmysql.h
+libauthmysql_la_SOURCES=authmysql.cpp preauthmysql.cpp authmysqllib.cpp authmysql.h
 libauthmysql_la_DEPENDENCIES=$(commonlibdep)
 libauthmysql_la_LIBADD=$(commonlibadd) $(libauthmysql_t)
 libauthmysql_la_LDFLAGS=$(commonldflags)
 
-authmysqllib.lo: authmysqllib.c authmysqlrc.h
-
 if HAVE_AUTHMYSQL
 install-authmysqlrc:
        $(mkinstalldirs) $(DESTDIR)`dirname @authmysqlrc@` || :
@@ -210,13 +205,11 @@ authmysqlrc.h:
 
 libauthsqlite_t=@SQLITE_LIBS@ @NETLIBS@
 
-libauthsqlite_la_SOURCES=authsqlite.c preauthsqlite.c authsqlitelib.c authsqlite.h
+libauthsqlite_la_SOURCES=authsqlite.cpp authsqlitelib.cpp authsqlite.h
 libauthsqlite_la_DEPENDENCIES=$(commonlibdep)
 libauthsqlite_la_LIBADD=$(commonlibadd) $(libauthsqlite_t)
 libauthsqlite_la_LDFLAGS=$(commonldflags)
 
-authsqlitelib.lo: authsqlitelib.c authsqliterc.h
-
 if HAVE_AUTHSQLITE
 install-authsqliterc:
        $(mkinstalldirs) $(DESTDIR)`dirname @authsqliterc@` || :
@@ -287,10 +280,20 @@ authdaemonrc.h:
 HTMLFILES=README.html NEWS.html INSTALL.html \
        README.authsqlite.html README.authmysql.html README.authpostgres.html
 
+
+if HAVE_SGML
+
+GITFILES=authldaprc authmysqlrc authpgsqlrc authsqliterc authdaemonrc.in
+
+$(GITFILES): %: %.git
+       perl -p -e 's/\$$Id:[^\$$]*/\$$Id: '"`git log --pretty=format:\"%H\" -n 1 -- $<`-`date +%Y%m%d%H%M%S`/" <$< >$@.tmp
+       mv -f $@.tmp $@
+endif
+
 EXTRA_DIST=$(HTMLFILES) sysconftool COPYING COPYING.GPL\
        authldap.schema \
        authldap.ldif \
-       authldaprc authmysqlrc authpgsqlrc authsqliterc README.ldap \
+       $(GITFILES) README.ldap \
        README.authmysql.myownquery \
        README.authdebug.html.in \
        courier-authlib.spec \
@@ -357,12 +360,14 @@ authenumerate_LDFLAGS=
 #
 # The main daemon.
 
-authdaemondprog_SOURCES=authdaemond.c
+authdaemondprog_SOURCES=authdaemond.c authdaemondcpp.cpp
+
 authdaemondprog_DEPENDENCIES=libcourierauthcommon.la \
+       libcourierauth.la \
        libs/liblock/liblock.la $(modules) \
        libs/libhmac/libhmac.la libs/md5/libmd5.la libs/sha1/libsha1.la \
        libs/rfc822/libencode.la libs/numlib/libnumlib.la
-authdaemondprog_LDADD=$(LIBLTDL) libcourierauthcommon.la libs/liblock/liblock.la \
+authdaemondprog_LDADD=$(LIBLTDL) libcourierauthcommon.la libcourierauth.la libs/liblock/liblock.la \
        libs/libhmac/libhmac.la libs/md5/libmd5.la libs/sha1/libsha1.la \
        libs/rfc822/libencode.la libs/numlib/libnumlib.la
 authdaemondprog_LDFLAGS=-export-dynamic $(modules:%=-dlopen %) @NETLIBS@
@@ -386,7 +391,8 @@ BUILT1=authlib.html authldaprc.h authmysqlrc.h authpgsqlrc.h authpiperc.h \
        authchangepwdir.h sbindir.h \
        pkglibdir.h pkgincludedir.h mailusergroup.h \
        README_authlib.html
-BUILT_SOURCES=$(BUILT1) $(man3:%.3=%.html) $(man1:%.1=%.html)
+BUILT_SOURCES=$(BUILT1) $(GITFILES) $(man3:%.3=%.html) $(man1:%.1=%.html) \
+       authsqliterc.h authmysqlrc.h authpgsqlrc.h authldaprc.h
 
 authchangepwdir.h: config.status
        echo '#define AUTHCHANGEPWDIR "$(pkglibexecdir)"' >authchangepwdir.h
@@ -462,14 +468,6 @@ authlib.3: authlib.3.in
 
 if HAVE_SGML
 
-GITFILES=authdaemonrc.in
-
-BUILT_SOURCES += $(GITFILES)
-
-$(GITFILES): %: %.git
-       perl -p -e 's/\$$Id:[^\$$]*/\$$Id: '"`git log --pretty=format:\"%H\" -n 1 -- $<`-`date +%Y%m%d%H%M%S`/" <$< >$@.tmp
-       mv -f $@.tmp $@
-
 authpasswd.html: authpasswd.sgml libs/docbook/sgml2html
        libs/docbook/sgml2html authpasswd.sgml authpasswd.html
 
@@ -652,15 +650,13 @@ bump.rpm.release: @PACKAGE@.spec @PACKAGE@.lpspec
        mv @PACKAGE@.lpspec.new @PACKAGE@.lpspec
 
 upload-beta:
-       test -z "$(SFPASSWD)" && exit 1; exit 0
        rm -f @PACKAGE@-@VERSION@.tar.bz2.sig; gpg --detach-sign --default-key mrsam@courier-mta.com @PACKAGE@-@VERSION@.tar.bz2; test -f @PACKAGE@-@VERSION@.tar.bz2.sig || exit 1
-       ~/src/sftools/release.pl mrsam $(SFPASSWD) courier authlib-devel `echo @VERSION@|sed 's/.*\(........\)/\1/'` @PACKAGE@-@VERSION@.tar.bz2 @PACKAGE@-@VERSION@.tar.bz2.sig
+       ~/src/sftools/release.pl mrsam courier authlib-devel `echo @VERSION@|sed 's/.*\(........\)/\1/'` @PACKAGE@-@VERSION@.tar.bz2 @PACKAGE@-@VERSION@.tar.bz2.sig
 
 upload-dist:
-       test -z "$(SFPASSWD)" && exit 1; exit 0
        rm -f @PACKAGE@-@VERSION@.tar.bz2.sig; gpg --detach-sign --default-key mrsam@courier-mta.com @PACKAGE@-@VERSION@.tar.bz2; test -f @PACKAGE@-@VERSION@.tar.bz2.sig || exit 1
        set -e; v="@PACKAGE@/@VERSION@/`date +%Y%m%d%H%M%S`"; git tag -s $$v -m 'Tag version @VERSION@'; cd libs; git tag -s $$v -m 'Tag version @VERSION@'
-       socksify ~/src/sftools/release.pl mrsam $(SFPASSWD) courier authlib @VERSION@ @PACKAGE@-@VERSION@.tar.bz2 @PACKAGE@-@VERSION@.tar.bz2.sig
+       socksify ~/src/sftools/release.pl mrsam courier authlib @VERSION@ @PACKAGE@-@VERSION@.tar.bz2 @PACKAGE@-@VERSION@.tar.bz2.sig
 
 HTMLDOCFILES=$(HTMLFILES) README.authdebug.html README_authlib.html \
        $(man3:%.3=%.html) $(man1:%.1=%.html) userdb/userdb.html userdb/makeuserdb.html userdb/userdbpw.html
index 4b08cf3..f14452b 100644 (file)
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -100,7 +100,6 @@ sbin_PROGRAMS = authtest$(EXEEXT) authenumerate$(EXEEXT) \
 bin_PROGRAMS = courierauthconfig$(EXEEXT)
 noinst_PROGRAMS = authdaemontest$(EXEEXT) authmksock$(EXEEXT) \
        authdaemondprog$(EXEEXT)
-@HAVE_SGML_TRUE@am__append_1 = $(GITFILES)
 subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/configure.ac
@@ -163,29 +162,28 @@ libauthcustom_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
 am__DEPENDENCIES_1 =
 am_libauthldap_la_OBJECTS = authldap.lo preauthldap.lo authldaplib.lo
 libauthldap_la_OBJECTS = $(am_libauthldap_la_OBJECTS)
-libauthldap_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
-       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
-       $(AM_CFLAGS) $(CFLAGS) $(libauthldap_la_LDFLAGS) $(LDFLAGS) -o \
-       $@
+libauthldap_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
+       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
+       $(AM_CXXFLAGS) $(CXXFLAGS) $(libauthldap_la_LDFLAGS) \
+       $(LDFLAGS) -o $@
 am_libauthmysql_la_OBJECTS = authmysql.lo preauthmysql.lo \
        authmysqllib.lo
 libauthmysql_la_OBJECTS = $(am_libauthmysql_la_OBJECTS)
-libauthmysql_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
-       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
-       $(AM_CFLAGS) $(CFLAGS) $(libauthmysql_la_LDFLAGS) $(LDFLAGS) \
-       -o $@
+libauthmysql_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
+       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
+       $(AM_CXXFLAGS) $(CXXFLAGS) $(libauthmysql_la_LDFLAGS) \
+       $(LDFLAGS) -o $@
 am_libauthpam_la_OBJECTS = authpam.lo preauthpam.lo
 libauthpam_la_OBJECTS = $(am_libauthpam_la_OBJECTS)
 libauthpam_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
        $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
        $(libauthpam_la_LDFLAGS) $(LDFLAGS) -o $@
-am_libauthpgsql_la_OBJECTS = authpgsql.lo preauthpgsql.lo \
-       authpgsqllib.lo
+am_libauthpgsql_la_OBJECTS = authpgsql.lo authpgsqllib.lo
 libauthpgsql_la_OBJECTS = $(am_libauthpgsql_la_OBJECTS)
-libauthpgsql_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
-       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
-       $(AM_CFLAGS) $(CFLAGS) $(libauthpgsql_la_LDFLAGS) $(LDFLAGS) \
-       -o $@
+libauthpgsql_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
+       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
+       $(AM_CXXFLAGS) $(CXXFLAGS) $(libauthpgsql_la_LDFLAGS) \
+       $(LDFLAGS) -o $@
 am_libauthpipe_la_OBJECTS = authpipe.lo authpipelib.lo
 libauthpipe_la_OBJECTS = $(am_libauthpipe_la_OBJECTS)
 libauthpipe_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
@@ -203,13 +201,12 @@ libauthshadow_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
        $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
        $(AM_CFLAGS) $(CFLAGS) $(libauthshadow_la_LDFLAGS) $(LDFLAGS) \
        -o $@
-am_libauthsqlite_la_OBJECTS = authsqlite.lo preauthsqlite.lo \
-       authsqlitelib.lo
+am_libauthsqlite_la_OBJECTS = authsqlite.lo authsqlitelib.lo
 libauthsqlite_la_OBJECTS = $(am_libauthsqlite_la_OBJECTS)
-libauthsqlite_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
-       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
-       $(AM_CFLAGS) $(CFLAGS) $(libauthsqlite_la_LDFLAGS) $(LDFLAGS) \
-       -o $@
+libauthsqlite_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
+       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
+       $(AM_CXXFLAGS) $(CXXFLAGS) $(libauthsqlite_la_LDFLAGS) \
+       $(LDFLAGS) -o $@
 am__DEPENDENCIES_2 = userdb/libuserdb.la
 am_libauthuserdb_la_OBJECTS = authuserdb.lo preauthuserdb.lo \
        preauthuserdbcommon.lo authuserdbpwd.lo
@@ -230,16 +227,16 @@ libcourierauth_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
        $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
        $(AM_CFLAGS) $(CFLAGS) $(libcourierauth_la_LDFLAGS) $(LDFLAGS) \
        -o $@
-am_libcourierauthcommon_la_OBJECTS = authgetconfig.lo \
+am_libcourierauthcommon_la_OBJECTS = authconfigfile.lo \
        authpwdenumerate.lo authsaslfrombase64.lo authsasltobase64.lo \
        authsyschangepwd.lo authsyscommon.lo authldapescape.lo \
        cramlib.lo checkpassword.lo cryptpassword.lo \
        checkpasswordmd5.lo checkpasswordsha1.lo
 libcourierauthcommon_la_OBJECTS =  \
        $(am_libcourierauthcommon_la_OBJECTS)
-libcourierauthcommon_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
-       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
-       $(AM_CFLAGS) $(CFLAGS) $(libcourierauthcommon_la_LDFLAGS) \
+libcourierauthcommon_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
+       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
+       $(AM_CXXFLAGS) $(CXXFLAGS) $(libcourierauthcommon_la_LDFLAGS) \
        $(LDFLAGS) -o $@
 libcourierauthsasl_la_DEPENDENCIES = libcourierauthcommon.la \
        libcourierauth.la
@@ -264,12 +261,13 @@ libcourierauthsaslclient_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
        $(AM_CFLAGS) $(CFLAGS) $(libcourierauthsaslclient_la_LDFLAGS) \
        $(LDFLAGS) -o $@
 PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) $(sbin_PROGRAMS)
-am_authdaemondprog_OBJECTS = authdaemond.$(OBJEXT)
+am_authdaemondprog_OBJECTS = authdaemond.$(OBJEXT) \
+       authdaemondcpp.$(OBJEXT)
 authdaemondprog_OBJECTS = $(am_authdaemondprog_OBJECTS)
-authdaemondprog_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
-       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
-       $(AM_CFLAGS) $(CFLAGS) $(authdaemondprog_LDFLAGS) $(LDFLAGS) \
-       -o $@
+authdaemondprog_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
+       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
+       $(AM_CXXFLAGS) $(CXXFLAGS) $(authdaemondprog_LDFLAGS) \
+       $(LDFLAGS) -o $@
 am_authdaemontest_OBJECTS = authdaemontest.$(OBJEXT)
 authdaemontest_OBJECTS = $(am_authdaemontest_OBJECTS)
 authdaemontest_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
@@ -329,6 +327,24 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@)
 am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
 am__v_CCLD_0 = @echo "  CCLD    " $@;
 am__v_CCLD_1 = 
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
+       $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+       $(AM_CXXFLAGS) $(CXXFLAGS)
+AM_V_CXX = $(am__v_CXX_@AM_V@)
+am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
+am__v_CXX_0 = @echo "  CXX     " $@;
+am__v_CXX_1 = 
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+       $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
+am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
+am__v_CXXLD_0 = @echo "  CXXLD   " $@;
+am__v_CXXLD_1 = 
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \
        $(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \
        $(libauthpgsql_la_SOURCES) $(libauthpipe_la_SOURCES) \
@@ -475,6 +491,10 @@ COURIERCONFIG = @COURIERCONFIG@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CRYPTLIBS = @CRYPTLIBS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
@@ -574,6 +594,7 @@ abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
 ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
@@ -645,8 +666,8 @@ modules = @LIBAUTHUSERDB@ \
 
 pkglibexec_SCRIPTS = authsystem.passwd
 pkglib_LTLIBRARIES = libcourierauth.la \
-       libcourierauthsasl.la libcourierauthsaslclient.la \
-       libcourierauthcommon.la $(modules)
+       libcourierauthcommon.la libcourierauthsasl.la libcourierauthsaslclient.la \
+       $(modules)
 
 sbin_SCRIPTS = authdaemond
 EXTRA_LTLIBRARIES = libauthuserdb.la \
@@ -672,13 +693,14 @@ commonlibadd = libcourierauthcommon.la
 libcourierauthcommon_t = @CRYPTLIBS@
 libcourierauthcommon_la_SOURCES = \
        auth.h courierauth.h \
-       authgetconfig.c \
+       authconfigfile.cpp \
+       authconfigfile.h \
        authpwdenumerate.c \
        authsaslfrombase64.c authsasltobase64.c \
        courierauthstaticlist.h \
        authsyschangepwd.c authsyscommon.c \
        authldapescape.c \
-       cramlib.c cramlib.h \
+       cramlib.c \
        checkpassword.c cryptpassword.c \
        checkpasswordmd5.c checkpasswordsha1.c
 
@@ -726,28 +748,28 @@ libauthshadow_la_LDFLAGS = $(commonldflags)
 
 # The authpgsql module
 libauthpgsql_t = @PGSQL_LIBS@ @LIBM@ @NETLIBS@
-libauthpgsql_la_SOURCES = authpgsql.c preauthpgsql.c authpgsqllib.c authpgsql.h
+libauthpgsql_la_SOURCES = authpgsql.c authpgsqllib.cpp authpgsql.h
 libauthpgsql_la_DEPENDENCIES = $(commonlibdep)
 libauthpgsql_la_LIBADD = $(commonlibadd) $(libauthpgsql_t)
 libauthpgsql_la_LDFLAGS = $(commonldflags)
 
 # The authldap module
 libauthldap_t = @LDAPLIBS@ @NETLIBS@
-libauthldap_la_SOURCES = authldap.c preauthldap.c authldaplib.c authldap.h
+libauthldap_la_SOURCES = authldap.c preauthldap.c authldaplib.cpp authldap.h
 libauthldap_la_DEPENDENCIES = $(commonlibdep)
 libauthldap_la_LIBADD = $(commonlibadd) $(libauthldap_t)
 libauthldap_la_LDFLAGS = $(commonldflags)
 
 # The authmysql module
 libauthmysql_t = @MYSQL_LIBS@ @LIBM@ @NETLIBS@
-libauthmysql_la_SOURCES = authmysql.c preauthmysql.c authmysqllib.c authmysql.h
+libauthmysql_la_SOURCES = authmysql.cpp preauthmysql.cpp authmysqllib.cpp authmysql.h
 libauthmysql_la_DEPENDENCIES = $(commonlibdep)
 libauthmysql_la_LIBADD = $(commonlibadd) $(libauthmysql_t)
 libauthmysql_la_LDFLAGS = $(commonldflags)
 
 # The authsqlite module
 libauthsqlite_t = @SQLITE_LIBS@ @NETLIBS@
-libauthsqlite_la_SOURCES = authsqlite.c preauthsqlite.c authsqlitelib.c authsqlite.h
+libauthsqlite_la_SOURCES = authsqlite.cpp authsqlitelib.cpp authsqlite.h
 libauthsqlite_la_DEPENDENCIES = $(commonlibdep)
 libauthsqlite_la_LIBADD = $(commonlibadd) $(libauthsqlite_t)
 libauthsqlite_la_LDFLAGS = $(commonldflags)
@@ -766,10 +788,11 @@ libauthpipe_la_LDFLAGS = $(commonldflags)
 HTMLFILES = README.html NEWS.html INSTALL.html \
        README.authsqlite.html README.authmysql.html README.authpostgres.html
 
+@HAVE_SGML_TRUE@GITFILES = authldaprc authmysqlrc authpgsqlrc authsqliterc authdaemonrc.in
 EXTRA_DIST = $(HTMLFILES) sysconftool COPYING COPYING.GPL\
        authldap.schema \
        authldap.ldif \
-       authldaprc authmysqlrc authpgsqlrc authsqliterc README.ldap \
+       $(GITFILES) README.ldap \
        README.authmysql.myownquery \
        README.authdebug.html.in \
        courier-authlib.spec \
@@ -826,13 +849,14 @@ authenumerate_LDFLAGS =
 
 #
 # The main daemon.
-authdaemondprog_SOURCES = authdaemond.c
+authdaemondprog_SOURCES = authdaemond.c authdaemondcpp.cpp
 authdaemondprog_DEPENDENCIES = libcourierauthcommon.la \
+       libcourierauth.la \
        libs/liblock/liblock.la $(modules) \
        libs/libhmac/libhmac.la libs/md5/libmd5.la libs/sha1/libsha1.la \
        libs/rfc822/libencode.la libs/numlib/libnumlib.la
 
-authdaemondprog_LDADD = $(LIBLTDL) libcourierauthcommon.la libs/liblock/liblock.la \
+authdaemondprog_LDADD = $(LIBLTDL) libcourierauthcommon.la libcourierauth.la libs/liblock/liblock.la \
        libs/libhmac/libhmac.la libs/md5/libmd5.la libs/sha1/libsha1.la \
        libs/rfc822/libencode.la libs/numlib/libnumlib.la
 
@@ -854,10 +878,10 @@ BUILT1 = authlib.html authldaprc.h authmysqlrc.h authpgsqlrc.h authpiperc.h \
        pkglibdir.h pkgincludedir.h mailusergroup.h \
        README_authlib.html
 
-BUILT_SOURCES = $(BUILT1) $(man3:%.3=%.html) $(man1:%.1=%.html) \
-       $(am__append_1)
+BUILT_SOURCES = $(BUILT1) $(GITFILES) $(man3:%.3=%.html) $(man1:%.1=%.html) \
+       authsqliterc.h authmysqlrc.h authpgsqlrc.h authldaprc.h
+
 noinst_DATA = $(BUILT_SOURCES)
-@HAVE_SGML_TRUE@GITFILES = authdaemonrc.in
 HTMLDOCFILES = $(HTMLFILES) README.authdebug.html README_authlib.html \
        $(man3:%.3=%.html) $(man1:%.1=%.html) userdb/userdb.html userdb/makeuserdb.html userdb/userdbpw.html
 
@@ -865,7 +889,7 @@ all: $(BUILT_SOURCES) courier_auth_config.h
        $(MAKE) $(AM_MAKEFLAGS) all-recursive
 
 .SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
+.SUFFIXES: .c .cpp .lo .o .obj
 am--refresh: Makefile
        @:
 $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
@@ -978,16 +1002,16 @@ libauthcustom.la: $(libauthcustom_la_OBJECTS) $(libauthcustom_la_DEPENDENCIES) $
        $(AM_V_CCLD)$(libauthcustom_la_LINK)  $(libauthcustom_la_OBJECTS) $(libauthcustom_la_LIBADD) $(LIBS)
 
 libauthldap.la: $(libauthldap_la_OBJECTS) $(libauthldap_la_DEPENDENCIES) $(EXTRA_libauthldap_la_DEPENDENCIES) 
-       $(AM_V_CCLD)$(libauthldap_la_LINK)  $(libauthldap_la_OBJECTS) $(libauthldap_la_LIBADD) $(LIBS)
+       $(AM_V_CXXLD)$(libauthldap_la_LINK)  $(libauthldap_la_OBJECTS) $(libauthldap_la_LIBADD) $(LIBS)
 
 libauthmysql.la: $(libauthmysql_la_OBJECTS) $(libauthmysql_la_DEPENDENCIES) $(EXTRA_libauthmysql_la_DEPENDENCIES) 
-       $(AM_V_CCLD)$(libauthmysql_la_LINK)  $(libauthmysql_la_OBJECTS) $(libauthmysql_la_LIBADD) $(LIBS)
+       $(AM_V_CXXLD)$(libauthmysql_la_LINK)  $(libauthmysql_la_OBJECTS) $(libauthmysql_la_LIBADD) $(LIBS)
 
 libauthpam.la: $(libauthpam_la_OBJECTS) $(libauthpam_la_DEPENDENCIES) $(EXTRA_libauthpam_la_DEPENDENCIES) 
        $(AM_V_CCLD)$(libauthpam_la_LINK)  $(libauthpam_la_OBJECTS) $(libauthpam_la_LIBADD) $(LIBS)
 
 libauthpgsql.la: $(libauthpgsql_la_OBJECTS) $(libauthpgsql_la_DEPENDENCIES) $(EXTRA_libauthpgsql_la_DEPENDENCIES) 
-       $(AM_V_CCLD)$(libauthpgsql_la_LINK)  $(libauthpgsql_la_OBJECTS) $(libauthpgsql_la_LIBADD) $(LIBS)
+       $(AM_V_CXXLD)$(libauthpgsql_la_LINK)  $(libauthpgsql_la_OBJECTS) $(libauthpgsql_la_LIBADD) $(LIBS)
 
 libauthpipe.la: $(libauthpipe_la_OBJECTS) $(libauthpipe_la_DEPENDENCIES) $(EXTRA_libauthpipe_la_DEPENDENCIES) 
        $(AM_V_CCLD)$(libauthpipe_la_LINK)  $(libauthpipe_la_OBJECTS) $(libauthpipe_la_LIBADD) $(LIBS)
@@ -999,7 +1023,7 @@ libauthshadow.la: $(libauthshadow_la_OBJECTS) $(libauthshadow_la_DEPENDENCIES) $
        $(AM_V_CCLD)$(libauthshadow_la_LINK)  $(libauthshadow_la_OBJECTS) $(libauthshadow_la_LIBADD) $(LIBS)
 
 libauthsqlite.la: $(libauthsqlite_la_OBJECTS) $(libauthsqlite_la_DEPENDENCIES) $(EXTRA_libauthsqlite_la_DEPENDENCIES) 
-       $(AM_V_CCLD)$(libauthsqlite_la_LINK)  $(libauthsqlite_la_OBJECTS) $(libauthsqlite_la_LIBADD) $(LIBS)
+       $(AM_V_CXXLD)$(libauthsqlite_la_LINK)  $(libauthsqlite_la_OBJECTS) $(libauthsqlite_la_LIBADD) $(LIBS)
 
 libauthuserdb.la: $(libauthuserdb_la_OBJECTS) $(libauthuserdb_la_DEPENDENCIES) $(EXTRA_libauthuserdb_la_DEPENDENCIES) 
        $(AM_V_CCLD)$(libauthuserdb_la_LINK)  $(libauthuserdb_la_OBJECTS) $(libauthuserdb_la_LIBADD) $(LIBS)
@@ -1008,7 +1032,7 @@ libcourierauth.la: $(libcourierauth_la_OBJECTS) $(libcourierauth_la_DEPENDENCIES
        $(AM_V_CCLD)$(libcourierauth_la_LINK) -rpath $(pkglibdir) $(libcourierauth_la_OBJECTS) $(libcourierauth_la_LIBADD) $(LIBS)
 
 libcourierauthcommon.la: $(libcourierauthcommon_la_OBJECTS) $(libcourierauthcommon_la_DEPENDENCIES) $(EXTRA_libcourierauthcommon_la_DEPENDENCIES) 
-       $(AM_V_CCLD)$(libcourierauthcommon_la_LINK) -rpath $(pkglibdir) $(libcourierauthcommon_la_OBJECTS) $(libcourierauthcommon_la_LIBADD) $(LIBS)
+       $(AM_V_CXXLD)$(libcourierauthcommon_la_LINK) -rpath $(pkglibdir) $(libcourierauthcommon_la_OBJECTS) $(libcourierauthcommon_la_LIBADD) $(LIBS)
 
 libcourierauthsasl.la: $(libcourierauthsasl_la_OBJECTS) $(libcourierauthsasl_la_DEPENDENCIES) $(EXTRA_libcourierauthsasl_la_DEPENDENCIES) 
        $(AM_V_CCLD)$(libcourierauthsasl_la_LINK) -rpath $(pkglibdir) $(libcourierauthsasl_la_OBJECTS) $(libcourierauthsasl_la_LIBADD) $(LIBS)
@@ -1125,7 +1149,7 @@ clean-sbinPROGRAMS:
 
 authdaemondprog$(EXEEXT): $(authdaemondprog_OBJECTS) $(authdaemondprog_DEPENDENCIES) $(EXTRA_authdaemondprog_DEPENDENCIES) 
        @rm -f authdaemondprog$(EXEEXT)
-       $(AM_V_CCLD)$(authdaemondprog_LINK) $(authdaemondprog_OBJECTS) $(authdaemondprog_LDADD) $(LIBS)
+       $(AM_V_CXXLD)$(authdaemondprog_LINK) $(authdaemondprog_OBJECTS) $(authdaemondprog_LDADD) $(LIBS)
 
 authdaemontest$(EXEEXT): $(authdaemontest_OBJECTS) $(authdaemontest_DEPENDENCIES) $(EXTRA_authdaemontest_DEPENDENCIES) 
        @rm -f authdaemontest$(EXEEXT)
@@ -1227,13 +1251,14 @@ mostlyclean-compile:
 distclean-compile:
        -rm -f *.tab.c
 
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/authconfigfile.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/authcustom.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/authdaemon.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/authdaemond.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/authdaemondcpp.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/authdaemonlib.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/authdaemontest.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/authenumerate.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/authgetconfig.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/authinfo.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/authldap.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/authldapescape.Plo@am__quote@
@@ -1284,10 +1309,8 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/preauthldap.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/preauthmysql.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/preauthpam.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/preauthpgsql.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/preauthpwd.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/preauthshadow.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/preauthsqlite.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/preauthuserdb.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/preauthuserdbcommon.Plo@am__quote@
 
@@ -1312,6 +1335,27 @@ distclean-compile:
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
 
+.cpp.o:
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
+
 mostlyclean-libtool:
        -rm -f *.lo
 
@@ -1602,7 +1646,7 @@ distdir: $(DISTFILES)
          ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
        || chmod -R a+r "$(distdir)"
 dist-gzip: distdir
-       tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+       tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
        $(am__post_remove_distdir)
 dist-bzip2: distdir
        tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
@@ -1627,7 +1671,7 @@ dist-shar: distdir
        @echo WARNING: "Support for shar distribution archives is" \
                       "deprecated." >&2
        @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
-       shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+       shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
        $(am__post_remove_distdir)
 
 dist-zip: distdir
@@ -1645,7 +1689,7 @@ dist dist-all:
 distcheck: dist
        case '$(DIST_ARCHIVES)' in \
        *.tar.gz*) \
-         GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+         eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
        *.tar.bz2*) \
          bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
        *.tar.lz*) \
@@ -1655,7 +1699,7 @@ distcheck: dist
        *.tar.Z*) \
          uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
        *.shar.gz*) \
-         GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+         eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
        *.zip*) \
          unzip $(distdir).zip ;;\
        esac
@@ -1886,8 +1930,6 @@ uninstall-man: uninstall-man1 uninstall-man3
 .PRECIOUS: Makefile
 
 
-authpgsqllib.lo: authpgsqllib.c authpgsqlrc.h
-
 @HAVE_AUTHPGSQL_TRUE@install-authpgsqlrc:
 @HAVE_AUTHPGSQL_TRUE@  $(mkinstalldirs) $(DESTDIR)`dirname @authpgsqlrc@` || :
 @HAVE_AUTHPGSQL_TRUE@  $(INSTALL_DATA) -m 660 $(srcdir)/authpgsqlrc \
@@ -1907,8 +1949,6 @@ authpgsqllib.lo: authpgsqllib.c authpgsqlrc.h
 authpgsqlrc.h:
        echo "#define AUTHPGSQLRC \"@authpgsqlrc@\"" >authpgsqlrc.h
 
-authldaplib.lo: authldaplib.c authldaprc.h
-
 @HAVE_LDAP_TRUE@install-authldaprc:
 @HAVE_LDAP_TRUE@       $(mkinstalldirs) $(DESTDIR)`dirname @authldaprc@` || :
 @HAVE_LDAP_TRUE@       $(INSTALL_DATA) -m 660 $(srcdir)/authldaprc \
@@ -1928,8 +1968,6 @@ authldaplib.lo: authldaplib.c authldaprc.h
 authldaprc.h:
        echo "#define AUTHLDAPRC \"@authldaprc@\"" >authldaprc.h
 
-authmysqllib.lo: authmysqllib.c authmysqlrc.h
-
 @HAVE_AUTHMYSQL_TRUE@install-authmysqlrc:
 @HAVE_AUTHMYSQL_TRUE@  $(mkinstalldirs) $(DESTDIR)`dirname @authmysqlrc@` || :
 @HAVE_AUTHMYSQL_TRUE@  $(INSTALL_DATA) -m 660 $(srcdir)/authmysqlrc \
@@ -1949,8 +1987,6 @@ authmysqllib.lo: authmysqllib.c authmysqlrc.h
 authmysqlrc.h:
        echo "#define AUTHMYSQLRC \"@authmysqlrc@\"" >authmysqlrc.h
 
-authsqlitelib.lo: authsqlitelib.c authsqliterc.h
-
 @HAVE_AUTHSQLITE_TRUE@install-authsqliterc:
 @HAVE_AUTHSQLITE_TRUE@ $(mkinstalldirs) $(DESTDIR)`dirname @authsqliterc@` || :
 @HAVE_AUTHSQLITE_TRUE@ $(INSTALL_DATA) -m 660 $(srcdir)/authsqliterc \
@@ -1993,6 +2029,10 @@ authdaemonrc.h:
        echo "#define AUTHDAEMONSOCK AUTHDAEMONVAR \"/socket\"" >>authdaemonrc.h
        echo "#define AUTHDAEMONLOCK AUTHDAEMONVAR \"/lock\"" >>authdaemonrc.h
 
+@HAVE_SGML_TRUE@$(GITFILES): %: %.git
+@HAVE_SGML_TRUE@       perl -p -e 's/\$$Id:[^\$$]*/\$$Id: '"`git log --pretty=format:\"%H\" -n 1 -- $<`-`date +%Y%m%d%H%M%S`/" <$< >$@.tmp
+@HAVE_SGML_TRUE@       mv -f $@.tmp $@
+
 README: README.html
        links -dump -no-references README.html >README
 
@@ -2072,10 +2112,6 @@ authlib.html: authlib.html.in
 authlib.3: authlib.3.in
        $(SHELL) ./config.status --file=authlib.3
 
-@HAVE_SGML_TRUE@$(GITFILES): %: %.git
-@HAVE_SGML_TRUE@       perl -p -e 's/\$$Id:[^\$$]*/\$$Id: '"`git log --pretty=format:\"%H\" -n 1 -- $<`-`date +%Y%m%d%H%M%S`/" <$< >$@.tmp
-@HAVE_SGML_TRUE@       mv -f $@.tmp $@
-
 @HAVE_SGML_TRUE@authpasswd.html: authpasswd.sgml libs/docbook/sgml2html
 @HAVE_SGML_TRUE@       libs/docbook/sgml2html authpasswd.sgml authpasswd.html
 
@@ -2255,15 +2291,13 @@ bump.rpm.release: @PACKAGE@.spec @PACKAGE@.lpspec
        mv @PACKAGE@.lpspec.new @PACKAGE@.lpspec
 
 upload-beta:
-       test -z "$(SFPASSWD)" && exit 1; exit 0
        rm -f @PACKAGE@-@VERSION@.tar.bz2.sig; gpg --detach-sign --default-key mrsam@courier-mta.com @PACKAGE@-@VERSION@.tar.bz2; test -f @PACKAGE@-@VERSION@.tar.bz2.sig || exit 1
-       ~/src/sftools/release.pl mrsam $(SFPASSWD) courier authlib-devel `echo @VERSION@|sed 's/.*\(........\)/\1/'` @PACKAGE@-@VERSION@.tar.bz2 @PACKAGE@-@VERSION@.tar.bz2.sig
+       ~/src/sftools/release.pl mrsam courier authlib-devel `echo @VERSION@|sed 's/.*\(........\)/\1/'` @PACKAGE@-@VERSION@.tar.bz2 @PACKAGE@-@VERSION@.tar.bz2.sig
 
 upload-dist:
-       test -z "$(SFPASSWD)" && exit 1; exit 0
        rm -f @PACKAGE@-@VERSION@.tar.bz2.sig; gpg --detach-sign --default-key mrsam@courier-mta.com @PACKAGE@-@VERSION@.tar.bz2; test -f @PACKAGE@-@VERSION@.tar.bz2.sig || exit 1
        set -e; v="@PACKAGE@/@VERSION@/`date +%Y%m%d%H%M%S`"; git tag -s $$v -m 'Tag version @VERSION@'; cd libs; git tag -s $$v -m 'Tag version @VERSION@'
-       socksify ~/src/sftools/release.pl mrsam $(SFPASSWD) courier authlib @VERSION@ @PACKAGE@-@VERSION@.tar.bz2 @PACKAGE@-@VERSION@.tar.bz2.sig
+       socksify ~/src/sftools/release.pl mrsam courier authlib @VERSION@ @PACKAGE@-@VERSION@.tar.bz2 @PACKAGE@-@VERSION@.tar.bz2.sig
 
 htmldoc: $(HTMLDOCFILES)
        for f in $^; do d=`basename $$f`; test "$$d" = "README.html" && d="index.html"; tidy -i -q --tidy-mark no --doctype transitional --input-encoding utf8 --output-encoding utf8 -asxml <$$f >$$f.tmp ; xsltproc --nonet $$HOME/www/www.courier-mta.org/xsl/authlib.xsl $$f.tmp | perl -ne 's~\$(id):.*\$$~\$(id):'"$$h"'\$$~; print' >$$HOME/www/www.courier-mta.org/authlib/$$d; rm -f $$f.tmp; done
index 85c772b..91220fe 100644 (file)
@@ -439,8 +439,9 @@ This module reads
 the list of mail accounts and passwords from an LDAP directory.
 The <code class="filename">@authldaprc@</code> configuration file defines the
 particular details regarding the LDAP directory layout.</p><p>
-A suggested LDAP schema can be found in the file
-<code class="filename">authldap.schema</code>,
+A suggested LDAP schema can be found in the files
+<code class="filename">authldap.schema</code> and
+<code class="filename">authldap.ldif</code>,
 which is included in Courier authentication library's source code, and
 may be installed on your system.</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="authcustom" shape="rect"> </a><code class="literal">authcustom</code></h2></div></div></div><p>
 This is a do-nothing module where custom authentication code
index 6379c8b..8a0d7e7 100644 (file)
@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.15 -*- Autoconf -*-
+# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -20,6 +20,83 @@ You have another version of autoconf.  It may work, but is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
 To do so, use the procedure documented by the package, typically 'autoreconf'.])])
 
+dnl Sets the COURIER_UNICODE_CXXFLAGS variable to any additional compiler
+dnl flags needed to build the courier-unicode package and packages that
+dnl use the courier-unicode package.
+
+AC_DEFUN([AX_COURIER_UNICODE_CXXFLAGS],[
+
+save_FLAGS="$CXXFLAGS"
+
+AC_LANG_PUSH([C++])
+
+AC_TRY_COMPILE([
+#include <string>
+], [
+     std::u32string s;
+     char32_t c;
+     ],
+     [
+     ],
+     [
+
+COURIER_UNICODE_CXXFLAGS="-std=c++11"
+CXXFLAGS="$save_CFLAGS $COURIER_UNICODE_CXXFLAGS"
+
+AC_TRY_COMPILE([
+#include <string>
+], [
+     std::u32string s;
+     char32_t c;
+     ],
+     [
+     ],
+     [
+
+COURIER_UNICODE_CXXFLAGS="-std=c++0x"
+CXXFLAGS="$save_CFLAGS $COURIER_UNICODE_CXXFLAGS"
+
+AC_TRY_COMPILE([
+#include <string>
+], [
+     std::u32string s;
+     char32_t c;
+     ],
+     [
+     ],
+     [
+AC_MSG_ERROR([*** A compiler with C++11 Unicode support was not found])
+])
+])
+])
+CXXFLAGS="$save_FLAGS"
+AC_LANG_POP([C++])
+])
+
+AC_DEFUN([AX_COURIER_UNICODE_VERSION],[
+
+AC_MSG_CHECKING(courier-unicode library and version)
+
+AC_TRY_COMPILE([
+#include <courier-unicode.h>
+#ifndef COURIER_UNICODE_VERSION
+#define COURIER_UNICODE_VERSION 0
+#endif
+
+#if COURIER_UNICODE_VERSION < 210
+#error "courier-unicode 2.1 library is required"
+#endif
+
+],[],[],
+AC_MSG_ERROR([
+ERROR: The Courier Unicode Library 2.1 header files appear not to be installed.
+You may need to upgrade the library or install a separate development
+subpackage in addition to the main package.])
+)
+
+AC_MSG_RESULT([ok])
+])
+
 # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
 #
 #   Copyright (C) 1996-2001, 2003-2015 Free Software Foundation, Inc.
@@ -10075,7 +10152,7 @@ AC_DEFUN([AC_PROG_SYSCONFTOOL],
 ]
 )
 
-# Copyright (C) 2002-2014 Free Software Foundation, Inc.
+# Copyright (C) 2002-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10090,7 +10167,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
 [am__api_version='1.15'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.15], [],
+m4_if([$1], [1.15.1], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -10106,14 +10183,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.15])dnl
+[AM_AUTOMAKE_VERSION([1.15.1])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10165,7 +10242,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
 
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10196,7 +10273,7 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10387,7 +10464,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10463,7 +10540,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 
 # Do all the work for Automake.                             -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10660,7 +10737,7 @@ for _am_header in $config_headers :; do
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10681,7 +10758,7 @@ if test x"${install_sh+set}" != xset; then
 fi
 AC_SUBST([install_sh])])
 
-# Copyright (C) 2003-2014 Free Software Foundation, Inc.
+# Copyright (C) 2003-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10702,7 +10779,7 @@ AC_SUBST([am__leading_dot])])
 
 # Check to see how 'make' treats includes.                 -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10752,7 +10829,7 @@ rm -f confinc confmf
 
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10791,7 +10868,7 @@ fi
 
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10820,7 +10897,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
 AC_DEFUN([_AM_IF_OPTION],
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10867,7 +10944,7 @@ AC_LANG_POP([C])])
 # For backward compatibility.
 AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10886,7 +10963,7 @@ AC_DEFUN([AM_RUN_LOG],
 
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10967,7 +11044,7 @@ AC_CONFIG_COMMANDS_PRE(
 rm -f conftest.file
 ])
 
-# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2009-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -11027,7 +11104,7 @@ AC_SUBST([AM_BACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
 ])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -11055,7 +11132,7 @@ fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006-2014 Free Software Foundation, Inc.
+# Copyright (C) 2006-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -11074,7 +11151,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004-2014 Free Software Foundation, Inc.
+# Copyright (C) 2004-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/auth.h b/auth.h
index 837eb41..316495c 100644 (file)
--- a/auth.h
+++ b/auth.h
@@ -47,17 +47,6 @@ int auth_sys_common( int (*auth_pre_func)(const char *,
                     int (*callback_func)(struct authinfo *, void *),
                     void *callback_arg);
 
-const char *authgetconfig(const char *filename, const char *env);
-
-char *auth_parse_select_clause (char *(*escape_func)(const char *, size_t),
-                               const char *clause, const char *username,
-                               const char *defdomain,
-                               const char *service);
-
-char *auth_parse_chpass_clause (char *(*escape_func)(const char *, size_t),
-                               const char *clause, const char *username,
-                               const char *defdomain, const char *newpass,
-                               const char *newpass_crypt);
 
 #ifdef __cplusplus
 }
index 9b8bbf8..3a40fd3 100644 (file)
@@ -2,14 +2,14 @@
 .\"  <!-- Copyright 2004 Double Precision, Inc.  See COPYING for -->
 .\"  <!-- distribution information. -->
 .\"     Title: auth_enumerate
-.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
-.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\"      Date: 06/20/2015
+.\"    Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
+.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
+.\"      Date: 09/08/2017
 .\"    Manual: Double Precision, Inc.
 .\"    Source: Double Precision, Inc.
 .\"  Language: English
 .\"
-.TH "AUTH_ENUMERATE" "3" "06/20/2015" "Double Precision, Inc." "Double Precision, Inc."
+.TH "AUTH_ENUMERATE" "3" "09/08/2017" "Double Precision, Inc." "Double Precision, Inc."
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
index f6020c2..b566adf 100644 (file)
@@ -2,14 +2,14 @@
 .\"  <!-- Copyright 2004 Double Precision, Inc.  See COPYING for -->
 .\"  <!-- distribution information. -->
 .\"     Title: auth_generic
-.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
-.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\"      Date: 06/20/2015
+.\"    Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
+.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
+.\"      Date: 09/08/2017
 .\"    Manual: Double Precision, Inc.
 .\"    Source: Double Precision, Inc.
 .\"  Language: English
 .\"
-.TH "AUTH_GENERIC" "3" "06/20/2015" "Double Precision, Inc." "Double Precision, Inc."
+.TH "AUTH_GENERIC" "3" "09/08/2017" "Double Precision, Inc." "Double Precision, Inc."
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
index f5dcc11..bbd88bc 100644 (file)
@@ -2,14 +2,14 @@
 .\"  <!-- Copyright 2004 Double Precision, Inc.  See COPYING for -->
 .\"  <!-- distribution information. -->
 .\"     Title: auth_getoption
-.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
-.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\"      Date: 06/20/2015
+.\"    Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
+.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
+.\"      Date: 09/08/2017
 .\"    Manual: Double Precision, Inc.
 .\"    Source: Double Precision, Inc.
 .\"  Language: English
 .\"
-.TH "AUTH_GETOPTION" "3" "06/20/2015" "Double Precision, Inc." "Double Precision, Inc."
+.TH "AUTH_GETOPTION" "3" "09/08/2017" "Double Precision, Inc." "Double Precision, Inc."
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
index 16f4c47..57150c4 100644 (file)
@@ -2,14 +2,14 @@
 .\"  <!-- Copyright 2004 Double Precision, Inc.  See COPYING for -->
 .\"  <!-- distribution information. -->
 .\"     Title: auth_getuserinfo
-.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
-.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\"      Date: 06/20/2015
+.\"    Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
+.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
+.\"      Date: 09/08/2017
 .\"    Manual: Double Precision, Inc.
 .\"    Source: Double Precision, Inc.
 .\"  Language: English
 .\"
-.TH "AUTH_GETUSERINFO" "3" "06/20/2015" "Double Precision, Inc." "Double Precision, Inc."
+.TH "AUTH_GETUSERINFO" "3" "09/08/2017" "Double Precision, Inc." "Double Precision, Inc."
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
index d617d53..b2bccc5 100644 (file)
@@ -2,14 +2,14 @@
 .\"  <!-- Copyright 2004 Double Precision, Inc.  See COPYING for -->
 .\"  <!-- distribution information. -->
 .\"     Title: auth_login
-.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
-.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\"      Date: 06/20/2015
+.\"    Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
+.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
+.\"      Date: 09/08/2017
 .\"    Manual: Double Precision, Inc.
 .\"    Source: Double Precision, Inc.
 .\"  Language: English
 .\"
-.TH "AUTH_LOGIN" "3" "06/20/2015" "Double Precision, Inc." "Double Precision, Inc."
+.TH "AUTH_LOGIN" "3" "09/08/2017" "Double Precision, Inc." "Double Precision, Inc."
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
index 314e931..ed0155c 100644 (file)
@@ -2,14 +2,14 @@
 .\"  <!-- Copyright 2015 Double Precision, Inc.  See COPYING for -->
 .\"  <!-- distribution information. -->
 .\"     Title: auth_mkhomedir
-.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
-.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\"      Date: 11/04/2015
+.\"    Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
+.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
+.\"      Date: 09/08/2017
 .\"    Manual: Double Precision, Inc.
 .\"    Source: Double Precision, Inc.
 .\"  Language: English
 .\"
-.TH "AUTH_MKHOMEDIR" "3" "11/04/2015" "Double Precision, Inc." "Double Precision, Inc."
+.TH "AUTH_MKHOMEDIR" "3" "09/08/2017" "Double Precision, Inc." "Double Precision, Inc."
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
index 33e6d3a..573e32b 100644 (file)
@@ -2,14 +2,14 @@
 .\"  <!-- Copyright 2004 Double Precision, Inc.  See COPYING for -->
 .\"  <!-- distribution information. -->
 .\"     Title: auth_passwd
-.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
-.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\"      Date: 06/20/2015
+.\"    Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
+.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
+.\"      Date: 09/08/2017
 .\"    Manual: Double Precision, Inc.
 .\"    Source: Double Precision, Inc.
 .\"  Language: English
 .\"
-.TH "AUTH_PASSWD" "3" "06/20/2015" "Double Precision, Inc." "Double Precision, Inc."
+.TH "AUTH_PASSWD" "3" "09/08/2017" "Double Precision, Inc." "Double Precision, Inc."
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
index 705157c..4c59c8e 100644 (file)
@@ -2,14 +2,14 @@
 .\"  <!-- Copyright 2004-2008 Double Precision, Inc.  See COPYING for -->
 .\"  <!-- distribution information. -->
 .\"     Title: auth_sasl
-.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
-.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\"      Date: 06/20/2015
+.\"    Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
+.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
+.\"      Date: 09/08/2017
 .\"    Manual: Double Precision, Inc.
 .\"    Source: Double Precision, Inc.
 .\"  Language: English
 .\"
-.TH "AUTH_SASL" "3" "06/20/2015" "Double Precision, Inc." "Double Precision, Inc."
+.TH "AUTH_SASL" "3" "09/08/2017" "Double Precision, Inc." "Double Precision, Inc."
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -136,7 +136,8 @@ conversation\&.
 is a version of
 \fBauth_sasl\fR
 that recognizes the
-EXTERNALSASL
+EXTERNAL
+SASL
 method\&. It takes an extra parameter,
 \fIexternalauth\fR\&. This parameter should be set to indicate an login that was authenticated via some other means, such as, perhaps, an
 SSL
diff --git a/authconfigfile.cpp b/authconfigfile.cpp
new file mode 100644 (file)
index 0000000..0a79c5b
--- /dev/null
@@ -0,0 +1,263 @@
+/*
+** Copyright 2016 Double Precision, Inc.  See COPYING for
+** distribution information.
+*/
+
+#if HAVE_CONFIG_H
+#include "courier_auth_config.h"
+#endif
+
+#if HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
+extern "C" {
+#include "authldap.h"
+#include "auth.h"
+#include "authldaprc.h"
+#include "courierauthdebug.h"
+};
+
+#include <algorithm>
+#include <fstream>
+#include <sstream>
+
+#include "authconfigfile.h"
+
+courier::auth::config_file::config_file(const char *filenameArg)
+       : filename(filenameArg), loaded(false)
+{
+}
+
+bool courier::auth::config_file::load(bool reload)
+{
+       struct stat stat_buf;
+
+       if (stat(filename, &stat_buf) < 0)
+       {
+               courier_auth_err("stat(%s) failed", filename);
+               return false;
+       }
+
+       if (loaded)
+       {
+               if (stat_buf.st_mtime != config_timestamp)
+                       do_reload();
+               return true;
+       }
+
+       loaded=open_and_load_file(reload);
+
+       if (loaded)
+               config_timestamp=stat_buf.st_mtime;
+       return loaded;
+}
+
+class courier::auth::config_file::isspace {
+
+public:
+
+       bool operator()(char c)
+       {
+               return std::isspace(c);
+       }
+};
+
+class courier::auth::config_file::not_isspace : public isspace {
+
+public:
+
+       bool operator()(char c)
+       {
+               return !isspace::operator()(c);
+       }
+};
+
+
+bool courier::auth::config_file::open_and_load_file(bool reload)
+{
+       std::ifstream f(filename);
+
+       if (!f.is_open())
+       {
+               courier_auth_err("Cannot open %s", filename);
+
+               return false;
+       }
+
+       std::string s;
+
+       bool seen_marker=false;
+
+       while (s.clear(), !std::getline(f, s).eof() || !s.empty())
+       {
+               std::string::iterator e=s.end();
+
+               std::string::iterator p=
+                       std::find_if(s.begin(), e, not_isspace());
+
+               if (p == s.end() || *p == '#')
+               {
+                       static const char marker[]="##NAME: MARKER:";
+
+                       if (s.substr(0, sizeof(marker)-1) == marker)
+                               seen_marker=true;
+                       continue;
+               }
+
+               std::string::iterator q=std::find_if(p, e, isspace());
+
+               std::string name(p, q);
+               std::string setting;
+
+               while (1)
+               {
+                       q=std::find_if(q, e, not_isspace());
+
+                       while (q != e && isspace()(e[-1]))
+                               --e;
+
+                       if (q == e)
+                               break;
+
+                       bool continuing=false;
+
+                       if (e[-1] == '\\')
+                       {
+                               continuing=true;
+                               e[-1]=' ';
+                       }
+
+                       setting.insert(setting.end(), q, e);
+
+                       if (!continuing)
+                               break;
+
+                       std::getline(f, s);
+
+                       q=s.begin();
+                       e=s.end();
+               }
+
+               parsed_config.insert(std::make_pair(name, setting));
+       }
+
+       if (!seen_marker)
+       {
+               courier_auth_err((reload
+                                 ? "marker line not found in %s will try again later"
+                                 : "marker line not found in %s (probably forgot to run sysconftool after an upgrade)"), filename);
+               return false;
+       }
+
+       return do_load();
+}
+
+bool courier::auth::config_file::getconfig(const char *name,
+                                          std::string &value,
+                                          bool required,
+                                          const char *default_value) const
+{
+       std::map<std::string, std::string>::const_iterator
+               iter=parsed_config.find(name);
+
+       if (iter != parsed_config.end())
+       {
+               value=iter->second;
+               return true;
+       }
+
+       if (required)
+       {
+               courier_auth_err("%s not found in %s",
+                                name, filename);
+               return false;
+       }
+
+       value.clear();
+       if (default_value)
+               value=default_value;
+       return true;
+}
+
+template<>
+bool courier::auth::config_file::config(const char *name,
+                                       std::string &value,
+                                       bool required,
+                                       const char *default_value) const
+{
+       return getconfig(name, value, required, default_value);
+}
+
+std::string courier::auth::config_file::config(const char *name) const
+{
+       return config(name, 0);
+}
+
+std::string courier::auth::config_file::config(const char *name,
+                                              const char *default_value) const
+{
+       std::string retval;
+
+       config(name, retval, false, default_value);
+
+       return retval;
+}
+
+std::string
+courier::auth::config_file::expand_string(const std::string &s,
+                                         const std::map<std::string,
+                                         std::string> &parameters)
+{
+       std::ostringstream o;
+
+       std::string::const_iterator b=s.begin(), e=s.end(), p;
+       std::map<std::string, std::string>::const_iterator p_iter;
+
+       while (b != e)
+       {
+               p=std::find(b, e, '$');
+
+               o << std::string(b, p);
+
+               b=p;
+
+               if (b == e)
+                       continue;
+
+               if (*++b != '(')
+               {
+                       o << '$';
+                       continue;
+               }
+
+               p=std::find(++b, e, ')');
+
+               p_iter=parameters.find(std::string(b, p));
+               b=p;
+               if (b != e)
+                       ++b;
+
+               if (p_iter != parameters.end())
+                       o << p_iter->second;
+       }
+       return o.str();
+}
+
+std::string
+courier::auth::config_file::parse_custom_query(const std::string &s,
+                                              const std::string &login,
+                                              const std::string &defdomain,
+                                              std::map<std::string,
+                                              std::string> &parameters)
+{
+
+       std::string::const_iterator b=login.begin(),
+               e=login.end(),
+               p=std::find(b, e, '@');
+
+       parameters["local_part"]=std::string(b, p);
+       parameters["domain"]=p == e ? defdomain:std::string(p+1, e);
+
+       return expand_string(s, parameters);
+}
diff --git a/authconfigfile.h b/authconfigfile.h
new file mode 100644 (file)
index 0000000..e87258c
--- /dev/null
@@ -0,0 +1,101 @@
+#ifndef authconfigfile_h
+#define authconfigfile_h
+
+#if HAVE_CONFIG_H
+#include "courier_auth_config.h"
+#endif
+
+#include <time.h>
+#if HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+#include <string>
+#include <sstream>
+#include <map>
+
+namespace courier {
+       namespace auth {
+#if 0
+       }
+}
+#endif
+
+class config_file {
+
+protected:
+       const char *filename;
+
+       std::map<std::string, std::string> parsed_config;
+private:
+       bool loaded;
+       time_t config_timestamp;
+
+public:
+       config_file(const char *filenameArg);
+       bool load(bool reload=false);
+
+private:
+       virtual bool do_load()=0;
+       virtual void do_reload()=0;
+
+       class isspace;
+       class not_isspace;
+
+       bool open_and_load_file(bool reload);
+
+ public:
+
+
+       template<typename value_type>
+               bool config(const char *name,
+                           value_type &value,
+                           bool required,
+                           const char *default_value=0)
+               const
+       {
+               std::string string_value;
+
+               if (!getconfig(name, string_value, required, default_value))
+                       return false;
+
+               std::istringstream i(string_value);
+
+               i >> value;
+               return true;
+       }
+
+       std::string config(const char *name) const;
+       std::string config(const char *name, const char *default_value) const;
+
+       bool getconfig(const char *name,
+                      std::string &value,
+                      bool required,
+                      const char *default_value=0) const;
+
+       static std::string expand_string(const std::string &s,
+                                        const std::map<std::string,
+                                        std::string> &parameters);
+
+       static std::string
+               parse_custom_query(const std::string &s,
+                                  const std::string &login,
+                                  const std::string &defdomain,
+                                  std::map<std::string,
+                                  std::string> &parameters);
+};
+
+template<>
+bool config_file::config(const char *name,
+                            std::string &value,
+                            bool required,
+                            const char *default_value) const;
+
+#if 0
+{
+       {
+#endif
+       }
+}
+
+#endif
index ff16979..48329cd 100644 (file)
@@ -14,7 +14,9 @@
 
 #include       "auth.h"
 #include       "authcustom.h"
+#include       "courierauth.h"
 #include       "courierauthstaticlist.h"
+#include       "libhmac/hmac.h"
 
 
 static int auth_custom_login(const char *service, char *authdata,
@@ -33,9 +35,6 @@ static int auth_custom_login(const char *service, char *authdata,
        return authcustomcommon(user, pass, callback_func, callback_arg);
 }
 
-#include       "libhmac/hmac.h"
-#include       "cramlib.h"
-
 static int auth_custom_cram(const char *service,
                            const char *authtype,
                            char *authdata,
index 44ad65e..3000907 100644 (file)
@@ -1,5 +1,5 @@
 /*
-** Copyright 2000-2008 Double Precision, Inc.  See COPYING for
+** Copyright 2000-2018 Double Precision, Inc.  See COPYING for
 ** distribution information.
 */
 
@@ -23,9 +23,9 @@
 #include       "authdaemonrc.h"
 #include       "courierauthdebug.h"
 #include       "pkglibdir.h"
+#include       "courierauth.h"
 #include       "courierauthstaticlist.h"
 #include        "libhmac/hmac.h"
-#include        "cramlib.h"
 #include       <ltdl.h>
 
 
@@ -56,10 +56,11 @@ struct      sockaddr_un skun;
        strcat(skun.sun_path, ".tmp");
        unlink(skun.sun_path);
        if (bind(fd, (const struct sockaddr *)&skun, sizeof(skun)) ||
-               listen(fd, SOMAXCONN) ||
-               chmod(skun.sun_path, 0777) ||
-               rename(skun.sun_path, AUTHDAEMONSOCK) ||
-               fcntl(fd, F_SETFL, O_NONBLOCK) < 0)
+           listen(fd, SOMAXCONN) ||
+           chmod(skun.sun_path, 0777) ||
+           rename(skun.sun_path, AUTHDAEMONSOCK) ||
+           fcntl(fd, F_SETFD, FD_CLOEXEC) < 0 ||
+           fcntl(fd, F_SETFL, O_NONBLOCK) < 0)
        {
                perror(AUTHDAEMONSOCK);
                close(fd);
@@ -440,9 +441,9 @@ static int printauth(struct authinfo *authinfo, void *vp)
                        return (1);
        if (authinfo->fullname)
        {
-               /* 
-                * Only the first field of the comma-seperated GECOS field is the 
-                * full username. 
+               /*
+                * Only the first field of the comma-seperated GECOS field is the
+                * full username.
                 */
                char *fullname;
                char *p;
@@ -458,7 +459,7 @@ static int printauth(struct authinfo *authinfo, void *vp)
                p = fullname;
                while (*p != ',' && *p != '\0')
                        p++;
-               *p=0; 
+               *p=0;
                retval = writeenvval(fd, "NAME", fullname);
                free(fullname);
                if(retval)
@@ -614,6 +615,7 @@ static void enumerate(int fd)
        struct authstaticinfolist *l;
 
        ei.fd=fd;
+       ei.buf_ptr=ei.buffer;
        ei.buf_left=0;
 
        for (l=modulelist; l; l=l->next)
@@ -1023,7 +1025,8 @@ int start()
                saddr_len=sizeof(saddr);
                if ((fd=accept(s, &saddr, &saddr_len)) < 0)
                        continue;
-               if (fcntl(fd, F_SETFL, 0) < 0)
+               if (fcntl(fd, F_SETFL, 0) < 0 ||
+                   fcntl(fd, F_SETFD, FD_CLOEXEC) < 0)
                {
                        perror("CRIT: fcntl() failed");
                }
@@ -1032,18 +1035,3 @@ int start()
                close(fd);
        }
 }
-
-int main(int argc, char **argv)
-{
-       courier_authdebug_login_init();
-
-       if (argc > 1)
-       {
-               fprintf(stderr, "Error: authdaemond no longer handles its own daemonizing.\n"
-                       "Use new startup script.\n");
-               exit(1);
-       }
-
-       start();
-       return (0);
-}
diff --git a/authdaemondcpp.cpp b/authdaemondcpp.cpp
new file mode 100644 (file)
index 0000000..4d7f8d7
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+** Copyright 2016 Double Precision, Inc.  See COPYING for
+** distribution information.
+*/
+
+#include <iostream>
+#include <stdlib.h>
+
+extern "C" {
+
+#include "courierauthdebug.h"
+
+       int start();
+};
+
+int main(int argc, char **argv)
+{
+       courier_authdebug_login_init();
+
+       if (argc > 1)
+       {
+               std::cerr <<
+                       "Error: authdaemond no longer handles its own daemonizing."
+                         << std::endl
+                         << "Use new startup script." << std::endl;
+               exit(1);
+       }
+
+       start();
+       return (0);
+}
index 7d81ef4..19e8506 100644 (file)
@@ -1,4 +1,4 @@
-##VERSION: $Id: 7b218a8185f424046f3ef3322a37443983e443e3-20150228120722$
+##VERSION: $Id: 7b218a8185f424046f3ef3322a37443983e443e3-20160104202005$
 #
 # Copyright 2000-2005 Double Precision, Inc.  See COPYING for
 # distribution information.
diff --git a/authgetconfig.c b/authgetconfig.c
deleted file mode 100644 (file)
index 0156797..0000000
+++ /dev/null
@@ -1,446 +0,0 @@
-/*
-** Copyright 2012-2015 Double Precision, Inc.  See COPYING for
-** distribution information.
-*/
-
-#if    HAVE_CONFIG_H
-#include       "courier_auth_config.h"
-#endif
-#include       "auth.h"
-#include       "courierauthdebug.h"
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-static const char *configfilename=0;
-static char *configauth=0;
-static size_t configauth_size=0;
-
-#define err courier_auth_err
-
-const char *authgetconfig(const char *filename, const char *env)
-{
-       size_t  i;
-       char    *p=0;
-       int     l=strlen(env);
-
-       if (configfilename && strcmp(filename, configfilename))
-       {
-               if (configauth)
-                       free(configauth);
-               configauth=0;
-               configauth_size=0;
-       }
-
-       configfilename=filename;
-
-       if (!configauth)
-       {
-               FILE    *f=fopen(filename, "r");
-               struct  stat    buf;
-
-               if (!f) return (0);
-               if (fstat(fileno(f), &buf) ||
-                       (configauth=malloc(buf.st_size+2)) == 0)
-               {
-                       fclose(f);
-                       return (0);
-               }
-               if (fread(configauth, buf.st_size, 1, f) != 1)
-               {
-                       free(configauth);
-                       configauth=0;
-                       fclose(f);
-                       return (0);
-               }
-               configauth[configauth_size=buf.st_size]=0;
-
-               for (i=0; i<configauth_size; i++)
-                       if (configauth[i] == '\n')
-                       {       /* siefca@pld.org.pl */
-                               if (!i || configauth[i-1] != '\\')
-                               {
-                                       configauth[i]='\0';
-                               }
-                               else
-                               {
-                                       configauth[i]=configauth[i-1]= ' ';
-                               }
-                       }
-               fclose(f);
-       }
-
-       for (i=0; i<configauth_size; )
-       {
-               p=configauth+i;
-               if (strncmp(p, env, l) == 0 &&
-                       isspace((int)(unsigned char)p[l]))
-               {
-                       p += l;
-                       while (*p && *p != '\n' &&
-                               isspace((int)(unsigned char)*p))
-                               ++p;
-                       break;
-               }
-
-               while (i < configauth_size)
-                       if (configauth[i++] == 0)       break;
-       }
-
-       if (i < configauth_size)
-               return (p);
-       return (0);
-}
-
-/* siefca@pld.org.pl */
-#define                MAX_SUBSTITUTION_LEN    32
-#define                SV_BEGIN_MARK           "$("
-#define                SV_END_MARK             ")"
-#define                SV_BEGIN_LEN            ((sizeof(SV_BEGIN_MARK))-1)
-#define                SV_END_LEN              ((sizeof(SV_END_MARK))-1)
-
-/* siefca@pld.org.pl */
-struct var_data {
-       const char *name;
-       const char *value;
-       const size_t size;
-       size_t value_length;
-       } ;
-
-/* siefca@pld.org.pl */
-typedef int (*parsefunc)(const char *, size_t, void *);
-
-/* siefca@pld.org.pl */
-static struct var_data *get_variable (const char *begin, size_t len,
-                                     struct var_data *vdt)
-{
-struct var_data *vdp;
-
-       if (!begin || !vdt) /* should never happend */
-       {
-               err("get_variable: critical error while "
-                                "parsing substitution variable");
-               return NULL;
-       }
-       if (len < 1)
-       {
-               err("get_variable: unknown empty substitution "
-                                "variable - aborting");
-               return NULL;
-       }
-       if (len > MAX_SUBSTITUTION_LEN)
-       {
-               err("get_variable: variable name too long "
-                                "while parsing substitution. "
-                                "name begins with "
-                                SV_BEGIN_MARK
-                                "%.*s...", MAX_SUBSTITUTION_LEN, begin);
-               return NULL;
-       }
-
-       for (vdp=vdt; vdp->name; vdp++)
-               if (vdp->size == len+1 &&
-                   !strncmp(begin, vdp->name, len))
-               {
-                       if (!vdp->value)
-                               vdp->value = "";
-                       if (!vdp->value_length)         /* length cache */
-                               vdp->value_length = strlen (vdp->value);
-                       return vdp;
-               }
-
-       err("get_variable: unknown substitution variable "
-                        SV_BEGIN_MARK
-                        "%.*s"
-                        SV_END_MARK
-                        , (int)len, begin);
-
-       return NULL;
-}
-
-/* siefca@pld.org.pl */
-static int ParsePlugin_counter (const char *p, size_t length, void *vp)
-{
-       if (!p || !vp || length < 0)
-       {
-               err("get_variable: bad arguments while counting "
-                                "query string");
-               return -1;
-       }
-
-       *((size_t *)vp) += length;
-
-       return 0;
-}
-
-/* siefca@pld.org.pl */
-static int ParsePlugin_builder (const char *p, size_t length, void *vp)
-{
-char   **strptr = (char **) vp;
-
-       if (!p || !vp || length < 0)
-       {
-               err("get_variable: bad arguments while building "
-                                "query string");
-               return -1;
-       }
-
-       if (!length) return 0;
-       memcpy ((void *) *strptr, (void *) p, length);
-       *strptr += length;
-
-       return 0;
-}
-
-/* siefca@pld.org.pl */
-static int parse_core  (const char *source, struct var_data *vdt,
-                       parsefunc outfn, void *result)
-{
-size_t v_size          = 0,
-       t_size          = 0;
-const char     *p, *q, *e,
-               *v_begin, *v_end,
-               *t_begin, *t_end;
-struct var_data        *v_ptr;
-
-       if (!source)
-               source = "";
-       if (!result)
-       {
-               err("auth_parse: no memory allocated for result "
-                                "while parser core was invoked");
-               return -1;
-       }
-       if (!vdt)
-       {
-               err("auth_parse: no substitution table found "
-                                "while parser core was invoked");
-               return -1;
-       }
-
-       q = source;
-       while ( (p=strstr(q, SV_BEGIN_MARK)) )
-       {
-               e = strstr (p, SV_END_MARK);
-               if (!e)
-               {
-                       err("auth_parse: syntax error in "
-                                        "substitution "
-                                        "- no closing symbol found! "
-                                        "bad variable begins with:"
-                                        "%.*s...", MAX_SUBSTITUTION_LEN, p);
-                       return -1;
-               }
-
-               /*
-                **
-                **          __________sometext$(variable_name)_________
-                **                    |      |  |           |
-                **             t_begin' t_end'  `v_begin    `v_end
-                **
-                 */
-
-               v_begin = p+SV_BEGIN_LEN; /* variable field ptr             */
-               v_end   = e-SV_END_LEN;   /* variable field last character  */
-               v_size  = v_end-v_begin+1;/* variable field length          */
-
-               t_begin = q;              /* text field ptr                 */
-               t_end   = p-1;            /* text field last character      */
-               t_size  = t_end-t_begin+1;/* text field length              */
-
-               /* work on text */
-               if ( (outfn (t_begin, t_size, result)) == -1 )
-                       return -1;
-
-               /* work on variable */
-               v_ptr = get_variable (v_begin, v_size, vdt);
-               if (!v_ptr) return -1;
-
-               if ( (outfn (v_ptr->value, v_ptr->value_length, result)) == -1 )
-                       return -1;
-
-               q = e + 1;
-       }
-
-       /* work on last part of text if any */
-       if (*q != '\0')
-               if ( (outfn (q, strlen(q), result)) == -1 )
-                       return -1;
-
-       return 0;
-}
-
-/* siefca@pld.org.pl */
-static char *parse_string (const char *source, struct var_data *vdt)
-{
-struct var_data *vdp   = NULL;
-char   *output_buf     = NULL,
-       *pass_buf       = NULL;
-size_t buf_size        = 2;
-
-       if (source == NULL || *source == '\0' ||
-           vdt == NULL    || vdt[0].name == NULL)
-       {
-               err("auth_parse: source clause is empty "
-                      "- this is critical error");
-               return NULL;
-       }
-
-       /* zero var_data length cache - important! */
-       for (vdp=vdt; vdp->name; vdp++)
-               vdp->value_length = 0;
-
-
-       /* phase 1 - count and validate string */
-       if ( (parse_core (source, vdt, &ParsePlugin_counter, &buf_size)) != 0)
-               return NULL;
-
-       /* phase 2 - allocate memory */
-       output_buf = malloc (buf_size);
-       if (!output_buf)
-       {
-               perror ("malloc");
-               return NULL;
-       }
-       pass_buf = output_buf;
-
-       /* phase 3 - build the output string */
-       if ( (parse_core (source, vdt, &ParsePlugin_builder, &pass_buf)) != 0)
-       {
-               free (output_buf);
-               return NULL;
-       }
-       *pass_buf = '\0';
-
-       return output_buf;
-}
-
-static char *local_part_escaped(const char *username,
-                               char *(*escape_func)(const char *, size_t))
-{
-       const char *p=strchr(username, '@');
-       size_t n=p ? p-username:strlen(username);
-
-       return escape_func(username, n);
-}
-
-static char *domain_part_escaped(const char *username,
-                                const char *defdomain,
-                                char *(*escape_func)(const char *, size_t))
-{
-       const char *p=strchr(username, '@');
-       size_t n;
-
-       if (p)
-               ++p;
-       else
-               p=defdomain;
-
-       n=strlen(p);
-
-       return escape_func(p, n);
-}
-
-static int local_and_domain_part_escaped(char *(*escape_func)(const char *, size_t),
-                                        const char *username,
-                                        const char *defdomain,
-                                        char **local_ret,
-                                        char **domain_ret)
-{
-       if ((*local_ret=local_part_escaped(username, escape_func)) == NULL)
-               return 0;
-
-       if ((*domain_ret=domain_part_escaped(username, defdomain,
-                                            escape_func)) == NULL)
-       {
-               free(*local_ret);
-               return 0;
-       }
-
-       return 1;
-}
-
-/* siefca@pld.org.pl */
-char *auth_parse_select_clause (char *(*escape_func)(const char *, size_t),
-                               const char *clause, const char *username,
-                               const char *defdomain,
-                               const char *service)
-{
-       char *str;
-
-       static struct var_data vd[]={
-               {"local_part",  NULL,   sizeof("local_part"),   0},
-               {"domain",              NULL,   sizeof("domain"),       0},
-               {"service",             NULL,   sizeof("service"),      0},
-               {NULL,          NULL,   0,                      0}};
-
-       char *l_part;
-       char *d_part;
-
-       if (clause == NULL || *clause == '\0' ||
-           !username || *username == '\0')
-               return NULL;
-
-       if (!local_and_domain_part_escaped(escape_func,
-                                          username, defdomain,
-                                          &l_part, &d_part))
-               return NULL;
-
-       vd[0].value=l_part;
-       vd[1].value=d_part;
-       vd[2].value     = service;
-
-       str=parse_string (clause, vd);
-       free(l_part);
-       free(d_part);
-       return str;
-}
-
-/* siefca@pld.org.pl */
-char *auth_parse_chpass_clause (char *(*escape_func)(const char *, size_t),
-                               const char *clause, const char *username,
-                               const char *defdomain, const char *newpass,
-                               const char *newpass_crypt)
-{
-       char *str;
-
-       static struct var_data vd[]={
-               {"local_part",  NULL,   sizeof("local_part"),           0},
-               {"domain",      NULL,   sizeof("domain"),               0},
-               {"newpass",     NULL,   sizeof("newpass"),              0},
-               {"newpass_crypt", NULL, sizeof("newpass_crypt"),        0},
-               {NULL,          NULL,   0,                              0}};
-       char *l_part;
-       char *d_part;
-
-       if (clause == NULL || *clause == '\0'           ||
-           !username || *username == '\0'              ||
-           !newpass || *newpass == '\0'                ||
-           !newpass_crypt || *newpass_crypt == '\0')   return NULL;
-
-       if (!local_and_domain_part_escaped(escape_func,
-                                          username, defdomain,
-                                          &l_part, &d_part))
-               return NULL;
-
-       vd[0].value=l_part;
-       vd[1].value=d_part;
-       vd[2].value     = newpass;
-       vd[3].value     = newpass_crypt;
-
-       if (!vd[0].value || !vd[1].value ||
-           !vd[2].value || !vd[3].value)
-       {
-               free(l_part);
-               free(d_part);
-               return NULL;
-       }
-
-       str=parse_string (clause, vd);
-       free(l_part);
-       free(d_part);
-       return str;
-}
index 37323f0..d69cde1 100644 (file)
 
 #include       "auth.h"
 #include       "authldap.h"
+#include       "courierauth.h"
 #include       "courierauthstaticlist.h"
 #include       "courierauthdebug.h"
-
-
-extern void auth_ldap_enumerate( void(*cb_func)(const char *name,
-                                               uid_t uid,
-                                               gid_t gid,
-                                               const char *homedir,
-                                               const char *maildir,
-                                               const char *options,
-                                               void *void_arg),
-                                void *void_arg);
+#include       "libhmac/hmac.h"
 
 static int auth_ldap_login(const char *service, char *authdata,
                           int (*callback_func)(struct authinfo *, void *),
@@ -45,9 +37,6 @@ static int auth_ldap_login(const char *service, char *authdata,
                              callback_arg);
 }
 
-#include       "libhmac/hmac.h"
-#include       "cramlib.h"
-
 static int auth_ldap_cram(const char *service,
                          const char *authtype, char *authdata,
                          int (*callback_func)(struct authinfo *, void *),
@@ -81,9 +70,6 @@ extern int auth_ldap_pre(const char *userid, const char *service,
         int (*callback)(struct authinfo *, void *),
                  void *arg);
 
-extern int auth_ldap_changepw(const char *, const char *, const char *,
-                             const char *);
-
 static struct authstaticinfo authldap_info={
        "authldap",
        auth_ldap,
index 534f8d4..ba18b48 100644 (file)
@@ -21,4 +21,17 @@ int authldapcommon(const char *, const char *,
 
 void authldapclose();
 
+void auth_ldap_enumerate( void(*cb_func)(const char *name,
+                                        uid_t uid,
+                                        gid_t gid,
+                                        const char *homedir,
+                                        const char *maildir,
+                                        const char *options,
+                                               void *void_arg),
+                         void *void_arg);
+
+int auth_ldap_changepw(const char *, const char *, const char *,
+                      const char *);
+
+
 #endif
diff --git a/authldaplib.c b/authldaplib.c
deleted file mode 100644 (file)
index 39b0245..0000000
+++ /dev/null
@@ -1,2067 +0,0 @@
-/*
- * authldap.c - 
- *
- * courier-imap - 
- * 
- * Copyright 1999 Luc Saillard <luc.saillard@alcove.fr>.
- *
- * This module use a server LDAP to authenticate user.
- * See the README.ldap
- *
- * 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 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
- *
- * See the GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301, USA.
- */
-
-/*
- * Modified 28/11/2001 Iustin Pop <iusty@intensit.de>
- * There was a bug regarding the LDAP_TLS option: if both LDAP_TLS
- * and was LDAP_AUTHBIND were enabled, the ldap_start_tls function
- * was called only for the first connection, resulting in the fact
- * that the bind for checking the password was done without TLS,
- * sending the password in clear text over the network. Detected 
- * when using OpenLDAP with "security ssf=128" (which disalows any 
- * clear-text communication).
-*/
-
-/*
-   Modified 01/21/2000 James Golovich <james@wwnet.net>
-
-1. If LDAP_AUTHBIND is set in the config file, then the ldap server will
-handle passwords via authenticated binds, instead of checking these
-internally.
-2. Changed paramaters for authldap_get to include pass.
-
-*/
-
-/*
-   Modified 12/31/99 Sam Varshavchik:
-
-1. read_env reads from a configuration file, instead of the environment
-2. read_config appropriately modified.
-3. If 'user' contains the @ character, domain from config is NOT appended.
-4. added 'homeDir' attribute.  Use 'homeDir' instead of mailDir, and put
-   mailDir into MAILDIR=
-5. read_config renamed to authldap_read_config
-6. get_user_info renamed to authldap_get
-7. Added authldap_free_config, to clean up all the allocated memory
-   (required for preauthldap).
-8. Output LDAP attributes are defined in the configuration file as well.
-9. Allow both plaintext and crypted passwords to be read from LDAP.
-10. Added GLOB_UID GLOB_GID, as well as UID and GID params.
-
-2/19/2000 Sam.
-
-Rewrite to allow this code to be used in a long-running authentication daemon
-(for Courier).  authldap_get renamed to authldapcommon, will initialize and
-maintain a persistent connection.  Password checking moved entirely to
-authldap.c.  authldapclose() will unbind and close the connection.
-
-connection gets closed and reopened automatically after a protocol error.
-
-error return from authldapcommon will indicate whether this is a transient,
-or a permanent failure.
-
-authldap_free_config removed - no longer required.
-
-*/
-
-#if HAVE_CONFIG_H
-#include "courier_auth_config.h"
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <string.h>
-#include <errno.h>
-#include <pwd.h>
-#include <grp.h>
-#include <time.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if HAVE_LBER_H
-#include <lber.h>
-#endif
-#if HAVE_LDAP_H
-#include <ldap.h>
-#if LDAP_VENDOR_VERSION > 20000
-#define OPENLDAPV2
-#endif
-#endif
-#if HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#if HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-
-#include "authldap.h"
-#include "auth.h"
-#include "authldaprc.h"
-#include "courierauthdebug.h"
-
-#define err courier_auth_err
-
-#ifndef DEBUG_LDAP
-#define DEBUG_LDAP 0
-#endif
-
-#ifndef        LDAP_OPT_SUCCESS
-#define LDAP_OPT_SUCCESS LDAP_SUCCESS
-#endif
-
-static char **l_get_values(LDAP *ld, LDAPMessage *entry, const char *attribut)
-{
-       struct berval **p=ldap_get_values_len(ld, entry, attribut);
-       int i, n;
-       char **a;
-
-       if (!p)
-               return NULL;
-
-       n=ldap_count_values_len(p);
-
-
-       a=malloc((n + 1) * sizeof(char *));
-
-       if (!a)
-       {
-               DPRINTF("malloc failed");
-               ldap_value_free_len(p);
-               return NULL;
-       }
-
-       for (i=0; i<n; i++)
-       {
-               if ((a[i]=malloc(p[i]->bv_len+1)) == NULL)
-               {
-                       DPRINTF("malloc failed");
-                       while (i--)
-                       {
-                               free(a[i]);
-                       }
-                       free(a);
-                       ldap_value_free_len(p);
-                       return NULL;
-               }
-
-               memcpy(a[i], p[i]->bv_val, p[i]->bv_len);
-               a[i][p[i]->bv_len]=0;
-       }
-
-       ldap_value_free_len(p);
-       a[i]=NULL;
-       return a;
-}
-
-static void l_value_free(char **p)
-{
-       int i;
-
-       for (i=0; p[i]; ++i)
-               free(p[i]);
-       free(p);
-}
-
-static int l_count_values(char **p)
-{
-       int i;
-
-       for (i=0; p[i]; ++i)
-               ;
-       return i;
-}
-
-static int l_unbind(LDAP *ld)
-{
-       return ldap_unbind_ext(ld, NULL, NULL);
-}
-
-static int l_simple_bind_s(LDAP *ld,
-                          const char *who,
-                          const char *passwd)
-{
-       struct berval cred;
-
-       cred.bv_len=passwd ? strlen(passwd):0;
-       cred.bv_val=(char *)passwd;
-
-       return ldap_sasl_bind_s(ld, who, NULL, &cred, NULL, NULL, NULL);
-}
-
-static int l_search_st(LDAP *ld,
-                      const char *base,
-                      int scope,
-                      const char *filter,
-                      char **attrs,
-                      int attrsonly,
-                      struct timeval *timeout,
-                      LDAPMessage **res)
-{
-       return ldap_search_ext_s(ld, base, scope, filter, attrs,
-                                attrsonly,
-                                NULL, NULL,
-                                timeout,
-                                100,
-                                res);
-}
-
-static int l_modify_s(LDAP *ld,
-                     const char *dn,
-                     LDAPMod **mods)
-{
-       return ldap_modify_ext_s(ld, dn, mods, NULL, NULL);
-}
-
-static int l_search(LDAP *ld,
-                   const char *base,
-                   int scope,
-                   const char *filter,
-                   char **attrs,
-                   int attrsonly)
-{
-       struct timeval tv;
-       int msgid;
-
-       tv.tv_sec=60*60;
-       tv.tv_usec=0;
-
-       if (ldap_search_ext(ld, base, scope, filter, attrs, attrsonly,
-                           NULL, NULL, &tv, 1000000, &msgid) !=
-           LDAP_SUCCESS)
-               return -1;
-
-       return msgid;
-}
-
-struct ldap_info
-{
-       const char *uri;
-       const char *binddn;
-       const char *bindpw;
-       const char *basedn;
-       const char *mail;
-        const char *filter;
-        const char *enumerate_filter;
-       const char *domain;
-
-       uid_t uid;
-       gid_t gid;
-       int   timeout;
-       int   authbind;
-        int   initbind;
-       int   deref;
-       int   protocol_version;
-       int   tls;
-
-       const char *mailroot;
-
-       char **auxoptions;
-       char **auxnames;
-       const char **attrlist;
-
-       /* Optional emailmap to handle */
-
-       const char *emailmap;
-       const char *emailmap_basedn;
-       const char *emailmap_handle;
-       const char *emailmap_handle_lookup;
-};
-
-/*
-** There's a memory leak in OpenLDAP 1.2.11, presumably in earlier versions
-** too.  See http://www.OpenLDAP.org/its/index.cgi?findid=864 for more
-** information.  To work around the bug, the first time a connection fails
-** we stop trying for 60 seconds.  After 60 seconds we kill the process,
-** and let the parent process restart it.
-**
-** We'll control this behavior via LDAP_MEMORY_LEAK.  Set it to ZERO to turn
-** off this behavior (whenever OpenLDAP gets fixed).
-*/
-
-static time_t ldapfailflag=0;
-
-static void ldapconnfailure()
-{
-       const char *p=getenv("LDAP_MEMORY_LEAK");
-
-       if (!p)
-       {
-#ifdef LDAP_VENDOR_NAME
-#ifdef LDAP_VENDOR_VERSION
-#define DO_OPENLDAP_CHECK
-#endif
-#endif
-
-#ifdef DO_OPENLDAP_CHECK
-
-               /* It's supposed to be fixed in 20019 */
-
-               if (strcmp(LDAP_VENDOR_NAME, "OpenLDAP") == 0 &&
-                   LDAP_VENDOR_VERSION < 20019)
-                       p="1";
-               else
-                       p="0";
-#else
-               p="0";
-#endif
-       }
-
-       if (atoi(p) && !ldapfailflag)
-       {
-               time(&ldapfailflag);
-               ldapfailflag += 60;
-       }
-}
-
-static int ldapconncheck()
-{
-       time_t t;
-
-       if (!ldapfailflag)
-               return (0);
-
-       time(&t);
-
-       if (t >= ldapfailflag)
-               exit(0);
-       return (1);
-}
-
-static int read_env(const char *env, const char **copy,
-       const char *errstr, int needit, const char *value_default);
-static void copy_value(LDAP *ld, LDAPMessage *entry, const char *attribut,
-       char **copy, const char *username);
-
-/*
- * Function: read_env
- * Copy the environnement $env and copy to $copy if not null
- * if needit is false, and env doesn't exist, copy $value_default to $copy
- * INPUT:
- *   $env: pointer to the environnement name
- *   $copy: where the value go
- *   $err: print a nice message when $env not_found and $needit is true
- *   $needit: if $needit is true and $value not found, return a error
- *   $value_default: the default value when $needit is false and $env doesn't exists
- * OUTPUT:
- *   boolean
- */
-static int read_env(const char *env, const char **copy,
-       const char *errstr, int needit, const char *value_default)
-{
-static char *ldapauth=0;
-static size_t ldapauth_size=0;
-size_t i;
-char   *p=0;
-int    l=strlen(env);
-
-       if (!ldapauth)
-       {
-       FILE    *f=fopen(AUTHLDAPRC, "r");
-       struct  stat    buf;
-
-               if (!f) return (0);
-               if (fstat(fileno(f), &buf) ||
-                       (ldapauth=malloc(buf.st_size+2)) == 0)
-               {
-                       fclose(f);
-                       return (0);
-               }
-               if (fread(ldapauth, buf.st_size, 1, f) != 1)
-               {
-                       free(ldapauth);
-                       ldapauth=0;
-                       fclose(f);
-                       return (0);
-               }
-               ldapauth[ldapauth_size=buf.st_size]=0;
-
-               for (i=0; i<ldapauth_size; i++)
-                       if (ldapauth[i] == '\n')
-                               ldapauth[i]=0;
-               fclose(f);
-       }
-
-       for (i=0; i<ldapauth_size; )
-       {
-               p=ldapauth+i;
-               if (memcmp(p, env, l) == 0 &&
-                       isspace((int)(unsigned char)p[l]))
-               {
-                       p += l;
-                       while (*p && *p != '\n' &&
-                               isspace((int)(unsigned char)*p))
-                               ++p;
-                       break;
-               }
-
-               while (i < ldapauth_size)
-                       if (ldapauth[i++] == 0) break;
-       }
-
-       if (i < ldapauth_size)
-       {
-               *copy= p;
-               return (1);
-       }
-
-       if (needit)
-       {
-               err("%s", errstr);
-               return 0;
-       }
-
-       *copy=0;
-       if (value_default)
-               *copy=value_default;
-
-       return 1;
-}
-
-/*
- * Function: authldap_read_config
- *   Read Configuration from the environnement table
- * INPUT:
- *   $ldap: a structure where we place information
- * OUTPUT:
- *   boolean
- */
-static int authldap_read_config(struct ldap_info *ldap)
-{
-       struct passwd *pwent;
-       struct group  *grent;
-       const char *p;
-       size_t i, pass;
-
-       for (i=0; ldap->auxoptions && ldap->auxoptions[i]; i++)
-               free(ldap->auxoptions[i]);
-       for (i=0; ldap->auxnames && ldap->auxnames[i]; i++)
-               free(ldap->auxnames[i]);
-
-       if (ldap->attrlist)
-               free(ldap->attrlist);
-       if (ldap->auxnames)
-               free(ldap->auxnames);
-       if (ldap->auxoptions)
-               free(ldap->auxoptions);
-
-       memset(ldap,0,sizeof(struct ldap_info));
-       
-       if (!read_env("LDAP_URI",&ldap->uri,
-                     "You need to specify LDAP_URI in config file",1,NULL))
-               return 0;
-
-       if (!read_env("LDAP_AUTHBIND", &p, "", 0, ""))
-               return (0);
-
-       if (p)
-               sscanf(p,"%d",&ldap->authbind);
-
-       if (!read_env("LDAP_INITBIND", &p, "", 0, "1"))
-               return (0);
-
-       if (p)
-               sscanf(p,"%d",&ldap->initbind);
-
-       if (!read_env("LDAP_BASEDN",&ldap->basedn,
-                     "You need to specify a basedn in config file",1,NULL))
-               return 0;
-       if (!read_env("LDAP_BINDDN",&ldap->binddn,
-                     "You need to specify a BINDDN in config file",0,NULL))
-               return 0;
-       if (!read_env("LDAP_BINDPW",&ldap->bindpw,
-                     "You need to specify a password for the BINDDN in config file",0,NULL))
-               return 0;
-       if (!read_env("LDAP_MAIL",&ldap->mail,
-                     "You need to specify a attribute for mail in config file",0,"mail"))
-               return 0;
-       if (!read_env("LDAP_DOMAIN",&ldap->domain,
-                     "You need to specify a domain for mail in config file",0,""))
-               return 0;
-
-       p=0;
-       ldap->uid=0;
-       if (!read_env("LDAP_GLOB_UID", &p, "", 0, ""))
-               return (0);
-
-       if (p && *p)
-       {
-               unsigned long n;
-
-               if (sscanf(p, "%lu", &n) == 1)
-                       ldap->uid=(uid_t)n;
-               else
-               {
-                       pwent=getpwnam(p);
-                       if (!pwent)
-                       {
-                               err("authldap: INVALID LDAP_GLOB_UID");
-                               return (0);
-                       }
-                       ldap->uid=pwent->pw_uid;
-               }
-       }
-
-       ldap->gid=0;
-       p=0;
-       if (!read_env("LDAP_GLOB_GID", &p, "", 0, ""))
-               return (0);
-
-       if (p && *p)
-       {
-               unsigned long n;
-
-               if (sscanf(p, "%lu", &n) == 1)
-                       ldap->gid=(gid_t)n;
-               else
-               {
-                       grent=getgrnam(p);
-                       if (!grent)
-                       {
-                               err("authldap: INVALID LDAP_GLOB_GID");
-                               return (0);
-                       }
-                       ldap->gid=grent->gr_gid;
-               }
-       }
-
-       ldap->timeout=5;
-       p=0;
-       if (read_env("LDAP_TIMEOUT", &p, "", 0, "") && p)
-       {
-               sscanf(p,"%d",&ldap->timeout);
-       }
-
-       ldap->tls=0;
-       p=0;
-       if (read_env("LDAP_TLS", &p, "", 0, "") && p)
-       {
-               ldap->tls=atoi(p);
-       }
-
-       ldap->filter=0;
-       p=0;
-       if (read_env("LDAP_FILTER", &p, "", 0, "") && p && strlen (p))
-       {
-               ldap->filter=p;
-       }
-
-       ldap->enumerate_filter=0;
-       p=0;
-       if (read_env("LDAP_ENUMERATE_FILTER", &p, "", 0, "") && p && strlen (p))
-       {
-               ldap->enumerate_filter=p;
-       }
-       else if (ldap->filter)
-       {
-               ldap->enumerate_filter=ldap->filter;
-       }
-       else
-       {
-               ldap->enumerate_filter = malloc(strlen(ldap->mail)+3);
-               if (!ldap->enumerate_filter)
-               {
-                       perror("CRIT: authldap: malloc failed");
-                       return 0;
-               }
-               sprintf((char *)ldap->enumerate_filter, "%s=*", ldap->mail);
-       }
-
-       ldap->deref = LDAP_DEREF_NEVER; 
-       ldap->protocol_version = 0;     /* use API default */
-       p=0;
-       if (!read_env("LDAP_DEREF", &p, "", 0, ""))
-               return (0);
-       if (p)
-       {
-#ifndef LDAP_OPT_DEREF
-               err("authldaplib: LDAP_OPT_DEREF not available, ignored");
-#endif
-               if (!strcasecmp (p, "never"))
-                       ldap->deref = LDAP_DEREF_NEVER;
-               else if (!strcasecmp (p, "searching"))
-                       ldap->deref = LDAP_DEREF_SEARCHING;
-               else if (!strcasecmp (p, "finding"))
-                       ldap->deref = LDAP_DEREF_FINDING;
-               else if (!strcasecmp (p, "always"))
-                       ldap->deref = LDAP_DEREF_ALWAYS; 
-       }
-
-       if (!read_env("LDAP_PROTOCOL_VERSION", &p, 0, 0, 0))
-               return (0);
-       if (p)
-       {
-       int lpv = atoi(p);
-#ifndef LDAP_OPT_PROTOCOL_VERSION
-               err("authldaplib: LDAP_OPT_PROTOCOL_VERSION not available, ignored");
-#endif
-               if (lpv == 0
-#ifdef LDAP_VERSION_MIN
-                       || lpv < LDAP_VERSION_MIN
-#endif
-#ifdef LDAP_VERSION_MAX
-                       || lpv > LDAP_VERSION_MAX
-#endif
-               )
-                       err("authldaplib: illegal protocol version ignored");
-               else
-                       ldap->protocol_version = lpv;
-       }
-
-       if (!read_env("LDAP_MAILROOT",&ldap->mailroot,"",0,NULL)
-           || ldap->mailroot == NULL || ldap->mailroot[0] == 0)
-               ldap->mailroot=NULL;
-
-       if (!read_env("LDAP_EMAILMAP", &ldap->emailmap, "", 0, "") ||
-           !read_env("LDAP_EMAILMAP_BASEDN", &ldap->emailmap_basedn, "", 0, "") ||
-           !read_env("LDAP_EMAILMAP_ATTRIBUTE", &ldap->emailmap_handle, "", 0, "")||
-           !read_env("LDAP_EMAILMAP_MAIL",
-                     &ldap->emailmap_handle_lookup, "", 0, ""))
-               return (0);
-
-
-       for (pass=0; pass<2; pass++)
-       {
-               if (pass)
-               {
-                       if ((ldap->auxnames=malloc((i+1)*sizeof(char *)))
-                           == NULL ||
-                           (ldap->auxoptions=malloc((i+1)*sizeof(char *)))
-                           == NULL)
-                       {
-                               perror("CRIT: authldap: malloc failed");
-                               if (ldap->auxnames)
-                                       ldap->auxnames[0]=0;
-                               return 0;
-                       }
-               }
-               i=0;
-
-               if (pass)
-               {
-                       ldap->auxnames[0]=NULL;
-                       ldap->auxoptions[0]=NULL;
-               }
-
-               if (!read_env("LDAP_AUXOPTIONS", &p, "", 0, NULL)
-                   || p == NULL || *p == 0)
-                       p=NULL;
-
-               while (p && *p)
-               {
-                       size_t n;
-
-                       if (*p == ',')
-                       {
-                               ++p;
-                               continue;
-                       }
-
-                       for (n=0; p[n] && p[n] != ',' && p[n] != '='; n++)
-                               ;
-
-                       if (pass)
-                       {
-                               if ((ldap->auxoptions[i]=malloc(n+1)) == NULL)
-                               {
-                                       perror("CRIT: authldap: malloc failed");
-                                       return 0;
-                               }
-
-                               memcpy(ldap->auxoptions[i], p, n);
-                               ldap->auxoptions[i][n]=0;
-                               ldap->auxoptions[i+1]=NULL;
-                       }
-
-                       p += n;
-
-                       if (*p == '=') ++p;
-
-                       for (n=0; p[n] && p[n] != ','; n++)
-                               ;
-
-                       if (pass)
-                       {
-                               if (n == 0)
-                               {
-                                       if ((ldap->auxnames[i]=
-                                            strdup(ldap->auxoptions[i]))
-                                           == NULL)
-                                       {
-                                               perror("CRIT: authldap: malloc failed");
-                                               return 0;
-                                       }
-                               }
-                               else if ((ldap->auxnames[i]=malloc(n+1)) == NULL)
-                               {
-                                       perror("CRIT: authldap: malloc failed");
-                                       return 0;
-                               }
-                               else
-                               {
-                                       memcpy(ldap->auxnames[i], p, n);
-                                       ldap->auxnames[i][n]=0;
-                                       ldap->auxnames[i+1]=NULL;
-                               }
-                       }
-                       p += n;
-                       ++i;
-               }
-       }
-
-       if ((ldap->attrlist=malloc((i+20)*sizeof(const char *))) == NULL)
-       {
-               perror("CRIT: authldap: malloc failed");
-               return 0;
-       }
-
-       return 1;
-}
-
-static void get_error(LDAP *ld, LDAPMessage *entry,
-                     const char *func,
-                     const char *attribut)
-{
-#if HAVE_LDAP_PARSE_RESULT
-
-       int errcode;
-       char *nmatched;
-       char *errmsg;
-               
-
-       if (ldap_parse_result(ld, entry, &errcode, &nmatched,
-                             &errmsg, NULL, NULL, 0)
-           != LDAP_SUCCESS)
-       {
-               DPRINTF("ldap_parseresult failed");
-       }
-       else
-       {
-               if (errcode && errcode != LDAP_DECODING_ERROR &&
-                   errcode != LDAP_NO_RESULTS_RETURNED)
-               {
-                       DPRINTF("get_values attribute %s: %s",
-                               attribut,
-                               errmsg ? errmsg:"unknown error");
-               }
-
-               if (errmsg)
-                       ldap_memfree(errmsg);
-               if (nmatched)
-                       ldap_memfree(nmatched);
-       }
-#else
-#if HAVE_LDAP_RESULT2ERROR
-       int ld_errno = ldap_result2error(ld,entry,0);
-       if (ld_errno && ld_errno != LDAP_DECODING_ERROR
-           && ld_errno != LDAP_NO_RESULTS_RETURNED)
-       {
-               DPRINTF("get_values attribute %s: %s", attribut,
-                       ldap_err2string(ld_errno));
-       }
-#else
-       if (ld->ld_errno != LDAP_DECODING_ERROR
-           && ld->ld_errno != LDAP_NO_RESULTS_RETURNED)
-       {
-               DPRINTF("get_values attribute %s: %s", attribut,
-                       ldap_err2string(ld->ld_errno));
-       }
-#endif
-#endif
-}
-
-static char **get_values(LDAP *ld, LDAPMessage *entry, const char *attribut)
-{
-       char ** values;
-       values=l_get_values(ld,entry, (char *)attribut);
-
-       if (values==NULL)
-       {
-               get_error(ld, entry, "get_values", attribut);
-       }
-
-       return values;
-}
-
-
-
-/*
- * Function: copy_value
- *   Copy value from a LDAP attribute to $copy
- * INPUT:
- *   $ld:       the connection with the LDAP server
- *   $entry:    the entry who contains attributes
- *   $attribut: this attribut
- *   $copy:     where data can go
- * OUTPUT:
- *   void
- */
-static void copy_value(LDAP *ld, LDAPMessage *entry, const char *attribut,
-                      char **copy, const char *username)
-{
-       char ** values;
-       values=l_get_values(ld,entry, attribut);
-
-       if (values==NULL)
-       {
-               get_error(ld, entry, "copy_value ", attribut);
-               *copy=NULL;
-               return;
-       }
-  /* We accept only attribute with one value */
-       else if (l_count_values(values)>1)
-        {
-                *copy=strdup(values[0]);
-                fprintf(stderr, "WARN: authldaplib: duplicate attribute %s for %s\n",
-                       attribut,
-                       username);
-                *copy=NULL;
-        }
-  /* We accept only attribute with one value */
-       else if (l_count_values(values)!=1)
-        {
-                *copy=NULL;
-        }
-  else
-        {
-                *copy=strdup(values[0]);
-        }
-#if DEBUG_LDAP
-  DPRINTF("copy_value %s: %s",attribut,values[0]);
-#endif
-  l_value_free(values);
-}
-
-static struct ldap_info my_ldap;
-static LDAP *my_ldap_fp=0;
-static LDAP *bindp=0;  /* for checking passwords with AUTHBIND */
-
-void authldapclose()
-{
-       if (my_ldap_fp)
-       {
-               l_unbind(my_ldap_fp);
-               my_ldap_fp=0;
-       }
-       if (bindp)
-       {
-               l_unbind(bindp);
-               bindp=0;
-       }
-}
-
-static int ldaperror(int rc)
-{
-#ifdef OPENLDAPV2
-       if (rc && !LDAP_NAME_ERROR(rc))
-#else
-       if (rc && !NAME_ERROR(rc))
-#endif
-       {
-               /* If there was a protocol error, close the connection */
-               authldapclose();
-               ldapconnfailure();
-       }
-       return (rc);
-}
-
-/* This function takes a ldap connection and 
- * tries to enable TLS on it.
-*/
-static int enable_tls_on(LDAP *conn) {
-#if HAVE_LDAP_TLS
-       int version;
-       int ldrc;
-
-       if (ldaperror(ldrc=ldap_get_option (conn,
-                                   LDAP_OPT_PROTOCOL_VERSION,
-                                   &version))
-           != LDAP_SUCCESS)
-       {
-               const char *s=ldap_err2string(ldrc);
-
-               err("ldap_get_option failed: %s", s);
-               return (-1);
-       }
-
-       if (version < LDAP_VERSION3)
-       {
-               version = LDAP_VERSION3;
-               (void)ldap_set_option (conn,
-                                      LDAP_OPT_PROTOCOL_VERSION,
-                                      &version);
-       }
-
-       if (ldaperror(ldrc=ldap_start_tls_s(conn, NULL, NULL))
-           != LDAP_SUCCESS)
-       {
-               const char *s=ldap_err2string(ldrc);
-
-               err("ldap_start_tls_s failed: %s", s);
-               return (-1);
-       }
-       return 0;
-#else
-       err("authldaplib: TLS not available");
-       return (-1);
-#endif
-}
-
-static LDAP *ldapconnect()
-{
-LDAP   *p=NULL;
-
-#if DEBUG_LDAP
-       DPRINTF("URI:      %s",my_ldap.uri);
-       DPRINTF("UID:      %d",my_ldap.uid);
-       DPRINTF("GID:      %d",my_ldap.gid);
-#endif
-
-       if (ldapconncheck())
-       {
-               DPRINTF("authldaplib: timing out after failed connection");
-               return (NULL);
-       }
-
-       ldap_initialize(&p, my_ldap.uri);
-
-       if (p==NULL)
-       {
-               err("cannot connect to LDAP server (%s): %s",
-                       my_ldap.uri, strerror(errno));
-               ldapconnfailure();
-       }
-#ifdef LDAP_OPT_NETWORK_TIMEOUT
-       if (my_ldap.timeout > 0)
-               ldap_set_option (p, LDAP_OPT_NETWORK_TIMEOUT, &my_ldap.timeout);
-#endif
-#if DEBUG_LDAP
-       DPRINTF("ldapconnect end");
-#endif
-       return (p);
-}
-
-static int ldapopen()
-{
-int     ldrc;
-
-       if (my_ldap_fp) return (0);
-
-       if (authldap_read_config(&my_ldap) == 0)
-       {
-               err("authldaplib: error in LDAP configuration file, aborting");
-               return (1);
-       }
-
-       my_ldap_fp=ldapconnect();
-
-       if (!my_ldap_fp)
-       {
-               return (1);
-       }
-
-#ifdef LDAP_OPT_PROTOCOL_VERSION
-
-       /* Set protocol version if selected */
-       if (my_ldap.protocol_version &&
-               ldaperror(ldrc = ldap_set_option(my_ldap_fp, LDAP_OPT_PROTOCOL_VERSION,
-               (void *) & my_ldap.protocol_version)) != LDAP_SUCCESS)
-         {
-               const char *s=ldap_err2string(ldrc);
-
-               err("ldap_set_option(PROTOCOL_VERSION %d) failed: %s",
-                       my_ldap.protocol_version, s);
-               authldapclose();
-               ldapconnfailure();
-               return (-1);
-         }
-       if (my_ldap.protocol_version)
-       {
-               DPRINTF("selected ldap protocol version %d", my_ldap.protocol_version);
-       }
-#endif
-
-       if (my_ldap.tls && enable_tls_on(my_ldap_fp))
-       {
-               authldapclose();
-               ldapconnfailure();
-               return (-1);
-       }
-
-#ifdef LDAP_OPT_DEREF
-
-       /* Set dereferencing mode */
-       if (ldaperror(ldrc = ldap_set_option(my_ldap_fp, LDAP_OPT_DEREF,
-                                        (void *) & my_ldap.deref)) != LDAP_SUCCESS)
-       {
-               const char *s=ldap_err2string(ldrc);
-
-               err("ldap_set_option(DEREF) failed: %s", s);
-               authldapclose();
-               ldapconnfailure();
-               return (-1);
-       }
-#endif
-
-       if(my_ldap.initbind)
-       {
-               /* Bind to server */
-               if (courier_authdebug_login_level >= 2)
-               {
-                       DPRINTF("binding to LDAP server as DN '%s', password '%s'",
-                               my_ldap.binddn ? my_ldap.binddn : "<null>",
-                               my_ldap.bindpw ? my_ldap.bindpw : "<null>");
-               }
-               else
-               {
-                       DPRINTF("binding to LDAP server as DN '%s'",
-                               my_ldap.binddn ? my_ldap.binddn : "<null>");
-               }
-
-               if (ldaperror(ldrc = l_simple_bind_s(my_ldap_fp,
-                                                    my_ldap.binddn,
-                                                    my_ldap.bindpw))
-                   != LDAP_SUCCESS)
-               {
-                       const char *s=ldap_err2string(ldrc);
-
-                       err("ldap_simple_bind_s failed: %s", s);
-                       authldapclose();
-                       ldapconnfailure();
-                       return (-1);
-               }
-       }
-       return (0);
-}
-
-static int auth_ldap_do(const char *, const char *, const char *,
-                       int (*)(struct authinfo *, void *),
-                        void *arg, const char *);
-
-int auth_ldap_changepw(const char *dummy, const char *user,
-                      const char *pass,
-                      const char *newpass)
-{
-       return auth_ldap_do("authlib", user, pass, NULL, NULL, newpass);
-}
-
-/*
- * Function: authldapcommon
- *   Get information from the LDAP server ($ldap) for this $user
- * INPUT:
- *   $user: the login name
- *   $pass: the login password (NULL if we don't want to check the pw)
- *   callback - callback function with filled in authentication info
- *   arg - extra argument for the callback function.
- * OUTPUT:
- *   < 0 - authentication failure
- *   > 0 - temporary failure
- *   else return code from the callback function.
- */
-
-int authldapcommon(const char *service,
-                  const char *user, const char *pass,
-                  int (*callback)(struct authinfo *, void *),
-                  void *arg)
-{
-       return (auth_ldap_do(service, user, pass, callback, arg, NULL));
-}
-
-static int auth_ldap_do2(const char *service,
-                        const char *user, const char *pass,
-                       int (*callback)(struct authinfo *, void *),
-                        void *arg, const char *newpass);
-
-static int auth_ldap_retry(const char *service,
-                          const char *user, const char *pass,
-                          int (*callback)(struct authinfo *, void *),
-                          void *arg, const char *newpass);
-
-static int auth_ldap_do(const char *service,
-                       const char *user, const char *pass,
-                       int (*callback)(struct authinfo *, void *),
-                        void *arg, const char *newpass)
-{
-       int rc=auth_ldap_retry(service, user, pass, callback, arg, newpass);
-
-       if (rc > 0)
-               rc=auth_ldap_retry(service, user, pass, callback, arg,
-                                  newpass);
-
-       return rc;
-}
-
-static int auth_ldap_retry(const char *service,
-                          const char *user, const char *pass,
-                          int (*callback)(struct authinfo *, void *),
-                          void *arg, const char *newpass)
-{
-       char *q;
-       int i;
-
-       q=courier_auth_ldap_escape(user);
-
-       if (!q)
-       {
-               perror("malloc");
-               return 1;
-       }
-
-       i=auth_ldap_do2(service, q, pass, callback, arg, newpass);
-       free(q);
-       return (i);
-}
-
-
-static int auth_ldap_do3(const char *service,
-                        const char *attrname,
-                        const char *user, const char *pass,
-                        int (*callback)(struct authinfo *, void *),
-                        void *arg, const char *newpass, const char *authaddr);
-
-static char *emailmap_get_search_string(const char *str, const char *email);
-
-static int auth_ldap_do2(const char *service,
-                        const char *user, const char *pass,
-                        int (*callback)(struct authinfo *, void *),
-                        void *arg, const char *newpass)
-{
-       char *srch;
-       struct timeval tv;
-       const char *attributes[2];
-       LDAPMessage *result, *entry;
-       int cnt;
-       char *v;
-       const char *aname;
-
-       if (ldapopen()) return (-1);
-
-       if (my_ldap.emailmap[0] == 0 || strchr(user, '@') == NULL)
-               return (auth_ldap_do3(service, my_ldap.mail,
-                                     user, pass, callback, arg, newpass,
-                                     user));
-       /* Mapping is not enabled */
-
-       srch=emailmap_get_search_string(my_ldap.emailmap, user);
-
-       if (!srch)
-       {
-               perror("CRIT: authldaplib: malloc");
-               exit(1);
-       }
-       DPRINTF("using emailmap search: %s", srch);
-
-       tv.tv_sec=my_ldap.timeout;
-       tv.tv_usec=0;
-
-       attributes[0]=my_ldap.emailmap_handle;
-
-       if (!attributes[0][0])
-               attributes[0]="handle";
-       attributes[1]=NULL;
-
-       if (ldaperror(l_search_st(my_ldap_fp,
-                                 (char *)(my_ldap.emailmap_basedn[0] ?
-                                          my_ldap.emailmap_basedn
-                                          :my_ldap.basedn),
-                                 LDAP_SCOPE_SUBTREE,
-                                 srch, (char **)attributes, 0,
-                                 &tv, &result))
-           != LDAP_SUCCESS)
-       {
-               free(srch);
-
-               DPRINTF("ldap_search_st failed");
-               if (my_ldap_fp) return (-1);
-               return (1);
-       }
-
-       if ((cnt=ldap_count_entries(my_ldap_fp, result)) != 1)
-       {
-               if (cnt)
-                       err("emailmap: %d entries returned from search %s (but we need exactly 1)",
-                              cnt, srch);
-               free(srch);
-               ldap_msgfree(result);
-               return -1;
-       }
-       free(srch);
-
-       entry=ldap_first_entry(my_ldap_fp, result);
-
-       if (!entry)
-       {
-               ldap_msgfree(result);
-
-               err("authldap: unexpected NULL from ldap_first_entry");
-               return -1;
-       }
-
-       copy_value(my_ldap_fp, entry, attributes[0], &v, user);
-
-       if (!v)
-       {
-               DPRINTF("emailmap: empty attribute");
-               ldap_msgfree(result);
-               return (-1);
-       }
-
-       aname=my_ldap.emailmap_handle_lookup;
-       if (aname[0] == 0)
-               aname=my_ldap.mail;
-
-       DPRINTF("emailmap results: aname=%s, handle=%s", aname, v);
-
-       cnt=auth_ldap_do3(service,
-                         aname, v, pass, callback, arg, newpass, user);
-
-       ldap_msgfree(result);
-       free(v);
-       return (cnt);
-}
-
-static int auth_ldap_do3(const char *service,
-                        const char *attrname,
-                        const char *user, const char *pass,
-                        int (*callback)(struct authinfo *, void *),
-                        void *arg, const char *newpass,
-                        const char *authaddr)
-{
-       char *newpass_crypt=0;
-       const char *attributes[10];
-       struct timeval timeout;
-
-       LDAPMessage *result;
-       LDAPMessage *entry;
-       char *filter, *dn;
-       int i, j;
-
-       struct authinfo auth;
-       char *homeDir=0;
-       char *mailDir=0;
-       char *userPassword=0;
-       char *cryptPassword=0;
-       char *options=0;
-       char *cn=0;
-       uid_t au;
-       gid_t ag;
-       int rc;
-       char *quota=0;
-        int additionalFilter = 0;
-        int hasAdditionalFilter = 0;
-
-        hasAdditionalFilter = my_ldap.filter != 0;
-
-       memset(&auth, 0, sizeof(auth));
-
-        if (hasAdditionalFilter)
-        {
-            /* To add the additional filter, we need to add on the
-             * additional size for "(&)" and the other filter.  So
-             * filter+3
-             */
-            additionalFilter = strlen(my_ldap.filter) + 3;
-        }
-
-       if ((filter=malloc(additionalFilter+strlen(attrname)+strlen(user)+
-                          (my_ldap.domain ? strlen(my_ldap.domain):0)+
-                          sizeof ("(=@)"))) == 0)
-       {
-               perror("malloc");
-               return 1;
-       }
-        strcpy(filter, "\0");
-
-        if (hasAdditionalFilter)
-        {
-            strcat(filter, "(&");
-            strcat(filter, my_ldap.filter);
-        }
-
-        strcat(strcat(strcat(strcat(filter, "("), attrname), "="), user);
-       if ( my_ldap.domain && my_ldap.domain[0] && strchr(user, '@') == 0 )
-               strcat(strcat(filter, "@"), my_ldap.domain);
-       strcat(filter, ")");
-        
-        if (hasAdditionalFilter)
-        {
-            strcat(filter, ")");
-        }
-
-       DPRINTF("using search filter: %s", filter);
-
-       timeout.tv_sec=my_ldap.timeout;
-       timeout.tv_usec=0;
-
-       read_env("LDAP_HOMEDIR", &attributes[0], "", 0, "homeDir");
-       read_env(service && strcmp(service, "courier") == 0
-                ? "LDAP_DEFAULTDELIVERY":"LDAP_MAILDIR",
-                &attributes[1], "", 0, 0);
-       read_env("LDAP_FULLNAME", &attributes[2], "", 0, "cn");
-       read_env("LDAP_CLEARPW", &attributes[3], "", 0, 0);
-       read_env("LDAP_CRYPTPW", &attributes[4], "", 0, 0);
-       read_env("LDAP_UID", &attributes[5], "", 0, 0);
-       read_env("LDAP_GID", &attributes[6], "", 0, 0);
-       attributes[7]=my_ldap.mail;
-       read_env("LDAP_MAILDIRQUOTA", &attributes[8], "", 0, 0);
-
-       j=0;
-       for (i=0; i<9; i++)
-       {
-               if (attributes[i])
-                       my_ldap.attrlist[j++]=attributes[i];
-       }
-
-       for (i=0; my_ldap.auxoptions[i]; i++)
-               my_ldap.attrlist[j++]=my_ldap.auxoptions[i];
-
-       my_ldap.attrlist[j]=0;
-
-       if (ldaperror(l_search_st(my_ldap_fp,
-                                 (char *)my_ldap.basedn,LDAP_SCOPE_SUBTREE,
-                                 filter, (char **)my_ldap.attrlist, 0,
-                                 &timeout, &result))
-                     != LDAP_SUCCESS)
-       {
-               DPRINTF("ldap_search_st() failed");
-               free(filter);
-
-               if (my_ldap_fp) return (-1);
-               return (1);
-       }
-
-       free(filter);
-
-       /* If we are more than one result, reject */
-       if (ldap_count_entries(my_ldap_fp,result)!=1)
-       {
-               DPRINTF("number of entries returned: %d (but we need exactly 1)",
-                       ldap_count_entries(my_ldap_fp,result));
-               ldap_msgfree(result);
-               return -1;
-       }
-
-       dn = ldap_get_dn(my_ldap_fp, result);
-
-       DPRINTF("one entry returned, DN: %s", dn ? dn : "<null>");
-
-       if (dn == NULL) 
-       {
-               DPRINTF("ldap_get_dn failed");
-               return -1;
-       }
-
-       /* Get the pointer on this result */
-       entry=ldap_first_entry(my_ldap_fp,result);
-       if (entry==NULL)
-       {
-               DPRINTF("ldap_first_entry failed");
-               free(dn);
-               return -1;
-       }
-
-#if DEBUG_LDAP
-       DPRINTF("after ldap_first_entry");
-#endif
-
-       /* print all the raw attributes */
-       if (courier_authdebug_login_level >= 2)
-       {
-       char *attr;
-       BerElement *berptr = 0;
-
-               attr = ldap_first_attribute(my_ldap_fp, entry, &berptr);
-               if (attr)
-               {
-                       DPRINTF("raw ldap entry returned:");
-               }
-
-               while (attr)
-               {
-               char **av, **ap;
-               
-                       av = l_get_values(my_ldap_fp, entry, attr);
-                       ap = av;
-                       if (av)
-                       {
-                               while(*ap)
-                               {
-                                       DPRINTF("| %s: %s", attr, *ap);
-                                       ap++;
-                               }
-                               l_value_free(av);
-                       }
-                       ldap_memfree(attr);
-                       attr = ldap_next_attribute(my_ldap_fp, entry, berptr);
-               }
-               
-               ber_free(berptr, 0);
-       }
-
-       /* Copy the directory and the password into struct */
-       copy_value(my_ldap_fp,entry,attributes[0],&homeDir, user);
-       if (attributes[1])
-               copy_value(my_ldap_fp,entry,attributes[1],&mailDir, user);
-       copy_value(my_ldap_fp,entry,attributes[2],&cn, user);
-       if (attributes[3])
-               copy_value(my_ldap_fp,entry,attributes[3],&userPassword, user);
-       if (attributes[4])
-               copy_value(my_ldap_fp,entry,attributes[4],&cryptPassword, user);
-
-       au=my_ldap.uid;
-       ag=my_ldap.gid;
-       if (attributes[5])
-       {
-               char *p=0;
-               unsigned long n;
-
-               copy_value(my_ldap_fp, entry, attributes[5], &p, user);
-               if (p) {
-                       if (sscanf(p, "%lu", &n) > 0)
-                               au= (uid_t)n;
-                       free(p);
-               }
-#if DEBUG_LDAP
-               DPRINTF("au= %d",au);
-#endif
-       }
-
-       if (attributes[6])
-       {
-               char *p=0;
-               unsigned long n;
-
-               copy_value(my_ldap_fp, entry, attributes[6], &p, user);
-               if (p) {
-                       if (sscanf(p, "%lu", &n) > 0)
-                               ag= (gid_t)n;
-                       free(p);
-               }
-#if DEBUG_LDAP
-               DPRINTF("ag= %d",ag);
-#endif
-       }
-
-       if (attributes[8])
-               copy_value(my_ldap_fp,entry,attributes[8],&quota, user);
-
-       if (homeDir != 0 && my_ldap.mailroot != 0 && *my_ldap.mailroot)
-       {
-               char *new_mailroot=malloc(strlen(homeDir)+
-                                         strlen(my_ldap.mailroot)+2);
-
-               if (!new_mailroot)
-               {
-                       perror("CRIT: authldap: malloc failed");
-                       rc= -1;
-               }
-               else
-               {
-                       strcat(strcat(strcpy(new_mailroot, my_ldap.mailroot),
-                                     "/"), homeDir);
-                       free(homeDir);
-                       homeDir=new_mailroot;
-               }
-       }
-
-       j=1;
-
-       for (i=0; my_ldap.auxoptions[i]; i++)
-       {
-               char *val;
-
-               copy_value(my_ldap_fp, entry, my_ldap.auxoptions[i], &val,
-                          user);
-
-               if (!val)
-                       continue;
-
-               j += 2 + strlen(my_ldap.auxnames[i]) +
-                       strlen(val);
-               free(val);
-       }
-
-       options=malloc(j);
-
-       if (!options)
-       {
-               perror("CRIT: authldap: malloc failed");
-               rc= -1;
-       }
-       else
-       {
-               *options=0;
-
-               for (i=0; my_ldap.auxoptions[i]; i++)
-               {
-                       char *val;
-
-                       copy_value(my_ldap_fp, entry, my_ldap.auxoptions[i],
-                                  &val,
-                                  user);
-
-                       if (!val)
-                               continue;
-
-                       if (*options)
-                               strcat(options, ",");
-                       strcat(options, my_ldap.auxnames[i]);
-                       strcat(options, "=");
-                       strcat(options, val);
-                       free(val);
-               }
-       }
-
-
-       auth.sysuserid= &au;
-       auth.sysgroupid= ag;
-       auth.homedir=homeDir;
-       auth.address=authaddr;
-       auth.fullname=cn;
-       auth.maildir=mailDir;
-       auth.clearpasswd=userPassword;
-       auth.passwd=cryptPassword;
-       auth.quota=quota;
-       auth.options=options && *options ? options:NULL;
-
-       if (homeDir == 0)
-               auth.homedir="";
-
-       rc=0;
-
-       if (au == 0 || ag == 0)
-       {
-               err("authldaplib: refuse to authenticate %s: uid=%d, gid=%d (zero uid or gid not permitted)",
-                      user, au, ag);
-               rc= 1;
-       }
-
-       courier_authdebug_authinfo("DEBUG: authldaplib: ", &auth,
-               userPassword, cryptPassword);
-
-       if (pass)
-       {
-               if (my_ldap.authbind) 
-               {
-                       if (!bindp)
-                       {
-                               bindp=ldapconnect();
-
-                               if (!bindp)
-                               {
-                                       DPRINTF("ldapconnect failed");
-                                       rc=1;
-                               }
-                               else
-#ifdef LDAP_OPT_PROTOCOL_VERSION
-                               /* Set protocol version */
-                               if (my_ldap.protocol_version &&
-                                       ldap_set_option(bindp, LDAP_OPT_PROTOCOL_VERSION,
-                                       (void *) & my_ldap.protocol_version) != LDAP_OPT_SUCCESS)
-                                 {
-                                       err("ldap_set_option(PROTOCOL_VERSION %d) failed",
-                                               my_ldap.protocol_version);
-                                       rc = 1;
-                                 }
-                               else
-#endif
-                               if(my_ldap.tls && enable_tls_on(bindp)) {
-                                       err("authldaplib: LDAP_TLS enabled but I'm unable to start tls, check your config");
-                                       rc = 1;
-                               }
-                       }
-
-                       if (bindp)
-                       {
-                               if (rc == 0)
-                               {
-                               int ldrc;
-                                       DPRINTF("rebinding with DN '%s' to validate password", dn);
-                                       ldrc = l_simple_bind_s(bindp, dn, pass);
-                                       switch (ldrc)
-                                       {
-                                       case LDAP_SUCCESS:
-                                               DPRINTF("authentication bind successful");
-                                               break;
-                                       case LDAP_INVALID_CREDENTIALS:
-                                               DPRINTF("authentication bind failed, invalid credentials");
-                                               rc = -1;
-                                               break;
-                                       default:
-                                               DPRINTF("authentication bind failed, some other problem: %s",
-                                                       ldap_err2string(ldrc));
-                                               rc = 1;
-                                               break;
-                                       }
-                               }
-                               /* Drop the connection if there was a fatal
-                                  error or if we are using historic LDAP v2,
-                                  which didn't support rebinding on same conn */
-                               if (rc > 0 || my_ldap.protocol_version == 2)
-                               {
-                                       l_unbind(bindp);
-                                       bindp=0;
-                               }
-                       }
-
-                       if (rc == 0 && newpass)
-                       {
-                               if ((newpass_crypt=authcryptpasswd(newpass,
-                                                                  auth.passwd)
-                                    ) == 0)
-                                       rc= -1;
-                       }
-               }
-               else
-               {
-                       if (auth.clearpasswd)
-                       {
-                               if (strcmp(pass,auth.clearpasswd))
-                               {
-                                       if (courier_authdebug_login_level >= 2)
-                                       {
-                                               DPRINTF("supplied password '%s' does not match clearpasswd '%s'",
-                                                       pass, auth.clearpasswd);
-                                       }
-                                       else
-                                       {
-                                               DPRINTF("supplied password does not match clearpasswd");
-                                       }
-                                       rc= -1;
-                               }
-                       }
-                       else
-                       {
-                               const char *p=auth.passwd;
-
-                               if (!p)
-                               {
-                                       DPRINTF("no password to compare against!");
-                                       rc= -1;
-                               }
-                               else if (authcheckpassword(pass, p))
-                                       rc= -1;
-                       }
-
-                       if (rc == 0 && newpass && auth.passwd)
-                       {
-                               if ((newpass_crypt=authcryptpasswd(newpass,
-                                                                  auth.passwd)
-                                    ) == 0)
-                                       rc= -1;
-                       }
-               }
-        }
-
-       if (rc == 0 && newpass)
-       {
-               LDAPMod *mods[3];
-               int mod_index=0;
-
-               LDAPMod mod_clear, mod_crypt;
-               char *mod_clear_vals[2], *mod_crypt_vals[2];
-
-               if (attributes[3])
-               {
-                       mods[mod_index]= &mod_clear;
-                       mod_clear.mod_op=LDAP_MOD_REPLACE;
-                       mod_clear.mod_type=(char *)attributes[3];
-                       mod_clear.mod_values=mod_clear_vals;
-
-                       mod_clear_vals[0]=(char *)newpass;
-                       mod_clear_vals[1]=NULL;
-                       ++mod_index;
-               }
-
-               if (attributes[4] && newpass_crypt)
-               {
-                       mods[mod_index]= &mod_crypt;
-                       mod_crypt.mod_op=LDAP_MOD_REPLACE;
-                       mod_crypt.mod_type=(char *)attributes[4];
-                       mod_crypt.mod_values=mod_crypt_vals;
-
-                       mod_crypt_vals[0]=newpass_crypt;
-                       mod_crypt_vals[1]=NULL;
-                       ++mod_index;
-               }
-               if (mod_index == 0)
-                       rc= -1;
-               else
-               {
-                       int ld_errno;
-                       mods[mod_index]=0;
-
-                       /* On a system which uses LDAP_AUTHBIND, we probably
-                          want to use the user's credentials (bindp) rather
-                          than the search credentials (my_ldap_fp) for
-                          performing the password update. (May not always be
-                          true, ideally it would be configurable) */
-                       ld_errno = l_modify_s(bindp? bindp:my_ldap_fp, dn, mods);
-                       if (ld_errno != LDAP_SUCCESS)
-                       {
-                               rc= -1;
-                               DPRINTF("LDAP modify failed: %s",
-                                       ldap_err2string(ld_errno));
-                       }
-               }
-       }
-
-       if (newpass_crypt)
-               free(newpass_crypt);
-       free (dn);
-#if DEBUG_LDAP
-       DPRINTF("before callback rc=%d",rc);
-#endif
-
-       if (rc == 0 && callback)
-       {
-               if (!auth.clearpasswd)
-                       auth.clearpasswd=pass;
-               rc= (*callback)(&auth, arg);
-#if DEBUG_LDAP
-               DPRINTF("after callback rc=%d",rc);
-#endif
-       }
-
-       ldap_msgfree(result);
-       if (options)    free(options);
-       if (homeDir)    free(homeDir);
-       if (mailDir)    free(mailDir);
-       if (userPassword)       free(userPassword);
-       if (cryptPassword)      free(cryptPassword);
-       if (cn)         free(cn);
-       if (quota)      free(quota);
-       return (rc);
-}
-
-/**
- ** Create an emailmap search string.  I'm going to wrap this into an external
- ** variable, so I'll use generic coding here.
- */
-
-struct varlist {
-       const char *varname;
-       int varname_len;
-       const char *varvalue;
-       int varvalue_len;
-} ;
-
-static char *var_expand(const char *, const struct varlist *);
-
-static char *emailmap_get_search_string(const char *str, const char *email)
-{
-       struct varlist vl[3];
-       const char *realmptr=strrchr(email, '@');/* Guaranteed nonNULL */
-
-       static const char userid[]="user";
-       static const char realm[]="realm";
-
-       vl[0].varname=userid;
-       vl[0].varname_len=sizeof(userid)-1;
-       vl[0].varvalue=email;
-       vl[0].varvalue_len=realmptr - email;
-       vl[1].varname=realm;
-       vl[1].varname_len=sizeof(realm)-1;
-       vl[1].varvalue=realmptr+1;
-       vl[1].varvalue_len=strlen(vl[1].varvalue);
-       vl[2].varname=NULL;
-
-       return (var_expand(str, vl));
-}
-
-static char *var_expand(const char *str, const struct varlist *vl)
-{
-       const char *p;
-       int cnt;
-       int pass;
-       char *q, *r;
-
-       cnt=0;
-       q=NULL;
-
-       /*
-       ** Pass 1 - count expanded string length, allocate buffer,
-       ** Pass 2 - generate the string.
-       */
-
-       for (pass=0; pass<2; pass++)
-       {
-               if (pass)
-               {
-                       if ((q=malloc(cnt)) == NULL)
-                               return (NULL);
-               }
-               r=q;
-               cnt=1;
-
-               p=str;
-
-               while (*p)
-               {
-                       if (*p == '@')
-                       {
-                               int j;
-
-                               for (j=0; vl[j].varname; j++)
-                               {
-                                       if (memcmp(vl[j].varname, p+1,
-                                                  vl[j].varname_len) == 0
-                                           && p[vl[j].varname_len+1] == '@')
-                                               break;
-                               }
-
-                               if (vl[j].varname)
-                               {
-                                       p += vl[j].varname_len+2;
-
-                                       if (r)
-                                       {
-                                               memcpy(r, vl[j].varvalue,
-                                                      vl[j].varvalue_len);
-                                               r += vl[j].varvalue_len;
-                                       }
-                                       cnt += vl[j].varvalue_len;
-                                       continue;
-                               }
-                       }
-
-                       if (r)
-                               *r++ = *p;
-                       ++p;
-                       ++cnt;
-               }
-               if (r)
-                       *r=0;
-       }
-
-       return (q);
-}
-
-void auth_ldap_enumerate( void(*cb_func)(const char *name,
-                                        uid_t uid,
-                                        gid_t gid,
-                                        const char *homedir,
-                                        const char *maildir,
-                                        const char *options,
-                                        void *void_arg),
-                          void *void_arg)
-{
-       const char *attributes[5];
-
-       int i, j;
-       int msgid;
-
-       if (ldapopen())
-       {
-               (*cb_func)(NULL, 0, 0, NULL, NULL, NULL, void_arg);
-               return;
-       }
-
-       read_env("LDAP_MAIL", &attributes[0], "", 0, "mail");
-       read_env("LDAP_UID", &attributes[1], "", 0, 0);
-       read_env("LDAP_GID", &attributes[2], "", 0, 0);
-       read_env("LDAP_HOMEDIR", &attributes[3], "", 0, "homeDir");
-       read_env("LDAP_MAILDIR", &attributes[4], "", 0, 0);
-
-       j=0;
-       for (i=0; i<5; i++)
-       {
-               if (attributes[i])
-                       my_ldap.attrlist[j++]=attributes[i];
-       }
-
-       for (i=0; my_ldap.auxoptions[i]; i++)
-               my_ldap.attrlist[j++]=my_ldap.auxoptions[i];
-
-       my_ldap.attrlist[j]=0;
-
-       DPRINTF("ldap_search: basedn='%s', filter='%s'",
-               my_ldap.basedn, my_ldap.enumerate_filter);
-       if ((msgid = l_search(my_ldap_fp, (char *)my_ldap.basedn,LDAP_SCOPE_SUBTREE,
-                             my_ldap.enumerate_filter,
-                             (char **)my_ldap.attrlist, 0)) < 0)
-       {
-               DPRINTF("ldap_search failed");
-               return;
-       }
-
-       while(1) /* process results as they come in */
-       {
-               struct timeval timeout;
-               LDAPMessage *result;
-               LDAPMessage *entry;
-               int ldrc;
-
-               timeout.tv_sec=my_ldap.timeout;
-               timeout.tv_usec=0;
-               ldrc = ldap_result(my_ldap_fp, msgid, 0, &timeout, &result);
-               switch (ldrc)
-               {
-               case -1:
-                       DPRINTF("error in ldap_result");
-                       ldap_msgfree(result);
-                       return;
-               case 0:
-                       DPRINTF("timeout waiting for search result");
-                       ldap_msgfree(result);
-                       return;
-               case LDAP_RES_SEARCH_ENTRY:
-                       break; /* deal with below */
-               case LDAP_RES_SEARCH_RESULT:
-                       if (ldap_parse_result(my_ldap_fp, result, &ldrc,
-                               NULL, NULL, NULL, NULL, 0) != LDAP_SUCCESS)
-                       {
-                               DPRINTF("ldap_parse_result failed");
-                               ldap_msgfree(result);
-                               return;
-                       }
-                       ldap_msgfree(result);
-                       if (ldrc != LDAP_SUCCESS)
-                       {
-                               DPRINTF("ldap search failure result: %s",
-                                       ldap_err2string(ldrc));
-                               return;
-                       }
-                       /* Search successfully completed */
-                       (*cb_func)(NULL, 0, 0, NULL, NULL, NULL, void_arg);
-                       return;
-               default:
-                       DPRINTF("ldap result type 0x%02X ignored", ldrc);
-                       ldap_msgfree(result);
-                       continue;
-               }
-
-               entry = ldap_first_entry(my_ldap_fp, result);
-               while (entry)
-               {
-                       char **names = get_values(my_ldap_fp, entry, attributes[0]);
-                       int n;
-
-                       if (names == NULL)
-                       {
-                               entry = ldap_next_entry(my_ldap_fp, entry);
-                               continue;
-                       }
-
-                       n=l_count_values(names);
-                       if (n > 0)
-                       {
-                               const char *name = names[0] ? names[0] : "<null>";
-                               int i,j;
-                               char *uid_s=NULL;
-                               char *gid_s=NULL;
-                               char *homedir;
-                               char *maildir;
-                               char *options;
-                               uid_t uid=my_ldap.uid;
-                               gid_t gid=my_ldap.gid;
-
-                               if (attributes[1])
-                               {
-                                       copy_value(my_ldap_fp, entry, attributes[1],
-                                                  &uid_s,
-                                                  name);
-                               }
-
-                               if (attributes[2])
-                               {
-                                       copy_value(my_ldap_fp, entry, attributes[2],
-                                                  &gid_s, name);
-                               }
-
-                               copy_value(my_ldap_fp, entry, attributes[3],
-                                          &homedir, name);
-                               copy_value(my_ldap_fp, entry, attributes[4],
-                                          &maildir, name);
-
-                               if (uid_s)
-                                       uid=atol(uid_s);
-                               if (gid_s)
-                                       gid=atol(gid_s);
-
-                               j=1;
-
-                               for (i=0; my_ldap.auxoptions[i]; i++)
-                               {
-                                       char *val;
-
-                                       copy_value(my_ldap_fp, entry, my_ldap.auxoptions[i],
-                                                  &val, name);
-
-                                       if (!val)
-                                               continue;
-
-                                       j += 2 + strlen(my_ldap.auxnames[i]) +
-                                               strlen(val);
-                                       free(val);
-                               }
-
-                               options=malloc(j);
-
-                               if (!options)
-                               {
-                                       l_value_free(names);
-                                       perror("CRIT: auth_ldap_enumerate: malloc failed");
-                                       return;
-                               }
-                               *options=0;
-
-                               for (i=0; my_ldap.auxoptions[i]; i++)
-                               {
-                                       char *val;
-
-                                       copy_value(my_ldap_fp, entry, my_ldap.auxoptions[i],
-                                                  &val, name);
-
-                                       if (!val)
-                                               continue;
-
-                                       if (*options)
-                                               strcat(options, ",");
-                                       strcat(options, my_ldap.auxnames[i]);
-                                       strcat(options, "=");
-                                       strcat(options, val);
-                                       free(val);
-                               }
-
-                               for (j = 0; j < n; j++)
-                               {
-                                       name=names[j];
-
-                                       if (name && homedir)
-                                               (*cb_func)(name, uid, gid, homedir,
-                                                          maildir, options, void_arg);
-                               }
-
-                               if (uid_s)
-                                       free(uid_s);
-                               if (gid_s)
-                                       free(gid_s);
-                               if (homedir)
-                                       free(homedir);
-                               if (maildir)
-                                       free(maildir);
-                               if (options)
-                                       free(options);
-                       }
-                       l_value_free(names);
-
-                       entry = ldap_next_entry(my_ldap_fp, entry);
-               }
-
-               ldap_msgfree(result);
-       }
-}
diff --git a/authldaplib.cpp b/authldaplib.cpp
new file mode 100644 (file)
index 0000000..d5b71a7
--- /dev/null
@@ -0,0 +1,1660 @@
+/*
+** Copyright 2016 Double Precision, Inc.  See COPYING for
+** distribution information.
+*/
+
+#if HAVE_CONFIG_H
+#include "courier_auth_config.h"
+#endif
+#include <string>
+#include <sstream>
+#include <map>
+#include <vector>
+#include <algorithm>
+#include <cctype>
+
+#if HAVE_LBER_H
+#include <lber.h>
+#endif
+#if HAVE_LDAP_H
+#include <ldap.h>
+#endif
+#include <pwd.h>
+#include <grp.h>
+#include <errno.h>
+#include <time.h>
+#if HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#if HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
+extern "C" {
+#include "authldap.h"
+#include "auth.h"
+#include "authldaprc.h"
+#include "courierauthdebug.h"
+};
+
+#include "authconfigfile.h"
+#include <stdio.h>
+
+#ifndef        LDAP_OPT_SUCCESS
+#define LDAP_OPT_SUCCESS LDAP_SUCCESS
+#endif
+
+/*
+** Main connection to the LDAP server, and a separate connection for the
+** LDAP_AUTHBIND option.
+*/
+
+class ldap_connection {
+
+public:
+       LDAP *connection;
+
+       ldap_connection() : connection(0) {}
+       ~ldap_connection() { disconnect(); }
+
+       bool connected() const { return connection != 0; }
+
+       bool connect();
+       void disconnect();
+       void close();
+
+private:
+       bool enable_tls();
+
+public:
+
+       static bool ok(const char *method, int rc)
+       {
+               if (rc == 0 || LDAP_NAME_ERROR(rc))
+                       return true;
+
+               courier_auth_err("%s failed: %s", method,
+                                ldap_err2string(rc));
+               return false;
+       }
+
+       bool bind(const std::string &userid,
+                 const std::string &password)
+       {
+               std::vector<char> buffer(password.begin(), password.end());
+               struct berval cred;
+
+               cred.bv_len=buffer.size();
+               cred.bv_val=&buffer[0];
+
+               if (connect() &&
+                   ok("ldap_sasl_bind_s",
+                      ldap_sasl_bind_s(connection, userid.c_str(),
+                                       NULL, &cred,
+                                       NULL, NULL, NULL)))
+                       return true;
+
+               disconnect();
+               return connect() &&
+                       ok("ldap_sasl_bind_s",
+                          ldap_sasl_bind_s(connection, userid.c_str(),
+                                           NULL, &cred,
+                                           NULL, NULL, NULL));
+       }
+};
+
+ldap_connection main_connection, bind_connection;
+
+
+// Loaded and parsed authldaprc configuration file.
+
+class authldaprc_file : public courier::auth::config_file {
+
+public:
+
+       int protocol_version;
+       int timeout;
+       int authbind;
+       int initbind;
+       int tls;
+       uid_t uid;
+       gid_t gid;
+
+       std::string ldap_uri, ldap_binddn, ldap_bindpw, ldap_basedn;
+       int ldap_deref;
+
+       std::vector<std::string> auxoptions, auxnames;
+
+       authldaprc_file();
+
+private:
+       bool do_load();
+       void do_reload();
+public:
+};
+
+/*
+** There's a memory leak in OpenLDAP 1.2.11, presumably in earlier versions
+** too.  See http://www.OpenLDAP.org/its/index.cgi?findid=864 for more
+** information.  To work around the bug, the first time a connection fails
+** we stop trying for 60 seconds.  After 60 seconds we kill the process,
+** and let the parent process restart it.
+**
+** We'll control this behavior via LDAP_MEMORY_LEAK.  Set it to ZERO to turn
+** off this behavior (whenever OpenLDAP gets fixed).
+*/
+
+static time_t ldapfailflag=0;
+
+static void ldapconnfailure()
+{
+       const char *p=getenv("LDAP_MEMORY_LEAK");
+
+       if (!p)
+       {
+#ifdef LDAP_VENDOR_NAME
+#ifdef LDAP_VENDOR_VERSION
+#define DO_OPENLDAP_CHECK
+#endif
+#endif
+
+#ifdef DO_OPENLDAP_CHECK
+
+               /* It's supposed to be fixed in 20019 */
+
+               if (strcmp(LDAP_VENDOR_NAME, "OpenLDAP") == 0 &&
+                   LDAP_VENDOR_VERSION < 20019)
+                       p="1";
+               else
+                       p="0";
+#else
+               p="0";
+#endif
+       }
+
+       if (atoi(p) && !ldapfailflag)
+       {
+               time(&ldapfailflag);
+               ldapfailflag += 60;
+       }
+}
+
+static int ldapconncheck()
+{
+       time_t t;
+
+       if (!ldapfailflag)
+               return (0);
+
+       time(&t);
+
+       if (t >= ldapfailflag)
+               exit(0);
+       return (1);
+}
+
+authldaprc_file::authldaprc_file()
+       : config_file(AUTHLDAPRC)
+{
+}
+
+bool authldaprc_file::do_load()
+{
+       bool loaded=true;
+
+       // Frequently-accessed variables.
+
+       if (!config("LDAP_TIMEOUT", timeout, false, "5") ||
+           !config("LDAP_TLS", tls, false, "0"))
+       {
+               loaded=false;
+       }
+
+       if (!config("LDAP_URI", ldap_uri, true))
+       {
+               loaded=false;
+       }
+
+       ldap_deref=0;
+
+       std::string deref_setting;
+
+       config("LDAP_DEREF", deref_setting, false, "");
+
+       for (std::string::iterator p=deref_setting.begin();
+            p != deref_setting.end(); ++p)
+               *p=std::tolower(*p);
+
+#ifdef LDAP_OPT_DEREF
+
+       ldap_deref=LDAP_DEREF_NEVER;
+
+       if (deref_setting == "never")
+               ldap_deref = LDAP_DEREF_NEVER;
+       else if (deref_setting == "searching")
+               ldap_deref = LDAP_DEREF_SEARCHING;
+       else if (deref_setting == "finding")
+               ldap_deref = LDAP_DEREF_FINDING;
+       else if (deref_setting == "always")
+               ldap_deref = LDAP_DEREF_ALWAYS;
+       else if (deref_setting != "")
+       {
+               loaded=false;
+               courier_auth_err("authldap: INVALID LDAP_OPT_DEREF");
+       }
+#endif
+       uid=0;
+       gid=0;
+
+       std::string uid_str, gid_str;
+
+       config("LDAP_GLOB_UID", uid_str, false);
+       config("LDAP_GLOB_GID", gid_str, false);
+
+       if (!uid_str.empty())
+       {
+               std::istringstream i(uid_str);
+
+               i >> uid;
+
+               if (i.fail())
+               {
+                       struct passwd *pwent=getpwnam(uid_str.c_str());
+
+                       if (!pwent)
+                       {
+                               courier_auth_err("authldap: INVALID LDAP_GLOB_UID");
+                               loaded=false;
+                       }
+                       else
+                       {
+                               uid=pwent->pw_uid;
+                       }
+               }
+       }
+
+       if (!gid_str.empty())
+       {
+               std::istringstream i(uid_str);
+
+               i >> gid;
+
+               if (i.fail())
+               {
+                       struct group  *grent=getgrnam(gid_str.c_str());
+
+                       if (!grent)
+                       {
+                               courier_auth_err("authldap: INVALID LDAP_GLOB_GID");
+                               loaded=false;
+                       }
+                       else
+                       {
+                               gid=grent->gr_gid;
+                       }
+               }
+       }
+
+       if (!config("LDAP_AUTHBIND", authbind, false, "0")
+           || !config("LDAP_INITBIND", initbind, false, "0")
+           || !config("LDAP_BASEDN", ldap_basedn, true))
+               loaded=false;
+
+       if (initbind)
+       {
+               if (!config("LDAP_BINDDN", ldap_binddn, true) ||
+                   !config("LDAP_BINDPW", ldap_bindpw, true))
+                       loaded=false;
+       }
+
+       if (!config("LDAP_PROTOCOL_VERSION", protocol_version, false, "0"))
+               loaded=false;
+
+       if (protocol_version)
+       {
+#ifndef LDAP_OPT_PROTOCOL_VERSION
+               courier_auth_err("authldaplib: LDAP_OPT_PROTOCOL_VERSION ignored");
+               loaded=false;
+#endif
+               if (0
+#ifdef LDAP_VERSION_MIN
+                       || protocol_version < LDAP_VERSION_MIN
+#endif
+#ifdef LDAP_VERSION_MAX
+                       || protocol_version > LDAP_VERSION_MAX
+#endif
+               )
+               {
+                       protocol_version=0;
+                       courier_auth_err("authldaplib: LDAP_PROTOCOL_VERSION not supported");
+                       loaded=false;
+               }
+       }
+
+       std::string auxoptions_str;
+
+       config("LDAP_AUXOPTIONS", auxoptions_str, "");
+
+       std::string::iterator p=auxoptions_str.begin();
+
+       while (p != auxoptions_str.end())
+       {
+               if (*p == ',')
+               {
+                       ++p;
+                       continue;
+               }
+
+               std::string::iterator q=p;
+
+               p=std::find(p, auxoptions_str.end(), ',');
+
+               std::string auxoption(q, p);
+               std::string auxname;
+
+               q=std::find(auxoption.begin(), auxoption.end(), '=');
+
+               if (q != auxoption.end())
+               {
+                       auxname=std::string(q+1, auxoption.end());
+                       auxoption=std::string(auxoption.begin(), q);
+               }
+
+               auxoptions.push_back(auxoption);
+               auxnames.push_back(auxname);
+       }
+
+       return loaded;
+}
+
+void authldaprc_file::do_reload()
+{
+       // File changed, try to load it again.
+
+       authldaprc_file new_file;
+
+       if (new_file.load(true))
+       {
+               *this=new_file;
+               DPRINTF("authldap: reloaded %s", filename);
+
+               // If we reloaded the file, close the
+               // connections, so they can be reopened using
+               // the new config.
+
+               main_connection.close();
+               bind_connection.close();
+       }
+}
+
+static authldaprc_file authldaprc;
+
+#if HAVE_LDAP_TLS
+bool ldap_connection::enable_tls()
+{
+       int version;
+
+       if (!ok("ldap_get_option",
+               ldap_get_option(connection, LDAP_OPT_PROTOCOL_VERSION,
+                               &version)))
+               return false;
+
+       if (version < LDAP_VERSION3)
+       {
+               version = LDAP_VERSION3;
+               (void)ldap_set_option (connection,
+                                      LDAP_OPT_PROTOCOL_VERSION,
+                                      &version);
+       }
+
+       if (!ok("ldap_start_tls_s",
+               ldap_start_tls_s(connection, NULL, NULL)))
+               return false;
+
+       return true;
+}
+
+#else
+
+bool ldap_connection::enable_tls()
+{
+       courier_auth_err("authldaplib: TLS not available");
+       return (-1);
+}
+#endif
+
+bool ldap_connection::connect()
+{
+       if (connected()) return true;
+
+       DPRINTF("authldaplib: connecting to %s", authldaprc.ldap_uri.c_str());
+
+       if (ldapconncheck())
+       {
+               DPRINTF("authldaplib: timing out after failed connection");
+               return (false);
+       }
+
+       ldap_initialize(&connection, authldaprc.ldap_uri.c_str());
+
+       if (connection==NULL)
+       {
+               courier_auth_err("cannot connect to LDAP server (%s): %s",
+                                authldaprc.ldap_uri.c_str(), strerror(errno));
+               ldapconnfailure();
+       }
+#ifdef LDAP_OPT_NETWORK_TIMEOUT
+       else if (authldaprc.timeout > 0)
+       {
+               DPRINTF("timeout set to %d", authldaprc.timeout);
+               ldap_set_option (connection, LDAP_OPT_NETWORK_TIMEOUT, &authldaprc.timeout);
+#endif
+       }
+
+#ifdef LDAP_OPT_PROTOCOL_VERSION
+
+       if (authldaprc.protocol_version &&
+           !ok("ldap_set_option",
+               ldap_set_option(connection,
+                               LDAP_OPT_PROTOCOL_VERSION,
+                               (void *) &authldaprc.protocol_version)))
+       {
+               disconnect();
+               return false;
+       }
+
+       if (authldaprc.protocol_version)
+       {
+               DPRINTF("selected ldap protocol version %d", authldaprc.protocol_version);
+       }
+#endif
+
+       if (authldaprc.tls && !enable_tls())
+       {
+               disconnect();
+               return false;
+       }
+
+#ifdef LDAP_OPT_DEREF
+       if (!ok("ldap_set_option",
+               ldap_set_option(connection, LDAP_OPT_DEREF,
+                               (void *)&authldaprc.ldap_deref)))
+       {
+               disconnect();
+               return (false);
+       }
+#else
+       if (!deref_setting.empty())
+       {
+               courier_auth_err("authldaplib: LDAP_OPT_DEREF not available, ignored");
+       }
+#endif
+
+       return true;
+}
+
+void ldap_connection::disconnect()
+{
+       close();
+       ldapconnfailure();
+}
+
+void ldap_connection::close()
+{
+       if (connection == NULL)
+               return;
+
+       ldap_unbind_ext(connection, 0, 0);
+       connection=NULL;
+}
+
+static int ldapopen()
+{
+       if (main_connection.connected()) return 0;
+
+       if (!main_connection.connect())
+               return 1;
+
+       if (authldaprc.initbind)
+       {
+               /* Bind to server */
+               if (courier_authdebug_login_level >= 2)
+               {
+                       DPRINTF("binding to LDAP server as DN '%s', password '%s'",
+                               authldaprc.ldap_binddn.empty() ? "<null>"
+                               : authldaprc.ldap_binddn.c_str(),
+                               authldaprc.ldap_bindpw.empty() ? "<null>"
+                               : authldaprc.ldap_bindpw.c_str());
+               }
+               else
+               {
+                       DPRINTF("binding to LDAP server as DN '%s'",
+                               authldaprc.ldap_binddn.empty() ? "<null>"
+                               : authldaprc.ldap_binddn.c_str());
+               }
+
+               if (!main_connection.bind(authldaprc.ldap_binddn,
+                                         authldaprc.ldap_bindpw))
+               {
+                       authldapclose();
+                       ldapconnfailure();
+                       return (-1);
+               }
+       }
+       return (0);
+}
+
+class authldaprc_attributes {
+
+public:
+
+       std::map<std::string, std::string *> attributes;
+
+       std::string attribute(const char *name,
+                             const char *default_value,
+                             std::string &return_value)
+       {
+               std::string value;
+
+               authldaprc.config(name, value, false, default_value);
+
+               if (!value.empty())
+                       attributes[value]=&return_value;
+               return value;
+       }
+};
+
+class authldaprc_attribute_vector : public std::vector<std::string> {
+
+public:
+
+       authldaprc_attribute_vector(const std::map<std::string, std::string *>
+                                   &attributes)
+       {
+               for (std::map<std::string, std::string *>::const_iterator
+                            p=attributes.begin(); p != attributes.end(); ++p)
+               {
+                       push_back(p->first);
+               }
+       }
+};
+
+class authldaprc_search_attributes {
+
+       std::vector<std::string> copy_buffer;
+
+public:
+
+       std::vector<char *> all_attributes_ptr;
+
+       authldaprc_search_attributes(const std::vector<std::string> &attributes)
+               : copy_buffer(attributes)
+       {
+               for (std::vector<std::string>::iterator
+                            p=copy_buffer.begin();
+                    p != copy_buffer.end(); ++p)
+               {
+                       if (p->empty())
+                               continue;
+
+                       p->push_back(0);
+                       all_attributes_ptr.push_back(& (*p)[0]);
+               }
+
+               all_attributes_ptr.push_back(0);
+       }
+
+       char **search_attributes()
+       {
+               return &all_attributes_ptr[0];
+       }
+};
+
+class authldaprc_search_result : authldaprc_search_attributes {
+
+public:
+
+       LDAPMessage *ptr;
+       bool finished;
+
+       authldaprc_search_result(ldap_connection &conn,
+                                const std::string &basedn,
+                                const std::string &query,
+                                const std::vector<std::string> &attributes,
+                                const struct timeval &timeout)
+               : authldaprc_search_attributes(attributes),
+                 ptr(NULL), finished(false)
+       {
+               struct timeval timeout_copy=timeout;
+
+               if (!conn.connect() ||
+                   !conn.ok("ldap_search_ext_s",
+                            ldap_search_ext_s(conn.connection,
+                                              basedn.c_str(),
+                                              LDAP_SCOPE_SUBTREE,
+                                              query.c_str(),
+                                              search_attributes(),
+                                              0,
+                                              NULL, NULL,
+                                              &timeout_copy,
+                                              100, &ptr)))
+               {
+                       ptr=NULL;
+                       conn.disconnect();
+                       if (!conn.connect()
+                           || !conn.ok("ldap_search_ext_s",
+                                    ldap_search_ext_s(conn.connection,
+                                                      basedn.c_str(),
+                                                      LDAP_SCOPE_SUBTREE,
+                                                      query.c_str(),
+                                                      search_attributes(),
+                                                      0,
+                                                      NULL, NULL,
+                                                      &timeout_copy,
+                                                      100, &ptr)))
+                       {
+                               ptr=NULL;
+                       }
+               }
+       }
+
+       authldaprc_search_result(ldap_connection &conn,
+                                int msgid,
+                                bool all,
+                                const struct timeval &timeout)
+               :authldaprc_search_attributes(std::vector<std::string>()),
+                ptr(NULL), finished(false)
+       {
+               while (1)
+               {
+                       struct timeval timeout_copy=timeout;
+
+                       int rc=ldap_result(conn.connection, msgid, all ? 1:0,
+                                          &timeout_copy,
+                                          &ptr);
+
+                       switch (rc)
+                       {
+                       case -1:
+                               DPRINTF("ldap_result() failed");
+                               ldap_msgfree(ptr);
+                               ptr=NULL;
+                               return;
+                       case 0:
+                               DPRINTF("ldap_result() timed out");
+                               ldap_msgfree(ptr);
+                               ptr=NULL;
+                               return;
+                       case LDAP_RES_SEARCH_ENTRY:
+                               break; /* deal with below */
+                       case LDAP_RES_SEARCH_RESULT:
+                               if (ldap_parse_result(conn.connection, ptr,
+                                                     &rc,
+                                                     NULL, NULL, NULL, NULL,
+                                                     0) != LDAP_SUCCESS)
+                               {
+                                       DPRINTF("ldap_parse_result failed");
+                                       ldap_msgfree(ptr);
+                                       ptr=NULL;
+                                       return;
+                               }
+                               ldap_msgfree(ptr);
+                               ptr=NULL;
+                               if (rc != LDAP_SUCCESS)
+                               {
+                                       DPRINTF("search failed: %s",
+                                               ldap_err2string(rc));
+                                       return;
+                               }
+                               finished=true;
+                               return;
+                       default:
+                               DPRINTF("ldap_result(): ignored 0x%02X status",
+                                       rc);
+                               ldap_msgfree(ptr);
+                               ptr=NULL;
+                               continue;
+                       }
+                       break;
+               }
+       }
+
+       bool operator!() const
+       {
+               return ptr == NULL;
+       }
+
+       operator bool() const
+       {
+               return ptr != NULL;
+       }
+
+       ~authldaprc_search_result()
+       {
+               if (ptr)
+                       ldap_msgfree(ptr);
+       }
+};
+
+static std::vector<std::string>
+authldap_entry_values(LDAP *connection, LDAPMessage *msg,
+                     const std::string &attrname)
+{
+       std::vector<std::string> values;
+
+       struct berval **p=ldap_get_values_len(connection, msg,
+                                             attrname.c_str());
+
+       if (p)
+       {
+
+               size_t n=ldap_count_values_len(p);
+
+               values.reserve(n);
+
+               for (size_t i=0; i<n; i++)
+               {
+                       const char *ptr=
+                               reinterpret_cast<const char *>(p[i]->bv_val);
+
+                       values.push_back(std::string(ptr, ptr+p[i]->bv_len));
+               }
+
+               ldap_value_free_len(p);
+       }
+       return values;
+}
+
+class authldap_get_values {
+
+       LDAP *connection;
+       LDAPMessage *entry;
+       std::string context;
+
+public:
+
+       authldap_get_values(LDAP *connectionArg,
+                           LDAPMessage *entryArg,
+                           const std::string &contextArg)
+               : connection(connectionArg),
+                 entry(entryArg),
+                 context(contextArg)
+       {
+       }
+
+       bool operator()(const std::string &attrname,
+                       std::string &value)
+       {
+               std::vector<std::string> values=
+                       authldap_entry_values(connection, entry, attrname);
+
+               if (values.empty())
+                       return false;
+
+               if (values.size() > 1)
+               {
+                       fprintf(stderr,
+                               "WARN: authldaplib: duplicate attribute %s for %s\n",
+                               attrname.c_str(),
+                               context.c_str());
+               }
+
+               value=values[0];
+               return true;
+       }
+
+       std::string options()
+       {
+               size_t i;
+
+               std::ostringstream options;
+               const char *options_sep="";
+
+               for (i=0; i<authldaprc.auxoptions.size(); ++i)
+               {
+                       std::string value;
+
+                       if (operator()(authldaprc.auxoptions[i], value)
+                           && !value.empty())
+                       {
+                               options << options_sep
+                                       << authldaprc.auxnames[i]
+                                       << "="
+                                       << value;
+                               options_sep=",";
+                       }
+               }
+               return options.str();
+       }
+};
+
+static void cpp_auth_ldap_enumerate( void(*cb_func)(const char *name,
+                                                   uid_t uid,
+                                                   gid_t gid,
+                                                   const char *homedir,
+                                                   const char *maildir,
+                                                   const char *options,
+                                                   void *void_arg),
+                                    void *void_arg)
+{
+       int msgid;
+
+       if (ldapopen())
+       {
+               (*cb_func)(NULL, 0, 0, NULL, NULL, NULL, void_arg);
+               return;
+       }
+
+       std::string mail_field, uid_field, gid_field,
+               homedir_field, maildir_field;
+
+       authldaprc.config("LDAP_MAIL", mail_field, false, "mail");
+       authldaprc.config("LDAP_UID", uid_field, false);
+       authldaprc.config("LDAP_GID", gid_field, false);
+       authldaprc.config("LDAP_HOMEDIR", homedir_field, false, "homeDir");
+       authldaprc.config("LDAP_MAILDIR", maildir_field, false);
+
+       std::vector<std::string> attribute_vector;
+
+       attribute_vector.push_back(mail_field);
+       attribute_vector.push_back(uid_field);
+       attribute_vector.push_back(gid_field);
+       attribute_vector.push_back(homedir_field);
+       attribute_vector.push_back(maildir_field);
+
+       for (size_t i=0; i<authldaprc.auxoptions.size(); i++)
+       {
+               attribute_vector.push_back(authldaprc.auxoptions[i]);
+       }
+
+       std::string enumerate_filter;
+
+       authldaprc.config("LDAP_ENUMERATE_FILTER", enumerate_filter, false);
+
+       if (enumerate_filter.empty())
+       {
+               std::string filter;
+
+               authldaprc.config("LDAP_FILTER", filter, false);
+
+               if (!filter.empty())
+               {
+                       enumerate_filter=filter;
+               }
+               else
+               {
+                       std::string s;
+
+                       authldaprc.config("LDAP_MAIL", s, false);
+
+                       enumerate_filter = s + "=*";
+               }
+       }
+
+       DPRINTF("ldap_search: basedn='%s', filter='%s'",
+               authldaprc.ldap_basedn.c_str(), enumerate_filter.c_str());
+
+       authldaprc_search_attributes search_attributes(attribute_vector);
+
+       struct timeval tv;
+       tv.tv_sec=60*60;
+       tv.tv_usec=0;
+
+       if (ldap_search_ext(main_connection.connection,
+                           authldaprc.ldap_basedn.c_str(),
+                           LDAP_SCOPE_SUBTREE,
+                           enumerate_filter.c_str(),
+                           search_attributes.search_attributes(),
+                           0,
+                           NULL, NULL, &tv, 1000000, &msgid) < 0)
+       {
+               DPRINTF("ldap_search_ext failed");
+               return;
+       }
+
+       /* Process results */
+
+       while (1)
+       {
+               struct timeval timeout;
+               LDAPMessage *entry;
+
+               timeout.tv_sec=authldaprc.timeout;
+               timeout.tv_usec=0;
+
+               authldaprc_search_result search_result(main_connection,
+                                                      msgid,
+                                                      false,
+                                                      timeout);
+
+               if (search_result.finished)
+                       break;
+
+               if (!search_result)
+                       return;
+
+               entry = ldap_first_entry(main_connection.connection, search_result.ptr);
+
+               while (entry)
+               {
+                       std::vector<std::string>
+                               names=authldap_entry_values(main_connection.connection,
+                                                           entry,
+                                                           mail_field);
+
+                       if (names.empty())
+                       {
+                               entry = ldap_next_entry(main_connection.connection, entry);
+                               continue;
+                       }
+
+                       size_t n=names.size();
+
+                       if (n > 0)
+                       {
+                               std::string uid_s, gid_s, homedir, maildir;
+                               uid_t uid=authldaprc.uid;
+                               gid_t gid=authldaprc.gid;
+
+                               authldap_get_values
+                                       get_value(main_connection.connection, entry,
+                                                 names[0]);
+
+                               if (!uid_field.empty())
+                                       get_value(uid_field, uid_s);
+
+                               if (!gid_field.empty())
+                               {
+                                       get_value(gid_field, gid_s);
+                               }
+
+                               get_value(homedir_field, homedir);
+                               get_value(maildir_field, maildir);
+
+                               if (!uid_s.empty())
+                                       std::istringstream(uid_s)
+                                               >> uid;
+
+                               if (!gid_s.empty())
+                                       std::istringstream(gid_s)
+                                               >> gid;
+
+                               std::string options=get_value.options();
+
+                               for (size_t j=0; j < n; j++)
+                               {
+                                       if (!homedir.empty())
+                                               (*cb_func)(names[j].c_str(),
+                                                          uid, gid,
+                                                          homedir.c_str(),
+                                                          maildir.empty()
+                                                          ? 0:maildir.c_str(),
+                                                          options.empty()
+                                                          ? 0:options.c_str(),
+                                                          void_arg);
+                               }
+                       }
+
+                       entry = ldap_next_entry(main_connection.connection, entry);
+               }
+       }
+
+       /* Success */
+       (*cb_func)(NULL, 0, 0, NULL, NULL, NULL, void_arg);
+}
+
+static void cpp_authldapclose()
+{
+       main_connection.disconnect();
+       bind_connection.disconnect();
+}
+
+class authldap_lookup : private authldaprc_attributes {
+
+       struct authinfo auth;
+       const char *service;
+       std::string attrname;
+       std::string user;
+       const char *pass;
+       const char *newpass;
+       const char *authaddr;
+
+public:
+       authldap_lookup(const char *serviceArg,
+                       const std::string &attrnameArg,
+                       const std::string &userArg,
+                       const char *passArg,
+                       const char *newpassArg,
+                       const char *authaddrArg);
+
+       int operator()(int (*callback)(struct authinfo *, void *), void *arg);
+
+private:
+       int verify_password(const std::string &dn);
+       int verify_password_myself(const std::string &dn);
+       int verify_password_authbind(const std::string &dn);
+};
+
+authldap_lookup::authldap_lookup(const char *serviceArg,
+                                const std::string &attrnameArg,
+                                const std::string &userArg,
+                                const char *passArg,
+                                const char *newpassArg,
+                                const char *authaddrArg)
+       : service(serviceArg),
+         attrname(attrnameArg),
+         user(userArg),
+         pass(passArg),
+         newpass(newpassArg),
+         authaddr(authaddrArg)
+{
+}
+
+int authldap_lookup::operator()(int (*callback)(struct authinfo *, void *),
+                               void *arg)
+{
+       struct timeval timeout;
+
+       LDAPMessage *entry;
+
+       std::string dn;
+
+       std::string homeDir, mailDir, userPassword,
+               cryptPassword,
+               cn,
+               uidNumber,
+               gidNumber, quota;
+
+       uid_t au;
+       gid_t ag;
+       int rc;
+
+       std::ostringstream query;
+
+       std::string filter;
+
+       authldaprc.config("LDAP_FILTER", filter, false);
+
+       if (!filter.empty())
+       {
+               query << "(&" << filter;
+       }
+
+       query << "(" << attrname << "=" << user;
+
+       std::string domain;
+
+       authldaprc.config("LDAP_DOMAIN", domain, false);
+
+       if (!domain.empty() &&
+            std::find(user.begin(), user.end(), '@') == user.end())
+               query << "@" << domain;
+       query << ")";
+
+       if (!filter.empty())
+               query << ")";
+
+       std::string query_str=query.str();
+
+       DPRINTF("Query: %s", query_str.c_str());
+
+       timeout.tv_sec=authldaprc.timeout;
+       timeout.tv_usec=0;
+
+       attribute("LDAP_HOMEDIR", "homeDir", homeDir);
+       attribute(service && strcmp(service, "courier") == 0
+                 ? "LDAP_DEFAULTDELIVERY":"LDAP_MAILDIR", 0, mailDir);
+       attribute("LDAP_FULLNAME", 0, cn);
+       std::string clearpw_value=attribute("LDAP_CLEARPW", 0, userPassword);
+       std::string cryptpw_value=attribute("LDAP_CRYPTPW", 0, cryptPassword);
+       attribute("LDAP_UID", 0, uidNumber);
+       attribute("LDAP_GID", 0, gidNumber);
+       attribute("LDAP_MAILDIRQUOTA", 0, quota);
+
+       authldaprc_attribute_vector all_attributes(attributes);
+
+       for (size_t i=0; i<authldaprc.auxoptions.size(); i++)
+       {
+               all_attributes.push_back(authldaprc.auxoptions[i]);
+       }
+
+       authldaprc_search_result result(main_connection,
+                                       authldaprc.ldap_basedn,
+                                       query_str,
+                                       all_attributes,
+                                       timeout);
+
+       int n_entries=ldap_count_entries(main_connection.connection, result.ptr);
+
+       if (n_entries != 1)
+       {
+               if (n_entries == 0)
+               {
+                       DPRINTF("Not found");
+               }
+               else
+               {
+                       DPRINTF("Returned multiple entries (%d)", n_entries);
+               }
+               return -1;
+       }
+
+       char *dn_p = ldap_get_dn(main_connection.connection, result.ptr);
+
+       DPRINTF("Returned DN: %s", dn_p ? dn_p : "<null>");
+
+       if (dn_p == NULL)
+       {
+               DPRINTF("ldap_get_dn failed");
+               return -1;
+       }
+
+       dn=dn_p;
+       free(dn_p);
+
+       /* Get the pointer on this result */
+       entry=ldap_first_entry(main_connection.connection, result.ptr);
+       if (entry==NULL)
+       {
+               DPRINTF("ldap_first_entry failed");
+               return -1;
+       }
+
+       /* print all the raw attributes */
+       if (courier_authdebug_login_level >= 2)
+       {
+               BerElement *berptr = 0;
+               char *attr=
+                       ldap_first_attribute(main_connection.connection, entry, &berptr);
+
+               while (attr)
+               {
+                       std::vector<std::string>
+                               values=authldap_entry_values(main_connection.connection,
+                                                            entry,
+                                                            attr);
+                       for (size_t i=0; i<values.size(); ++i)
+                               DPRINTF("    %s: %s", attr, values[i].c_str());
+
+                       ldap_memfree(attr);
+                       attr = ldap_next_attribute(main_connection.connection, entry,
+                                                  berptr);
+               }
+
+               ber_free(berptr, 0);
+       }
+
+       authldap_get_values get_value(main_connection.connection, entry, dn.c_str());
+
+       for (std::map<std::string, std::string *>::iterator
+                    p=attributes.begin(); p != attributes.end(); ++p)
+       {
+               get_value(p->first, *p->second);
+       }
+
+       au=authldaprc.uid;
+       ag=authldaprc.gid;
+       if (!uidNumber.empty())
+       {
+               std::istringstream(uidNumber) >> au;
+       }
+
+       if (!gidNumber.empty())
+       {
+               std::istringstream(gidNumber) >> ag;
+       }
+
+       std::string mailroot;
+
+       authldaprc.config("LDAP_MAILROOT", mailroot, false);
+
+       if (!homeDir.empty() && !mailroot.empty())
+       {
+               homeDir = mailroot + "/" + homeDir;
+       }
+
+       std::string options=get_value.options();
+
+       memset(&auth, 0, sizeof(auth));
+
+       auth.sysuserid= &au;
+       auth.sysgroupid= ag;
+       auth.homedir=homeDir.c_str();
+       auth.address=authaddr;
+       auth.fullname=cn.c_str();
+
+       if (!mailDir.empty())
+               auth.maildir=mailDir.c_str();
+
+       if (!userPassword.empty())
+               auth.clearpasswd=userPassword.c_str();
+
+       if (!cryptPassword.empty())
+               auth.passwd=cryptPassword.c_str();
+
+       if (!quota.empty())
+               auth.quota=quota.c_str();
+
+       if (!options.empty())
+               auth.options=options.c_str();
+
+       rc=0;
+
+       if (au == 0 || ag == 0)
+       {
+               courier_auth_err("authldaplib: refuse to authenticate %s: uid=%d, gid=%d (zero uid or gid not permitted)",
+                                user.c_str(), au, ag);
+               rc= 1;
+       }
+
+       courier_authdebug_authinfo("DEBUG: authldaplib: ", &auth,
+                                  userPassword.c_str(),
+                                  cryptPassword.c_str());
+
+       if (rc == 0)
+               rc=verify_password(dn);
+
+       std::string newpass_crypt;
+
+       if (rc == 0 && newpass)
+       {
+               char *p=authcryptpasswd(newpass, auth.passwd);
+
+               if (!p)
+                       rc=-1;
+               else
+               {
+                       newpass_crypt=p;
+                       free(p);
+               }
+
+               LDAPMod *mods[3];
+               int mod_index=0;
+
+               LDAPMod mod_clear, mod_crypt;
+               char *mod_clear_vals[2], *mod_crypt_vals[2];
+
+               std::vector<char> clearpw_buffer, cryptpw_buffer;
+
+               if (!clearpw_value.empty() && auth.clearpasswd)
+               {
+                       clearpw_buffer.insert(clearpw_buffer.end(),
+                                             clearpw_value.begin(),
+                                             clearpw_value.end());
+
+                       clearpw_buffer.push_back(0);
+
+                       mods[mod_index]= &mod_clear;
+                       mod_clear.mod_op=LDAP_MOD_REPLACE;
+                       mod_clear.mod_type=&clearpw_buffer[0];
+                       mod_clear.mod_values=mod_clear_vals;
+
+                       DPRINTF("Modify: %s", mod_clear.mod_type);
+
+                       mod_clear_vals[0]=(char *)newpass;
+                       mod_clear_vals[1]=NULL;
+                       ++mod_index;
+               }
+
+               if (!cryptpw_value.empty() &&
+                   !newpass_crypt.empty() && auth.passwd)
+               {
+                       cryptpw_buffer.insert(cryptpw_buffer.end(),
+                                             cryptpw_value.begin(),
+                                             cryptpw_value.end());
+
+                       cryptpw_buffer.push_back(0);
+
+                       mods[mod_index]= &mod_crypt;
+                       mod_crypt.mod_op=LDAP_MOD_REPLACE;
+                       mod_crypt.mod_type=&cryptpw_buffer[0];
+                       mod_crypt.mod_values=mod_crypt_vals;
+
+                       DPRINTF("Modify: %s", mod_crypt.mod_type);
+
+                       newpass_crypt.push_back(0);
+                       mod_crypt_vals[0]=&newpass_crypt[0];
+                       mod_crypt_vals[1]=NULL;
+                       ++mod_index;
+               }
+               if (mod_index == 0)
+                       rc= -1;
+               else
+               {
+                       mods[mod_index]=0;
+
+                       /*
+                       ** Use the user connection for updating the password.
+                       */
+
+                       int ld_errno=
+                               ldap_modify_ext_s(bind_connection.connected()
+                                                 ? bind_connection.connection
+                                                 : main_connection.connection,
+                                                 dn.c_str(), mods,
+                                                 NULL, NULL);
+
+                       if (ld_errno != LDAP_SUCCESS)
+                       {
+                               rc= -1;
+                               DPRINTF("Password update failed: %s",
+                                       ldap_err2string(ld_errno));
+                       }
+               }
+       }
+
+       if (rc == 0 && callback)
+       {
+               if (!auth.clearpasswd)
+                       auth.clearpasswd=pass;
+               rc= (*callback)(&auth, arg);
+       }
+
+       return (rc);
+}
+
+int authldap_lookup::verify_password(const std::string &dn)
+{
+       if (!pass)
+               return 0;
+
+       if (authldaprc.authbind)
+               return verify_password_authbind(dn);
+
+       return verify_password_myself(dn);
+}
+
+int authldap_lookup::verify_password_authbind(const std::string &dn)
+{
+       if (!bind_connection.connect())
+               return 1;
+
+       if (!bind_connection.bind(dn, pass))
+       {
+               bind_connection.close();
+               return 1;
+       }
+
+       if (authldaprc.protocol_version == 2)
+       {
+               // protocol version 2 does not allow rebinds.
+
+               bind_connection.close();
+       }
+
+       return 0;
+}
+
+int authldap_lookup::verify_password_myself(const std::string &dn)
+{
+       if (auth.clearpasswd)
+       {
+               if (strcmp(pass, auth.clearpasswd))
+               {
+                       if (courier_authdebug_login_level >= 2)
+                       {
+                               DPRINTF("Password for %s: '%s' does not match clearpasswd '%s'",
+                                       dn.c_str(), pass, auth.clearpasswd);
+                       }
+                       else
+                       {
+                               DPRINTF("Password for %s does not match",
+                                       dn.c_str());
+                       }
+                       return -1;
+               }
+       }
+       else
+       {
+               const char *p=auth.passwd;
+
+               if (!p)
+               {
+                       DPRINTF("Missing password in LDAP!");
+                       return -1;
+               }
+
+               if (authcheckpassword(pass, p))
+               {
+                       DPRINTF("Password for %s does not match",
+                               dn.c_str());
+                       return -1;
+               }
+        }
+
+       return 0;
+}
+
+/*
+** Replace keywords in the emailmap string.
+*/
+
+static std::string emailmap_replace(const char *str,
+                                   const std::string &user_value,
+                                   const std::string &realm_value)
+{
+       std::ostringstream o;
+
+       while (*str)
+       {
+               const char *p=str;
+
+               while (*str && *str != '@')
+                       ++str;
+
+               o << std::string(p, str);
+
+               if (*str != '@')
+                       continue;
+
+               ++str;
+
+               p=str;
+               while (*str && *str != '@')
+                       ++str;
+
+               std::string key(p, str);
+
+               if (*str)
+                       ++str;
+
+               if (key == "user")
+                       o << user_value;
+               else if (key == "realm")
+                       o << realm_value;
+       }
+
+       return o.str();
+}
+
+static int auth_ldap_try(const char *service,
+                        const char *unquoted_user, const char *pass,
+                        int (*callback)(struct authinfo *, void *),
+                        void *arg, const char *newpass)
+{
+       std::string user;
+
+       {
+               char *q=courier_auth_ldap_escape(unquoted_user);
+
+               user=q;
+               free(q);
+       }
+
+       if (ldapopen()) return (-1);
+
+       std::string::iterator at=std::find(user.begin(), user.end(), '@');
+
+       std::string emailmap;
+
+       authldaprc.config("LDAP_EMAILMAP", emailmap, false);
+
+       std::string mail;
+
+       if (!authldaprc.config("LDAP_MAIL", mail, false, "mail"))
+               return -1;
+
+       if (emailmap.empty() || at == user.end())
+       {
+               authldap_lookup real_lookup(service, mail, user, pass,
+                                           newpass, user.c_str());
+
+               return real_lookup(callback, arg);
+       }
+
+       std::string user_value(user.begin(), at);
+       std::string realm_value(++at, user.end());
+
+       std::string query=
+               emailmap_replace(emailmap.c_str(), user_value, realm_value);
+
+       DPRINTF("using emailmap search: %s", query.c_str());
+
+       struct timeval tv;
+
+       tv.tv_sec=authldaprc.timeout;
+       tv.tv_usec=0;
+
+       std::vector<std::string> attributes;
+
+       attributes.push_back("");
+
+       authldaprc.config("LDAP_EMAILMAP_ATTRIBUTE", attributes[0], false);
+
+       if (attributes[0].empty())
+               attributes[0]="handle";
+
+       std::string basedn;
+
+       if (!authldaprc.config("LDAP_EMAILMAP_BASEDN", basedn, true))
+               return -1;
+
+       authldaprc_search_result
+               lookup(main_connection,
+                      basedn,
+                      query,
+                      attributes,
+                      tv);
+
+       if (!lookup)
+       {
+               if (main_connection.connection) return (-1);
+               return (1);
+       }
+
+       int cnt=ldap_count_entries(main_connection.connection, lookup.ptr);
+
+       if (cnt != 1)
+       {
+               courier_auth_err("emailmap: %d entries returned from search %s (but we need exactly 1)",
+                   cnt, query.c_str());
+               return -1;
+       }
+
+       LDAPMessage *entry=ldap_first_entry(main_connection.connection, lookup.ptr);
+
+       if (!entry)
+       {
+               courier_auth_err("authldap: unexpected NULL from ldap_first_entry");
+               return -1;
+       }
+
+       authldap_get_values get_value(main_connection.connection, entry, query);
+
+       std::string v;
+
+       get_value(attributes[0], v);
+
+       if (v.empty())
+       {
+               DPRINTF("emailmap: empty attribute");
+               return (-1);
+       }
+
+
+       std::string attrname;
+
+       authldaprc.config("LDAP_EMAILMAP_MAIL", attrname, false);
+
+       if (attrname.empty())
+       {
+               attrname=mail;
+       }
+
+       DPRINTF("emailmap: attribute=%s, value=%s", attrname.c_str(),
+               v.c_str());
+
+       authldap_lookup real_lookup(service, attrname, v.c_str(), pass,
+                                   newpass, user.c_str());
+
+       return real_lookup(callback, arg);
+}
+
+// Try the query once. If there's a connection-level error, try again.
+
+static int auth_ldap_retry(const char *service,
+                          const char *unquoted_user,
+                          const char *pass,
+                          int (*callback)(struct authinfo *, void *),
+                          void *arg, const char *newpass)
+{
+       int rc=auth_ldap_try(service, unquoted_user, pass, callback, arg,
+                            newpass);
+
+       if (rc > 0)
+               rc=auth_ldap_try(service, unquoted_user, pass, callback, arg,
+                                  newpass);
+
+       return rc;
+}
+
+extern "C" {
+
+#if 0
+};
+#endif
+
+int auth_ldap_changepw(const char *dummy, const char *user,
+                      const char *pass,
+                      const char *newpass)
+{
+       if (!authldaprc.load())
+               return 1;
+
+       return auth_ldap_retry("authlib", user, pass, NULL, NULL, newpass);
+}
+
+int authldapcommon(const char *service,
+                  const char *user, const char *pass,
+                  int (*callback)(struct authinfo *, void *),
+                  void *arg)
+{
+       if (!authldaprc.load())
+               return 1;
+       return (auth_ldap_retry(service, user, pass, callback, arg, NULL));
+}
+
+void authldapclose()
+{
+       cpp_authldapclose();
+}
+
+void auth_ldap_enumerate( void(*cb_func)(const char *name,
+                                        uid_t uid,
+                                        gid_t gid,
+                                        const char *homedir,
+                                        const char *maildir,
+                                        const char *options,
+                                        void *void_arg),
+                          void *void_arg)
+{
+       if (!authldaprc.load())
+               return;
+
+       cpp_auth_ldap_enumerate(cb_func, void_arg);
+}
+
+#if 0
+{
+#endif
+}
index 812c6f9..77131a8 100644 (file)
@@ -1,6 +1,6 @@
-##VERSION: $Id: authldaprc 265 2013-02-25 03:49:33Z mrsam $
+##VERSION: $Id: 7ee49247d1dbf52d4bb8e0b1a180f2411aa3628a-20160107214650$
 #
-# Copyright 2000-2004 Double Precision, Inc.  See COPYING for
+# Copyright 2000-2016 Double Precision, Inc.  See COPYING for
 # distribution information.
 #
 # Do not alter lines that begin with ##, they are used when upgrading
@@ -20,6 +20,8 @@
 # That is, the name of the field, followed by spaces or tabs, followed by
 # field value.  No trailing spaces.
 #
+# Changes to this file take effect immediately.
+#
 # Here are the fields:
 
 ##NAME: LOCATION:1
@@ -69,11 +71,11 @@ LDAP_TIMEOUT                5
 
 ##NAME: LDAP_INITBIND:1
 #
-# Define this to do an initial bind to the adminstrator DN set in LDAP_BINDDN. 
+# Define this to do an initial bind to the adminstrator DN set in LDAP_BINDDN.
 # If your LDAP server allows access without a bind, or you want to authenticate
 # using a rebind (and have set LDAP_AUTHBIND to 1, you can set this to 0 and
 # need not write the LDAP-Admin passwort into this file.
-# 
+#
 LDAP_INITBIND          1
 
 ##NAME: LDAP_MAIL:0
@@ -93,7 +95,7 @@ LDAP_MAIL             mail
 
 ##NAME: LDAP_DOMAIN:0
 #
-# The following default domain will be appended, if not explicitly specified. 
+# The following default domain will be appended, if not explicitly specified.
 #
 # LDAP_DOMAIN          example.com
 
@@ -176,7 +178,7 @@ LDAP_CRYPTPW                userPassword
 #
 # Auxiliary options.  The LDAP_AUXOPTIONS setting should contain a list of
 # comma-separated "ATTRIBUTE=NAME" pairs.  These names are additional
-# attributes that define various per-account "options", as given in 
+# attributes that define various per-account "options", as given in
 # INSTALL's description of the OPTIONS setting.
 #
 # Each ATTRIBUTE specifies an LDAP attribute name.  If it is present,
@@ -198,7 +200,6 @@ LDAP_CRYPTPW                userPassword
 
 ##NAME: LDAP_ENUMERATE_FILTER:0
 #
-# {EXPERIMENTAL}
 # Optional custom filter used when enumerating accounts for authenumerate,
 # in order to compile a list of accounts for shared folders. If present,
 # this filter will be used instead of LDAP_FILTER.
@@ -280,3 +281,8 @@ LDAP_TLS            0
 # LDAP_BASEDN, but will key against LDAP_EMAILMAP_MAIL instead of LDAP_MAIL.
 #
 # LDAP_EMAILMAP_MAIL mail
+
+##NAME: MARKER:0
+#
+# Do not remove this section from this configuration file. This section
+# must be present at the end of this file.
index 4de8780..01580c0 100644 (file)
@@ -2,14 +2,14 @@
 .\"  <!-- Copyright 2004-2015 Double Precision, Inc.  See COPYING for -->
 .\"  <!-- distribution information. -->
 .\"     Title: authlib
-.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
-.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\"      Date: 11/04/2015
+.\"    Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
+.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
+.\"      Date: 09/08/2017
 .\"    Manual: Double Precision, Inc.
 .\"    Source: Double Precision, Inc.
 .\"  Language: English
 .\"
-.TH "AUTHLIB" "3" "11/04/2015" "Double Precision, Inc." "Double Precision, Inc."
+.TH "AUTHLIB" "3" "09/08/2017" "Double Precision, Inc." "Double Precision, Inc."
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
similarity index 60%
rename from authmysql.c
rename to authmysql.cpp
index d7e6269..362930d 100644 (file)
 #if    HAVE_UNISTD_H
 #include       <unistd.h>
 #endif
+#include <iostream>
 
-#include       "auth.h"
 #include       "authmysql.h"
+extern "C" {
+#include       "auth.h"
 #include       "courierauthstaticlist.h"
 #include       "courierauthdebug.h"
-#include       "libhmac/hmac.h"
-#include       "cramlib.h"
-
-
-extern void auth_mysql_enumerate( void(*cb_func)(const char *name,
-                                                uid_t uid,
-                                                gid_t gid,
-                                                const char *homedir,
-                                                const char *maildir,
-                                                const char *options,
-                                                void *void_arg),
-                                 void *void_arg);
+#include       "courierauth.h"
+}
 
-static int auth_mysql_login(const char *service, char *authdata,
-                           int (*callback_func)(struct authinfo *, void *),
-                           void *callback_arg)
+static bool verify(const authmysqluserinfo &authinfo,
+                  const char *user,
+                  const char *pass)
 {
-       char *user, *pass;
-       struct authmysqluserinfo *authinfo;
-       struct  authinfo        aa;
-
-
-       if ((user=strtok(authdata, "\n")) == 0 ||
-               (pass=strtok(0, "\n")) == 0)
+       if (authinfo.home.size() == 0)  /* User not found */
        {
                errno=EPERM;
-               return (-1);
+               return false;           /* Username not found */
        }
 
-       authinfo=auth_mysql_getuserinfo(user, service);
-
-       if (!authinfo)          /* Fatal error - such as MySQL being down */
+       if (authinfo.cryptpw.size())
        {
-               errno=EACCES;
-               return (-1);
-       }
-
-       if (authinfo->cryptpw)
-       {
-               if (authcheckpassword(pass,authinfo->cryptpw))
+               if (authcheckpassword(pass,authinfo.cryptpw.c_str()))
                {
                        errno=EPERM;
-                       return (-1);    /* User/Password not found. */
+                       return false;   /* User/Password not found. */
                }
        }
-       else if (authinfo->clearpw)
+       else if (authinfo.clearpw.size())
        {
-               if (strcmp(pass, authinfo->clearpw))
+               if (authinfo.clearpw != pass)
                {
                        if (courier_authdebug_login_level >= 2)
                        {
                                DPRINTF("supplied password '%s' does not match clearpasswd '%s'",
-                                       pass, authinfo->clearpw);
+                                       pass, authinfo.clearpw.c_str());
                        }
                        else
                        {
                                DPRINTF("supplied password does not match clearpasswd");
                        }
                        errno=EPERM;
-                       return (-1);
+                       return false;
                }
        }
        else
        {
-               DPRINTF("no password available to compare");
+               DPRINTF("no password available to compare for '%s'", user);
                errno=EPERM;
-               return (-1);            /* Username not found */
+               return false;           /* Username not found */
        }
+       return true;
+}
+
+static int auth_mysql_login(const char *service, char *authdata,
+                           int (*callback_func)(struct authinfo *, void *),
+                           void *callback_arg)
+{
+       char *user, *pass;
+       struct  authinfo        aa;
+
+       if ((user=strtok(authdata, "\n")) == 0 ||
+               (pass=strtok(0, "\n")) == 0)
+       {
+               errno=EPERM;
+               return (-1);
+       }
+
+       authmysqluserinfo authinfo;
+
+       if (!auth_mysql_getuserinfo(user, service, authinfo))
+               /* Fatal error - such as MySQL being down */
+       {
+               errno=EACCES;
+               return (-1);
+       }
+
+       if (!verify(authinfo, user, pass))
+               return -1;
 
        memset(&aa, 0, sizeof(aa));
 
-       aa.sysuserid= &authinfo->uid;
-       aa.sysgroupid= authinfo->gid;
-       aa.homedir=authinfo->home;
-       aa.maildir=authinfo->maildir && authinfo->maildir[0] ?
-               authinfo->maildir:0;
-       aa.address=authinfo->username;
-       aa.quota=authinfo->quota && authinfo->quota[0] ?
-               authinfo->quota:0;
-       aa.fullname=authinfo->fullname;
-       aa.options=authinfo->options;
+       aa.sysuserid= &authinfo.uid;
+       aa.sysgroupid= authinfo.gid;
+       aa.homedir=authinfo.home.c_str();
+
+#define STR(z) (authinfo.z.size() ? authinfo.z.c_str():0)
+
+       aa.maildir=STR(maildir);
+       aa.address=STR(username);
+       aa.quota=STR(quota);
+       aa.fullname=STR(fullname);
+       aa.options=STR(options);
        aa.clearpasswd=pass;
-       aa.passwd=authinfo->cryptpw;
+       aa.passwd=STR(cryptpw);
        courier_authdebug_authinfo("DEBUG: authmysql: ", &aa,
-                           authinfo->clearpw, authinfo->cryptpw);
+                                  aa.clearpasswd, aa.passwd);
 
        return (*callback_func)(&aa, callback_arg);
 }
@@ -111,39 +118,20 @@ static int auth_mysql_changepw(const char *service, const char *user,
                               const char *pass,
                               const char *newpass)
 {
-       struct authmysqluserinfo *authinfo;
-
-       authinfo=auth_mysql_getuserinfo(user, service);
+       authmysqluserinfo authinfo;
 
-       if (!authinfo)
+       if (!auth_mysql_getuserinfo(user, service, authinfo))
        {
                errno=ENOENT;
                return (-1);
        }
 
-       if (authinfo->cryptpw)
+       if (!verify(authinfo, user, pass))
        {
-               if (authcheckpassword(pass,authinfo->cryptpw))
-               {
-                       errno=EPERM;
-                       return (-1);    /* User/Password not found. */
-               }
-       }
-       else if (authinfo->clearpw)
-       {
-               if (strcmp(pass, authinfo->clearpw))
-               {
-                       errno=EPERM;
-                       return (-1);
-               }
-       }
-       else
-       {
-               errno=EPERM;
                return (-1);
        }
 
-       if (auth_mysql_setpass(user, newpass, authinfo->cryptpw))
+       if (!auth_mysql_setpass(user, newpass, authinfo.cryptpw.c_str()))
        {
                errno=EPERM;
                return (-1);
@@ -193,7 +181,9 @@ static struct authstaticinfo authmysql_info={
        auth_mysql_enumerate};
 
 
-struct authstaticinfo *courier_authmysql_init()
-{
-       return &authmysql_info;
+extern "C" {
+       struct authstaticinfo *courier_authmysql_init()
+       {
+               return &authmysql_info;
+       }
 }
index 01bf6cf..3cade40 100644 (file)
@@ -3,33 +3,47 @@
 
 #include       "courier_auth_config.h"
 #include       <stdlib.h>
-#include       <string.h>
 #include       <sys/types.h>
 #include       <mysql.h>
 #include       <errmsg.h>
 
-struct authmysqluserinfo {
-       char *username;
-       char *fullname;
-       char *cryptpw;
-       char *clearpw;
-       char *home;
-       char *maildir;
-       char *quota;
-       char *options;
+#include        <string>
+
+class authmysqluserinfo {
+ public:
+       std::string username;
+       std::string fullname;
+       std::string cryptpw;
+       std::string clearpw;
+       std::string home;
+       std::string maildir;
+       std::string quota;
+       std::string options;
        uid_t uid;
        gid_t gid;
-       } ;
+};
+
+bool auth_mysql_getuserinfo(const char *username,
+                           const char *service,
+                           authmysqluserinfo &uiret);
 
-extern struct authmysqluserinfo *auth_mysql_getuserinfo(const char *,
-                                                       const char *);
 extern void auth_mysql_cleanup();
 
-extern int auth_mysql_setpass(const char *, const char *, const char *);
+extern bool auth_mysql_setpass(const char *, const char *, const char *);
 
 struct authinfo;
 
 extern int auth_mysql_pre(const char *, const char *,
                 int (*)(struct authinfo *, void *), void *arg);
 
+extern void auth_mysql_enumerate( void(*cb_func)(const char *name,
+                                                uid_t uid,
+                                                gid_t gid,
+                                                const char *homedir,
+                                                const char *maildir,
+                                                const char *options,
+                                                void *void_arg),
+                                 void *void_arg);
+
+
 #endif
diff --git a/authmysqllib.c b/authmysqllib.c
deleted file mode 100644 (file)
index 08ebdee..0000000
+++ /dev/null
@@ -1,809 +0,0 @@
-/*
-** Copyright 2000-2010 Double Precision, Inc.  See COPYING for
-** distribution information.
-*/
-
-#include       <stdio.h>
-#include       <stdlib.h>
-#include       <string.h>
-#include       <unistd.h>
-#include       <ctype.h>
-#include       <sys/types.h>
-#include       <sys/stat.h>
-#include       <mysql.h>
-#include       <time.h>
-
-#include       "authmysql.h"
-#include       "authmysqlrc.h"
-#include       "auth.h"
-#include       "courierauthdebug.h"
-
-#define err courier_auth_err
-
-static const char *read_env(const char *env)
-{
-       return authgetconfig(AUTHMYSQLRC, env);
-}
-
-static MYSQL mysql_buf;
-
-static MYSQL *mysql=0;
-
-static char *escape_str(const char *c, size_t n)
-{
-       char *buf=malloc(n*2+1);
-
-       if (!buf)
-       {
-               perror("malloc");
-               return NULL;
-       }
-
-       mysql_real_escape_string(mysql, buf, c, n);
-       return buf;
-}
-
-static void set_session_options(void)
-/*
-* session variables can be set once for the whole session
-*/
-{
-/* Anton Dobkin <anton@viansib.ru>, VIAN, Ltd. */
-#if MYSQL_VERSION_ID >= 41000    
-       const char *character_set=read_env("MYSQL_CHARACTER_SET"), *check;
-    
-        if(character_set){
-
-            /*
-            * This function works like the SET NAMES statement, but also sets
-            * the value of mysql->charset, and thus affects the character set
-            * used by mysql_real_escape_string()
-            *
-            * (return value apparently work the opposite of what is documented)
-            */
-            mysql_set_character_set(mysql, character_set);
-            check = mysql_character_set_name(mysql);
-            if (strcmp(character_set, check) != 0)
-            {
-                err("Cannot set MySQL character set \"%s\", working with \"%s\"\n",
-                    character_set, check);
-            }
-            else
-            {
-                DPRINTF("Install of a character set for MySQL: %s", character_set);
-            }
-        }
-#endif /* 41000 */
-}
-
-static int do_connect()
-{
-const  char *server;
-const  char *userid;
-const  char *password;
-const  char *database;
-const  char *server_socket=0;
-unsigned int server_port=0;
-unsigned int server_opt=0;
-const  char *p;
-
-const  char *sslkey;
-const  char *sslcert;
-const  char *sslcacert;
-const  char *sslcapath;
-const  char *sslcipher;
-unsigned int  use_ssl=0;
-
-/*
-** Periodically detect dead connections.
-*/
-       if (mysql)
-       {
-               static time_t last_time=0;
-               time_t t_check;
-
-               time(&t_check);
-
-               if (t_check < last_time)
-                       last_time=t_check;      /* System clock changed */
-
-               if (t_check < last_time + 60)
-                       return (0);
-
-               last_time=t_check;
-                       
-               if (mysql_ping(mysql) == 0) return (0);
-
-               DPRINTF("authmysqllib: mysql_ping failed, connection lost");
-               mysql_close(mysql);
-               mysql=0;
-       }
-
-       server=read_env("MYSQL_SERVER");
-       userid=read_env("MYSQL_USERNAME");
-       password=read_env("MYSQL_PASSWORD");
-       database=read_env("MYSQL_DATABASE");
-
-#if MYSQL_VERSION_ID >= 32200
-       sslkey=read_env("MYSQL_SSL_KEY");
-       sslcert=read_env("MYSQL_SSL_CERT");
-       sslcacert=read_env("MYSQL_SSL_CACERT");
-       sslcapath=read_env("MYSQL_SSL_CAPATH");
-       sslcipher=read_env("MYSQL_SSL_CIPHER");
-
-       if ((sslcert != NULL) && ((sslcacert != NULL) || (sslcapath != NULL)))
-       {
-               use_ssl=1;
-       }
-#endif
-
-       server_socket=(char *) read_env("MYSQL_SOCKET");
-
-       if ((p=read_env("MYSQL_PORT")) != 0)
-       {
-               server_port=(unsigned int) atoi(p);
-       }
-
-       if ((p=read_env("MYSQL_OPT")) != 0)
-       {
-               server_opt=(unsigned int) atol(p);
-       }
-
-       if (!server && !server_socket)
-       {
-               err("authmysql: MYSQL_SERVER nor MYSQL_SOCKET set in"
-                       AUTHMYSQLRC ".");
-               return (-1);
-       }
-
-       if (!userid)
-       {
-               err("authmysql: MYSQL_USERNAME not set in "
-                       AUTHMYSQLRC ".");
-               return (-1);
-       }
-
-       if (!database)
-       {
-               err("authmysql: MYSQL_DATABASE not set in "
-                       AUTHMYSQLRC ".");
-               return (-1);
-       }
-
-#if MYSQL_VERSION_ID >= 32200
-       mysql_init(&mysql_buf);
-       if (use_ssl)
-       {
-               mysql_ssl_set(&mysql_buf, sslkey, sslcert, sslcacert,
-                             sslcapath, sslcipher);
-       }
-       mysql=mysql_real_connect(&mysql_buf, server, userid, password,
-                                NULL,
-                                server_port,
-                                server_socket,
-                                server_opt);
-#else
-       mysql=mysql_connect(&mysql_buf, server, userid, password);
-#endif
-       if (!mysql)
-       {
-               err("failed to connect to mysql server (server=%s, userid=%s): %s",
-                       server ? server : "<null>",
-                       userid ? userid : "<null>",
-                       mysql_error(&mysql_buf));
-               return (-1);
-       }
-
-       if (mysql_select_db(mysql, database))
-       {
-               err("authmysql: mysql_select_db(%s) error: %s",
-                       database, mysql_error(mysql));
-               mysql_close(mysql);
-               mysql=0;
-               return (-1);
-       }
-       
-       DPRINTF("authmysqllib: connected. Versions: "
-               "header %lu, "
-               "client %lu, "
-               "server %lu",
-               (long)MYSQL_VERSION_ID,
-               mysql_get_client_version(),
-               mysql_get_server_version(mysql));
-
-       set_session_options();  
-       return (0);
-}
-
-void auth_mysql_cleanup()
-{
-       if (mysql)
-       {
-               mysql_close(mysql);
-               mysql=0;
-       }
-}
-
-static struct authmysqluserinfo ui={0, 0, 0, 0, 0, 0, 0, 0};
-
-static void initui()
-{
-
-       if (ui.username)
-               free(ui.username);
-       if (ui.cryptpw)
-               free(ui.cryptpw);
-       if (ui.clearpw)
-               free(ui.clearpw);
-       if (ui.home)
-               free(ui.home);
-       if (ui.maildir)
-               free(ui.maildir);
-       if (ui.quota)
-               free(ui.quota);
-       if (ui.fullname)
-               free(ui.fullname);
-       if (ui.options)
-               free(ui.options);
-       memset(&ui, 0, sizeof(ui));
-}
-
-struct authmysqluserinfo *auth_mysql_getuserinfo(const char *username,
-                                                const char *service)
-{
-const char *defdomain  =NULL;
-char   *querybuf;
-MYSQL_ROW      row;
-MYSQL_RES      *result;
-int            num_fields;
-char           *endp;
-
-const char     *select_clause; /* siefca@pld.org.pl */
-
-#define DEFAULT_SELECT_QUERY "SELECT %s, %s, %s, %s, %s, %s, %s, %s, %s, %s FROM %s WHERE %s = '%s%s%s' %s%s%s", \
-               login_field, crypt_field, clear_field, uid_field,\
-               gid_field, home_field, maildir_field, quota_field,\
-               name_field, options_field, user_table, login_field,\
-               username_escaped,\
-               has_domain || !*defdomain ? "":"@", has_domain ? "":defdomain, \
-               *where_clause ? " AND (":"", where_clause,\
-               *where_clause ? ")":""
-
-       if (do_connect())       return (0);
-
-       initui();
-
-       select_clause=read_env("MYSQL_SELECT_CLAUSE");
-       defdomain=read_env("DEFAULT_DOMAIN");   
-       if (!defdomain) defdomain="";
-       
-       if (!select_clause) /* siefca@pld.org.pl */
-       {
-               const char      *user_table,
-                               *crypt_field,
-                               *clear_field,
-                               *name_field,
-                               *uid_field,
-                               *gid_field,
-                               *login_field,
-                               *home_field,
-                               *maildir_field,
-                               *quota_field,
-                               *options_field,
-                               *where_clause;
-               char            *username_escaped;
-               size_t  query_size;
-               char dummy_buf[1];
-               int has_domain;
-
-               user_table=read_env("MYSQL_USER_TABLE");
-
-               if (!user_table)
-               {
-                       err("authmysql: MYSQL_USER_TABLE not set in "
-                               AUTHMYSQLRC ".");
-                       return (0);
-               }
-
-               crypt_field=read_env("MYSQL_CRYPT_PWFIELD");
-               clear_field=read_env("MYSQL_CLEAR_PWFIELD");
-               name_field=read_env("MYSQL_NAME_FIELD");
-
-               if (!crypt_field && !clear_field)
-               {
-                       err("authmysql: MYSQL_CRYPT_PWFIELD and "
-                               "MYSQL_CLEAR_PWFIELD not set in " AUTHMYSQLRC ".");
-                       return (0);
-               }
-               if (!crypt_field) crypt_field="\"\"";
-               if (!clear_field) clear_field="\"\"";
-               if (!name_field) name_field="\"\"";
-
-               uid_field = read_env("MYSQL_UID_FIELD");
-               if (!uid_field) uid_field = "uid";
-
-               gid_field = read_env("MYSQL_GID_FIELD");
-               if (!gid_field) gid_field = "gid";
-
-               login_field = read_env("MYSQL_LOGIN_FIELD");
-               if (!login_field) login_field = "id";
-
-               home_field = read_env("MYSQL_HOME_FIELD");
-               if (!home_field) home_field = "home";
-
-               maildir_field=read_env(service && strcmp(service, "courier")==0
-                                      ? "MYSQL_DEFAULTDELIVERY"
-                                      : "MYSQL_MAILDIR_FIELD");
-               if (!maildir_field) maildir_field="\"\"";
-
-               quota_field=read_env("MYSQL_QUOTA_FIELD");
-               if (!quota_field) quota_field="\"\""; 
-
-               options_field=read_env("MYSQL_AUXOPTIONS_FIELD");
-               if (!options_field) options_field="\"\"";
-
-               where_clause=read_env("MYSQL_WHERE_CLAUSE");
-               if (!where_clause) where_clause = "";
-
-               username_escaped=malloc(strlen(username)*2+1);
-
-               if (!username_escaped)
-               {
-                       perror("malloc");
-                       return (0);
-               }
-
-               mysql_real_escape_string(mysql, username_escaped,
-                                        username, strlen(username));
-
-               has_domain=strchr(username, '@') != NULL;
-
-               query_size=snprintf(dummy_buf, 1, DEFAULT_SELECT_QUERY);
-
-               querybuf=malloc(query_size+1);
-
-               if (!querybuf)
-               {
-                       free(username_escaped);
-                       perror("malloc");
-                       return(0);
-               }
-
-               snprintf(querybuf, query_size+1, DEFAULT_SELECT_QUERY);
-               free(username_escaped);
-
-       }
-       else
-       {
-               /* siefca@pld.org.pl */
-               querybuf=auth_parse_select_clause (escape_str,
-                                                  select_clause, username,
-                                                  defdomain, service);
-               if (!querybuf)
-               {
-                       DPRINTF("parse_select_clause failed (DEFAULT_DOMAIN not set?)");
-                       return 0;
-               }
-       }
-
-       DPRINTF("SQL query: %s", querybuf);
-       if (mysql_query (mysql, querybuf))
-       {
-               /* <o.blasnik@nextra.de> */
-
-               DPRINTF("mysql_query failed, reconnecting: %s", mysql_error(mysql));
-               auth_mysql_cleanup();
-
-               if (do_connect())
-               {
-                       free(querybuf);
-                       return (0);
-               }
-
-               if (mysql_query (mysql, querybuf))
-               {
-                       DPRINTF("mysql_query failed second time, giving up: %s", mysql_error(mysql));
-                       free(querybuf);
-                       auth_mysql_cleanup();
-                       /* Server went down, that's OK,
-                       ** try again next time.
-                       */
-                       return (0);
-               }
-       }
-       free(querybuf);
-
-       result = mysql_store_result (mysql);       
-       if (result)
-       {
-               if (mysql_num_rows(result))
-               {
-                       row = mysql_fetch_row (result);
-                       num_fields = mysql_num_fields (result);
-
-                       if (num_fields < 6)
-                       {
-                               DPRINTF("incomplete row, only %d fields returned",
-                                       num_fields);
-                               mysql_free_result(result);
-                               return(0);
-                       }
-
-                       if (row[0] && row[0][0])
-                               ui.username=strdup(row[0]);
-                       if (row[1] && row[1][0])
-                               ui.cryptpw=strdup(row[1]);
-                       if (row[2] && row[2][0])
-                               ui.clearpw=strdup(row[2]);
-                       /* perhaps authmysql needs a glob_uid/glob_gid feature
-                          like authldap? */
-                       if (!row[3] || !row[3][0] ||
-                          (ui.uid=strtol(row[3], &endp, 10), endp[0] != '\0'))
-                       {
-                               DPRINTF("invalid value for uid: '%s'",
-                                       row[3] ? row[3] : "<null>");
-                               mysql_free_result(result);
-                               return 0;
-                       }
-                       if (!row[4] || !row[4][0] ||
-                          (ui.gid=strtol(row[4], &endp, 10), endp[0] != '\0'))
-                       {
-                               DPRINTF("invalid value for gid: '%s'",
-                                       row[4] ? row[4] : "<null>");
-                               mysql_free_result(result);
-                               return 0;
-                       }
-                       if (row[5] && row[5][0])
-                               ui.home=strdup(row[5]);
-                       else
-                       {
-                               DPRINTF("required value for 'home' (column 6) is missing");
-                               mysql_free_result(result);
-                               return(0);
-                       }
-                       if (num_fields > 6 && row[6] && row[6][0])
-                               ui.maildir=strdup(row[6]);
-                       if (num_fields > 7 && row[7] && row[7][0])
-                               ui.quota=strdup(row[7]);
-                       if (num_fields > 8 && row[8] && row[8][0])
-                               ui.fullname=strdup(row[8]);
-                       if (num_fields > 9 && row[9] && row[9][0])
-                               ui.options=strdup(row[9]);
-               }
-               else
-               {
-                       DPRINTF("zero rows returned");
-                       mysql_free_result(result);
-                       return (&ui); /* User not found */
-               }
-       }
-       else
-       {
-               DPRINTF("mysql_store_result failed");
-               return (0);
-       }
-       mysql_free_result(result);
-       return (&ui);
-}
-
-int auth_mysql_setpass(const char *user, const char *pass,
-                      const char *oldpass)
-{
-       char *newpass_crypt;
-       char *sql_buf;
-       int rc=0;
-
-       char *clear_escaped;
-       char *crypt_escaped;
-
-       const char  *clear_field        =NULL,
-                   *crypt_field        =NULL,
-                   *defdomain          =NULL,
-                   *where_clause       =NULL,
-                   *user_table         =NULL,
-                   *login_field        =NULL,
-                   *chpass_clause      =NULL; /* siefca@pld.org.pl */
-
-       if (do_connect())       return (-1);
-
-       if (!(newpass_crypt=authcryptpasswd(pass, oldpass)))
-               return (-1);
-
-       clear_escaped=malloc(strlen(pass)*2+1);
-
-       if (!clear_escaped)
-       {
-               perror("malloc");
-               free(newpass_crypt);
-               return -1;
-       }
-
-       crypt_escaped=malloc(strlen(newpass_crypt)*2+1);
-
-       if (!crypt_escaped)
-       {
-               perror("malloc");
-               free(clear_escaped);
-               free(newpass_crypt);
-               return -1;
-       }
-
-       mysql_real_escape_string(mysql, clear_escaped, pass, strlen(pass));
-       mysql_real_escape_string(mysql, crypt_escaped,
-                                newpass_crypt, strlen(newpass_crypt));
-
-       /* siefca@pld.org.pl */
-       chpass_clause=read_env("MYSQL_CHPASS_CLAUSE");
-       defdomain=read_env("DEFAULT_DOMAIN");
-       user_table=read_env("MYSQL_USER_TABLE");
-       if (!chpass_clause)
-       {
-               int has_domain=strchr(user, '@') != NULL;
-               char *username_escaped;
-               char dummy_buf[1];
-               size_t sql_buf_size;
-
-               username_escaped=malloc(strlen(user)*2+1);
-
-               if (!username_escaped)
-               {
-                       perror("malloc");
-                       free(clear_escaped);
-                       free(crypt_escaped);
-                       free(newpass_crypt);
-                       return -1;
-               }
-
-               mysql_real_escape_string(mysql, username_escaped,
-                                        user, strlen(user));
-
-               login_field = read_env("MYSQL_LOGIN_FIELD");
-               if (!login_field) login_field = "id";
-               crypt_field=read_env("MYSQL_CRYPT_PWFIELD");
-               clear_field=read_env("MYSQL_CLEAR_PWFIELD");
-               where_clause=read_env("MYSQL_WHERE_CLAUSE");
-
-               if (!where_clause)
-                       where_clause="";
-
-               if (!crypt_field)
-                       crypt_field="";
-
-               if (!clear_field)
-                       clear_field="";
-
-               if (!defdomain)
-                       defdomain="";
-
-#define DEFAULT_SETPASS_UPDATE \
-               "UPDATE %s SET %s%s%s%s %s %s%s%s%s WHERE %s='%s%s%s' %s%s%s", \
-                       user_table,                                     \
-                       *clear_field ? clear_field:"",                  \
-                       *clear_field ? "='":"",                         \
-                       *clear_field ? clear_escaped:"",                \
-                       *clear_field ? "'":"",                          \
-                                                                       \
-                       *clear_field && *crypt_field ? ",":"",          \
-                                                                       \
-                       *crypt_field ? crypt_field:"",                  \
-                       *crypt_field ? "='":"",                         \
-                       *crypt_field ? crypt_escaped:"",                \
-                       *crypt_field ? "'":"",                          \
-                       login_field,                                    \
-                       username_escaped,                               \
-                       has_domain || !*defdomain ? "":"@",             \
-                       has_domain ? "":defdomain,                      \
-                       *where_clause ? " AND (":"", where_clause,      \
-                       *where_clause ? ")":""
-
-
-               sql_buf_size=snprintf(dummy_buf, 1, DEFAULT_SETPASS_UPDATE);
-
-               sql_buf=malloc(sql_buf_size+1);
-
-               if (sql_buf)
-                       snprintf(sql_buf, sql_buf_size+1,
-                                DEFAULT_SETPASS_UPDATE);
-
-               free(username_escaped);
-       }
-       else
-       {
-               sql_buf=auth_parse_chpass_clause(escape_str,
-                                                chpass_clause,
-                                                user,
-                                                defdomain,
-                                                clear_escaped,
-                                                crypt_escaped);
-       }
-       
-       free(clear_escaped);
-       free(crypt_escaped);
-       free(newpass_crypt);
-
-       if (courier_authdebug_login_level >= 2)
-       {
-               DPRINTF("setpass SQL: %s", sql_buf);
-       }
-       if (mysql_query (mysql, sql_buf))
-       {
-               DPRINTF("setpass SQL failed");
-               rc= -1;
-               auth_mysql_cleanup();
-       }
-       free(sql_buf);
-       return (rc);
-}
-
-void auth_mysql_enumerate( void(*cb_func)(const char *name,
-                                         uid_t uid,
-                                         gid_t gid,
-                                         const char *homedir,
-                                         const char *maildir,
-                                         const char *options,
-                                         void *void_arg),
-                          void *void_arg)
-{
-       const char *defdomain, *select_clause;
-       char    *querybuf;
-       MYSQL_ROW       row;
-       MYSQL_RES       *result;
-
-       if (do_connect())
-       {
-               (*cb_func)(NULL, 0, 0, NULL, NULL, NULL, void_arg);
-               return;
-       }
-
-       initui();
-
-       select_clause=read_env("MYSQL_ENUMERATE_CLAUSE");
-       defdomain=read_env("DEFAULT_DOMAIN");
-       if (!defdomain || !defdomain[0])
-               defdomain="*"; /* otherwise parse_select_clause fails */
-       
-       if (!select_clause)
-       {
-               const char      *user_table,
-                               *uid_field,
-                               *gid_field,
-                               *login_field,
-                               *home_field,
-                               *maildir_field,
-                               *options_field,
-                               *where_clause;
-               char dummy_buf[1];
-               size_t query_len;
-
-               user_table=read_env("MYSQL_USER_TABLE");
-
-               if (!user_table)
-               {
-                       err("authmysql: MYSQL_USER_TABLE not set in "
-                               AUTHMYSQLRC ".");
-                       return;
-               }
-
-               uid_field = read_env("MYSQL_UID_FIELD");
-               if (!uid_field) uid_field = "uid";
-
-               gid_field = read_env("MYSQL_GID_FIELD");
-               if (!gid_field) gid_field = "gid";
-
-               login_field = read_env("MYSQL_LOGIN_FIELD");
-               if (!login_field) login_field = "id";
-
-               home_field = read_env("MYSQL_HOME_FIELD");
-               if (!home_field) home_field = "home";
-
-               maildir_field=read_env("MYSQL_MAILDIR_FIELD");
-               if (!maildir_field) maildir_field="\"\"";
-
-               options_field=read_env("MYSQL_AUXOPTIONS_FIELD");
-               if (!options_field) options_field="\"\"";
-
-               where_clause=read_env("MYSQL_WHERE_CLAUSE");
-               if (!where_clause) where_clause = "";
-
-
-#define DEFAULT_ENUMERATE_QUERY \
-               "SELECT %s, %s, %s, %s, %s, %s FROM %s %s%s",\
-                       login_field, uid_field, gid_field,              \
-                       home_field, maildir_field,                      \
-                       options_field, user_table,                      \
-                       *where_clause ? " WHERE ":"",                   \
-                       where_clause
-
-               query_len=snprintf(dummy_buf, 1, DEFAULT_ENUMERATE_QUERY);
-
-               querybuf=malloc(query_len+1);
-
-               if (!querybuf)
-               {
-                       perror("malloc");
-                       return;
-               }
-
-               snprintf(querybuf, query_len+1, DEFAULT_ENUMERATE_QUERY);
-       }
-       else
-       {
-               /* siefca@pld.org.pl */
-               querybuf=auth_parse_select_clause (escape_str,
-                                                  select_clause, "*",
-                                                  defdomain, "enumerate");
-               if (!querybuf)
-               {
-                       DPRINTF("authmysql: parse_select_clause failed");
-                       return;
-               }
-       }
-       DPRINTF("authmysql: enumerate query: %s", querybuf);
-
-       if (mysql_query (mysql, querybuf))
-       {
-               DPRINTF("mysql_query failed, reconnecting: %s", mysql_error(mysql));
-               /* <o.blasnik@nextra.de> */
-
-               auth_mysql_cleanup();
-
-               if (do_connect())
-               {
-                       free(querybuf);
-                       return;
-               }
-
-               if (mysql_query (mysql, querybuf))
-               {
-                       DPRINTF("mysql_query failed second time, giving up: %s", mysql_error(mysql));
-                       free(querybuf);
-                       auth_mysql_cleanup();
-                       return;
-               }
-       }
-       free(querybuf);
-
-       result = mysql_use_result (mysql);
-       if (result)
-       {
-               const char *username;
-               uid_t uid;
-               gid_t gid;
-               const char *homedir;
-               const char *maildir;
-               const char *options;
-
-               while ((row = mysql_fetch_row (result)) != NULL)
-               {
-                       if(!row[0] || !row[0][0]
-                          || !row[1] || !row[1][0]
-                          || !row[2] || !row[2][0]
-                          || !row[3] || !row[3][0])
-                       {
-                               continue;
-                       }
-
-                       username=row[0];
-                       uid=atol(row[1]); /* FIXME use strtol to validate */
-                       gid=atol(row[2]);
-                       homedir=row[3];
-                       maildir=row[4];
-                       options=row[5];
-
-                       if (maildir && !*maildir)
-                               maildir=NULL;
-
-                       (*cb_func)(username, uid, gid, homedir,
-                                  maildir, options, void_arg);
-               }
-       }
-       /* NULL row could indicate end of result or an error */
-       if (mysql_errno(mysql))
-       {
-               DPRINTF("mysql error during enumeration: %s", mysql_error(mysql));
-       }
-       else
-               (*cb_func)(NULL, 0, 0, NULL, NULL, NULL, void_arg);
-
-       if (result) mysql_free_result(result);
-}
diff --git a/authmysqllib.cpp b/authmysqllib.cpp
new file mode 100644 (file)
index 0000000..0e8f00a
--- /dev/null
@@ -0,0 +1,810 @@
+/*
+** Copyright 2000-2016 Double Precision, Inc.  See COPYING for
+** distribution information.
+*/
+
+#include       <stdio.h>
+#include       <stdlib.h>
+#include       <string.h>
+#include       <unistd.h>
+#include       <ctype.h>
+#include       <sys/types.h>
+#include       <sys/stat.h>
+#include       <mysql.h>
+#include       <time.h>
+
+#include       "authmysql.h"
+
+extern "C" {
+#include       "authmysqlrc.h"
+#include       "auth.h"
+#include       "courierauthdebug.h"
+};
+
+#include <map>
+#include <sstream>
+#include <algorithm>
+
+#define err courier_auth_err
+
+#include "authconfigfile.h"
+
+class authmysql_connection {
+
+public:
+       MYSQL *mysql;
+       time_t last_time;
+
+       class authmysqlrc_vars {
+       public:
+               std::string server, server_socket, userid, password, database,
+                       character_set,
+                       sslkey, sslcert, sslcacert,
+                       sslcapath, sslcipher,
+
+                       defdomain, user_table,
+                       uid_field,
+                       gid_field,
+                       name_field,
+                       crypt_field, clear_field,
+                       login_field,
+                       home_field,
+                       maildir_field,
+                       defaultdelivery_field,
+                       quota_field,
+                       options_field,
+                       where_clause,
+                       select_clause,
+                       enumerate_clause,
+                       chpass_clause;
+
+               unsigned int server_port;
+               unsigned int server_opt;
+
+               authmysqlrc_vars()
+                       : server_port(0), server_opt(0) {}
+       };
+
+       class authmysqlrc_file : public courier::auth::config_file,
+                                public authmysqlrc_vars {
+
+               authmysql_connection &conn;
+
+       public:
+
+               authmysqlrc_file &operator=(const authmysqlrc_file &o)
+               {
+                       courier::auth::config_file::operator=(o);
+                       authmysqlrc_vars::operator=(o);
+                       return *this;
+               }
+
+               authmysqlrc_file(authmysql_connection &connArg)
+                       : courier::auth::config_file(AUTHMYSQLRC),
+                         conn(connArg)
+               {
+               }
+
+               bool do_load()
+               {
+                       server=config("MYSQL_SERVER");
+                       userid=config("MYSQL_USERNAME");
+                       password=config("MYSQL_PASSWORD");
+                       database=config("MYSQL_DATABASE");
+                       character_set=config("MYSQL_CHARACTER_SET");
+
+                       sslkey=config("MYSQL_SSL_KEY");
+                       sslcert=config("MYSQL_SSL_CERT");
+                       sslcacert=config("MYSQL_SSL_CACERT");
+                       sslcapath=config("MYSQL_SSL_CAPATH");
+                       sslcipher=config("MYSQL_SSL_CIPHER");
+
+                       if ((std::istringstream(config("MYSQL_PORT"))
+                            >> server_port).fail())
+                       {
+                               err("authmysql: cannot parse the MYSQL_PORT "
+                                   "setting");
+                               return false;
+                       }
+
+                       if ((std::istringstream(config("MYSQL_OPT"))
+                            >> server_opt).fail())
+                       {
+                               err("authmysql: cannot parse the MYSQL_OPT "
+                                   "setting");
+                               return false;
+                       }
+                       server_socket=config("MYSQL_SOCKET");
+
+                       if (!server.size() && !server_socket.size())
+                       {
+                               err("authmysql: MYSQL_SERVER nor MYSQL_SOCKET set in"
+                                   AUTHMYSQLRC ".");
+                               return false;
+                       }
+
+                       if (!userid.size())
+                       {
+                               err("authmysql: MYSQL_USERNAME not set in "
+                                   AUTHMYSQLRC ".");
+                               return false;
+                       }
+
+                       if (!database.size())
+                       {
+                               err("authmysql: MYSQL_DATABASE not set in "
+                                   AUTHMYSQLRC ".");
+                               return false;
+                       }
+
+                       defdomain=config("DEFAULT_DOMAIN");
+                       user_table=config("MYSQL_USER_TABLE");
+
+                       if (!user_table.size())
+                       {
+                               err("authmysql: MYSQL_USER_TABLE not set in "
+                                   AUTHMYSQLRC ".");
+                               return false;
+                       }
+
+                       uid_field=config("MYSQL_UID_FIELD", "uid");
+                       gid_field=config("MYSQL_GID_FIELD", "gid");
+                       name_field=config("MYSQL_NAME_FIELD", "''");
+                       login_field=config("MYSQL_LOGIN_FIELD", "id");
+                       home_field=config("MYSQL_HOME_FIELD", "home");
+                       maildir_field=config("MYSQL_MAILDIR_FIELD",
+                                            "''");
+                       defaultdelivery_field=
+                               config("MYSQL_DEFAULTDELIVERY_FIELD",
+                                      "''");
+                       quota_field=config("MYSQL_QUOTA_FIELD", "''");
+
+                       options_field=config("MYSQL_AUXOPTIONS_FIELD",
+                                            "''");
+                       where_clause=config("MYSQL_WHERE_CLAUSE",
+                                           "1=1");
+                       select_clause=config("MYSQL_SELECT_CLAUSE");
+                       enumerate_clause=config("MYSQL_ENUMERATE_CLAUSE");
+
+                       chpass_clause=config("MYSQL_CHPASS_CLAUSE");
+                       crypt_field=config("MYSQL_CRYPT_PWFIELD", "''");
+                       clear_field=config("MYSQL_CLEAR_PWFIELD", "''");
+
+                       if (crypt_field == "''" && clear_field == "''")
+                       {
+                               err("authmysql: MYSQL_CRYPT_PWFIELD and "
+                                   "MYSQL_CLEAR_PWFIELD not set in "
+                                   AUTHMYSQLRC ".");
+                               return false;
+                       }
+
+                       return true;
+               }
+
+               void do_reload()
+               {
+                       authmysqlrc_file new_file(conn);
+
+                       if (new_file.load(true))
+                       {
+                               *this=new_file;
+                               DPRINTF("authmysql: reloaded %s", filename);
+
+                               // Disconnect from the server, new login
+                               // parameters, perhaps.
+
+                               conn.cleanup();
+                       }
+               }
+       };
+
+       authmysqlrc_file config_file;
+
+       authmysql_connection() : mysql(0), last_time(0), config_file(*this)
+       {
+       }
+
+       ~authmysql_connection()
+       {
+               cleanup();
+       }
+
+       void cleanup()
+       {
+               if (mysql)
+               {
+                       mysql_close(mysql);
+                       delete mysql;
+                       mysql=0;
+               }
+       }
+
+       static authmysql_connection *singleton;
+
+       bool try_connection()
+       {
+               bool rc=check_connection();
+
+               if (!rc)
+                       cleanup();
+               return rc;
+       }
+
+       bool check_connection();
+
+       class result {
+
+               MYSQL_RES *res;
+               MYSQL_ROW row;
+
+               size_t num_fields_n;
+               unsigned long *lengths;
+       public:
+               result(const authmysql_connection &conn, bool use_result=false)
+                       : res(use_result
+                             ? mysql_use_result(conn.mysql)
+                             : mysql_store_result(conn.mysql)), row(NULL),
+                         num_fields_n(0),
+                         lengths(NULL)
+               {
+               }
+
+               ~result()
+               {
+                       if (res)
+                               mysql_free_result(res);
+               }
+
+               operator bool() const
+               {
+                       return res != NULL;
+               }
+
+               size_t num_rows() const
+               {
+                       return res ? mysql_num_rows(res):0;
+               }
+
+               size_t num_fields() const { return num_fields_n; }
+
+               bool fetch()
+               {
+                       if (res && (row=mysql_fetch_row(res)) != NULL)
+                       {
+                               num_fields_n=mysql_num_fields(res);
+                               lengths=mysql_fetch_lengths(res);
+                               return true;
+                       }
+                       num_fields_n=0;
+                       lengths=NULL;
+                       return false;
+               }
+
+               std::string operator[](size_t column) const
+               {
+                       if (column < num_fields())
+                       {
+                               const char *p=reinterpret_cast<const char *>
+                                       (row[column]);
+
+                               return std::string(p, p + lengths[column]);
+                       }
+                       return std::string();
+               }
+       };
+
+       bool query(const std::string &sql)
+       {
+               if (mysql_query(mysql, sql.c_str()) == 0)
+                       return true;
+
+               DPRINTF("mysql_query failed: %s", mysql_error(mysql));
+               cleanup();
+
+               if (!try_connection())
+                       return false;
+
+               if (mysql_query (mysql, sql.c_str()))
+               {
+                       DPRINTF("mysql_query failed second time, giving up: %s", mysql_error(mysql));
+
+                       cleanup();
+                       return false;
+               }
+               return true;
+       }
+
+       std::string escape(const std::string &s)
+       {
+               std::string buffer;
+               size_t n=s.size()*2+1;
+
+               buffer.resize(n);
+
+               mysql_real_escape_string(mysql, &buffer[0],
+                                        s.c_str(), s.size());
+               buffer.resize(strlen(&buffer[0]));
+               return buffer;
+       }
+
+       std::string get_default_select(const char *username,
+                                      const char *service);
+
+       bool getuserinfo(const char *username,
+                        const char *service,
+                        authmysqluserinfo &uiret);
+
+       bool setpass(const char *user, const char *pass,
+                    const char *oldpass);
+
+       void enumerate( void(*cb_func)(const char *name,
+                                      uid_t uid,
+                                      gid_t gid,
+                                      const char *homedir,
+                                      const char *maildir,
+                                      const char *options,
+                                      void *void_arg),
+                       void *void_arg);
+
+       static bool connect()
+       {
+               if (!singleton)
+                       singleton=new authmysql_connection;
+
+               if (!singleton->config_file.load())
+                       return false;
+
+               return singleton->try_connection();
+       }
+};
+
+authmysql_connection *authmysql_connection::singleton=0;
+
+bool authmysql_connection::check_connection()
+{
+       bool use_ssl=false;
+
+       /*
+       ** Periodically detect dead connections.
+       */
+       if (mysql)
+       {
+               time_t t_check;
+
+               time(&t_check);
+
+               if (t_check < last_time)
+                       last_time=t_check;      /* System clock changed */
+
+               if (t_check < last_time + 60)
+                       return true;
+
+               last_time=t_check;
+
+               if (mysql_ping(mysql) == 0) return true;
+
+               DPRINTF("authmysqllib: mysql_ping failed, connection lost");
+               cleanup();
+       }
+
+       if (config_file.sslcacert.size() || config_file.sslcapath.size())
+       {
+               if (config_file.sslcert.size())
+                       DPRINTF("authmysqllib: certificate file set to %s",
+                               config_file.sslcert.c_str());
+
+               if (config_file.sslcipher.size())
+                       DPRINTF("authmysqllib: ciphers set to %s",
+                               config_file.sslcipher.c_str());
+
+               if (config_file.sslcacert.size())
+                       DPRINTF("authmysqllib: certificate authority set to %s",
+                               config_file.sslcacert.c_str());
+               if (config_file.sslcapath.size())
+                       DPRINTF("authmysqllib: certificate authority set to %s",
+                               config_file.sslcapath.c_str());
+               use_ssl=true;
+       }
+
+       MYSQL *conn=new MYSQL;
+
+       mysql_init(conn);
+       if (use_ssl)
+       {
+               const char *key=config_file.sslkey.c_str();
+               const char *cert=config_file.sslcert.c_str();
+               const char *cacert=config_file.sslcacert.c_str();
+               const char *capath=config_file.sslcapath.c_str();
+               const char *cipher=config_file.sslcipher.c_str();
+
+               if (!*key) key=0;
+               if (!*cert) cert=0;
+               if (!*cacert) cacert=0;
+               if (!*capath) capath=0;
+               if (!*cipher) cipher=0;
+
+               mysql_ssl_set(conn, key, cert, cacert,
+                             capath, cipher);
+       }
+
+       mysql=mysql_real_connect(conn, config_file.server.c_str(),
+                                config_file.userid.c_str(),
+                                config_file.password.c_str(),
+                                NULL,
+                                config_file.server_port,
+                                (config_file.server_socket.size() ?
+                                 config_file.server_socket.c_str():0),
+                                config_file.server_opt);
+
+       if (!mysql)
+       {
+               err("failed to connect to mysql server (server=%s, userid=%s): %s",
+                   config_file.server.size() ? config_file.server.c_str() : "<null>",
+                   config_file.userid.size() ? config_file.userid.c_str() : "<null>",
+                   mysql_error(conn));
+
+               delete conn;
+               return false;
+       }
+
+       if (mysql_select_db(mysql, config_file.database.c_str()))
+       {
+               err("authmysql: mysql_select_db(%s) error: %s",
+                   config_file.database.c_str(), mysql_error(mysql));
+               return false;
+       }
+
+       DPRINTF("authmysqllib: connected. Versions: "
+               "header %lu, "
+               "client %lu, "
+               "server %lu",
+               (long)MYSQL_VERSION_ID,
+               mysql_get_client_version(),
+               mysql_get_server_version(mysql));
+
+        if (config_file.character_set.size())
+       {
+               mysql_set_character_set(mysql,
+                                       config_file.character_set.c_str());
+
+               std::string real_character_set=mysql_character_set_name(mysql);
+
+               if (config_file.character_set != real_character_set)
+               {
+                       err("Cannot set character set to \"%s\","
+                           " using \"%s\"\n",
+                           config_file.character_set.c_str(),
+                           real_character_set.c_str());
+               }
+               else
+               {
+                       DPRINTF("Using character set: %s",
+                               config_file.character_set.c_str());
+               }
+        }
+
+       return true;
+}
+
+std::string authmysql_connection::get_default_select(const char *username,
+                                                    const char *service)
+{
+       std::string q;
+
+
+       std::string maildir_field=
+               service && strcmp(service, "courier")==0
+               ? config_file.defaultdelivery_field
+               : config_file.maildir_field;
+
+       bool has_domain=strchr(username, '@') != NULL;
+
+       std::ostringstream o;
+
+       o << "SELECT "
+         << config_file.login_field << ", "
+         << config_file.crypt_field << ", "
+         << config_file.clear_field << ", "
+         << config_file.uid_field << ", "
+         << config_file.gid_field << ", "
+         << config_file.home_field << ", "
+         << maildir_field << ", "
+         << config_file.quota_field << ", "
+         << config_file.name_field << ", "
+         << config_file.options_field
+         << " FROM "
+         << config_file.user_table
+         << " WHERE "
+         << config_file.login_field
+         << " = '"
+         << escape(username);
+
+       if (!has_domain && config_file.defdomain.size())
+       {
+               o << "@" << config_file.defdomain;
+       }
+       o << "' AND (" << config_file.where_clause << ")";
+
+       q=o.str();
+       return q;
+}
+
+bool authmysql_connection::getuserinfo(const char *username,
+                                      const char *service,
+                                      authmysqluserinfo &uiret)
+{
+       std::string querybuf;
+
+       if (config_file.select_clause.empty())
+       {
+               querybuf=get_default_select(username, service);
+       }
+       else
+       {
+               std::map<std::string, std::string> parameters;
+
+               parameters["service"]=service;
+
+               querybuf=config_file
+                       .parse_custom_query(config_file.select_clause,
+                                           escape(username),
+                                           config_file.defdomain,
+                                           parameters);
+       }
+
+       DPRINTF("SQL query: %s", querybuf.c_str());
+
+       if (!query(querybuf))
+               return false;
+
+       result res(*this);
+
+       if (res.fetch())
+       {
+               if (res.num_fields() < 6)
+               {
+                       DPRINTF("incomplete row, only %d fields returned",
+                               res.num_fields());
+                       return false;
+               }
+
+               uiret.username=res[0];
+               uiret.cryptpw=res[1];
+               uiret.clearpw=res[2];
+
+               std::string uid_s=res[3];
+               std::string gid_s=res[4];
+
+               std::istringstream(uid_s) >> uiret.uid;
+               std::istringstream(gid_s) >> uiret.gid;
+
+               if (uiret.uid == 0)
+               {
+                       DPRINTF("invalid value for uid: '%s'",
+                               uid_s.size() ? uid_s.c_str() : "<null>");
+                       return false;
+               }
+
+               if (uiret.gid == 0)
+               {
+                       DPRINTF("invalid value for gid: '%s'",
+                               gid_s.size() ? gid_s.c_str() : "<null>");
+                       return false;
+               }
+               uiret.home=res[5];
+
+               if (uiret.home.size() == 0)
+               {
+                       DPRINTF("required value for 'home' (column 6) is missing");
+                       return false;
+               }
+
+               uiret.maildir=res[6];
+               uiret.quota=res[7];
+               uiret.fullname=res[8];
+               uiret.options=res[9];
+       }
+       else
+       {
+               DPRINTF("zero rows returned");
+       }
+       return true;
+}
+
+bool authmysql_connection::setpass(const char *user, const char *pass,
+                                  const char *oldpass)
+{
+       std::string newpass_crypt;
+
+       {
+               char *p;
+
+               if (!(p=authcryptpasswd(pass, oldpass)))
+                       return false;
+
+               newpass_crypt=p;
+               free(p);
+       }
+
+       std::string clear_escaped=escape(pass);
+
+       std::string crypt_escaped=escape(newpass_crypt);
+
+       std::string sql_buf;
+
+       if (config_file.chpass_clause.size() == 0)
+       {
+               std::string username_escaped=escape(user);
+
+               bool has_domain=strchr(user, '@') != NULL;
+
+               std::ostringstream o;
+
+               o << "UPDATE " << config_file.user_table << " SET ";
+
+               if (config_file.clear_field != "''")
+                       o << config_file.clear_field << "='"
+                         << clear_escaped << "'";
+
+               if (config_file.crypt_field != "''")
+               {
+                       if (config_file.clear_field != "''") o << ", ";
+                       o << config_file.crypt_field << "='" << crypt_escaped << "'";
+               }
+
+               o << " WHERE " << config_file.login_field << "='"
+                 << username_escaped;
+
+               if (!has_domain && config_file.defdomain.size())
+                       o << "@" << config_file.defdomain;
+               o << "'";
+
+               sql_buf=o.str();
+       }
+       else
+       {
+               std::map<std::string, std::string> parameters;
+
+               parameters["newpass"]=clear_escaped;
+               parameters["newpass_crypt"]=crypt_escaped;
+
+               sql_buf=config_file
+                       .parse_custom_query(config_file.chpass_clause,
+                                           user,
+                                           config_file.defdomain,
+                                           parameters);
+       }
+
+       if (courier_authdebug_login_level >= 2)
+       {
+               DPRINTF("setpass SQL: %s", sql_buf.c_str());
+       }
+
+       if (!query(sql_buf))
+               return false;
+       return true;
+}
+
+void authmysql_connection::enumerate(void(*cb_func)(const char *name,
+                                                   uid_t uid,
+                                                   gid_t gid,
+                                                   const char *homedir,
+                                                   const char *maildir,
+                                                   const char *options,
+                                                   void *void_arg),
+                                    void *void_arg)
+{
+       std::string querybuf;
+
+       if (config_file.enumerate_clause.empty())
+       {
+               std::ostringstream o;
+
+               o << "SELECT "
+                 << config_file.login_field << ", "
+                 << config_file.uid_field << ", "
+                 << config_file.gid_field << ", "
+                 << config_file.home_field << ", "
+                 << config_file.maildir_field << ", "
+                 << config_file.options_field << " FROM "
+                 << config_file.user_table << " WHERE "
+                 << config_file.where_clause;
+
+               querybuf=o.str();
+       }
+       else
+       {
+               std::map<std::string, std::string> parameters;
+
+               parameters["service"]="enumerate";
+               querybuf=config_file
+                       .parse_custom_query(config_file.enumerate_clause, "*",
+                                           config_file.defdomain, parameters);
+       }
+       DPRINTF("authmysql: enumerate query: %s", querybuf.c_str());
+
+       if (!query(querybuf))
+               return;
+
+       result row(*this);
+
+       if (row)
+       {
+               while (row.fetch())
+               {
+                       std::string username=row[0];
+
+                       if (username.size() == 0)
+                               continue;
+
+                       uid_t uid=0;
+                       gid_t gid=0;
+
+                       std::istringstream(row[1]) >> uid;
+                       std::istringstream(row[2]) >> gid;
+                       std::string homedir=row[3];
+                       std::string maildir=row[4];
+                       std::string options=row[5];
+
+                       (*cb_func)(username.c_str(), uid, gid,
+                                  homedir.c_str(),
+                                  maildir.size() ? maildir.c_str():NULL,
+                                  options.size() ? options.c_str():NULL,
+                                  void_arg);
+               }
+       }
+       /* NULL row could indicate end of result or an error */
+       if (mysql_errno(mysql))
+       {
+               DPRINTF("mysql error during enumeration: %s",
+                       mysql_error(mysql));
+       }
+       else
+               (*cb_func)(NULL, 0, 0, NULL, NULL, NULL, void_arg);
+}
+
+void auth_mysql_cleanup()
+{
+       if (authmysql_connection::singleton)
+       {
+               delete authmysql_connection::singleton;
+               authmysql_connection::singleton=0;
+       }
+}
+
+bool auth_mysql_setpass(const char *user, const char *pass,
+                       const char *oldpass)
+{
+       if (!authmysql_connection::connect())
+               return false;
+       return authmysql_connection::singleton->setpass(user, pass, oldpass);
+}
+
+void auth_mysql_enumerate( void(*cb_func)(const char *name,
+                                         uid_t uid,
+                                         gid_t gid,
+                                         const char *homedir,
+                                         const char *maildir,
+                                         const char *options,
+                                         void *void_arg),
+                          void *void_arg)
+{
+       if (!authmysql_connection::connect())
+       {
+               (*cb_func)(NULL, 0, 0, NULL, NULL, NULL, void_arg);
+               return;
+       }
+
+       authmysql_connection::singleton->enumerate(cb_func, void_arg);
+}
+
+bool auth_mysql_getuserinfo(const char *username,
+                           const char *service,
+                           authmysqluserinfo &uiret)
+{
+       if (!authmysql_connection::connect())
+               return false;
+
+       return authmysql_connection::singleton->getuserinfo(username, service,
+                                                           uiret);
+}
index c2640c5..567ce19 100644 (file)
@@ -1,4 +1,4 @@
-##VERSION: $Id: authmysqlrc 17 2011-04-04 02:07:37Z mrsam $
+##VERSION: $Id: 01c3b327e4d5b8f4123500ce4c8d0ef7a690c10d-20160418083235$
 #
 # Copyright 2000-2007 Double Precision, Inc.  See COPYING for
 # distribution information.
@@ -78,7 +78,7 @@ MYSQL_DATABASE                mysql
 ##NAME: MYSQL_USER_TABLE:0
 #
 # The name of the table containing your user data.  See README.authmysqlrc
-# for the required fields in this table. 
+# for the required fields in this table.
 
 MYSQL_USER_TABLE       passwd
 
@@ -160,7 +160,7 @@ MYSQL_NAME_FIELD    name
 ##NAME: MYSQL_QUOTA_FIELD:0
 #
 # Define MYSQL_QUOTA_FIELD to be the name of the field that can optionally
-# specify a maildir quota.  See README.maildirquota for more information 
+# specify a maildir quota.  See README.maildirquota for more information
 #
 # MYSQL_QUOTA_FIELD    quota
 
@@ -192,7 +192,6 @@ MYSQL_NAME_FIELD    name
 
 ##NAME: MYSQL_SELECT_CLAUSE:0
 #
-# (EXPERIMENTAL)
 # This is optional, MYSQL_SELECT_CLAUSE can be set when you have a database,
 # which is structuraly different from proposed. The fixed string will
 # be used to do a SELECT operation on database, which should return fields
@@ -202,9 +201,6 @@ MYSQL_NAME_FIELD    name
 #
 # The username field should include the domain (see example below).
 #
-# Enabling this option causes ignorance of any other field-related
-# options, excluding default domain.
-#
 # There are two variables, which you can use. Substitution will be made
 # for them, so you can put entered username (local part) and domain name
 # in the right place of your query. These variables are:
@@ -220,6 +216,21 @@ MYSQL_NAME_FIELD   name
 # DEFAULTDELIVERY.  Courier mail server will also use esmtp when doing
 # authenticated ESMTP.
 #
+# Either cryptpw or clearpw are required. The other one can be specified
+# as an empty string; as well as maildir, quota, and option fields.
+#
+# Example:
+#
+# MYSQL_SELECT_CLAUSE   SELECT CONCAT(user,'@',domain), '', password, \
+#                              uid, gid, home, '' \
+#                       FROM users WHERE user='$(local_part)' \
+#                                    AND domain='$(domain)'
+#
+# The encrypted password field is not used, and a literal '', empty string,
+# appears in its place. Ditto for the 'maildir' field, and the remaining
+# optional fields are completely absent. The maildir field, in this example
+# can also be omitted, it's shown as an example only.
+#
 # This example is a little bit modified adaptation of vmail-sql
 # database scheme:
 #
@@ -286,3 +297,8 @@ MYSQL_NAME_FIELD    name
 #                      WHERE   local_part='$(local_part)'              \
 #                      AND     domain_name='$(domain)'
 #
+
+##NAME: MARKER:0
+#
+# Do not remove this section from this configuration file. This section
+# must be present at the end of this file.
index 352cb43..8679399 100644 (file)
@@ -2,14 +2,14 @@
 .\"  <!-- Copyright 2004-2008 Double Precision, Inc.  See COPYING for -->
 .\"  <!-- distribution information. -->
 .\"     Title: authpasswd
-.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
-.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\"      Date: 06/20/2015
+.\"    Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
+.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
+.\"      Date: 09/08/2017
 .\"    Manual: Double Precision, Inc.
 .\"    Source: Double Precision, Inc.
 .\"  Language: English
 .\"
-.TH "AUTHPASSWD" "1" "06/20/2015" "Double Precision, Inc." "Double Precision, Inc."
+.TH "AUTHPASSWD" "1" "09/08/2017" "Double Precision, Inc." "Double Precision, Inc."
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
index 27653cb..9e5c5aa 100644 (file)
 
 #include       "auth.h"
 #include       "authpgsql.h"
+#include       "courierauth.h"
 #include       "courierauthstaticlist.h"
 #include       "courierauthdebug.h"
 #include       "libhmac/hmac.h"
-#include       "cramlib.h"
-
 
 extern void auth_pgsql_enumerate( void(*cb_func)(const char *name,
                                                 uid_t uid,
@@ -31,126 +30,6 @@ extern void auth_pgsql_enumerate( void(*cb_func)(const char *name,
                                                 void *void_arg),
                                  void *void_arg);
 
-static int auth_pgsql_login(const char *service, char *authdata,
-                           int (*callback_func)(struct authinfo *, void *),
-                           void *callback_arg)
-{
-       char *user, *pass;
-       struct authpgsqluserinfo *authinfo;
-       struct  authinfo        aa;
-
-       if ((user=strtok(authdata, "\n")) == 0 ||
-               (pass=strtok(0, "\n")) == 0)
-       {
-               errno=EPERM;
-               return (-1);
-       }
-
-       authinfo=auth_pgsql_getuserinfo(user, service);
-
-       if (!authinfo)          /* Fatal error - such as PgSQL being down */
-       {
-               errno=EACCES;
-               return (-1);
-       }
-
-       if (authinfo->cryptpw)
-       {
-               if (authcheckpassword(pass,authinfo->cryptpw))
-               {
-                       errno=EPERM;
-                       return (-1);    /* User/Password not found. */
-               }
-       }
-       else if (authinfo->clearpw)
-       {
-               if (strcmp(pass, authinfo->clearpw))
-               {
-                       if (courier_authdebug_login_level >= 2)
-                       {
-                               DPRINTF("supplied password '%s' does not match clearpasswd '%s'",
-                                       pass, authinfo->clearpw);
-                       }
-                       else
-                       {
-                               DPRINTF("supplied password does not match clearpasswd");
-                       }
-                       errno=EPERM;
-                       return (-1);
-               }
-       }
-       else
-       {
-               DPRINTF("no password available to compare");
-               errno=EPERM;
-               return (-1);            /* Username not found */
-       }
-
-
-       memset(&aa, 0, sizeof(aa));
-
-       /*aa.sysusername=user;*/
-       aa.sysuserid= &authinfo->uid;
-       aa.sysgroupid= authinfo->gid;
-       aa.homedir=authinfo->home;
-       aa.maildir=authinfo->maildir && authinfo->maildir[0] ?
-               authinfo->maildir:0;
-       aa.address=authinfo->username;
-       aa.quota=authinfo->quota && authinfo->quota[0] ?
-               authinfo->quota:0;
-       aa.fullname=authinfo->fullname;
-       aa.options=authinfo->options;
-       aa.passwd=authinfo->cryptpw;
-       aa.clearpasswd=pass;
-       courier_authdebug_authinfo("DEBUG: authpgsql: ", &aa,
-                           authinfo->clearpw, authinfo->cryptpw);
-       return (*callback_func)(&aa, callback_arg);
-}
-
-static int auth_pgsql_changepw(const char *service, const char *user,
-                                const char *pass,
-                                const char *newpass)
-{
-       struct authpgsqluserinfo *authinfo;
-
-       authinfo=auth_pgsql_getuserinfo(user, service);
-
-       if (!authinfo)
-       {
-               errno=ENOENT;
-               return (-1);
-       }
-
-       if (authinfo->cryptpw)
-       {
-               if (authcheckpassword(pass,authinfo->cryptpw))
-               {
-                       errno=EPERM;
-                       return (-1);    /* User/Password not found. */
-               }
-       }
-       else if (authinfo->clearpw)
-       {
-               if (strcmp(pass, authinfo->clearpw))
-               {
-                       errno=EPERM;
-                       return (-1);
-               }
-       }
-       else
-       {
-               errno=EPERM;
-               return (-1);
-       }
-
-       if (auth_pgsql_setpass(user, newpass, authinfo->cryptpw))
-       {
-               errno=EPERM;
-               return (-1);
-       }
-       return (0);
-}
-
 static int auth_pgsql_cram(const char *service,
                           const char *authtype, char *authdata,
                           int (*callback_func)(struct authinfo *, void *),
index e89b521..4a87932 100644 (file)
 /*
 #include       <errmsg.h>
 */
-struct authpgsqluserinfo {
-       char *username;
-       char *fullname;
-       char *cryptpw;
-       char *clearpw;
-       char *home;
-       char *maildir;
-       char *quota;
-       char *options;
-       uid_t uid;
-       gid_t gid;
-       } ;
 
-extern struct authpgsqluserinfo *auth_pgsql_getuserinfo(const char *,
-                                                       const char *service);
-extern void auth_pgsql_cleanup();
+extern int auth_pgsql_login(const char *service, char *authdata,
+                           int (*callback_func)(struct authinfo *, void *),
+                           void *callback_arg);
+extern int auth_pgsql_changepw(const char *service, const char *user,
+                              const char *pass,
+                              const char *newpass);
 
-extern int auth_pgsql_setpass(const char *, const char *, const char *);
+extern void auth_pgsql_cleanup();
 
 struct authinfo;
 
diff --git a/authpgsqllib.c b/authpgsqllib.c
deleted file mode 100644 (file)
index 924323b..0000000
+++ /dev/null
@@ -1,1149 +0,0 @@
-/*
-** Copyright 2000-2004 Double Precision, Inc.  See COPYING for
-** distribution information.
-*/
-
-
-#include       <stdio.h>
-#include       <stdlib.h>
-#include       <string.h>
-#include       <unistd.h>
-#include       <ctype.h>
-#include       <sys/types.h>
-#include       <sys/stat.h>
-#include       <libpq-fe.h>
-#include       <time.h>
-
-#include       "authpgsql.h"
-#include       "authpgsqlrc.h"
-#include       "auth.h"
-#include       "courierauthdebug.h"
-
-#define err courier_auth_err
-
-/* tom@minnesota.com */
-#define                MAX_SUBSTITUTION_LEN    32
-#define                SV_BEGIN_MARK           "$("
-#define                SV_END_MARK             ")"
-#define                SV_BEGIN_LEN            ((sizeof(SV_BEGIN_MARK))-1)
-#define                SV_END_LEN              ((sizeof(SV_END_MARK))-1)
-
-
-/* tom@minnesota.com */
-struct var_data {                      
-       const char *name;
-       const char *value;
-       const size_t size;
-       } ;
-
-/* tom@minnesota.com */
-typedef int (*parsefunc)(const char *, size_t, void *);
-
-static const char *read_env(const char *env)
-{
-static char *pgsqlauth=0;
-static size_t pgsqlauth_size=0;
-size_t i;
-char   *p=0;
-int    l=strlen(env);
-
-       if (!pgsqlauth)
-       {
-       FILE    *f=fopen(AUTHPGSQLRC, "r");
-       struct  stat    buf;
-
-               if (!f) return (0);
-               if (fstat(fileno(f), &buf) ||
-                       (pgsqlauth=malloc(buf.st_size+2)) == 0)
-               {
-                       fclose(f);
-                       return (0);
-               }
-               if (fread(pgsqlauth, buf.st_size, 1, f) != 1)
-               {
-                       free(pgsqlauth);
-                       pgsqlauth=0;
-                       fclose(f);
-                       return (0);
-               }
-               pgsqlauth[pgsqlauth_size=buf.st_size]=0;
-
-               for (i=0; i<pgsqlauth_size; i++)
-                       if (pgsqlauth[i] == '\n')
-                       {       /* tom@minnesota.com */
-                               if (!i || pgsqlauth[i-1] != '\\')
-                               {
-                                       pgsqlauth[i]='\0';
-                               }
-                               else
-                               {
-                                       pgsqlauth[i]=pgsqlauth[i-1]= ' ';
-                               }
-                       }
-               fclose(f);
-       }
-
-       for (i=0; i<pgsqlauth_size; )
-       {
-               p=pgsqlauth+i;
-               if (memcmp(p, env, l) == 0 &&
-                       isspace((int)(unsigned char)p[l]))
-               {
-                       p += l;
-                       while (*p && *p != '\n' &&
-                               isspace((int)(unsigned char)*p))
-                               ++p;
-                       break;
-               }
-
-               while (i < pgsqlauth_size)
-                       if (pgsqlauth[i++] == 0)        break;
-       }
-
-       if (i < pgsqlauth_size)
-               return (p);
-       return (0);
-}
-
-static PGresult *pgresult=0;
-
-static PGconn *pgconn=0;
-
-/*
-* session variables can be set once for the whole session
-*/
-
-static void set_session_options(void)
-{
-       const char *character_set=read_env("PGSQL_CHARACTER_SET"), *check;
-
-       if (character_set)
-       {
-               PQsetClientEncoding(pgconn, character_set);
-               check = pg_encoding_to_char(PQclientEncoding(pgconn));
-               if (strcmp(character_set, check) != 0)
-               {
-                       err("Cannot set Postgresql character set \"%s\", working with \"%s\"\n",
-                           character_set, check);
-               }
-               else
-               {
-                       DPRINTF("Install of a character set for Postgresql: %s", character_set);
-               }
-        }
-}
-
-
-
-/*
-static FILE *DEBUG=0;
-*/
-
-static int do_connect()
-{
-const  char *server;
-const  char *userid;
-const  char *password;
-const  char *database;
-const  char *server_port=0;
-const  char *server_opt=0;
-/*
-       if (!DEBUG) {
-               DEBUG=fopen("/tmp/courier.debug","a");
-       }
-       fprintf(DEBUG,"Apro il DB!\n");
-       fflush(DEBUG);
-*/
-
-/*
-** Periodically detect dead connections.
-*/
-       if (pgconn)
-       {
-               static time_t last_time=0;
-               time_t t_check;
-
-               time(&t_check);
-
-               if (t_check < last_time)
-                       last_time=t_check;      /* System clock changed */
-
-               if (t_check < last_time + 60)
-                       return (0);
-
-               last_time=t_check;
-                       
-               if (PQstatus(pgconn) == CONNECTION_OK) return (0);
-
-               DPRINTF("authpgsqllib: PQstatus failed, connection lost");
-               PQfinish(pgconn);
-               pgconn=0;
-       }
-
-       server=read_env("PGSQL_HOST");
-       server_port=read_env("PGSQL_PORT");
-       userid=read_env("PGSQL_USERNAME");
-       password=read_env("PGSQL_PASSWORD");
-       database=read_env("PGSQL_DATABASE");
-       server_opt=read_env("PGSQL_OPT");
-
-/*
-       fprintf(DEBUG,"Letti i parametri!\n");
-       fflush(DEBUG);
-*/
-
-       if (!userid)
-       {
-               err("authpgsql: PGSQL_USERNAME not set in "
-                       AUTHPGSQLRC ".");
-               return (-1);
-       }
-
-       if (!database)
-       {
-               err("authpgsql: PGSQL_DATABASE not set in "
-                       AUTHPGSQLRC ".");
-               return (-1);
-       }
-
-/*
-       fprintf(DEBUG,"Connecting to db:%s:%s\%s user=%s pass=%s\n",server,server_port,database,userid,password);
-       fflush(DEBUG);
-*/
-       pgconn = PQsetdbLogin(server, server_port, server_opt, NULL , database,userid,password);
-
-       if (PQstatus(pgconn) == CONNECTION_BAD)
-       {
-                       err("Connection to server '%s' userid '%s' database '%s' failed.",
-                               server ? server : "<null>",
-                               userid ? userid : "<null>",
-                               database);
-               err("%s", PQerrorMessage(pgconn));
-               PQfinish(pgconn);
-               pgconn=0;
-               return -1;
-       }
-/*
-       fprintf(DEBUG,"Connected!\n");
-       fflush(DEBUG);
-*/
-
-       set_session_options();
-       return 0;
-
-}
-
-void auth_pgsql_cleanup()
-{
-       if (pgconn)
-       {
-               PQfinish(pgconn);
-               pgconn=0;
-       }
-}
-
-static struct authpgsqluserinfo ui={0, 0, 0, 0, 0, 0, 0, 0};
-
-static char *get_username_escaped(const char *username,
-                                 const char *defdomain)
-{
-       char *username_escaped;
-       int *error = NULL;
-
-       if (!defdomain)
-               defdomain="";
-
-        username_escaped=malloc(strlen(username)*2+2+strlen(defdomain));
-
-       if (!username_escaped)
-       {
-               perror("malloc");
-               return 0;
-       }
-
-       PQescapeStringConn(pgconn, username_escaped, username, strlen(username), error);
-
-       if (strchr(username, '@') == 0 && *defdomain)
-               strcat(strcat(username_escaped, "@"), defdomain);
-
-       return username_escaped;
-}
-
-/* tom@minnesota.com */
-static struct var_data *get_variable (const char *begin, size_t len,
-                                     struct var_data *vdt)
-{
-struct var_data *vdp;
-
-       if (!begin || !vdt) /* should never happend */
-       {
-               err("authpgsql: critical error while "
-                                "parsing substitution variable");
-               return NULL;
-       }
-       if (len < 1)
-       {
-               err("authpgsql: unknown empty substitution "
-                                "variable - aborting");
-               return NULL;
-       }
-       if (len > MAX_SUBSTITUTION_LEN)
-       {
-               err("authpgsql: variable name too long "
-                                "while parsing substitution. "
-                                "name begins with "
-                                SV_BEGIN_MARK
-                                "%.*s...", MAX_SUBSTITUTION_LEN, begin);
-               return NULL;
-       }
-       
-       for (vdp=vdt; vdp->name; vdp++)
-               if (vdp->size == len+1 &&
-                   !strncmp(begin, vdp->name, len))
-               {
-                       if (!vdp->value)
-                               vdp->value = "";
-                       return vdp;
-               }
-       
-       err("authpgsql: unknown substitution variable "
-                        SV_BEGIN_MARK
-                        "%.*s"
-                        SV_END_MARK
-                        , (int)len, begin);
-       
-       return NULL;
-}
-
-/* tom@minnesota.com */
-static int ParsePlugin_counter (const char *p, size_t length, void *vp)
-{
-       if (!p || !vp || length < 0)
-       {
-               err("authpgsql: bad arguments while counting "
-                                "query string");
-               return -1;
-       }
-       
-       *((size_t *)vp) += length;
-   
-       return 0;
-}
-
-/* tom@minnesota.com */
-static int ParsePlugin_builder (const char *p, size_t length, void *vp)
-{
-char   **strptr = (char **) vp;
-
-       if (!p || !vp || length < 0)
-       {
-               err("authpgsql: bad arguments while building "
-                                "query string");
-               return -1;
-       }
-       
-       if (!length) return 0;
-       memcpy ((void *) *strptr, (void *) p, length);
-       *strptr += length;
-       
-       return 0;
-}
-
-/* tom@minnesota.com */
-static int parse_core  (const char *source, struct var_data *vdt,
-                       parsefunc outfn, void *result)
-{
-size_t v_size          = 0,
-       t_size          = 0;
-const char     *p, *q, *e,
-               *v_begin, *v_end,
-               *t_begin, *t_end;
-struct var_data        *v_ptr;
-
-       if (!source)
-               source = "";
-       if (!result)
-       {
-               err("authpgsql: no memory allocated for result "
-                                "while parser core was invoked");
-               return -1;
-       }
-       if (!vdt)
-       {
-               err("authpgsql: no substitution table found "
-                                "while parser core was invoked");
-               return -1;
-       }
-       
-       q = source;
-       while ( (p=strstr(q, SV_BEGIN_MARK)) )
-       {
-               char *enc;
-
-               e = strstr (p, SV_END_MARK);
-               if (!e)
-               {
-                       err("authpgsql: syntax error in "
-                                        "substitution "
-                                        "- no closing symbol found! "
-                                        "bad variable begins with:"
-                                        "%.*s...", MAX_SUBSTITUTION_LEN, p);
-                       return -1;
-               }
-               
-               /*
-                **
-                **          __________sometext$(variable_name)_________
-                **                    |      |  |           |  
-                **             t_begin' t_end'  `v_begin    `v_end
-                **
-                 */
-
-               v_begin = p+SV_BEGIN_LEN; /* variable field ptr             */
-               v_end   = e-SV_END_LEN;   /* variable field last character  */
-               v_size  = v_end-v_begin+1;/* variable field length          */
-               
-               t_begin = q;              /* text field ptr                 */
-               t_end   = p-1;            /* text field last character      */
-               t_size  = t_end-t_begin+1;/* text field length              */
-
-               /* work on text */
-               if ( (outfn (t_begin, t_size, result)) == -1 )
-                       return -1;
-               
-               /* work on variable */
-               v_ptr = get_variable (v_begin, v_size, vdt);
-               if (!v_ptr) return -1;
-
-               enc=malloc(strlen(v_ptr->value)*2+1);
-
-               if (!enc)
-                       return -1;
-
-               PQescapeStringConn(pgconn, enc, v_ptr->value,
-                                  strlen(v_ptr->value), NULL);
-
-               if ( (outfn (enc, strlen(enc), result)) == -1 )
-               {
-                       free(enc);
-                       return -1;
-               }
-               free(enc);
-
-               q = e + 1;
-       }
-
-       /* work on last part of text if any */
-       if (*q != '\0')
-               if ( (outfn (q, strlen(q), result)) == -1 )
-                       return -1;
-
-       return 0;
-}
-
-/* tom@minnesota.com */
-static char *parse_string (const char *source, struct var_data *vdt)
-{
-char   *output_buf     = NULL,
-       *pass_buf       = NULL;
-size_t buf_size        = 2;
-
-       if (source == NULL || *source == '\0' || 
-           vdt == NULL    || vdt[0].name == NULL)
-       {
-               err("authpgsql: source clause is empty "
-                                "- this is critical error");
-               return NULL;
-       }
-
-       /* phase 1 - count and validate string */
-       if ( (parse_core (source, vdt, &ParsePlugin_counter, &buf_size)) != 0)
-               return NULL;
-
-       /* phase 2 - allocate memory */
-       output_buf = malloc (buf_size);
-       if (!output_buf)
-       {
-               perror ("malloc");
-               return NULL;
-       }
-       pass_buf = output_buf;
-
-       /* phase 3 - build the output string */
-       if ( (parse_core (source, vdt, &ParsePlugin_builder, &pass_buf)) != 0)
-       {
-               free (output_buf);
-               return NULL;
-       }       
-       *pass_buf = '\0';
-       
-       return output_buf;
-}
-
-static char *get_localpart (const char *username)
-{
-       char *p=strdup(username);
-       char *q;
-
-       if (!p)
-               return 0;
-
-       q=strchr(p, '@');
-
-       if (q)
-               *q=0;
-
-       return p;
-}
-
-static const char *get_domain (const char *username, const char *defdomain)
-{
-       const char *p=strchr(username, '@');
-
-       if (p)
-               return p+1;
-
-       return defdomain;
-}
-
-/* tom@minnesota.com */
-static char *parse_select_clause (const char *clause, const char *username,
-                                 const char *defdomain,
-                                 const char *service)
-{
-       char *localpart, *ret;
-       static struct var_data vd[]={
-               {"local_part",  NULL,   sizeof("local_part")},
-               {"domain",      NULL,   sizeof("domain")},
-               {"service",     NULL,   sizeof("service")},
-               {NULL,          NULL,   0}};
-
-       if (clause == NULL || *clause == '\0' ||
-           !username || *username == '\0')
-               return NULL;
-       
-       localpart=get_localpart(username);
-       if (!localpart)
-               return NULL;
-
-       vd[0].value     = localpart;
-       vd[1].value     = get_domain (username, defdomain);
-
-       if (!vd[1].value)
-       {
-               free(localpart);
-               return NULL;
-       }
-       vd[2].value     = service;
-
-       ret=parse_string (clause, vd);
-       free(localpart);
-       return ret;
-}
-
-/* tom@minnesota.com */
-static char *parse_chpass_clause (const char *clause, const char *username,
-                                 const char *defdomain, const char *newpass,
-                                 const char *newpass_crypt)
-{
-       char *localpart, *ret;
-
-       static struct var_data vd[]={
-               {"local_part",  NULL,   sizeof("local_part")},
-               {"domain",      NULL,   sizeof("domain")},
-               {"newpass",     NULL,   sizeof("newpass")},
-               {"newpass_crypt", NULL, sizeof("newpass_crypt")},
-               {NULL,          NULL,   0}};
-
-       if (clause == NULL || *clause == '\0'           ||
-           !username || *username == '\0'              ||
-           !newpass || *newpass == '\0'                ||
-           !newpass_crypt || *newpass_crypt == '\0')   return NULL;
-
-       localpart=get_localpart(username);
-       if (!localpart)
-               return NULL;
-
-       vd[0].value     = localpart;
-       vd[1].value     = get_domain (username, defdomain);
-       vd[2].value     = newpass;
-       vd[3].value     = newpass_crypt;
-       
-       if (!vd[1].value || !vd[2].value || !vd[3].value)
-       {
-               free(localpart);
-               return NULL;
-       }
-
-       ret=parse_string (clause, vd);
-       free(localpart);
-       return ret;
-}
-
-static void initui()
-{
-
-       if (ui.username)
-               free(ui.username);
-       if (ui.cryptpw)
-               free(ui.cryptpw);
-       if (ui.clearpw)
-               free(ui.clearpw);
-       if (ui.home)
-               free(ui.home);
-       if (ui.maildir)
-               free(ui.maildir);
-       if (ui.quota)
-               free(ui.quota);
-       if (ui.fullname)
-               free(ui.fullname);
-       if (ui.options)
-               free(ui.options);
-       memset(&ui, 0, sizeof(ui));
-}
-
-struct authpgsqluserinfo *auth_pgsql_getuserinfo(const char *username,
-                                                const char *service)
-{
-       const char *defdomain, *select_clause;
-       char    *querybuf;
-       size_t query_size;
-       char dummy_buf[1];
-
-#define SELECT_QUERY "SELECT %s, %s, %s, %s, %s, %s, %s, %s, %s, %s FROM %s WHERE %s = '%s' %s%s%s", \
-               login_field, crypt_field, clear_field, \
-               uid_field, gid_field, home_field, maildir_field, \
-               quota_field, \
-               name_field, \
-               options_field, \
-               user_table, login_field, username_escaped, \
-               where_pfix, where_clause, where_sfix
-
-       if (do_connect())       return (0);
-
-       initui();
-
-/*
-       fprintf(DEBUG,"1Leggo parametri\n");
-       fflush(DEBUG);
-*/
-       select_clause=read_env("PGSQL_SELECT_CLAUSE");
-       defdomain=read_env("DEFAULT_DOMAIN");
-       if (!defdomain) defdomain="";
-
-       if (!select_clause) /* tom@minnesota.com */
-       {
-               const char      *user_table,
-                               *crypt_field,
-                               *clear_field,
-                               *name_field,
-                               *uid_field,
-                               *gid_field,
-                               *login_field,
-                               *home_field,
-                               *maildir_field,
-                               *quota_field,
-                               *options_field,
-                               *where_clause;
-
-               const char *where_pfix, *where_sfix;
-               char *username_escaped;
-
-               user_table=read_env("PGSQL_USER_TABLE");
-
-               if (!user_table)
-               {
-                       err("authpgsql: PGSQL_USER_TABLE not set in "
-                               AUTHPGSQLRC ".");
-                       return (0);
-               }
-
-               crypt_field=read_env("PGSQL_CRYPT_PWFIELD");
-               clear_field=read_env("PGSQL_CLEAR_PWFIELD");
-               name_field=read_env("PGSQL_NAME_FIELD");
-
-               if (!crypt_field && !clear_field)
-               {
-                       err("authpgsql: PGSQL_CRYPT_PWFIELD and "
-                               "PGSQL_CLEAR_PWFIELD not set in " AUTHPGSQLRC ".");
-                       return (0);
-               }
-               if (!crypt_field) crypt_field="''";
-               if (!clear_field) clear_field="''";
-               if (!name_field) name_field="''";
-
-               uid_field = read_env("PGSQL_UID_FIELD");
-               if (!uid_field) uid_field = "uid";
-
-               gid_field = read_env("PGSQL_GID_FIELD");
-               if (!gid_field) gid_field = "gid";
-
-               login_field = read_env("PGSQL_LOGIN_FIELD");
-               if (!login_field) login_field = "id";
-
-               home_field = read_env("PGSQL_HOME_FIELD");
-               if (!home_field) home_field = "home";
-
-               maildir_field=read_env(service && strcmp(service, "courier")==0
-                                      ? "PGSQL_DEFAULTDELIVERY"
-                                      : "PGSQL_MAILDIR_FIELD");
-               if (!maildir_field) maildir_field="''";
-
-               quota_field=read_env("PGSQL_QUOTA_FIELD");
-               if (!quota_field) quota_field="''"; 
-
-               options_field=read_env("PGSQL_AUXOPTIONS_FIELD");
-               if (!options_field) options_field="''"; 
-
-               where_clause=read_env("PGSQL_WHERE_CLAUSE");
-               if (!where_clause) where_clause = "";
-
-               where_pfix=where_sfix="";
-
-               if (strcmp(where_clause, ""))
-               {
-                       where_pfix=" AND (";
-                       where_sfix=")";
-               }
-
-               username_escaped=get_username_escaped(username, defdomain);
-
-               if (!username_escaped)
-                       return 0;
-
-               query_size=snprintf(dummy_buf, 1, SELECT_QUERY);
-
-               querybuf=malloc(query_size+1);
-
-               if (!querybuf)
-               {
-                       free(username_escaped);
-                       perror("malloc");
-                       return 0;
-               }
-
-               snprintf(querybuf, query_size+1, SELECT_QUERY);
-               free(username_escaped);
-       }
-       else
-       {
-               /* tom@minnesota.com */
-               querybuf=parse_select_clause (select_clause, username,
-                                             defdomain, service);
-               if (!querybuf)
-               {
-                       DPRINTF("authpgsql: parse_select_clause failed (DEFAULT_DOMAIN not defined?)");
-                       return 0;
-               }
-       }
-
-       DPRINTF("SQL query: %s", querybuf);
-       pgresult = PQexec(pgconn, querybuf);
-       if (!pgresult || PQresultStatus(pgresult) != PGRES_TUPLES_OK)
-       {
-               DPRINTF("PQexec failed, reconnecting: %s", PQerrorMessage(pgconn));
-               if (pgresult) PQclear(pgresult);
-       
-               /* <o.blasnik@nextra.de> */
-
-               auth_pgsql_cleanup();
-
-               if (do_connect())
-               {
-                       free(querybuf);
-                       return (0);
-               }
-
-               pgresult = PQexec(pgconn, querybuf);
-               if (!pgresult || PQresultStatus(pgresult) != PGRES_TUPLES_OK)
-               {
-                       DPRINTF("PQexec failed second time, giving up: %s", PQerrorMessage(pgconn));
-                       if (pgresult) PQclear(pgresult);
-                       free(querybuf);
-                       auth_pgsql_cleanup();
-                       /* Server went down, that's OK,
-                       ** try again next time.
-                       */
-                       return (0);
-               }
-       }
-       free(querybuf);
-
-               if (PQntuples(pgresult)>0)
-               {
-               char *t, *endp;
-               int     num_fields = PQnfields(pgresult);
-
-                       if (num_fields < 6)
-                       {
-                               DPRINTF("incomplete row, only %d fields returned",
-                                       num_fields);
-                               PQclear(pgresult);
-                               return 0;
-                       }
-
-                       t=PQgetvalue(pgresult,0,0);
-                       if (t && t[0]) ui.username=strdup(t);
-                       t=PQgetvalue(pgresult,0,1);
-                       if (t && t[0]) ui.cryptpw=strdup(t);
-                       t=PQgetvalue(pgresult,0,2);
-                       if (t && t[0]) ui.clearpw=strdup(t);
-                       t=PQgetvalue(pgresult,0,3);
-                       if (!t || !t[0] ||
-                          (ui.uid=strtol(t, &endp, 10), endp[0] != '\0'))
-                       {
-                               DPRINTF("invalid value for uid: '%s'",
-                                       t ? t : "<null>");
-                               PQclear(pgresult);
-                               return 0;
-                       }
-                       t=PQgetvalue(pgresult,0,4);
-                       if (!t || !t[0] ||
-                          (ui.gid=strtol(t, &endp, 10), endp[0] != '\0'))
-                       {
-                               DPRINTF("invalid value for gid: '%s'",
-                                       t ? t : "<null>");
-                               PQclear(pgresult);
-                               return 0;
-                       }
-                       t=PQgetvalue(pgresult,0,5);
-                       if (t && t[0])
-                               ui.home=strdup(t);
-                       else
-                       {
-                               DPRINTF("required value for 'home' (column 6) is missing");
-                               PQclear(pgresult);
-                               return 0;
-                       }
-                       t=num_fields > 6 ? PQgetvalue(pgresult,0,6) : 0;
-                       if (t && t[0]) ui.maildir=strdup(t);
-                       t=num_fields > 7 ? PQgetvalue(pgresult,0,7) : 0;
-                       if (t && t[0]) ui.quota=strdup(t);
-                       t=num_fields > 8 ? PQgetvalue(pgresult,0,8) : 0;
-                       if (t && t[0]) ui.fullname=strdup(t);
-                       t=num_fields > 9 ? PQgetvalue(pgresult,0,9) : 0;
-                       if (t && t[0]) ui.options=strdup(t);
-               }
-               else
-               {
-                       DPRINTF("zero rows returned");
-                       PQclear(pgresult);
-                       return (&ui);
-               }
-               PQclear(pgresult);
-
-       return (&ui);
-}
-
-int auth_pgsql_setpass(const char *user, const char *pass,
-                      const char *oldpass)
-{
-       char *newpass_crypt;
-       char *sql_buf;
-       size_t sql_buf_size;
-       char dummy_buf[1];
-       int rc=0;
-
-       char *clear_escaped;
-       char *crypt_escaped;
-       int  *error = NULL;
-
-       char *username_escaped;
-
-       const char *clear_field=NULL;
-       const char *crypt_field=NULL;
-       const char *defdomain=NULL;
-       const char *where_clause=NULL;
-       const char *user_table=NULL;
-       const char *login_field=NULL;
-       const char *chpass_clause=NULL; /* tom@minnesota.com */
-
-       if (!pgconn)
-               return (-1);
-
-
-       if (!(newpass_crypt=authcryptpasswd(pass, oldpass)))
-               return (-1);
-
-       clear_escaped=malloc(strlen(pass)*2+1);
-
-        if (!clear_escaped)
-        {
-                perror("malloc");
-                free(newpass_crypt);
-                return -1;
-        }
-
-        crypt_escaped=malloc(strlen(newpass_crypt)*2+1);
-
-        if (!crypt_escaped)
-        {
-                perror("malloc");
-                free(clear_escaped);
-                free(newpass_crypt);
-                return -1;
-        }
-
-        PQescapeStringConn(pgconn, clear_escaped, pass, strlen(pass), error);
-        PQescapeStringConn(pgconn, crypt_escaped,
-                                 newpass_crypt, strlen(newpass_crypt), error);
-
-
-
-       /* tom@minnesota.com */
-       chpass_clause=read_env("PGSQL_CHPASS_CLAUSE");
-       defdomain=read_env("DEFAULT_DOMAIN");
-       user_table=read_env("PGSQL_USER_TABLE");
-       if (!chpass_clause)
-       {
-               login_field = read_env("PGSQL_LOGIN_FIELD");
-               if (!login_field) login_field = "id";
-               crypt_field=read_env("PGSQL_CRYPT_PWFIELD");
-               clear_field=read_env("PGSQL_CLEAR_PWFIELD");
-               where_clause=read_env("PGSQL_WHERE_CLAUSE");
-
-               username_escaped=get_username_escaped(user, defdomain);
-
-               if (!username_escaped)
-                       return -1;
-
-               if (!where_clause)
-                       where_clause="";
-
-               if (!crypt_field)
-                       crypt_field="";
-
-               if (!clear_field)
-                       clear_field="";
-
-#define DEFAULT_SETPASS_UPDATE \
-               "UPDATE %s SET %s%s%s%s %s %s%s%s%s WHERE %s='%s' %s%s%s", \
-                       user_table,                                     \
-                       *clear_field ? clear_field:"",                  \
-                       *clear_field ? "='":"",                         \
-                       *clear_field ? clear_escaped:"",                \
-                       *clear_field ? "'":"",                          \
-                                                                       \
-                       *clear_field && *crypt_field ? ",":"",          \
-                                                                       \
-                       *crypt_field ? crypt_field:"",                  \
-                       *crypt_field ? "='":"",                         \
-                       *crypt_field ? crypt_escaped:"",                \
-                       *crypt_field ? "'":"",                          \
-                                                                       \
-                       login_field, username_escaped,                  \
-                       *where_clause ? " AND (":"", where_clause,      \
-                       *where_clause ? ")":""
-
-
-               sql_buf_size=snprintf(dummy_buf, 1, DEFAULT_SETPASS_UPDATE);
-
-               sql_buf=malloc(sql_buf_size+1);
-
-               if (sql_buf)
-                       snprintf(sql_buf, sql_buf_size+1,
-                                DEFAULT_SETPASS_UPDATE);
-
-               free(username_escaped);
-       }
-       else
-       {
-               sql_buf=parse_chpass_clause(chpass_clause,
-                                           user,
-                                           defdomain,
-                                           pass,
-                                           newpass_crypt);
-       }
-
-       if (!sql_buf)
-       {
-               free(clear_escaped);
-               free(newpass_crypt);
-               return (-1);
-       }
-       if (courier_authdebug_login_level >= 2)
-       {
-               DPRINTF("setpass SQL: %s", sql_buf);
-       }
-       pgresult=PQexec (pgconn, sql_buf);
-       if (!pgresult || PQresultStatus(pgresult) != PGRES_COMMAND_OK)
-       {
-               DPRINTF("setpass SQL failed");
-               rc= -1;
-               auth_pgsql_cleanup();
-       }
-       PQclear(pgresult);
-       free(clear_escaped);
-       free(crypt_escaped);
-       free(newpass_crypt);
-       free(sql_buf);
-       return (rc);
-}
-
-void auth_pgsql_enumerate( void(*cb_func)(const char *name,
-                                         uid_t uid,
-                                         gid_t gid,
-                                         const char *homedir,
-                                         const char *maildir,
-                                         const char *options,
-                                         void *void_arg),
-                          void *void_arg)
-{
-       const char *select_clause, *defdomain;
-       char    *querybuf;
-
-       int i,n;
-
-       if (do_connect())
-       {
-               (*cb_func)(NULL, 0, 0, NULL, NULL, NULL, void_arg);
-               return;
-       }
-
-       initui();
-
-       select_clause=read_env("PGSQL_ENUMERATE_CLAUSE");
-       defdomain=read_env("DEFAULT_DOMAIN");
-       if (!defdomain || !defdomain[0])
-               defdomain="*"; /* otherwise parse_select_clause fails */
-
-       if (!select_clause) /* tom@minnesota.com */
-       {
-               const char      *user_table,
-                               *uid_field,
-                               *gid_field,
-                               *login_field,
-                               *home_field,
-                               *maildir_field,
-                               *options_field,
-                               *where_clause;
-               char dummy_buf[1];
-               size_t query_len;
-
-               user_table=read_env("PGSQL_USER_TABLE");
-
-               if (!user_table)
-               {
-                       err("authpgsql: PGSQL_USER_TABLE not set in "
-                              AUTHPGSQLRC ".");
-                       return;
-               }
-
-               uid_field = read_env("PGSQL_UID_FIELD");
-               if (!uid_field) uid_field = "uid";
-
-               gid_field = read_env("PGSQL_GID_FIELD");
-               if (!gid_field) gid_field = "gid";
-
-               login_field = read_env("PGSQL_LOGIN_FIELD");
-               if (!login_field) login_field = "id";
-
-               home_field = read_env("PGSQL_HOME_FIELD");
-               if (!home_field) home_field = "home";
-
-               maildir_field=read_env("PGSQL_MAILDIR_FIELD");
-               if (!maildir_field) maildir_field="''";
-
-               options_field=read_env("PGSQL_AUXOPTIONS_FIELD");
-               if (!options_field) options_field="''";
-
-               where_clause=read_env("PGSQL_WHERE_CLAUSE");
-               if (!where_clause) where_clause = "";
-
-#define DEFAULT_ENUMERATE_QUERY \
-               "SELECT %s, %s, %s, %s, %s, %s FROM %s %s%s",\
-                       login_field, uid_field, gid_field,              \
-                       home_field, maildir_field,                      \
-                       options_field, user_table,                      \
-                       *where_clause ? " WHERE ":"",                   \
-                       where_clause
-
-
-               query_len=snprintf(dummy_buf, 1, DEFAULT_ENUMERATE_QUERY);
-
-               querybuf=malloc(query_len+1);
-
-               if (!querybuf)
-               {
-                       perror("malloc");
-                       return;
-               }
-
-               snprintf(querybuf, query_len+1, DEFAULT_ENUMERATE_QUERY);
-       }
-       else
-       {
-               /* tom@minnesota.com */
-               querybuf=parse_select_clause (select_clause, "*",
-                                             defdomain, "enumerate");
-               if (!querybuf)
-               {
-                       DPRINTF("authpgsql: parse_select_clause failed");
-                       return;
-               }
-       }
-       DPRINTF("authpgsql: enumerate query: %s", querybuf);
-
-       if (PQsendQuery(pgconn, querybuf) == 0)
-       {
-               DPRINTF("PQsendQuery failed, reconnecting: %s",PQerrorMessage(pgconn));
-
-               auth_pgsql_cleanup();
-
-               if (do_connect())
-               {
-                       free(querybuf);
-                       return;
-               }
-
-               if (PQsendQuery(pgconn, querybuf) == 0)
-               {
-                       DPRINTF("PQsendQuery failed second time, giving up: %s",PQerrorMessage(pgconn));
-                       free(querybuf);
-                       auth_pgsql_cleanup();
-                       return;
-               }
-       }
-       free(querybuf);
-
-       while ((pgresult = PQgetResult(pgconn)) != NULL)
-       {
-               if (PQresultStatus(pgresult) != PGRES_TUPLES_OK)
-               {
-                       DPRINTF("pgsql error during enumeration: %s",PQerrorMessage(pgconn));
-                       PQclear(pgresult);
-                       return;
-               }
-
-               for (n=PQntuples(pgresult), i=0; i<n; i++)
-               {
-                       const char *username;
-                       uid_t uid;
-                       gid_t gid;
-                       const char *homedir;
-                       const char *maildir;
-                       const char *options;
-
-                       username=PQgetvalue(pgresult,i,0);
-                       uid=atol(PQgetvalue(pgresult,i,1));
-                       gid=atol(PQgetvalue(pgresult,i,2));
-                       homedir=PQgetvalue(pgresult,i,3);
-                       maildir=PQgetvalue(pgresult,i,4);
-                       options=PQgetvalue(pgresult,i,5);
-
-                       if (!username || !*username || !homedir || !*homedir)
-                               continue;
-
-                       if (maildir && !*maildir)
-                               maildir=NULL;
-
-                       (*cb_func)(username, uid, gid, homedir,
-                                  maildir, options, void_arg);
-
-               }
-               PQclear(pgresult);
-       }
-       /* FIXME: is it possible that a NULL result from PQgetResult could
-          indicate an error rather than EOF? The documentation is not clear */
-       (*cb_func)(NULL, 0, 0, NULL, NULL, NULL, void_arg);
-}
diff --git a/authpgsqllib.cpp b/authpgsqllib.cpp
new file mode 100644 (file)
index 0000000..fe8f650
--- /dev/null
@@ -0,0 +1,938 @@
+/*
+** Copyright 2000-2016 Double Precision, Inc.  See COPYING for
+** distribution information.
+*/
+
+
+#include       <stdio.h>
+#include       <stdlib.h>
+#include       <string.h>
+#include       <unistd.h>
+#include       <ctype.h>
+#include       <sys/types.h>
+#include       <sys/stat.h>
+#include       <libpq-fe.h>
+#include       <time.h>
+#include       <errno.h>
+
+extern "C" {
+#include       "authpgsql.h"
+#include       "authpgsqlrc.h"
+#include       "auth.h"
+#include       "courierauthdebug.h"
+};
+
+#include "authconfigfile.h"
+#include <string>
+
+#define err courier_auth_err
+
+
+class authpgsql_userinfo {
+public:
+       std::string username;
+       std::string fullname;
+       std::string cryptpw;
+       std::string clearpw;
+       std::string home;
+       std::string maildir;
+       std::string quota;
+       std::string options;
+       uid_t uid;
+       gid_t gid;
+       } ;
+
+class authpgsql_connection {
+
+       time_t last_time;
+       PGconn *pgconn;
+public:
+
+       class sentquery {
+
+               int status;
+
+       public:
+               sentquery(const authpgsql_connection &conn,
+                         const std::string &query)
+                       : status(PQsendQuery(conn.pgconn, query.c_str()))
+               {
+                       if (status == 0)
+                               DPRINTF("PQsendQuery failed: %s",
+                                       PQerrorMessage(conn.pgconn));
+               }
+
+               operator bool() const
+               {
+                       return status != 0;
+               }
+       };
+
+       class result {
+               PGresult *res;
+
+       public:
+               result(const authpgsql_connection &conn,
+                      const std::string &query)
+                       : res(PQexec(conn.pgconn, query.c_str()))
+               {
+               }
+
+               result(const authpgsql_connection &conn,
+                      const sentquery &query)
+                       : res(PQgetResult(conn.pgconn))
+               {
+               }
+
+               ~result()
+               {
+                       if (res)
+                               PQclear(res);
+               }
+
+               result(const result &res);
+               result &operator=(const result &res);
+
+               operator bool() const { return res != 0; }
+
+               bool query_failed() const
+               {
+                       return res == 0
+                               || PQresultStatus(res) != PGRES_TUPLES_OK;
+               }
+
+               bool command_failed() const
+               {
+                       return res == 0
+                               || PQresultStatus(res) != PGRES_COMMAND_OK;
+               }
+
+               size_t ntuples() const
+               {
+                       return res == 0 ? 0: PQntuples(res);
+               }
+
+               size_t nfields() const
+               {
+                       return res == 0 ? 0: PQnfields(res);
+               }
+
+               std::string value(size_t tuple, size_t field) const
+               {
+                       std::string v;
+
+                       if (tuple < ntuples() && field < nfields())
+                       {
+                               const char *p=PQgetvalue(res, tuple, field);
+
+                               if (p)
+                                       v=p;
+                       }
+                       return v;
+               }
+       };
+
+       class authpgsqlrc_vars {
+
+       public:
+
+               std::string character_set;
+               std::string connection;
+               std::string select_clause;
+               std::string chpass_clause;
+               std::string enumerate_clause;
+               std::string defdomain;
+               std::string user_table;
+               std::string clear_field;
+               std::string crypt_field;
+               std::string name_field;
+               std::string uid_field;
+               std::string gid_field;
+               std::string login_field;
+               std::string home_field;
+               std::string maildir_field;
+               std::string defaultdelivery_field;
+               std::string quota_field;
+               std::string options_field;
+               std::string where_clause;
+       };
+
+       class authpgsqlrc_file : public courier::auth::config_file,
+                                public authpgsqlrc_vars {
+
+               authpgsql_connection &conn;
+
+       public:
+
+               authpgsqlrc_file &operator=(const authpgsqlrc_file &o)
+               {
+                       courier::auth::config_file::operator=(o);
+                       authpgsqlrc_vars::operator=(o);
+                       return *this;
+               }
+
+               authpgsqlrc_file(authpgsql_connection &connArg)
+                       : courier::auth::config_file(AUTHPGSQLRC),
+                         conn(connArg)
+               {
+               }
+
+               bool do_load()
+               {
+                       character_set=config("PGSQL_CHARACTER_SET");
+
+                       if (!config("PGSQL_CONNECTION", connection, true))
+                               return false;
+
+                       select_clause=config("PGSQL_SELECT_CLAUSE");
+                       chpass_clause=config("PGSQL_CHPASS_CLAUSE");
+                       enumerate_clause=config("PGSQL_ENUMERATE_CLAUSE");
+
+                       defdomain=config("DEFAULT_DOMAIN");
+
+                       if (select_clause.empty() || chpass_clause.empty() ||
+                           enumerate_clause.empty())
+                       {
+                               if (!config("PGSQL_USER_TABLE", user_table, true))
+                                       return false;
+
+                               clear_field=config("PGSQL_CLEAR_PWFIELD");
+                               if (clear_field.empty())
+                               {
+                                       if (!config("PGSQL_CRYPT_PWFIELD",
+                                                   crypt_field,
+                                                   true))
+                                               return false;
+                               }
+                               else
+                               {
+                                       crypt_field=config("PGSQL_CRYPT_PWFIELD");
+                               }
+
+                               config("PGSQL_NAME_FIELD", name_field, false,
+                                      "''");
+
+                               if (crypt_field.empty()) crypt_field="''";
+                               if (clear_field.empty()) clear_field="''";
+
+                               config("PGSQL_UID_FIELD", uid_field, false, "uid");
+                               config("PGSQL_GID_FIELD", gid_field, false, "gid");
+                               config("PGSQL_LOGIN_FIELD", login_field, false, "id");
+                               config("PGSQL_HOME_FIELD", home_field, false, "home");
+                               config("PGSQL_MAILDIR_FIELD", maildir_field, false, "''");
+                               config("PGSQL_DEFAULTDELIVERY", defaultdelivery_field, false, "''");
+                               config("PGSQL_QUOTA_FIELD", quota_field, false, "''");
+                               config("PGSQL_AUXOPTIONS_FIELD", options_field, false, "''");
+
+                               config("PGSQL_WHERE_CLAUSE", where_clause, false, "1=1");
+                       }
+
+                       return true;
+               }
+
+               void do_reload()
+               {
+                       authpgsqlrc_file new_file(conn);
+
+                       if (new_file.load(true))
+                       {
+                               *this=new_file;
+                               DPRINTF("authpgsql: reloaded %s", filename);
+
+                               // Disconnect from the server, new login
+                               // parameters, perhaps.
+
+                               conn.disconnect();
+                       }
+               }
+       };
+
+       authpgsqlrc_file config_file;
+
+       authpgsql_connection()
+               : last_time(0), pgconn(0), config_file(*this)
+       {
+       }
+
+       ~authpgsql_connection()
+       {
+               disconnect();
+       }
+
+       void disconnect()
+       {
+               if (pgconn)
+               {
+                       PQfinish(pgconn);
+                       pgconn=0;
+               }
+       }
+
+       bool do_connect();
+
+       bool getuserinfo(authpgsql_userinfo &uiret,
+                        const char *username,
+                        const char *service);
+
+private:
+       bool getuserinfo(authpgsql_userinfo &uiret,
+                        const result &res);
+public:
+       bool setpass(const char *user, const char *pass, const char *oldpass);
+
+       void enumerate( void(*cb_func)(const char *name,
+                                      uid_t uid,
+                                      gid_t gid,
+                                      const char *homedir,
+                                      const char *maildir,
+                                      const char *options,
+                                      void *void_arg),
+                       void *void_arg);
+       void enumerate( const sentquery &sent,
+                       void(*cb_func)(const char *name,
+                                      uid_t uid,
+                                      gid_t gid,
+                                      const char *homedir,
+                                      const char *maildir,
+                                      const char *options,
+                                      void *void_arg),
+                       void *void_arg);
+
+       std::string escape(const std::string &s)
+       {
+               std::string buffer;
+               size_t n=s.size()*2+1;
+
+               buffer.resize(n);
+
+               n=PQescapeStringConn(pgconn, &buffer[0],
+                                    s.c_str(), s.size(), 0);
+
+               buffer.resize(n);
+
+               return buffer;
+       }
+
+       std::string escape_username(std::string username)
+       {
+               if (username.find('@') == username.npos &&
+                   !config_file.defdomain.empty())
+               {
+                       username.push_back('@');
+                       username += config_file.defdomain;
+               }
+
+               return escape(username);
+       }
+
+       static authpgsql_connection *singleton;
+};
+
+bool authpgsql_connection::do_connect()
+{
+       if (pgconn)
+       {
+               time_t t_check;
+
+               time(&t_check);
+
+               if (t_check < last_time)
+                       last_time=t_check;      /* System clock changed */
+
+               if (t_check < last_time + 60)
+                       return true;
+
+               last_time=t_check;
+
+               if (PQstatus(pgconn) == CONNECTION_OK) return true;
+
+               DPRINTF("authpgsql: PQstatus failed, connection lost");
+               PQfinish(pgconn);
+               pgconn=0;
+       }
+
+       pgconn = PQconnectdb(config_file.connection.c_str());
+
+       if (PQstatus(pgconn) == CONNECTION_BAD)
+       {
+                       err("PGSQL_CONNECTION could not be established");
+               err("%s", PQerrorMessage(pgconn));
+               PQfinish(pgconn);
+               pgconn=0;
+               return false;
+       }
+
+       if (!config_file.character_set.empty())
+       {
+               PQsetClientEncoding(pgconn,
+                                   config_file.character_set.c_str());
+               std::string real_character_set=
+                       pg_encoding_to_char(PQclientEncoding(pgconn));
+
+               if (config_file.character_set != real_character_set)
+               {
+                       err("Cannot set character set to \"%s\","
+                           " using \"%s\"\n",
+                           config_file.character_set.c_str(),
+                           real_character_set.c_str());
+               }
+               else
+               {
+                       DPRINTF("Using character set: %s",
+                               config_file.character_set.c_str());
+               }
+        }
+
+       return true;
+}
+
+bool authpgsql_connection::getuserinfo(authpgsql_userinfo &uiret,
+                                      const char *username,
+                                      const char *service)
+{
+       std::string querybuf;
+
+       if (!do_connect())
+               return false;
+
+       if (config_file.select_clause.empty())
+       {
+               std::ostringstream o;
+
+               o << "SELECT "
+                 << config_file.login_field << ", "
+                 << config_file.crypt_field << ", "
+                 << config_file.clear_field << ", "
+                 << config_file.uid_field << ", "
+                 << config_file.gid_field << ", "
+                 << config_file.home_field << ", "
+                 << (strcmp(service, "courier") == 0 ?
+                     config_file.defaultdelivery_field
+                     :config_file.maildir_field) << ", "
+                 << config_file.quota_field << ", "
+                 << config_file.name_field << ", "
+                 << config_file.options_field
+                 << " FROM " << config_file.user_table
+                 << " WHERE " << config_file.login_field
+                 << " = '"
+                 << escape_username(username)
+                 << "' AND (" << config_file.where_clause << ")";
+
+               querybuf=o.str();
+       }
+       else
+       {
+               std::map<std::string, std::string> parameters;
+
+               parameters["service"]=service;
+
+               querybuf=config_file
+                       .parse_custom_query(config_file.select_clause,
+                                           escape(username),
+                                           config_file.defdomain,
+                                           parameters);
+       }
+
+       DPRINTF("SQL query: %s", querybuf.c_str());
+
+       result res1(*this, querybuf);
+
+       if (res1)
+               return getuserinfo(uiret, res1);
+
+       disconnect();
+       if (do_connect())
+       {
+               result res2(*this, querybuf);
+
+               if (res2)
+                       return getuserinfo(uiret, res2);
+       }
+       return false;
+}
+
+bool authpgsql_connection::getuserinfo(authpgsql_userinfo &uiret,
+                                      const result &res)
+{
+       if (res.query_failed())
+               return false;
+
+       if (res.ntuples() > 0)
+       {
+               if (res.nfields() < 6)
+               {
+                       DPRINTF("incomplete row, only %d fields returned",
+                               res.nfields());
+                       return false;
+               }
+
+               uiret.username=res.value(0, 0);
+               uiret.cryptpw=res.value(0, 1);
+               uiret.clearpw=res.value(0, 2);
+
+               {
+                       std::string v=res.value(0, 3);
+
+                       std::istringstream i(v);
+
+                       i >> uiret.uid;
+
+                       if (i.fail() || !i.eof())
+                       {
+                               DPRINTF("invalid value for uid: '%s'",
+                                       v.c_str());
+                               return false;
+                       }
+               }
+
+               {
+                       std::string v=res.value(0, 4);
+
+                       std::istringstream i(v);
+
+                       i >> uiret.gid;
+
+                       if (i.fail() || !i.eof())
+                       {
+                               DPRINTF("invalid value for gid: '%s'",
+                                       v.c_str());
+                               return false;
+                       }
+               }
+
+
+               uiret.home=res.value(0, 5);
+               uiret.maildir=res.value(0, 6);
+               uiret.quota=res.value(0, 7);
+               uiret.fullname=res.value(0, 8);
+               uiret.options=res.value(0, 9);
+       }
+       else
+       {
+               DPRINTF("zero rows returned");
+               return true;
+       }
+
+       return true;
+}
+
+bool authpgsql_connection::setpass(const char *user, const char *pass,
+                                  const char *oldpass)
+{
+       if (!do_connect())
+               return false;
+
+       std::string newpass_crypt;
+
+       {
+               char *p;
+
+               if (!(p=authcryptpasswd(pass, oldpass)))
+                       return false;
+
+               newpass_crypt=p;
+               free(p);
+       }
+
+       std::string clear_escaped=escape(pass);
+       std::string crypt_escaped=escape(newpass_crypt);
+
+       std::string sql_buf;
+
+       if (config_file.chpass_clause.empty())
+       {
+               std::ostringstream o;
+
+               o << "UPDATE " << config_file.user_table
+                 << " SET ";
+               if (config_file.clear_field != "''")
+               {
+                       o << config_file.clear_field << "='"
+                         << clear_escaped
+                         << "'";
+
+                       if (config_file.crypt_field != "''")
+                               o << ", ";
+               }
+
+               if (config_file.crypt_field != "''")
+               {
+                       o << config_file.crypt_field << "='"
+                         << crypt_escaped
+                         << "'";
+               }
+
+               o << " WHERE "
+                 << config_file.login_field << "='"
+                 << escape_username(user)
+                 << "' AND (" << config_file.where_clause << ")";
+               sql_buf=o.str();
+       }
+       else
+       {
+               std::map<std::string, std::string> parameters;
+
+               parameters["newpass"]=clear_escaped;
+               parameters["newpass_crypt"]=crypt_escaped;
+
+               sql_buf=config_file
+                       .parse_custom_query(config_file.chpass_clause,
+                                           user,
+                                           config_file.defdomain,
+                                           parameters);
+       }
+
+       if (courier_authdebug_login_level >= 2)
+       {
+               DPRINTF("setpass SQL: %s", sql_buf.c_str());
+       }
+
+       result res(*this, sql_buf);
+
+       if (res.command_failed())
+       {
+               DPRINTF("setpass SQL failed");
+               disconnect();
+               return false;
+       }
+       return (true);
+}
+
+void authpgsql_connection::enumerate( void(*cb_func)(const char *name,
+                                                      uid_t uid,
+                                                      gid_t gid,
+                                                      const char *homedir,
+                                                      const char *maildir,
+                                                      const char *options,
+                                                      void *void_arg),
+                                       void *void_arg)
+{
+       if (!do_connect())
+       {
+               (*cb_func)(NULL, 0, 0, NULL, NULL, NULL, void_arg);
+               return;
+       }
+
+       std::string sql_buf;
+
+       if (config_file.enumerate_clause.empty())
+       {
+               std::ostringstream o;
+
+               o << "SELECT "
+                 << config_file.login_field << ", "
+                 << config_file.uid_field << ", "
+                 << config_file.gid_field << ", "
+                 << config_file.home_field << ", "
+                 << config_file.maildir_field << ", "
+                 << config_file.options_field
+                 << " FROM "
+                 << config_file.user_table << " WHERE "
+                 << config_file.where_clause;
+
+               sql_buf=o.str();
+       }
+       else
+       {
+               std::map<std::string, std::string> parameters;
+
+               parameters["service"]="enumerate";
+               sql_buf=config_file
+                       .parse_custom_query(config_file.enumerate_clause, "*",
+                                           config_file.defdomain, parameters);
+       }
+
+       DPRINTF("authpgsql: enumerate query: %s", sql_buf.c_str());
+
+       sentquery query1(*this, sql_buf);
+
+       if (query1)
+       {
+               enumerate(query1, cb_func, void_arg);
+               return;
+       }
+
+       disconnect();
+
+       if (!do_connect())
+               return;
+
+       sentquery query2(*this, sql_buf);
+       if (query2)
+       {
+               enumerate(query2, cb_func, void_arg);
+               return;
+       }
+}
+
+void authpgsql_connection::enumerate( const sentquery &sent,
+                                     void(*cb_func)(const char *name,
+                                                    uid_t uid,
+                                                    gid_t gid,
+                                                    const char *homedir,
+                                                    const char *maildir,
+                                                    const char *options,
+                                                    void *void_arg),
+                                     void *void_arg)
+{
+       while (1)
+       {
+               result res(*this, sent);
+
+               if (!res)
+                       break;
+
+               if (res.query_failed())
+                       continue;
+
+               size_t n=res.ntuples();
+
+               for (size_t i=0; i<n; ++i)
+               {
+                       std::string username=res.value(i, 0);
+                       std::string uid_s=res.value(i, 1);
+                       std::string gid_s=res.value(i, 2);
+                       std::string homedir=res.value(i, 3);
+                       std::string maildir=res.value(i, 4);
+                       std::string options=res.value(i, 5);
+
+                       uid_t uid=0;
+                       gid_t gid=0;
+
+                       std::istringstream(uid_s) >> uid;
+                       std::istringstream(gid_s) >> gid;
+
+                       if (username.empty() || homedir.empty())
+                               continue;
+
+                       (*cb_func)(username.c_str(), uid, gid,
+                                  homedir.c_str(),
+                                  (maildir.empty() ? 0:maildir.c_str()),
+                                  (options.empty() ? 0:options.c_str()),
+                                  void_arg);
+               }
+       }
+       (*cb_func)(NULL, 0, 0, NULL, NULL, NULL, void_arg);
+}
+
+
+static authpgsql_connection *get_conn()
+{
+       if (authpgsql_connection::singleton)
+       {
+               authpgsql_connection::singleton->config_file.load(true);
+               return authpgsql_connection::singleton;
+       }
+
+       authpgsql_connection *new_conn=new authpgsql_connection;
+
+       if (new_conn->config_file.load())
+       {
+               authpgsql_connection::singleton=new_conn;
+               return new_conn;
+       }
+
+       delete new_conn;
+       return NULL;
+}
+
+authpgsql_connection *authpgsql_connection::singleton=0;
+
+
+static bool auth_pgsql_getuserinfo(authpgsql_userinfo &uiret,
+                                  const char *username,
+                                  const char *service)
+{
+       authpgsql_connection *conn=get_conn();
+
+       if (!conn)
+               return false;
+
+       return conn->getuserinfo(uiret, username, service);
+}
+
+static bool docheckpw(authpgsql_userinfo &authinfo,
+                          const char *pass)
+{
+       if (!authinfo.cryptpw.empty())
+       {
+               if (authcheckpassword(pass,authinfo.cryptpw.c_str()))
+               {
+                       errno=EPERM;
+                       return false;
+               }
+       }
+       else if (!authinfo.clearpw.empty())
+       {
+               if (authinfo.clearpw != pass)
+               {
+                       if (courier_authdebug_login_level >= 2)
+                       {
+                               DPRINTF("supplied password '%s' does not match clearpasswd '%s'",
+                                       pass, authinfo.clearpw.empty());
+                       }
+                       else
+                       {
+                               DPRINTF("supplied password does not match clearpasswd");
+                       }
+                       errno=EPERM;
+                       return false;
+               }
+       }
+       else
+       {
+               DPRINTF("no password available to compare");
+               errno=EPERM;
+               return false;
+       }
+       return true;
+}
+
+static int do_auth_pgsql_login(const char *service, char *authdata,
+                              int (*callback_func)(struct authinfo *, void *),
+                              void *callback_arg)
+{
+       char *user, *pass;
+       authpgsql_userinfo uiret;
+       struct  authinfo        aa;
+
+       if ((user=strtok(authdata, "\n")) == 0 ||
+               (pass=strtok(0, "\n")) == 0)
+       {
+               errno=EPERM;
+               return (-1);
+       }
+
+       if (!auth_pgsql_getuserinfo(uiret, user, service))
+       {
+               errno=EACCES;   /* Fatal error - such as PgSQL being down */
+               return (-1);
+       }
+
+       if (!docheckpw(uiret, pass))
+               return -1;
+
+       memset(&aa, 0, sizeof(aa));
+
+       aa.sysuserid= &uiret.uid;
+       aa.sysgroupid= uiret.gid;
+       aa.homedir=uiret.home.c_str();
+       aa.maildir=uiret.maildir.empty() ? 0:uiret.maildir.c_str();
+       aa.address=uiret.username.c_str();
+       aa.quota=uiret.quota.empty() ? 0:uiret.quota.c_str();
+       aa.fullname=uiret.fullname.c_str();
+       aa.options=uiret.options.c_str();
+       aa.passwd=uiret.cryptpw.empty() ? 0:uiret.cryptpw.c_str();
+       aa.clearpasswd=pass;
+       courier_authdebug_authinfo("DEBUG: authpgsql: ", &aa,
+                           aa.clearpasswd, aa.passwd);
+       return (*callback_func)(&aa, callback_arg);
+}
+
+
+static int do_auth_pgsql_changepw(const char *service, const char *user,
+                                 const char *pass,
+                                 const char *newpass)
+{
+       authpgsql_connection *conn=get_conn();
+
+       if (!conn)
+               return false;
+
+       authpgsql_userinfo uiret;
+
+       if (conn->getuserinfo(uiret, user, service))
+       {
+               if (!docheckpw(uiret, pass))
+               {
+                       errno=EPERM;
+                       return -1;
+               }
+
+               if (!conn->setpass(user, newpass, uiret.cryptpw.c_str()))
+               {
+                       errno=EPERM;
+                       return (-1);
+               }
+               return 0;
+       }
+
+       errno=EPERM;
+       return (-1);
+}
+
+extern "C" {
+#if 0
+};
+#endif
+
+void auth_pgsql_cleanup()
+{
+       if (authpgsql_connection::singleton)
+               delete authpgsql_connection::singleton;
+       authpgsql_connection::singleton=0;
+}
+
+void auth_pgsql_enumerate( void(*cb_func)(const char *name,
+                                         uid_t uid,
+                                         gid_t gid,
+                                         const char *homedir,
+                                         const char *maildir,
+                                         const char *options,
+                                         void *void_arg),
+                          void *void_arg)
+{
+       authpgsql_connection *conn=get_conn();
+
+       if (conn)
+               conn->enumerate(cb_func, void_arg);
+}
+
+int auth_pgsql_login(const char *service, char *authdata,
+                    int (*callback_func)(struct authinfo *, void *),
+                    void *callback_arg)
+{
+       return do_auth_pgsql_login(service, authdata,
+                                  callback_func,
+                                  callback_arg);
+}
+
+int auth_pgsql_changepw(const char *service, const char *user,
+                       const char *pass,
+                       const char *newpass)
+{
+       return do_auth_pgsql_changepw(service, user, pass, newpass);
+}
+
+int    auth_pgsql_pre(const char *user, const char *service,
+                      int (*callback)(struct authinfo *, void *), void *arg)
+{
+       struct  authinfo        aa;
+       authpgsql_userinfo      uiret;
+
+       if (!auth_pgsql_getuserinfo(uiret, user, service))
+               return 1;
+
+       if (uiret.home.empty()) /* User not found */
+               return (-1);
+
+       memset(&aa, 0, sizeof(aa));
+
+       aa.sysuserid= &uiret.uid;
+       aa.sysgroupid= uiret.gid;
+       aa.homedir=uiret.home.c_str();
+       aa.maildir=uiret.maildir.empty() ? 0:uiret.maildir.c_str();
+       aa.address=uiret.username.c_str();
+       aa.quota=uiret.quota.empty() ? 0:uiret.quota.c_str();
+       aa.fullname=uiret.fullname.c_str();
+       aa.options=uiret.options.c_str();
+       aa.passwd=uiret.cryptpw.empty() ? 0:uiret.cryptpw.c_str();
+       aa.clearpasswd=uiret.clearpw.empty() ? 0:uiret.clearpw.c_str();
+
+       return ((*callback)(&aa, arg));
+}
+
+#if 0
+{
+#endif
+};
index ab85c8e..923dcc3 100644 (file)
@@ -1,4 +1,4 @@
-##VERSION: $Id: authpgsqlrc 17 2011-04-04 02:07:37Z mrsam $
+##VERSION: $Id: c6a82fc8c0bd0e858ca7c133640ed14769e3e04c-20160501082012$
 #
 # Copyright 2000-2004 Double Precision, Inc.  See COPYING for
 # distribution information.
 # field value.  Trailing spaces are prohibited.
 
 
-##NAME: LOCATION:0
+##NAME: LOCATION:1
 #
 # The server hostname, port, userid, and password used to log in.
 #
-# To connect to a filesystem socket, delete PGSQL_HOST, and set PGSQL_PORT to
-# the socket's last component.  So, if your pg socket is /tmp/.s.PGSQL.5400
-# set PGSQL_PORT to 5400.
+# See Postgresql's documenation for PQconnectdb(), for other options that
+# you can use here.
 
-PGSQL_HOST             pgsql.example.com
-PGSQL_PORT             5400
-PGSQL_USERNAME         admin
-PGSQL_PASSWORD         admin
-
-
-##NAME: PGSQL_OPT:0
-#
-# PGSQL_OPT specifies the connection debug options to PQsetdbLogin().
-# Don't bother with this setting unless you know what you're doing
-#
-# PGSQL_OPT            
+PGSQL_CONNECTION        \
+          host=pgsql.example.com \
+         port=5400              \
+         user=admin             \
+         password=admin
 
 ##NAME: PGSQL_DATABASE:0
 #
@@ -139,7 +131,7 @@ PGSQL_NAME_FIELD    name
 ##NAME: PGSQL_QUOTA_FIELD:0
 #
 # Define PGSQL_QUOTA_FIELD to be the name of the field that can optionally
-# specify a maildir quota.  See README.maildirquota for more information 
+# specify a maildir quota.  See README.maildirquota for more information
 #
 # PGSQL_QUOTA_FIELD    quota
 
@@ -258,3 +250,9 @@ PGSQL_NAME_FIELD    name
 #                      WHERE   local_part='$(local_part)'              \
 #                      AND     domain_name='$(domain)'
 #
+
+
+##NAME: MARKER:0
+#
+# Do not remove this section from this configuration file. This section
+# must be present at the end of this file.
index 72c31ca..9568775 100644 (file)
@@ -5,9 +5,9 @@
 */
 
 #include       "courier_auth_config.h"
+#include       "courierauth.h"
 #include       "courierauthsasl.h"
 #include       "authsaslclient.h"
-#include       "cramlib.h"
 #include       <stdlib.h>
 #include       <ctype.h>
 #include       <string.h>
index bd419d5..a545366 100644 (file)
@@ -20,11 +20,11 @@ extern "C" {
 
 #define SASL_LIST \
        SASL("EXTERNAL", NO_SERVER_FUNC(), authsaslclient_external) \
-       SASL("PLAIN", SERVER_FUNC(authsasl_plain), authsaslclient_plain) \
-       SASL("LOGIN", SERVER_FUNC(authsasl_login), authsaslclient_login) \
-       SASL("CRAM-MD5", SERVER_FUNC(authsasl_cram), authsaslclient_crammd5) \
+       SASL("CRAM-SHA256", SERVER_FUNC(authsasl_cram), authsaslclient_cramsha256) \
        SASL("CRAM-SHA1", SERVER_FUNC(authsasl_cram), authsaslclient_cramsha1) \
-       SASL("CRAM-SHA256", SERVER_FUNC(authsasl_cram), authsaslclient_cramsha256)
+       SASL("CRAM-MD5", SERVER_FUNC(authsasl_cram), authsaslclient_crammd5) \
+       SASL("PLAIN", SERVER_FUNC(authsasl_plain), authsaslclient_plain) \
+       SASL("LOGIN", SERVER_FUNC(authsasl_login), authsaslclient_login)
 
 /* A list of SASL client functions */
 
similarity index 56%
rename from authsqlite.c
rename to authsqlite.cpp
index 9d4a85f..3152d79 100644 (file)
 #include       <unistd.h>
 #endif
 
+extern "C" {
 #include       "auth.h"
-#include       "authsqlite.h"
 #include       "courierauthstaticlist.h"
+#include       "courierauth.h"
 #include       "courierauthdebug.h"
 #include       "libhmac/hmac.h"
-#include       "cramlib.h"
+}
+
+#include       "authsqlite.h"
+
+static int auth_sqlite_pre(const char *user, const char *service,
+                          int (*callback)(struct authinfo *, void *), void *arg)
+{
+       authsqliteuserinfo authinfo;
+       struct  authinfo        aa;
 
+       if (!auth_sqlite_getuserinfo(user, service, authinfo))
+               // Fatal error - such as Sqlite being down
+               return (1);
+
+       if (authinfo.home.empty()) // User not found
+               return (-1);
+
+       memset(&aa, 0, sizeof(aa));
+
+       /*aa.sysusername=user;*/
+       aa.sysuserid= &authinfo.uid;
+       aa.sysgroupid= authinfo.gid;
+       aa.homedir=authinfo.home.c_str();
+       aa.maildir=authinfo.maildir.empty() ? NULL:authinfo.maildir.c_str();
+       aa.address=authinfo.username.c_str();
+       aa.passwd=authinfo.cryptpw.c_str();
+       aa.clearpasswd=authinfo.clearpw.c_str();
+       aa.fullname=authinfo.fullname.c_str();
+       aa.quota=authinfo.quota.empty() ? NULL:authinfo.quota.c_str();
+       aa.options=authinfo.options.c_str();
+       return ((*callback)(&aa, arg));
+}
 
 extern void auth_sqlite_enumerate( void(*cb_func)(const char *name,
                                                  uid_t uid,
@@ -31,78 +62,83 @@ extern void auth_sqlite_enumerate( void(*cb_func)(const char *name,
                                                  void *void_arg),
                                   void *void_arg);
 
-static int auth_sqlite_login(const char *service, char *authdata,
-                            int (*callback_func)(struct authinfo *, void *),
-                            void *callback_arg)
+static bool docheckpw(authsqliteuserinfo &authinfo, const char *pass)
 {
-       char *user, *pass;
-       struct authsqliteuserinfo *authinfo;
-       struct  authinfo        aa;
-
-
-       if ((user=strtok(authdata, "\n")) == 0 ||
-               (pass=strtok(0, "\n")) == 0)
-       {
-               errno=EPERM;
-               return (-1);
-       }
-
-       authinfo=auth_sqlite_getuserinfo(user, service);
-
-       if (!authinfo)          /* Fatal error - such as Sqlite being down */
+       if (!authinfo.cryptpw.empty())
        {
-               errno=EACCES;
-               return (1);
-       }
-
-       if (authinfo->cryptpw)
-       {
-               if (authcheckpassword(pass,authinfo->cryptpw))
+               if (authcheckpassword(pass, authinfo.cryptpw.c_str()))
                {
                        errno=EPERM;
-                       return (-1);    /* User/Password not found. */
+                       return false;   /* User/Password not found. */
                }
        }
-       else if (authinfo->clearpw)
+       else if (!authinfo.clearpw.empty())
        {
-               if (strcmp(pass, authinfo->clearpw))
+               if (authinfo.clearpw != pass)
                {
                        if (courier_authdebug_login_level >= 2)
                        {
                                DPRINTF("supplied password '%s' does not match clearpasswd '%s'",
-                                       pass, authinfo->clearpw);
+                                       pass, authinfo.clearpw.c_str());
                        }
                        else
                        {
                                DPRINTF("supplied password does not match clearpasswd");
                        }
                        errno=EPERM;
-                       return (-1);
+                       return false;
                }
        }
        else
        {
                DPRINTF("no password available to compare");
                errno=EPERM;
-               return (-1);            /* Username not found */
+               return false;           /* Username not found */
+       }
+       return true;
+}
+
+static int auth_sqlite_login(const char *service, char *authdata,
+                            int (*callback_func)(struct authinfo *, void *),
+                            void *callback_arg)
+{
+       char *user, *pass;
+       authsqliteuserinfo authinfo;
+       struct  authinfo        aa;
+
+
+       if ((user=strtok(authdata, "\n")) == 0 ||
+               (pass=strtok(0, "\n")) == 0)
+       {
+               errno=EPERM;
+               return (-1);
        }
 
+       if (!auth_sqlite_getuserinfo(user, service, authinfo))
+               // Fatal error - such as Sqlite being down
+       {
+               errno=EACCES;
+               return (1);
+       }
+
+       if (!docheckpw(authinfo, pass))
+               return (-1);
+
        memset(&aa, 0, sizeof(aa));
 
-       aa.sysuserid= &authinfo->uid;
-       aa.sysgroupid= authinfo->gid;
-       aa.homedir=authinfo->home;
-       aa.maildir=authinfo->maildir && authinfo->maildir[0] ?
-               authinfo->maildir:0;
-       aa.address=authinfo->username;
-       aa.quota=authinfo->quota && authinfo->quota[0] ?
-               authinfo->quota:0;
-       aa.fullname=authinfo->fullname;
-       aa.options=authinfo->options;
+       aa.sysuserid= &authinfo.uid;
+       aa.sysgroupid= authinfo.gid;
+       aa.homedir=authinfo.home.c_str();
+       aa.maildir=authinfo.maildir.empty() ? NULL:authinfo.maildir.c_str();
+       aa.address=authinfo.username.c_str();
+       aa.quota=authinfo.quota.empty() ? NULL:authinfo.quota.c_str();
+       aa.fullname=authinfo.fullname.c_str();
+       aa.options=authinfo.options.c_str();
        aa.clearpasswd=pass;
-       aa.passwd=authinfo->cryptpw;
+       aa.passwd=authinfo.cryptpw.c_str();
        courier_authdebug_authinfo("DEBUG: authsqlite: ", &aa,
-                           authinfo->clearpw, authinfo->cryptpw);
+                                  authinfo.clearpw.c_str(),
+                                  authinfo.cryptpw.c_str());
 
        return (*callback_func)(&aa, callback_arg);
 }
@@ -111,39 +147,21 @@ static int auth_sqlite_changepw(const char *service, const char *user,
                                const char *pass,
                                const char *newpass)
 {
-       struct authsqliteuserinfo *authinfo;
-
-       authinfo=auth_sqlite_getuserinfo(user, service);
+       authsqliteuserinfo authinfo;
 
-       if (!authinfo)
+       if (!auth_sqlite_getuserinfo(user, service, authinfo))
        {
                errno=ENOENT;
                return (-1);
        }
 
-       if (authinfo->cryptpw)
-       {
-               if (authcheckpassword(pass,authinfo->cryptpw))
-               {
-                       errno=EPERM;
-                       return (-1);    /* User/Password not found. */
-               }
-       }
-       else if (authinfo->clearpw)
-       {
-               if (strcmp(pass, authinfo->clearpw))
-               {
-                       errno=EPERM;
-                       return (-1);
-               }
-       }
-       else
+       if (!docheckpw(authinfo, pass))
        {
                errno=EPERM;
-               return (-1);
+               return (-1);    /* User/Password not found. */
        }
 
-       if (auth_sqlite_setpass(user, newpass, authinfo->cryptpw))
+       if (auth_sqlite_setpass(user, newpass, authinfo.cryptpw.c_str()))
        {
                errno=EPERM;
                return (-1);
@@ -192,8 +210,9 @@ static struct authstaticinfo authsqlite_info={
        auth_sqlite_cleanup,
        auth_sqlite_enumerate};
 
-
-struct authstaticinfo *courier_authsqlite_init()
-{
-       return &authsqlite_info;
+extern "C" {
+       struct authstaticinfo *courier_authsqlite_init()
+       {
+               return &authsqlite_info;
+       }
 }
dissimilarity index 64%
index 901b68c..62f6983 100644 (file)
@@ -1,34 +1,34 @@
-#ifndef        authsqlite_h
-#define        authsqlite_h
-
-#include       "courier_auth_config.h"
-#include       <stdlib.h>
-#include       <string.h>
-#include       <sys/types.h>
-#include       <sqlite3.h>
-
-struct authsqliteuserinfo {
-       char *username;
-       char *fullname;
-       char *cryptpw;
-       char *clearpw;
-       char *home;
-       char *maildir;
-       char *quota;
-       char *options;
-       uid_t uid;
-       gid_t gid;
-       ;
-
-extern struct authsqliteuserinfo *auth_sqlite_getuserinfo(const char *,
-                                                         const char *);
-extern void auth_sqlite_cleanup();
-
-extern int auth_sqlite_setpass(const char *, const char *, const char *);
-
-struct authinfo;
-
-extern int auth_sqlite_pre(const char *, const char *,
-                          int (*)(struct authinfo *, void *), void *arg);
-
-#endif
+#ifndef        authsqlite_h
+#define        authsqlite_h
+
+#include       "courier_auth_config.h"
+
+#include       <string>
+#include       <sqlite3.h>
+
+class authsqliteuserinfo {
+
+ public:
+       std::string username;
+       std::string fullname;
+       std::string cryptpw;
+       std::string clearpw;
+       std::string home;
+       std::string maildir;
+       std::string quota;
+       std::string options;
+       uid_t uid;
+       gid_t gid;
+
+       authsqliteuserinfo() : uid(0), gid(0) {}
+;
+
+extern bool auth_sqlite_getuserinfo(const char *,
+                                   const char *,
+                                   authsqliteuserinfo &);
+
+extern void auth_sqlite_cleanup();
+
+extern int auth_sqlite_setpass(const char *, const char *, const char *);
+
+#endif
diff --git a/authsqlitelib.c b/authsqlitelib.c
deleted file mode 100644 (file)
index fa00a03..0000000
+++ /dev/null
@@ -1,637 +0,0 @@
-/*
-** Copyright 2012 Double Precision, Inc.  See COPYING for
-** distribution information.
-*/
-
-#include       <stdio.h>
-#include       <stdlib.h>
-#include       <string.h>
-#include       <unistd.h>
-#include       <ctype.h>
-#include       <sys/types.h>
-#include       <sys/stat.h>
-#include       <time.h>
-
-#include       "authsqlite.h"
-#include       "authsqliterc.h"
-#include       "auth.h"
-#include       "courierauthdebug.h"
-
-#define err courier_auth_err
-#define GET(c) ((c) < (n) && columns[(c)] ? columns[(c)]:"")
-
-static const char *read_env(const char *env)
-{
-       return authgetconfig(AUTHSQLITERC, env);
-}
-
-static sqlite3 *dbh=0;
-
-sqlite3 *do_connect()
-{
-       const char *p;
-
-       if (dbh)
-               return dbh;
-
-       p=read_env("SQLITE_DATABASE");
-
-       if (!p)
-               return 0;
-
-       if (access(p, R_OK))
-               return 0;
-
-       if (sqlite3_open_v2(p, &dbh, SQLITE_OPEN_READWRITE, NULL) != SQLITE_OK)
-       {
-               if (dbh)
-               {
-                       err("sqllite3_open(%s): %s", p, sqlite3_errmsg(dbh));
-                       sqlite3_close(dbh);
-                       dbh=0;
-               }
-               return 0;
-       }
-
-       return dbh;
-}
-
-void auth_sqlite_cleanup()
-{
-       if (dbh)
-       {
-               sqlite3_close(dbh);
-               dbh=0;
-       }
-}
-
-static char *escape_str(const char *c, size_t n)
-{
-       char *p=malloc(n+1), *q;
-
-       if (!p)
-       {
-               perror("malloc");
-               return 0;
-       }
-
-       memcpy(p, c, n);
-       p[n]=0;
-
-       q=sqlite3_mprintf("%q", p);
-       free(p);
-
-       p=strdup(q);
-       sqlite3_free(q);
-       if (!p)
-       {
-               perror("malloc");
-               return 0;
-       }
-       return p;
-}
-
-static struct authsqliteuserinfo ui={0, 0, 0, 0, 0, 0, 0, 0};
-static int ui_cnt;
-
-static void initui()
-{
-
-       if (ui.username)
-               free(ui.username);
-       if (ui.cryptpw)
-               free(ui.cryptpw);
-       if (ui.clearpw)
-               free(ui.clearpw);
-       if (ui.home)
-               free(ui.home);
-       if (ui.maildir)
-               free(ui.maildir);
-       if (ui.quota)
-               free(ui.quota);
-       if (ui.fullname)
-               free(ui.fullname);
-       if (ui.options)
-               free(ui.options);
-       memset(&ui, 0, sizeof(ui));
-}
-
-static int select_callback(void *dummy, int n, char **columns, char **names)
-{
-       if (ui_cnt++)
-       {
-               err("Multiple rows returned");
-               return -1;
-       }
-
-       initui();
-
-       if (n < 6)
-       {
-               err("Query came back with fewer than 6 columns");
-               return -1;
-       }
-
-       if ((ui.username=strdup(GET(0))) == NULL
-           || (ui.cryptpw=strdup(GET(1))) == NULL
-           || (ui.clearpw=strdup(GET(2))) == NULL
-           || (ui.home=strdup(GET(5))) == NULL
-           || (ui.maildir=strdup(GET(6))) == NULL
-           || (ui.quota=strdup(GET(7))) == NULL
-           || (ui.fullname=strdup(GET(8))) == NULL
-           || (ui.options=strdup(GET(9))) == NULL)
-       {
-               initui();
-               return 0;
-       }
-
-       ui.uid=atoi(GET(3));
-       ui.gid=atoi(GET(4));
-
-       return 0;
-}
-
-struct authsqliteuserinfo *auth_sqlite_getuserinfo(const char *username,
-                                                  const char *service)
-{
-       const char *defdomain   =NULL;
-       char    *querybuf;
-       char            *errmsg;
-       const char      *select_clause;
-
-#define DEFAULT_SELECT_QUERY "SELECT %s, %s, %s, %s, %s, %s, %s, %s, %s, %s FROM %s WHERE %s = '%s%s%s' %s%s%s", \
-               login_field, crypt_field, clear_field, uid_field,\
-               gid_field, home_field, maildir_field, quota_field,\
-               name_field, options_field, user_table, login_field,\
-               username_escaped,\
-               has_domain || !*defdomain ? "":"@", has_domain ? "":defdomain, \
-               *where_clause ? " AND (":"", where_clause,\
-               *where_clause ? ")":""
-
-       initui();
-
-       if (!do_connect())
-               return &ui;
-
-       select_clause=read_env("SQLITE_SELECT_CLAUSE");
-       defdomain=read_env("DEFAULT_DOMAIN");   
-       if (!defdomain) defdomain="";
-       
-       if (!select_clause) /* siefca@pld.org.pl */
-       {
-               const char      *user_table,
-                               *crypt_field,
-                               *clear_field,
-                               *name_field,
-                               *uid_field,
-                               *gid_field,
-                               *login_field,
-                               *home_field,
-                               *maildir_field,
-                               *quota_field,
-                               *options_field,
-                               *where_clause;
-               char            *username_escaped;
-               size_t  query_size;
-               char dummy_buf[1];
-               int has_domain;
-
-               user_table=read_env("SQLITE_USER_TABLE");
-
-               if (!user_table)
-               {
-                       err("authsqlite: SQLITE_USER_TABLE not set in "
-                               AUTHSQLITERC ".");
-                       return (0);
-               }
-
-               crypt_field=read_env("SQLITE_CRYPT_PWFIELD");
-               clear_field=read_env("SQLITE_CLEAR_PWFIELD");
-               name_field=read_env("SQLITE_NAME_FIELD");
-
-               if (!crypt_field && !clear_field)
-               {
-                       err("authsqlite: SQLITE_CRYPT_PWFIELD and "
-                               "SQLITE_CLEAR_PWFIELD not set in " AUTHSQLITERC ".");
-                       return (0);
-               }
-               if (!crypt_field) crypt_field="\"\"";
-               if (!clear_field) clear_field="\"\"";
-               if (!name_field) name_field="\"\"";
-
-               uid_field = read_env("SQLITE_UID_FIELD");
-               if (!uid_field) uid_field = "uid";
-
-               gid_field = read_env("SQLITE_GID_FIELD");
-               if (!gid_field) gid_field = "gid";
-
-               login_field = read_env("SQLITE_LOGIN_FIELD");
-               if (!login_field) login_field = "id";
-
-               home_field = read_env("SQLITE_HOME_FIELD");
-               if (!home_field) home_field = "home";
-
-               maildir_field=read_env(service && strcmp(service, "courier")==0
-                                      ? "SQLITE_DEFAULTDELIVERY"
-                                      : "SQLITE_MAILDIR_FIELD");
-               if (!maildir_field) maildir_field="\"\"";
-
-               quota_field=read_env("SQLITE_QUOTA_FIELD");
-               if (!quota_field) quota_field="\"\""; 
-
-               options_field=read_env("SQLITE_AUXOPTIONS_FIELD");
-               if (!options_field) options_field="\"\"";
-
-               where_clause=read_env("SQLITE_WHERE_CLAUSE");
-               if (!where_clause) where_clause = "";
-
-               username_escaped=escape_str(username, strlen(username));
-
-               if (!username_escaped)
-               {
-                       perror("malloc");
-                       return (0);
-               }
-
-               has_domain=strchr(username, '@') != NULL;
-
-               query_size=snprintf(dummy_buf, 1, DEFAULT_SELECT_QUERY);
-
-               querybuf=malloc(query_size+1);
-
-               if (!querybuf)
-               {
-                       free(username_escaped);
-                       perror("malloc");
-                       return(0);
-               }
-
-               snprintf(querybuf, query_size+1, DEFAULT_SELECT_QUERY);
-               free(username_escaped);
-
-       }
-       else
-       {
-               /* siefca@pld.org.pl */
-               querybuf=auth_parse_select_clause (escape_str,
-                                                  select_clause, username,
-                                                  defdomain, service);
-               if (!querybuf)
-               {
-                       DPRINTF("parse_select_clause failed (DEFAULT_DOMAIN not set?)");
-                       return 0;
-               }
-       }
-
-       DPRINTF("SQL query: %s", querybuf);
-       errmsg=0;
-       ui_cnt=0;
-       if (sqlite3_exec(dbh, querybuf, select_callback,
-                        NULL, &errmsg) != SQLITE_OK)
-       {
-               if (errmsg)
-               {
-                       err(errmsg);
-                       sqlite3_free(errmsg);
-               }
-
-               free(querybuf);
-               return 0;
-       }
-
-       free(querybuf);
-       if (errmsg)
-       {
-               err(errmsg);
-               sqlite3_free(errmsg);
-       }
-
-       return &ui;
-}
-
-static int dummy_callback(void *dummy, int n, char **columns, char **names)
-{
-       return 0;
-}
-
-int auth_sqlite_setpass(const char *user, const char *pass,
-                      const char *oldpass)
-{
-       char *newpass_crypt;
-       char *sql_buf;
-       int rc=0;
-       char *errmsg;
-       char *clear_escaped;
-       char *crypt_escaped;
-
-       const char  *clear_field        =NULL,
-                   *crypt_field        =NULL,
-                   *defdomain          =NULL,
-                   *where_clause       =NULL,
-                   *user_table         =NULL,
-                   *login_field        =NULL,
-                   *chpass_clause      =NULL; /* siefca@pld.org.pl */
-
-       if (!do_connect())      return (-1);
-
-       if (!(newpass_crypt=authcryptpasswd(pass, oldpass)))
-               return (-1);
-
-       clear_escaped=escape_str(pass, strlen(pass));
-
-       if (!clear_escaped)
-       {
-               perror("malloc");
-               free(newpass_crypt);
-               return -1;
-       }
-
-       crypt_escaped=escape_str(newpass_crypt, strlen(newpass_crypt));
-
-       if (!crypt_escaped)
-       {
-               perror("malloc");
-               free(clear_escaped);
-               free(newpass_crypt);
-               return -1;
-       }
-
-       /* siefca@pld.org.pl */
-       chpass_clause=read_env("SQLITE_CHPASS_CLAUSE");
-       defdomain=read_env("DEFAULT_DOMAIN");
-       user_table=read_env("SQLITE_USER_TABLE");
-       if (!chpass_clause)
-       {
-               int has_domain=strchr(user, '@') != NULL;
-               char *username_escaped;
-               char dummy_buf[1];
-               size_t sql_buf_size;
-
-               username_escaped=escape_str(user, strlen(user));
-
-               if (!username_escaped)
-               {
-                       perror("malloc");
-                       free(clear_escaped);
-                       free(crypt_escaped);
-                       free(newpass_crypt);
-                       return -1;
-               }
-
-               login_field = read_env("SQLITE_LOGIN_FIELD");
-               if (!login_field) login_field = "id";
-               crypt_field=read_env("SQLITE_CRYPT_PWFIELD");
-               clear_field=read_env("SQLITE_CLEAR_PWFIELD");
-               where_clause=read_env("SQLITE_WHERE_CLAUSE");
-
-               if (!where_clause)
-                       where_clause="";
-
-               if (!crypt_field)
-                       crypt_field="";
-
-               if (!clear_field)
-                       clear_field="";
-
-               if (!defdomain)
-                       defdomain="";
-
-#define DEFAULT_SETPASS_UPDATE \
-               "UPDATE %s SET %s%s%s%s %s %s%s%s%s WHERE %s='%s%s%s' %s%s%s", \
-                       user_table,                                     \
-                       *clear_field ? clear_field:"",                  \
-                       *clear_field ? "='":"",                         \
-                       *clear_field ? clear_escaped:"",                \
-                       *clear_field ? "'":"",                          \
-                                                                       \
-                       *clear_field && *crypt_field ? ",":"",          \
-                                                                       \
-                       *crypt_field ? crypt_field:"",                  \
-                       *crypt_field ? "='":"",                         \
-                       *crypt_field ? crypt_escaped:"",                \
-                       *crypt_field ? "'":"",                          \
-                       login_field,                                    \
-                       username_escaped,                               \
-                       has_domain || !*defdomain ? "":"@",             \
-                       has_domain ? "":defdomain,                      \
-                       *where_clause ? " AND (":"", where_clause,      \
-                       *where_clause ? ")":""
-
-
-               sql_buf_size=snprintf(dummy_buf, 1, DEFAULT_SETPASS_UPDATE);
-
-               sql_buf=malloc(sql_buf_size+1);
-
-               if (sql_buf)
-                       snprintf(sql_buf, sql_buf_size+1,
-                                DEFAULT_SETPASS_UPDATE);
-
-               free(username_escaped);
-       }
-       else
-       {
-               sql_buf=auth_parse_chpass_clause(escape_str, chpass_clause,
-                                                user,
-                                                defdomain,
-                                                clear_escaped,
-                                                crypt_escaped);
-       }
-       
-       free(clear_escaped);
-       free(crypt_escaped);
-       free(newpass_crypt);
-
-       if (courier_authdebug_login_level >= 2)
-       {
-               DPRINTF("setpass SQL: %s", sql_buf);
-       }
-
-       errmsg=NULL;
-
-       if (sqlite3_exec(dbh, sql_buf, dummy_callback,
-                        NULL, &errmsg) != SQLITE_OK)
-       {
-               rc=-1;
-       }
-       else
-       {
-               if (sqlite3_changes(dbh) > 0)
-               {
-                       DPRINTF("authsqllite: password updated");
-               }
-               else
-               {
-                       rc=-1;
-                       DPRINTF("authsqllite: password not updated");
-               }
-       }
-
-       if (errmsg)
-       {
-               err(errmsg);
-               sqlite3_free(errmsg);
-       }
-
-       free(sql_buf);
-       return (rc);
-}
-
-struct enumerate_user_cb {
-
-       void (*cb_func)(const char *name,
-                       uid_t uid,
-                       gid_t gid,
-                       const char *homedir,
-                       const char *maildir,
-                       const char *options,
-                       void *void_arg);
-       void *void_arg;
-};
-
-static int enumerate_callback(void *closure,
-                             int n, char **columns, char **names)
-{
-       struct enumerate_user_cb *cb=(struct enumerate_user_cb *)closure;
-
-       const char *username;
-       uid_t uid;
-       gid_t gid;
-       const char *homedir;
-       const char *maildir;
-       const char *options;
-
-       username=GET(0);
-       uid=atol(GET(1)); /* FIXME use strtol to validate */
-       gid=atol(GET(2));
-       homedir=GET(3);
-       maildir=GET(4);
-       options=GET(5);
-
-       if (maildir && !*maildir)
-               maildir=NULL;
-
-       if (options && !*options)
-               options=NULL;
-
-       (*cb->cb_func)(username, uid, gid, homedir,
-                      maildir, options, cb->void_arg);
-       return 0;
-}
-
-void auth_sqlite_enumerate( void(*cb_func)(const char *name,
-                                          uid_t uid,
-                                          gid_t gid,
-                                          const char *homedir,
-                                          const char *maildir,
-                                          const char *options,
-                                          void *void_arg),
-                           void *void_arg)
-{
-       const char *defdomain, *select_clause;
-       char    *querybuf;
-       char    *errmsg;
-       struct enumerate_user_cb cb;
-
-       cb.cb_func=cb_func;
-       cb.void_arg=void_arg;
-
-       if (!do_connect())      return;
-
-       initui();
-
-       select_clause=read_env("SQLITE_ENUMERATE_CLAUSE");
-       defdomain=read_env("DEFAULT_DOMAIN");
-       if (!defdomain || !defdomain[0])
-               defdomain="*"; /* otherwise parse_select_clause fails */
-       
-       if (!select_clause)
-       {
-               const char      *user_table,
-                               *uid_field,
-                               *gid_field,
-                               *login_field,
-                               *home_field,
-                               *maildir_field,
-                               *options_field,
-                               *where_clause;
-               char dummy_buf[1];
-               size_t query_len;
-
-               user_table=read_env("SQLITE_USER_TABLE");
-
-               if (!user_table)
-               {
-                       err("authsqlite: SQLITE_USER_TABLE not set in "
-                               AUTHSQLITERC ".");
-                       return;
-               }
-
-               uid_field = read_env("SQLITE_UID_FIELD");
-               if (!uid_field) uid_field = "uid";
-
-               gid_field = read_env("SQLITE_GID_FIELD");
-               if (!gid_field) gid_field = "gid";
-
-               login_field = read_env("SQLITE_LOGIN_FIELD");
-               if (!login_field) login_field = "id";
-
-               home_field = read_env("SQLITE_HOME_FIELD");
-               if (!home_field) home_field = "home";
-
-               maildir_field=read_env("SQLITE_MAILDIR_FIELD");
-               if (!maildir_field) maildir_field="\"\"";
-
-               options_field=read_env("SQLITE_AUXOPTIONS_FIELD");
-               if (!options_field) options_field="\"\"";
-
-               where_clause=read_env("SQLITE_WHERE_CLAUSE");
-               if (!where_clause) where_clause = "";
-
-
-#define DEFAULT_ENUMERATE_QUERY \
-               "SELECT %s, %s, %s, %s, %s, %s FROM %s %s%s",\
-                       login_field, uid_field, gid_field,              \
-                       home_field, maildir_field,                      \
-                       options_field, user_table,                      \
-                       *where_clause ? " WHERE ":"",                   \
-                       where_clause
-
-               query_len=snprintf(dummy_buf, 1, DEFAULT_ENUMERATE_QUERY);
-
-               querybuf=malloc(query_len+1);
-
-               if (!querybuf)
-               {
-                       perror("malloc");
-                       return;
-               }
-
-               snprintf(querybuf, query_len+1, DEFAULT_ENUMERATE_QUERY);
-       }
-       else
-       {
-               /* siefca@pld.org.pl */
-               querybuf=auth_parse_select_clause (escape_str,
-                                                  select_clause, "*",
-                                                  defdomain, "enumerate");
-               if (!querybuf)
-               {
-                       DPRINTF("authsqlite: parse_select_clause failed");
-                       return;
-               }
-       }
-       DPRINTF("authsqlite: enumerate query: %s", querybuf);
-
-       errmsg=NULL;
-
-       sqlite3_exec(dbh, querybuf, enumerate_callback, &cb, &errmsg);
-
-       if (errmsg)
-       {
-               err(errmsg);
-               sqlite3_free(errmsg);
-       }
-       free(querybuf);
-
-       (*cb.cb_func)(NULL, 0, 0, NULL, NULL, NULL, cb.void_arg);
-}
diff --git a/authsqlitelib.cpp b/authsqlitelib.cpp
new file mode 100644 (file)
index 0000000..9cee42d
--- /dev/null
@@ -0,0 +1,627 @@
+/*
+** Copyright 2016 Double Precision, Inc.  See COPYING for
+** distribution information.
+*/
+
+#include       <stdio.h>
+#include       <stdlib.h>
+#include       <string.h>
+#include       <unistd.h>
+#include       <ctype.h>
+#include       <sys/types.h>
+#include       <sys/stat.h>
+#include       <time.h>
+
+extern "C" {
+#include       "authsqliterc.h"
+#include       "auth.h"
+#include       "courierauthdebug.h"
+}
+
+#include <string>
+#include <sstream>
+#include "authsqlite.h"
+#include "authconfigfile.h"
+
+#define err courier_auth_err
+
+#define GET(c) ((c) < (n) && columns[(c)] ? columns[(c)]:"")
+
+class authsqlite_connection {
+
+public:
+       sqlite3 *dbh;
+
+       class authsqliterc_vars {
+       public:
+               std::string database;
+               std::string select_clause, defdomain;
+               std::string user_table, crypt_field, clear_field,
+                       name_field, uid_field, gid_field, login_field,
+                       home_field, maildir_field, defaultdelivery_field,
+                       quota_field, options_field,
+                       where_clause, chpass_clause, enumerate_clause;
+
+       };
+
+       class authsqliterc_file : public courier::auth::config_file,
+                                 public authsqliterc_vars {
+
+               authsqlite_connection &conn;
+
+       public:
+
+               authsqliterc_file &operator=(const authsqliterc_file &o);
+               authsqliterc_file(authsqlite_connection &connArg);
+               ~authsqliterc_file();
+
+               bool do_load();
+               void do_reload();
+       };
+
+       authsqliterc_file config_file;
+
+       authsqlite_connection() : dbh(NULL), config_file(*this)
+       {
+       }
+
+       ~authsqlite_connection()
+       {
+               disconnect();
+       }
+
+       void disconnect()
+       {
+               if (dbh)
+               {
+                       sqlite3_close(dbh);
+                       dbh=NULL;
+               }
+       }
+
+       std::string escape(const std::string &s);
+
+       sqlite3 *do_connect();
+
+       static authsqlite_connection *singleton;
+
+       static authsqlite_connection *connect();
+
+       bool getuserinfo(const char *username,
+                        const char *service,
+                        authsqliteuserinfo &ui);
+
+       void enumerate( void(*cb_func)(const char *name,
+                                      uid_t uid,
+                                      gid_t gid,
+                                      const char *homedir,
+                                      const char *maildir,
+                                      const char *options,
+                                                     void *void_arg),
+                       void *void_arg);
+
+       bool setpass(const char *user, const char *pass,
+                    const char *oldpass);
+};
+
+
+authsqlite_connection::authsqliterc_file
+&authsqlite_connection::authsqliterc_file
+::operator=(const authsqlite_connection::authsqliterc_file &o)
+{
+       courier::auth::config_file::operator=(o);
+       authsqliterc_vars::operator=(o);
+       return *this;
+}
+
+authsqlite_connection::authsqliterc_file
+::authsqliterc_file(authsqlite_connection &connArg)
+       : courier::auth::config_file(AUTHSQLITERC),
+         conn(connArg)
+{
+}
+
+authsqlite_connection::authsqliterc_file::~authsqliterc_file()
+{
+}
+
+bool authsqlite_connection::authsqliterc_file::do_load()
+{
+       if (!config("SQLITE_DATABASE", database, true))
+               return false;
+
+       defdomain=config("DEFAULT_DOMAIN");
+
+       select_clause=config("SQLITE_SELECT_CLAUSE");
+       chpass_clause=config("SQLITE_CHPASS_CLAUSE");
+       enumerate_clause=config("SQLITE_ENUMERATE_CLAUSE");
+
+       if (select_clause.empty() || chpass_clause.empty() ||
+           enumerate_clause.empty())
+       {
+               if (!config("SQLITE_USER_TABLE", user_table,
+                           true))
+                       return false;
+
+               crypt_field=config("SQLITE_CRYPT_PWFIELD", "''");
+
+               clear_field=config("SQLITE_CLEAR_PWFIELD", "''");
+
+               if (crypt_field + clear_field == "''''")
+               {
+                       err("SQLITE_CLEAR_PWFIELD and SQLITE_CLEAR_FIELD not set in " AUTHSQLITERC);
+                       return false;
+               }
+
+               name_field=config("SQLITE_NAME_FIELD", "''");
+
+               uid_field=config("SQLITE_UID_FIELD", "uid");
+               gid_field=config("SQLITE_GID_FIELD", "gid");
+               login_field=config("SQLITE_LOGIN_FIELD", "id");
+               home_field=config("SQLITE_HOME_FIELD", "home");
+
+               maildir_field=config("SQLITE_MAILDIR_FIELD", "''");
+               defaultdelivery_field=config("SQLITE_DEFAULTDELIVERY", "''");
+
+               quota_field=config("SQLITE_QUOTA_FIELD", "''");
+               options_field=config("SQLITE_AUXOPTIONS_FIELD", "''");
+               where_clause=config("SQLITE_WHERE_CLAUSE", "1=1");
+       }
+
+       return true;
+}
+
+void authsqlite_connection::authsqliterc_file::do_reload()
+{
+       authsqliterc_file new_file(conn);
+
+       if (new_file.load(true))
+       {
+               *this=new_file;
+               DPRINTF("authsqlite: reloaded %s", filename);
+
+               // Disconnect from the server, new login
+               // parameters, perhaps.
+
+               conn.disconnect();
+       }
+}
+
+authsqlite_connection *authsqlite_connection::singleton=NULL;
+
+authsqlite_connection *authsqlite_connection::connect()
+{
+       if (authsqlite_connection::singleton)
+       {
+               authsqlite_connection::singleton->config_file.load(true);
+               return authsqlite_connection::singleton;
+       }
+
+       authsqlite_connection *new_conn=new authsqlite_connection;
+
+       if (new_conn->config_file.load())
+       {
+               authsqlite_connection::singleton=new_conn;
+               return new_conn;
+       }
+
+       delete new_conn;
+       return NULL;
+}
+
+sqlite3 *authsqlite_connection::do_connect()
+{
+       const char *p;
+
+       if (dbh)
+               return dbh;
+
+       p=config_file.database.c_str();
+
+       if (sqlite3_open_v2(p, &dbh, SQLITE_OPEN_READWRITE, NULL) != SQLITE_OK)
+       {
+               if (dbh)
+               {
+                       err("sqllite3_open(%s): %s", p, sqlite3_errmsg(dbh));
+                       sqlite3_close(dbh);
+                       dbh=0;
+               }
+               return 0;
+       }
+
+       return dbh;
+}
+
+static void do_auth_sqlite_cleanup()
+{
+       if (authsqlite_connection::singleton)
+       {
+               delete authsqlite_connection::singleton;
+               authsqlite_connection::singleton=NULL;
+       }
+}
+
+std::string authsqlite_connection::escape(const std::string &s)
+{
+       char *q=sqlite3_mprintf("%q", s.c_str());
+
+       std::string r(q);
+       sqlite3_free(q);
+       return r;
+}
+
+
+class select_callback_info {
+public:
+       authsqliteuserinfo &ui;
+       int ui_cnt;
+
+       select_callback_info(authsqliteuserinfo &uiArg)
+               : ui(uiArg), ui_cnt(0)
+       {
+       }
+};
+
+static int select_callback(void *dummy, int n, char **columns, char **names)
+{
+       select_callback_info *cb=
+               reinterpret_cast<select_callback_info *>(dummy);
+
+       if (cb->ui_cnt++)
+       {
+               err("Multiple rows returned");
+               return -1;
+       }
+
+       if (n < 6)
+       {
+               err("Query came back with fewer than 6 columns");
+               return -1;
+       }
+
+       cb->ui.username=GET(0);
+       cb->ui.cryptpw=GET(1);
+       cb->ui.clearpw=GET(2);
+       cb->ui.home=GET(5);
+       cb->ui.maildir=GET(6);
+       cb->ui.quota=GET(7);
+       cb->ui.fullname=GET(8);
+       cb->ui.options=GET(9);
+
+       std::istringstream(GET(3)) >> cb->ui.uid;
+       std::istringstream(GET(4)) >> cb->ui.gid;
+       return 0;
+}
+
+bool authsqlite_connection::getuserinfo(const char *username,
+                                       const char *service,
+                                       authsqliteuserinfo &ui)
+{
+       char            *errmsg;
+
+       if (!do_connect())
+               return false;
+
+       std::string querybuf;
+
+       if (config_file.select_clause.empty())
+       {
+               std::ostringstream o;
+
+               o << "SELECT "
+                 << config_file.login_field << ", "
+                 << config_file.crypt_field << ", "
+                 << config_file.clear_field << ", "
+                 << config_file.uid_field << ", "
+                 << config_file.gid_field << ", "
+                 << config_file.home_field << ", "
+                 << (strcmp(service, "courier") == 0 ?
+                     config_file.defaultdelivery_field:
+                     config_file.maildir_field) << ", "
+                 << config_file.quota_field << ", "
+                 << config_file.name_field << ", "
+                 << config_file.options_field
+                 << " FROM " << config_file.user_table
+                 << " WHERE " << config_file.login_field
+                 << " = '" << escape(username);
+
+               if (strchr(username, '@') == NULL &&
+                   !config_file.defdomain.empty())
+               {
+                       o << "@" << config_file.defdomain;
+               }
+
+               o  << "' AND (" <<  config_file.where_clause << ")";
+
+               querybuf=o.str();
+       }
+       else
+       {
+               std::map<std::string, std::string> parameters;
+
+               parameters["service"]=service;
+
+               querybuf=config_file
+                       .parse_custom_query(config_file.select_clause,
+                                           escape(username),
+                                           config_file.defdomain,
+                                           parameters);
+       }
+
+       DPRINTF("SQL query: %s", querybuf.c_str());
+       errmsg=0;
+
+       select_callback_info info(ui);
+       if (sqlite3_exec(dbh, querybuf.c_str(), select_callback,
+               reinterpret_cast<void *>(&info), &errmsg) != SQLITE_OK)
+       {
+               if (errmsg)
+               {
+                       err(errmsg);
+                       sqlite3_free(errmsg);
+               }
+               return false;
+       }
+
+       if (errmsg)
+       {
+               err(errmsg);
+               sqlite3_free(errmsg);
+       }
+
+       return true;
+}
+
+static int dummy_callback(void *dummy, int n, char **columns, char **names)
+{
+       return 0;
+}
+
+bool authsqlite_connection::setpass(const char *user, const char *pass,
+                                   const char *oldpass)
+{
+       char *errmsg;
+       bool rc=true;
+
+       if (!do_connect())      return false;
+
+       std::string newpass_crypt;
+
+       {
+               char *p;
+
+               if (!(p=authcryptpasswd(pass, oldpass)))
+                       return false;
+
+               newpass_crypt=p;
+               free(p);
+       }
+
+       std::string clear_escaped=escape(pass);
+
+       std::string crypt_escaped=escape(newpass_crypt);
+
+       std::string sql_buf;
+
+       if (config_file.chpass_clause.size() == 0)
+       {
+               std::string username_escaped=escape(user);
+
+               bool has_domain=strchr(user, '@') != NULL;
+
+               std::ostringstream o;
+
+               o << "UPDATE " << config_file.user_table << " SET ";
+
+               if (config_file.clear_field != "''")
+                       o << config_file.clear_field << "='"
+                         << clear_escaped << "'";
+
+               if (config_file.crypt_field != "''")
+               {
+                       if (config_file.clear_field != "''") o << ", ";
+                       o << config_file.crypt_field << "='" << crypt_escaped << "'";
+               }
+
+               o << " WHERE " << config_file.login_field << "='"
+                 << username_escaped;
+
+               if (!has_domain && config_file.defdomain.size())
+                       o << "@" << config_file.defdomain;
+               o << "'";
+
+               sql_buf=o.str();
+       }
+       else
+       {
+               std::map<std::string, std::string> parameters;
+
+               parameters["newpass"]=clear_escaped;
+               parameters["newpass_crypt"]=crypt_escaped;
+
+               sql_buf=config_file
+                       .parse_custom_query(config_file.chpass_clause,
+                                           user,
+                                           config_file.defdomain,
+                                           parameters);
+       }
+
+       if (courier_authdebug_login_level >= 2)
+       {
+               DPRINTF("setpass SQL: %s", sql_buf.c_str());
+       }
+
+       errmsg=NULL;
+
+       if (sqlite3_exec(dbh, sql_buf.c_str(), dummy_callback,
+                        NULL, &errmsg) != SQLITE_OK)
+       {
+               rc=false;
+       }
+       else
+       {
+               if (sqlite3_changes(dbh) > 0)
+               {
+                       DPRINTF("authsqllite: password updated");
+               }
+               else
+               {
+                       rc=false;
+                       DPRINTF("authsqllite: password not updated");
+               }
+       }
+
+       if (errmsg)
+       {
+               err(errmsg);
+               sqlite3_free(errmsg);
+       }
+
+       return (rc);
+}
+
+struct enumerate_user_cb {
+
+       void (*cb_func)(const char *name,
+                       uid_t uid,
+                       gid_t gid,
+                       const char *homedir,
+                       const char *maildir,
+                       const char *options,
+                       void *void_arg);
+       void *void_arg;
+};
+
+static int enumerate_callback(void *closure,
+                             int n, char **columns, char **names)
+{
+       struct enumerate_user_cb *cb=(struct enumerate_user_cb *)closure;
+
+       const char *username;
+       uid_t uid;
+       gid_t gid;
+       const char *homedir;
+       const char *maildir;
+       const char *options;
+
+       username=GET(0);
+       uid=atol(GET(1)); /* FIXME use strtol to validate */
+       gid=atol(GET(2));
+       homedir=GET(3);
+       maildir=GET(4);
+       options=GET(5);
+
+       if (maildir && !*maildir)
+               maildir=NULL;
+
+       if (options && !*options)
+               options=NULL;
+
+       (*cb->cb_func)(username, uid, gid, homedir,
+                      maildir, options, cb->void_arg);
+       return 0;
+}
+
+void authsqlite_connection::enumerate( void(*cb_func)(const char *name,
+                                                     uid_t uid,
+                                                     gid_t gid,
+                                                     const char *homedir,
+                                                     const char *maildir,
+                                                     const char *options,
+                                                     void *void_arg),
+                                      void *void_arg)
+{
+       char *errmsg;
+       struct enumerate_user_cb cb;
+       std::string querybuf;
+
+       cb.cb_func=cb_func;
+       cb.void_arg=void_arg;
+
+       if (!do_connect())      return;
+
+       if (config_file.enumerate_clause.empty())
+       {
+               std::ostringstream o;
+
+               o << "SELECT "
+                 << config_file.login_field << ", "
+                 << config_file.uid_field << ", "
+                 << config_file.gid_field << ", "
+                 << config_file.home_field << ", "
+                 << config_file.maildir_field << ", "
+                 << config_file.options_field
+                 << " FROM " << config_file.user_table
+                 << " WHERE " << config_file.where_clause;
+
+               querybuf=o.str();
+       }
+       else
+       {
+               std::map<std::string, std::string> parameters;
+
+               parameters["service"]="enumerate";
+               querybuf=config_file
+                       .parse_custom_query(config_file.enumerate_clause, "*",
+                                           config_file.defdomain, parameters);
+       }
+
+       DPRINTF("authsqlite: enumerate query: %s", querybuf.c_str());
+
+       errmsg=NULL;
+
+       sqlite3_exec(dbh, querybuf.c_str(), enumerate_callback,
+                    reinterpret_cast<void *>(&cb), &errmsg);
+
+       if (errmsg)
+       {
+               err(errmsg);
+               sqlite3_free(errmsg);
+       }
+
+       (*cb.cb_func)(NULL, 0, 0, NULL, NULL, NULL, cb.void_arg);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+
+int auth_sqlite_setpass(const char *user, const char *pass,
+                       const char *oldpass)
+{
+       authsqlite_connection *conn=authsqlite_connection::connect();
+
+       if (conn && !conn->setpass(user, pass, oldpass))
+               return -1;
+       return 0;
+}
+
+void auth_sqlite_enumerate( void(*cb_func)(const char *name,
+                                          uid_t uid,
+                                          gid_t gid,
+                                          const char *homedir,
+                                          const char *maildir,
+                                          const char *options,
+                                          void *void_arg),
+                           void *void_arg)
+{
+       authsqlite_connection *conn=authsqlite_connection::connect();
+
+       if (conn)
+               conn->enumerate(cb_func, void_arg);
+}
+
+bool auth_sqlite_getuserinfo(const char *username,
+                            const char *service,
+                            authsqliteuserinfo &ui)
+{
+       authsqlite_connection *conn=authsqlite_connection::connect();
+
+       if (conn)
+               return conn->getuserinfo(username, service, ui);
+       return false;
+
+}
+
+void auth_sqlite_cleanup()
+{
+       do_auth_sqlite_cleanup();
+}
index 2826fff..21d5cd6 100644 (file)
@@ -1,4 +1,4 @@
-##VERSION: $Id: authsqliterc 17 2011-04-04 02:07:37Z mrsam $
+##VERSION: $Id: 33c3875d1a259c6bca0f14cafb3a3e9b69b340e7-20160507115108$
 #
 # Copyright 2012 Double Precision, Inc.  See COPYING for
 # distribution information.
@@ -124,7 +124,7 @@ SQLITE_NAME_FIELD   name
 ##NAME: SQLITE_QUOTA_FIELD:0
 #
 # Define SQLITE_QUOTA_FIELD to be the name of the field that can optionally
-# specify a maildir quota.  See README.maildirquota for more information 
+# specify a maildir quota.  See README.maildirquota for more information
 #
 # SQLITE_QUOTA_FIELD   quota
 
@@ -245,3 +245,8 @@ SQLITE_NAME_FIELD   name
 #                      WHERE   local_part='$(local_part)'              \
 #                      AND     domain_name='$(domain)'
 #
+
+##NAME: MARKER:0
+#
+# Do not remove this section from this configuration file. This section
+# must be present at the end of this file.
index 57d34c6..4793bfa 100644 (file)
@@ -2,14 +2,14 @@
 .\"  <!-- Copyright 2004 Double Precision, Inc.  See COPYING for -->
 .\"  <!-- distribution information. -->
 .\"     Title: authtest
-.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
-.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\"      Date: 06/20/2015
+.\"    Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
+.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
+.\"      Date: 09/08/2017
 .\"    Manual: Double Precision, Inc.
 .\"    Source: Double Precision, Inc.
 .\"  Language: English
 .\"
-.TH "AUTHTEST" "1" "06/20/2015" "Double Precision, Inc." "Double Precision, Inc."
+.TH "AUTHTEST" "1" "09/08/2017" "Double Precision, Inc." "Double Precision, Inc."
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
index 434509d..36006ca 100644 (file)
@@ -16,9 +16,9 @@
 #endif
 
 #include       "auth.h"
+#include       "courierauth.h"
 #include       "courierauthstaticlist.h"
 #include       "courierauthdebug.h"
-#include       "cramlib.h"
 #include       "libhmac/hmac.h"
 #include       "userdb/userdb.h"
 
index db445c0..3a5be7b 100644 (file)
@@ -99,7 +99,7 @@ int auth_userdb_passwd(const char *service,
                errno=EPERM;
                DPRINTF("userdb: Invalid service or password string for %s.\n",
                        uid);
-               return (1);
+               return (-1);
        }
 
        rc=try_auth_userdb_passwd(NULL, service, uid, opwd_buf, npwd_buf);
index c6b9606..9f7896a 100644 (file)
@@ -35,6 +35,7 @@ static int safe_strcmp(const char *a, const char *nullable_b)
 
 static int do_authcheckpassword(const char *password, const char *encrypted_password)
 {
+       char *cpass;
        if (strncmp(encrypted_password, "$1$", 3) == 0
            || strncasecmp(encrypted_password, "{MD5}", 5) == 0
            || strncasecmp(encrypted_password, "{MD5RAW}", 8) == 0
@@ -53,14 +54,17 @@ static int do_authcheckpassword(const char *password, const char *encrypted_pass
                encrypted_password += 7;
 #endif
 
-       return (
 #if    HAVE_CRYPT
-               safe_strcmp(encrypted_password,
-                           crypt(password, encrypted_password))
+
+       cpass = crypt(password, encrypted_password);
+       if (cpass == NULL) {
+               return 1;
+       } else {
+               return safe_strcmp(encrypted_password, cpass);
+       }
 #else
-               safe_strcmp(encrypted_password, password)
+       return safe_strcmp(encrypted_password, password)
 #endif
-                               );
 }
 
 int authcheckpassword(const char *password, const char *encrypted_password)
diff --git a/compile b/compile
index 69fad9c..de0005d 100755 (executable)
--- a/compile
+++ b/compile
@@ -1,9 +1,9 @@
-#! /bin/sh
+#!/bin/sh
 # Wrapper for compilers which do not understand '-c -o'.
 
-scriptversion=2012-10-14.11; # UTC
+scriptversion=2016-01-11.22; # UTC
 
-# Copyright (C) 1999-2015 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 # Written by Tom Tromey <tromey@cygnus.com>.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -255,7 +255,8 @@ EOF
     echo "compile $scriptversion"
     exit $?
     ;;
-  cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
+  cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
+  icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
     func_cl_wrapper "$@"      # Doesn't return...
     ;;
 esac
@@ -342,6 +343,6 @@ exit $ret
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
+# time-stamp-time-zone: "UTC0"
 # time-stamp-end: "; # UTC"
 # End:
index b79252d..2e9ad7f 100755 (executable)
@@ -1,8 +1,8 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright 1992-2013 Free Software Foundation, Inc.
+#   Copyright 1992-2016 Free Software Foundation, Inc.
 
-timestamp='2013-06-10'
+timestamp='2016-10-02'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -24,12 +24,12 @@ timestamp='2013-06-10'
 # program.  This Exception is an additional permission under section 7
 # of the GNU General Public License, version 3 ("GPLv3").
 #
-# Originally written by Per Bothner.
+# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
 #
 # You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
 #
-# Please send patches with a ChangeLog entry to config-patches@gnu.org.
+# Please send patches to <config-patches@gnu.org>.
 
 
 me=`echo "$0" | sed -e 's,.*/,,'`
@@ -50,7 +50,7 @@ version="\
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright 1992-2013 Free Software Foundation, Inc.
+Copyright 1992-2016 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -149,7 +149,7 @@ Linux|GNU|GNU/*)
        LIBC=gnu
        #endif
        EOF
-       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
        ;;
 esac
 
@@ -168,19 +168,29 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        # Note: NetBSD doesn't particularly care about the vendor
        # portion of the name.  We always set it to "unknown".
        sysctl="sysctl -n hw.machine_arch"
-       UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
-           /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+       UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
+           /sbin/$sysctl 2>/dev/null || \
+           /usr/sbin/$sysctl 2>/dev/null || \
+           echo unknown)`
        case "${UNAME_MACHINE_ARCH}" in
            armeb) machine=armeb-unknown ;;
            arm*) machine=arm-unknown ;;
            sh3el) machine=shl-unknown ;;
            sh3eb) machine=sh-unknown ;;
            sh5el) machine=sh5le-unknown ;;
+           earmv*)
+               arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
+               endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
+               machine=${arch}${endian}-unknown
+               ;;
            *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
        esac
        # The Operating System including object format, if it has switched
-       # to ELF recently, or will in the future.
+       # to ELF recently (or will in the future) and ABI.
        case "${UNAME_MACHINE_ARCH}" in
+           earm*)
+               os=netbsdelf
+               ;;
            arm*|i386|m68k|ns32k|sh3*|sparc|vax)
                eval $set_cc_for_build
                if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
@@ -197,6 +207,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
                os=netbsd
                ;;
        esac
+       # Determine ABI tags.
+       case "${UNAME_MACHINE_ARCH}" in
+           earm*)
+               expr='s/^earmv[0-9]/-eabi/;s/eb$//'
+               abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
+               ;;
+       esac
        # The OS release
        # Debian GNU/NetBSD machines have a different userland, and
        # thus, need a distinct triplet. However, they do not need
@@ -207,13 +224,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
                release='-gnu'
                ;;
            *)
-               release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+               release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2`
                ;;
        esac
        # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
        # contains redundant information, the shorter form:
        # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
-       echo "${machine}-${os}${release}"
+       echo "${machine}-${os}${release}${abi}"
        exit ;;
     *:Bitrig:*:*)
        UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
@@ -223,6 +240,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
        echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
        exit ;;
+    *:LibertyBSD:*:*)
+       UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
+       echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE}
+       exit ;;
     *:ekkoBSD:*:*)
        echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
        exit ;;
@@ -235,6 +256,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     *:MirBSD:*:*)
        echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
        exit ;;
+    *:Sortix:*:*)
+       echo ${UNAME_MACHINE}-unknown-sortix
+       exit ;;
     alpha:OSF1:*:*)
        case $UNAME_RELEASE in
        *4.0)
@@ -251,42 +275,42 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
        case "$ALPHA_CPU_TYPE" in
            "EV4 (21064)")
-               UNAME_MACHINE="alpha" ;;
+               UNAME_MACHINE=alpha ;;
            "EV4.5 (21064)")
-               UNAME_MACHINE="alpha" ;;
+               UNAME_MACHINE=alpha ;;
            "LCA4 (21066/21068)")
-               UNAME_MACHINE="alpha" ;;
+               UNAME_MACHINE=alpha ;;
            "EV5 (21164)")
-               UNAME_MACHINE="alphaev5" ;;
+               UNAME_MACHINE=alphaev5 ;;
            "EV5.6 (21164A)")
-               UNAME_MACHINE="alphaev56" ;;
+               UNAME_MACHINE=alphaev56 ;;
            "EV5.6 (21164PC)")
-               UNAME_MACHINE="alphapca56" ;;
+               UNAME_MACHINE=alphapca56 ;;
            "EV5.7 (21164PC)")
-               UNAME_MACHINE="alphapca57" ;;
+               UNAME_MACHINE=alphapca57 ;;
            "EV6 (21264)")
-               UNAME_MACHINE="alphaev6" ;;
+               UNAME_MACHINE=alphaev6 ;;
            "EV6.7 (21264A)")
-               UNAME_MACHINE="alphaev67" ;;
+               UNAME_MACHINE=alphaev67 ;;
            "EV6.8CB (21264C)")
-               UNAME_MACHINE="alphaev68" ;;
+               UNAME_MACHINE=alphaev68 ;;
            "EV6.8AL (21264B)")
-               UNAME_MACHINE="alphaev68" ;;
+               UNAME_MACHINE=alphaev68 ;;
            "EV6.8CX (21264D)")
-               UNAME_MACHINE="alphaev68" ;;
+               UNAME_MACHINE=alphaev68 ;;
            "EV6.9A (21264/EV69A)")
-               UNAME_MACHINE="alphaev69" ;;
+               UNAME_MACHINE=alphaev69 ;;
            "EV7 (21364)")
-               UNAME_MACHINE="alphaev7" ;;
+               UNAME_MACHINE=alphaev7 ;;
            "EV7.9 (21364A)")
-               UNAME_MACHINE="alphaev79" ;;
+               UNAME_MACHINE=alphaev79 ;;
        esac
        # A Pn.n version is a patched version.
        # A Vn.n version is a released version.
        # A Tn.n version is a released field test version.
        # A Xn.n version is an unreleased experimental baselevel.
        # 1.2 uses "1.2" for uname -r.
-       echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+       echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
        # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
        exitcode=$?
        trap '' 0
@@ -359,16 +383,16 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        exit ;;
     i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
        eval $set_cc_for_build
-       SUN_ARCH="i386"
+       SUN_ARCH=i386
        # If there is a compiler, see if it is configured for 64-bit objects.
        # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
        # This test works for both compilers.
-       if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+       if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
            if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
-               (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+               (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
                grep IS_64BIT_ARCH >/dev/null
            then
-               SUN_ARCH="x86_64"
+               SUN_ARCH=x86_64
            fi
        fi
        echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
@@ -393,7 +417,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        exit ;;
     sun*:*:4.2BSD:*)
        UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
-       test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+       test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3
        case "`/bin/arch`" in
            sun3)
                echo m68k-sun-sunos${UNAME_RELEASE}
@@ -579,8 +603,9 @@ EOF
        else
                IBM_ARCH=powerpc
        fi
-       if [ -x /usr/bin/oslevel ] ; then
-               IBM_REV=`/usr/bin/oslevel`
+       if [ -x /usr/bin/lslpp ] ; then
+               IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
+                          awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
        else
                IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
        fi
@@ -617,13 +642,13 @@ EOF
                    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
                    case "${sc_cpu_version}" in
-                     523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
-                     528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                     523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
+                     528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
                      532)                      # CPU_PA_RISC2_0
                        case "${sc_kernel_bits}" in
-                         32) HP_ARCH="hppa2.0n" ;;
-                         64) HP_ARCH="hppa2.0w" ;;
-                         '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                         32) HP_ARCH=hppa2.0n ;;
+                         64) HP_ARCH=hppa2.0w ;;
+                         '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
                        esac ;;
                    esac
                fi
@@ -662,11 +687,11 @@ EOF
                    exit (0);
                }
 EOF
-                   (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+                   (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
                    test -z "$HP_ARCH" && HP_ARCH=hppa
                fi ;;
        esac
-       if [ ${HP_ARCH} = "hppa2.0w" ]
+       if [ ${HP_ARCH} = hppa2.0w ]
        then
            eval $set_cc_for_build
 
@@ -679,12 +704,12 @@ EOF
            # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
            # => hppa64-hp-hpux11.23
 
-           if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+           if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
                grep -q __LP64__
            then
-               HP_ARCH="hppa2.0w"
+               HP_ARCH=hppa2.0w
            else
-               HP_ARCH="hppa64"
+               HP_ARCH=hppa64
            fi
        fi
        echo ${HP_ARCH}-hp-hpux${HPUX_REV}
@@ -789,14 +814,14 @@ EOF
        echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
        exit ;;
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
-       FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-       FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+       FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
+       FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
        exit ;;
     5000:UNIX_System_V:4.*:*)
-       FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-       FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+       FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
+       FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
        exit ;;
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
@@ -826,7 +851,7 @@ EOF
     *:MINGW*:*)
        echo ${UNAME_MACHINE}-pc-mingw32
        exit ;;
-    i*:MSYS*:*)
+    *:MSYS*:*)
        echo ${UNAME_MACHINE}-pc-msys
        exit ;;
     i*:windows32*:*)
@@ -878,7 +903,7 @@ EOF
        exit ;;
     *:GNU/*:*:*)
        # other systems with GNU libc and userland
-       echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
+       echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
        exit ;;
     i*86:Minix:*:*)
        echo ${UNAME_MACHINE}-pc-minix
@@ -901,7 +926,7 @@ EOF
          EV68*) UNAME_MACHINE=alphaev68 ;;
        esac
        objdump --private-headers /bin/sh | grep -q ld.so.1
-       if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
+       if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
        echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
     arc:Linux:*:* | arceb:Linux:*:*)
@@ -932,6 +957,9 @@ EOF
     crisv32:Linux:*:*)
        echo ${UNAME_MACHINE}-axis-linux-${LIBC}
        exit ;;
+    e2k:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
     frv:Linux:*:*)
        echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
@@ -944,6 +972,9 @@ EOF
     ia64:Linux:*:*)
        echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
+    k1om:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
     m32r*:Linux:*:*)
        echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
@@ -969,10 +1000,13 @@ EOF
        eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
        test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
        ;;
-    or1k:Linux:*:*)
+    mips64el:Linux:*:*)
        echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
-    or32:Linux:*:*)
+    openrisc*:Linux:*:*)
+       echo or1k-unknown-linux-${LIBC}
+       exit ;;
+    or32:Linux:*:* | or1k*:Linux:*:*)
        echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
     padre:Linux:*:*)
@@ -1001,6 +1035,9 @@ EOF
     ppcle:Linux:*:*)
        echo powerpcle-unknown-linux-${LIBC}
        exit ;;
+    riscv32:Linux:*:* | riscv64:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
     s390:Linux:*:* | s390x:Linux:*:*)
        echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
        exit ;;
@@ -1020,7 +1057,7 @@ EOF
        echo ${UNAME_MACHINE}-dec-linux-${LIBC}
        exit ;;
     x86_64:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       echo ${UNAME_MACHINE}-pc-linux-${LIBC}
        exit ;;
     xtensa*:Linux:*:*)
        echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
@@ -1099,7 +1136,7 @@ EOF
        # uname -m prints for DJGPP always 'pc', but it prints nothing about
        # the processor, so we play safe by assuming i586.
        # Note: whatever this is, it MUST be the same as what config.sub
-       # prints for the "djgpp" host, or else GDB configury will decide that
+       # prints for the "djgpp" host, or else GDB configure will decide that
        # this is a cross-build.
        echo i586-pc-msdosdjgpp
        exit ;;
@@ -1248,6 +1285,9 @@ EOF
     SX-8R:SUPER-UX:*:*)
        echo sx8r-nec-superux${UNAME_RELEASE}
        exit ;;
+    SX-ACE:SUPER-UX:*:*)
+       echo sxace-nec-superux${UNAME_RELEASE}
+       exit ;;
     Power*:Rhapsody:*:*)
        echo powerpc-apple-rhapsody${UNAME_RELEASE}
        exit ;;
@@ -1260,22 +1300,32 @@ EOF
        if test "$UNAME_PROCESSOR" = unknown ; then
            UNAME_PROCESSOR=powerpc
        fi
-       if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
-           if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
-               (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
-               grep IS_64BIT_ARCH >/dev/null
-           then
-               case $UNAME_PROCESSOR in
-                   i386) UNAME_PROCESSOR=x86_64 ;;
-                   powerpc) UNAME_PROCESSOR=powerpc64 ;;
-               esac
+       if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
+           if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
+               if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+                   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+                   grep IS_64BIT_ARCH >/dev/null
+               then
+                   case $UNAME_PROCESSOR in
+                       i386) UNAME_PROCESSOR=x86_64 ;;
+                       powerpc) UNAME_PROCESSOR=powerpc64 ;;
+                   esac
+               fi
            fi
+       elif test "$UNAME_PROCESSOR" = i386 ; then
+           # Avoid executing cc on OS X 10.9, as it ships with a stub
+           # that puts up a graphical alert prompting to install
+           # developer tools.  Any system running Mac OS X 10.7 or
+           # later (Darwin 11 and later) is required to have a 64-bit
+           # processor. This is not true of the ARM version of Darwin
+           # that Apple uses in portable devices.
+           UNAME_PROCESSOR=x86_64
        fi
        echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
        exit ;;
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
        UNAME_PROCESSOR=`uname -p`
-       if test "$UNAME_PROCESSOR" = "x86"; then
+       if test "$UNAME_PROCESSOR" = x86; then
                UNAME_PROCESSOR=i386
                UNAME_MACHINE=pc
        fi
@@ -1306,7 +1356,7 @@ EOF
        # "uname -m" is not consistent, so use $cputype instead. 386
        # is converted to i386 for consistency with other x86
        # operating systems.
-       if test "$cputype" = "386"; then
+       if test "$cputype" = 386; then
            UNAME_MACHINE=i386
        else
            UNAME_MACHINE="$cputype"
@@ -1348,7 +1398,7 @@ EOF
        echo i386-pc-xenix
        exit ;;
     i*86:skyos:*:*)
-       echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+       echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'`
        exit ;;
     i*86:rdos:*:*)
        echo ${UNAME_MACHINE}-pc-rdos
@@ -1359,171 +1409,25 @@ EOF
     x86_64:VMkernel:*:*)
        echo ${UNAME_MACHINE}-unknown-esx
        exit ;;
-esac
-
-eval $set_cc_for_build
-cat >$dummy.c <<EOF
-#ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/utsname.h>
-#endif
-main ()
-{
-#if defined (sony)
-#if defined (MIPSEB)
-  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
-     I don't know....  */
-  printf ("mips-sony-bsd\n"); exit (0);
-#else
-#include <sys/param.h>
-  printf ("m68k-sony-newsos%s\n",
-#ifdef NEWSOS4
-       "4"
-#else
-       ""
-#endif
-       ); exit (0);
-#endif
-#endif
-
-#if defined (__arm) && defined (__acorn) && defined (__unix)
-  printf ("arm-acorn-riscix\n"); exit (0);
-#endif
-
-#if defined (hp300) && !defined (hpux)
-  printf ("m68k-hp-bsd\n"); exit (0);
-#endif
-
-#if defined (NeXT)
-#if !defined (__ARCHITECTURE__)
-#define __ARCHITECTURE__ "m68k"
-#endif
-  int version;
-  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
-  if (version < 4)
-    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
-  else
-    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
-  exit (0);
-#endif
-
-#if defined (MULTIMAX) || defined (n16)
-#if defined (UMAXV)
-  printf ("ns32k-encore-sysv\n"); exit (0);
-#else
-#if defined (CMU)
-  printf ("ns32k-encore-mach\n"); exit (0);
-#else
-  printf ("ns32k-encore-bsd\n"); exit (0);
-#endif
-#endif
-#endif
-
-#if defined (__386BSD__)
-  printf ("i386-pc-bsd\n"); exit (0);
-#endif
-
-#if defined (sequent)
-#if defined (i386)
-  printf ("i386-sequent-dynix\n"); exit (0);
-#endif
-#if defined (ns32000)
-  printf ("ns32k-sequent-dynix\n"); exit (0);
-#endif
-#endif
-
-#if defined (_SEQUENT_)
-    struct utsname un;
-
-    uname(&un);
-
-    if (strncmp(un.version, "V2", 2) == 0) {
-       printf ("i386-sequent-ptx2\n"); exit (0);
-    }
-    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
-       printf ("i386-sequent-ptx1\n"); exit (0);
-    }
-    printf ("i386-sequent-ptx\n"); exit (0);
-
-#endif
-
-#if defined (vax)
-# if !defined (ultrix)
-#  include <sys/param.h>
-#  if defined (BSD)
-#   if BSD == 43
-      printf ("vax-dec-bsd4.3\n"); exit (0);
-#   else
-#    if BSD == 199006
-      printf ("vax-dec-bsd4.3reno\n"); exit (0);
-#    else
-      printf ("vax-dec-bsd\n"); exit (0);
-#    endif
-#   endif
-#  else
-    printf ("vax-dec-bsd\n"); exit (0);
-#  endif
-# else
-    printf ("vax-dec-ultrix\n"); exit (0);
-# endif
-#endif
-
-#if defined (alliant) && defined (i860)
-  printf ("i860-alliant-bsd\n"); exit (0);
-#endif
-
-  exit (1);
-}
-EOF
-
-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
-       { echo "$SYSTEM_NAME"; exit; }
-
-# Apollos put the system type in the environment.
-
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
-
-# Convex versions that predate uname can use getsysinfo(1)
-
-if [ -x /usr/convex/getsysinfo ]
-then
-    case `getsysinfo -f cpu_type` in
-    c1*)
-       echo c1-convex-bsd
-       exit ;;
-    c2*)
-       if getsysinfo -f scalar_acc
-       then echo c32-convex-bsd
-       else echo c2-convex-bsd
-       fi
-       exit ;;
-    c34*)
-       echo c34-convex-bsd
-       exit ;;
-    c38*)
-       echo c38-convex-bsd
-       exit ;;
-    c4*)
-       echo c4-convex-bsd
+    amd64:Isilon\ OneFS:*:*)
+       echo x86_64-unknown-onefs
        exit ;;
-    esac
-fi
+esac
 
 cat >&2 <<EOF
 $0: unable to guess system type
 
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
+This script (version $timestamp), has failed to recognize the
+operating system you are using. If your script is old, overwrite
+config.guess and config.sub with the latest versions from:
 
-  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
 and
-  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
 
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches@gnu.org> in order to provide the needed
-information to handle your system.
+If $0 has already been updated, send the following data and any
+information you think might be pertinent to config-patches@gnu.org to
+provide the necessary information to handle your system.
 
 config.guess timestamp = $timestamp
 
index d2a9613..cc69b06 100755 (executable)
@@ -1,8 +1,8 @@
 #! /bin/sh
 # Configuration validation subroutine script.
-#   Copyright 1992-2013 Free Software Foundation, Inc.
+#   Copyright 1992-2016 Free Software Foundation, Inc.
 
-timestamp='2013-08-10'
+timestamp='2016-09-05'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ timestamp='2013-08-10'
 # of the GNU General Public License, version 3 ("GPLv3").
 
 
-# Please send patches with a ChangeLog entry to config-patches@gnu.org.
+# Please send patches to <config-patches@gnu.org>.
 #
 # Configuration subroutine to validate and canonicalize a configuration type.
 # Supply the specified configuration type as an argument.
@@ -33,7 +33,7 @@ timestamp='2013-08-10'
 # Otherwise, we print the canonical config type on stdout and succeed.
 
 # You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
 
 # This file is supposed to be the same for all GNU packages
 # and recognize all the CPU types, system types and aliases
@@ -53,8 +53,7 @@ timestamp='2013-08-10'
 me=`echo "$0" | sed -e 's,.*/,,'`
 
 usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS
-       $0 [OPTION] ALIAS
+Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
 
 Canonicalize a configuration name.
 
@@ -68,7 +67,7 @@ Report bugs and patches to <config-patches@gnu.org>."
 version="\
 GNU config.sub ($timestamp)
 
-Copyright 1992-2013 Free Software Foundation, Inc.
+Copyright 1992-2016 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -117,8 +116,8 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
   nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
   linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
-  knetbsd*-gnu* | netbsd*-gnu* | \
-  kopensolaris*-gnu* | \
+  knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
+  kopensolaris*-gnu* | cloudabi*-eabi* | \
   storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
@@ -255,16 +254,18 @@ case $basic_machine in
        | arc | arceb \
        | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
        | avr | avr32 \
+       | ba \
        | be32 | be64 \
        | bfin \
        | c4x | c8051 | clipper \
        | d10v | d30v | dlx | dsp16xx \
-       | epiphany \
-       | fido | fr30 | frv \
+       | e2k | epiphany \
+       | fido | fr30 | frv | ft32 \
        | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
        | hexagon \
        | i370 | i860 | i960 | ia64 \
        | ip2k | iq2000 \
+       | k1om \
        | le32 | le64 \
        | lm32 \
        | m32c | m32r | m32rle | m68000 | m68k | m88k \
@@ -282,8 +283,10 @@ case $basic_machine in
        | mips64vr5900 | mips64vr5900el \
        | mipsisa32 | mipsisa32el \
        | mipsisa32r2 | mipsisa32r2el \
+       | mipsisa32r6 | mipsisa32r6el \
        | mipsisa64 | mipsisa64el \
        | mipsisa64r2 | mipsisa64r2el \
+       | mipsisa64r6 | mipsisa64r6el \
        | mipsisa64sb1 | mipsisa64sb1el \
        | mipsisa64sr71k | mipsisa64sr71kel \
        | mipsr5900 | mipsr5900el \
@@ -295,14 +298,14 @@ case $basic_machine in
        | nds32 | nds32le | nds32be \
        | nios | nios2 | nios2eb | nios2el \
        | ns16k | ns32k \
-       | open8 \
-       | or1k | or32 \
+       | open8 | or1k | or1knd | or32 \
        | pdp10 | pdp11 | pj | pjl \
        | powerpc | powerpc64 | powerpc64le | powerpcle \
        | pyramid \
+       | riscv32 | riscv64 \
        | rl78 | rx \
        | score \
-       | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+       | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
        | sh64 | sh64le \
        | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
        | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
@@ -310,6 +313,7 @@ case $basic_machine in
        | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
        | ubicom32 \
        | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
+       | visium \
        | we32k \
        | x86 | xc16x | xstormy16 | xtensa \
        | z8k | z80)
@@ -324,7 +328,10 @@ case $basic_machine in
        c6x)
                basic_machine=tic6x-unknown
                ;;
-       m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
+       leon|leon[3-9])
+               basic_machine=sparc-$basic_machine
+               ;;
+       m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
                basic_machine=$basic_machine-unknown
                os=-none
                ;;
@@ -369,18 +376,20 @@ case $basic_machine in
        | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
        | arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
        | avr-* | avr32-* \
+       | ba-* \
        | be32-* | be64-* \
        | bfin-* | bs2000-* \
        | c[123]* | c30-* | [cjt]90-* | c4x-* \
        | c8051-* | clipper-* | craynv-* | cydra-* \
        | d10v-* | d30v-* | dlx-* \
-       | elxsi-* \
+       | e2k-* | elxsi-* \
        | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
        | h8300-* | h8500-* \
        | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
        | hexagon-* \
        | i*86-* | i860-* | i960-* | ia64-* \
        | ip2k-* | iq2000-* \
+       | k1om-* \
        | le32-* | le64-* \
        | lm32-* \
        | m32c-* | m32r-* | m32rle-* \
@@ -400,8 +409,10 @@ case $basic_machine in
        | mips64vr5900-* | mips64vr5900el-* \
        | mipsisa32-* | mipsisa32el-* \
        | mipsisa32r2-* | mipsisa32r2el-* \
+       | mipsisa32r6-* | mipsisa32r6el-* \
        | mipsisa64-* | mipsisa64el-* \
        | mipsisa64r2-* | mipsisa64r2el-* \
+       | mipsisa64r6-* | mipsisa64r6el-* \
        | mipsisa64sb1-* | mipsisa64sb1el-* \
        | mipsisa64sr71k-* | mipsisa64sr71kel-* \
        | mipsr5900-* | mipsr5900el-* \
@@ -413,16 +424,18 @@ case $basic_machine in
        | nios-* | nios2-* | nios2eb-* | nios2el-* \
        | none-* | np1-* | ns16k-* | ns32k-* \
        | open8-* \
+       | or1k*-* \
        | orion-* \
        | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
        | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
        | pyramid-* \
+       | riscv32-* | riscv64-* \
        | rl78-* | romp-* | rs6000-* | rx-* \
        | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
        | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
        | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
        | sparclite-* \
-       | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
+       | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
        | tahoe-* \
        | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
        | tile*-* \
@@ -430,6 +443,7 @@ case $basic_machine in
        | ubicom32-* \
        | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
        | vax-* \
+       | visium-* \
        | we32k-* \
        | x86-* | x86_64-* | xc16x-* | xps100-* \
        | xstormy16-* | xtensa*-* \
@@ -506,6 +520,9 @@ case $basic_machine in
                basic_machine=i386-pc
                os=-aros
                ;;
+       asmjs)
+               basic_machine=asmjs-unknown
+               ;;
        aux)
                basic_machine=m68k-apple
                os=-aux
@@ -626,6 +643,14 @@ case $basic_machine in
                basic_machine=m68k-bull
                os=-sysv3
                ;;
+       e500v[12])
+               basic_machine=powerpc-unknown
+               os=$os"spe"
+               ;;
+       e500v[12]-*)
+               basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+               os=$os"spe"
+               ;;
        ebmon29k)
                basic_machine=a29k-amd
                os=-ebmon
@@ -767,6 +792,9 @@ case $basic_machine in
                basic_machine=m68k-isi
                os=-sysv
                ;;
+       leon-*|leon[3-9]-*)
+               basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
+               ;;
        m68knommu)
                basic_machine=m68k-unknown
                os=-linux
@@ -822,6 +850,10 @@ case $basic_machine in
                basic_machine=powerpc-unknown
                os=-morphos
                ;;
+       moxiebox)
+               basic_machine=moxie-unknown
+               os=-moxiebox
+               ;;
        msdos)
                basic_machine=i386-pc
                os=-msdos
@@ -998,7 +1030,7 @@ case $basic_machine in
        ppc-* | ppcbe-*)
                basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
                ;;
-       ppcle | powerpclittle | ppc-le | powerpc-little)
+       ppcle | powerpclittle)
                basic_machine=powerpcle-unknown
                ;;
        ppcle-* | powerpclittle-*)
@@ -1006,9 +1038,9 @@ case $basic_machine in
                ;;
        ppc64)  basic_machine=powerpc64-unknown
                ;;
-       ppc64-* | ppc64p7-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+       ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
                ;;
-       ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+       ppc64le | powerpc64little)
                basic_machine=powerpc64le-unknown
                ;;
        ppc64le-* | powerpc64little-*)
@@ -1354,27 +1386,28 @@ case $os in
              | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
              | -sym* | -kopensolaris* | -plan9* \
              | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
-             | -aos* | -aros* \
+             | -aos* | -aros* | -cloudabi* | -sortix* \
              | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
              | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
              | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
-             | -bitrig* | -openbsd* | -solidbsd* \
+             | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
              | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
              | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
              | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
              | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
              | -chorusos* | -chorusrdb* | -cegcc* \
              | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-             | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
+             | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
              | -linux-newlib* | -linux-musl* | -linux-uclibc* \
-             | -uxpv* | -beos* | -mpeix* | -udk* \
+             | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
              | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
              | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
              | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
              | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
              | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
              | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-             | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
+             | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
+             | -onefs* | -tirtos* | -phoenix*)
        # Remember, each alternative MUST END IN *, to match a version number.
                ;;
        -qnx*)
@@ -1506,6 +1539,8 @@ case $os in
                ;;
        -nacl*)
                ;;
+       -ios)
+               ;;
        -none)
                ;;
        *)
@@ -1592,9 +1627,6 @@ case $basic_machine in
        mips*-*)
                os=-elf
                ;;
-       or1k-*)
-               os=-elf
-               ;;
        or32-*)
                os=-coff
                ;;
index 8caa998..3803980 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for courier-authlib 0.66.4.
+# Generated by GNU Autoconf 2.69 for courier-authlib 0.69.0.
 #
 # Report bugs to <courier-users@lists.sourceforge.net>.
 #
@@ -594,8 +594,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='courier-authlib'
 PACKAGE_TARNAME='courier-authlib'
-PACKAGE_VERSION='0.66.4'
-PACKAGE_STRING='courier-authlib 0.66.4'
+PACKAGE_VERSION='0.69.0'
+PACKAGE_STRING='courier-authlib 0.69.0'
 PACKAGE_BUGREPORT='courier-users@lists.sourceforge.net'
 PACKAGE_URL=''
 
@@ -718,6 +718,7 @@ INCLTDL
 LTDLINCL
 LTDLDEPS
 LIBLTDL
+CXXCPP
 LT_SYS_LIBRARY_PATH
 OTOOL64
 OTOOL
@@ -751,6 +752,12 @@ SYSCONFTOOL
 SYSCONFTOOL_PERL
 LN_S
 CPP
+am__fastdepCXX_FALSE
+am__fastdepCXX_TRUE
+CXXDEPMODE
+ac_ct_CXX
+CXXFLAGS
+CXX
 am__fastdepCC_FALSE
 am__fastdepCC_TRUE
 CCDEPMODE
@@ -891,8 +898,12 @@ CFLAGS
 LDFLAGS
 LIBS
 CPPFLAGS
+CXX
+CXXFLAGS
+CCC
 CPP
-LT_SYS_LIBRARY_PATH'
+LT_SYS_LIBRARY_PATH
+CXXCPP'
 ac_subdirs_all='libltdl
 libs/bdbobj libs/gdbmobj libs/md5 libs/sha1 libs/libhmac libs/numlib libs/makedat userdb libs/rfc822 libs/random128 libs/liblock liblog'
 
@@ -1434,7 +1445,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures courier-authlib 0.66.4 to adapt to many kinds of systems.
+\`configure' configures courier-authlib 0.69.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1504,7 +1515,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of courier-authlib 0.66.4:";;
+     short | recursive ) echo "Configuration of courier-authlib 0.69.0:";;
    esac
   cat <<\_ACEOF
 
@@ -1585,9 +1596,12 @@ Some influential environment variables:
   LIBS        libraries to pass to the linker, e.g. -l<library>
   CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
               you have headers in a nonstandard directory <include dir>
+  CXX         C++ compiler command
+  CXXFLAGS    C++ compiler flags
   CPP         C preprocessor
   LT_SYS_LIBRARY_PATH
               User-defined run-time library search path.
+  CXXCPP      C++ preprocessor
 
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
@@ -1655,7 +1669,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-courier-authlib configure 0.66.4
+courier-authlib configure 0.69.0
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1707,6 +1721,44 @@ fi
 
 } # ac_fn_c_try_compile
 
+# ac_fn_cxx_try_compile LINENO
+# ----------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+        test -z "$ac_cxx_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_retval=1
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_cxx_try_compile
+
 # ac_fn_c_try_cpp LINENO
 # ----------------------
 # Try to preprocess conftest.$ac_ext, and return whether this succeeded.
@@ -1930,6 +1982,89 @@ $as_echo "$ac_res" >&6; }
 
 } # ac_fn_c_check_func
 
+# ac_fn_cxx_try_cpp LINENO
+# ------------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_cpp ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } > conftest.i && {
+        test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+        test ! -s conftest.err
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+    ac_retval=1
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_cxx_try_cpp
+
+# ac_fn_cxx_try_link LINENO
+# -------------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+        test -z "$ac_cxx_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        test -x conftest$ac_exeext
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_retval=1
+fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_cxx_try_link
+
 # ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
 # ---------------------------------------------
 # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
@@ -2124,7 +2259,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by courier-authlib $as_me 0.66.4, which was
+It was created by courier-authlib $as_me 0.69.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2990,7 +3125,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='courier-authlib'
- VERSION='0.66.4'
+ VERSION='0.69.0'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -4170,634 +4305,810 @@ else
 fi
 
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
-$as_echo_n "checking how to run the C preprocessor... " >&6; }
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
-  CPP=
-fi
-if test -z "$CPP"; then
-  if ${ac_cv_prog_CPP+:} false; then :
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -z "$CXX"; then
+  if test -n "$CCC"; then
+    CXX=$CCC
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CXX+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-      # Double quotes because CPP needs to be expanded
-    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
-    do
-      ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
+  if test -n "$CXX"; then
+  ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
 do
-  # Use a header file that comes with gcc, so configuring glibc
-  # with a fresh cross-compiler works.
-  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> exists even on freestanding compilers.
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp. "Syntax error" is here to catch this case.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-                    Syntax error
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-else
-  # Broken: fails on valid input.
-continue
 fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-  # Broken: success on invalid input.
-continue
-else
-  # Passes both tests.
-ac_preproc_ok=:
-break
 fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
-  break
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5
+$as_echo "$CXX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
-    done
-    ac_cv_prog_CPP=$CPP
 
+    test -n "$CXX" && break
+  done
 fi
-  CPP=$ac_cv_prog_CPP
+if test -z "$CXX"; then
+  ac_ct_CXX=$CXX
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  ac_cv_prog_CPP=$CPP
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
-$as_echo "$CPP" >&6; }
-ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
+  if test -n "$ac_ct_CXX"; then
+  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
 do
-  # Use a header file that comes with gcc, so configuring glibc
-  # with a fresh cross-compiler works.
-  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> exists even on freestanding compilers.
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp. "Syntax error" is here to catch this case.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-                    Syntax error
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CXX="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-else
-  # Broken: fails on valid input.
-continue
 fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-  # Broken: success on invalid input.
-continue
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5
+$as_echo "$ac_ct_CXX" >&6; }
 else
-  # Passes both tests.
-ac_preproc_ok=:
-break
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
-rm -f conftest.err conftest.i conftest.$ac_ext
 
+
+  test -n "$ac_ct_CXX" && break
 done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
 
-else
-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5; }
+  if test "x$ac_ct_CXX" = x; then
+    CXX="g++"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CXX=$ac_ct_CXX
+  fi
 fi
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
-$as_echo_n "checking whether ln -s works... " >&6; }
-LN_S=$as_ln_s
-if test "$LN_S" = "ln -s"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
-$as_echo "no, using $LN_S" >&6; }
+  fi
 fi
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
+$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
+if ${ac_cv_cxx_compiler_gnu+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
 
-       for ac_prog in perl5 perl
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_SYSCONFTOOL_PERL+:} false; then :
-  $as_echo_n "(cached) " >&6
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
 else
-  case $SYSCONFTOOL_PERL in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_SYSCONFTOOL_PERL="$SYSCONFTOOL_PERL" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_SYSCONFTOOL_PERL="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
+  ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
 
-  ;;
-esac
 fi
-SYSCONFTOOL_PERL=$ac_cv_path_SYSCONFTOOL_PERL
-if test -n "$SYSCONFTOOL_PERL"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SYSCONFTOOL_PERL" >&5
-$as_echo "$SYSCONFTOOL_PERL" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5
+$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GXX=yes
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  GXX=
 fi
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
+$as_echo_n "checking whether $CXX accepts -g... " >&6; }
+if ${ac_cv_prog_cxx_g+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+   ac_cxx_werror_flag=yes
+   ac_cv_prog_cxx_g=no
+   CXXFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+int
+main ()
+{
 
-  test -n "$SYSCONFTOOL_PERL" && break
-done
-test -n "$SYSCONFTOOL_PERL" || SYSCONFTOOL_PERL="perl"
-
-
-       if test "$SYSCONFTOOL_PERL" = "perl"
-       then
-               as_fn_error $? "perl not found - please install perl" "$LINENO" 5
-       fi
-
-       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysconftool..." >&5
-$as_echo_n "checking for sysconftool...... " >&6; }
-       SYSCONFTOOL=""
-       for sysconf_dir in $ac_aux_dir . .. ../..
-       do
-               if test -f $srcdir/$sysconf_dir/sysconftool
-               then
-                       SYSCONFTOOL=$srcdir/$sysconf_dir/sysconftool
-                       break
-               fi
-       done
-
-       if test "$SYSCONFTOOL" = ""
-       then
-               as_fn_error $? "sysconftool missing - not in the package" "$LINENO" 5
-       fi
-
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SYSCONFTOOL" >&5
-$as_echo "$SYSCONFTOOL" >&6; }
-       SYSCONFTOOL="$SYSCONFTOOL_PERL $SYSCONFTOOL"
-
-
-
-case `pwd` in
-  *\ * | *\    *)
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
-$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
-esac
-
-
-
-macro_version='2.4.6'
-macro_revision='2.4.6'
-
-
-
-
-
-
-
-
-
-
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_prog_cxx_g=yes
+else
+  CXXFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+int
+main ()
+{
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
 
-ltmain=$ac_aux_dir/ltmain.sh
+else
+  ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+        CXXFLAGS="-g"
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-# Make sure we can run config.sub.
-$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
-  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+int
+main ()
+{
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
-$as_echo_n "checking build system type... " >&6; }
-if ${ac_cv_build+:} false; then :
-  $as_echo_n "(cached) " >&6
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_prog_cxx_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5
+$as_echo "$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+  CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+  if test "$GXX" = yes; then
+    CXXFLAGS="-g -O2"
+  else
+    CXXFLAGS="-g"
+  fi
 else
-  ac_build_alias=$build_alias
-test "x$ac_build_alias" = x &&
-  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
-test "x$ac_build_alias" = x &&
-  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
-ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
-  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
-
+  if test "$GXX" = yes; then
+    CXXFLAGS="-O2"
+  else
+    CXXFLAGS=
+  fi
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
-$as_echo "$ac_cv_build" >&6; }
-case $ac_cv_build in
-*-*-*) ;;
-*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
-esac
-build=$ac_cv_build
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_build
-shift
-build_cpu=$1
-build_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-build_os=$*
-IFS=$ac_save_IFS
-case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
+depcc="$CXX"  am_compiler_list=
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
-$as_echo_n "checking host system type... " >&6; }
-if ${ac_cv_host+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if ${am_cv_CXX_dependencies_compiler_type+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test "x$host_alias" = x; then
-  ac_cv_host=$ac_cv_build
-else
-  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
-    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
-$as_echo "$ac_cv_host" >&6; }
-case $ac_cv_host in
-*-*-*) ;;
-*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
-esac
-host=$ac_cv_host
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_host
-shift
-host_cpu=$1
-host_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-host_os=$*
-IFS=$ac_save_IFS
-case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
-
-
-# Backslashify metacharacters that are still active within
-# double-quoted strings.
-sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
-
-# Same as above, but do not quote variable references.
-double_quote_subst='s/\(["`\\]\)/\\\1/g'
-
-# Sed substitution to delay expansion of an escaped shell variable in a
-# double_quote_subst'ed string.
-delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named 'D' -- because '-MD' means "put the output
+  # in D".
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
 
-# Sed substitution to delay expansion of an escaped single quote.
-delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+  am_cv_CXX_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  am__universal=false
+  case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac
 
-# Sed substitution to avoid accidental globbing in evaled expressions
-no_glob_subst='s/\*/\\\*/g'
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+      # Solaris 10 /bin/sh.
+      echo '/* dummy */' > sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
 
-ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
-ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+    # We check with '-c' and '-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle '-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs.
+    am__obj=sub/conftest.${OBJEXT-o}
+    am__minus_obj="-o $am__obj"
+    case $depmode in
+    gcc)
+      # This depmode causes a compiler race in universal mode.
+      test "$am__universal" = false || continue
+      ;;
+    nosideeffect)
+      # After this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested.
+      if test "x$enable_dependency_tracking" = xyes; then
+       continue
+      else
+       break
+      fi
+      ;;
+    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+      # This compiler won't grok '-c -o', but also, the minuso test has
+      # not run yet.  These depmodes are late enough in the game, and
+      # so weak that their functioning should not be impacted.
+      am__obj=conftest.${OBJEXT-o}
+      am__minus_obj=
+      ;;
+    none) break ;;
+    esac
+    if depmode=$depmode \
+       source=sub/conftest.c object=$am__obj \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CXX_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
-$as_echo_n "checking how to print strings... " >&6; }
-# Test print first, because it will be a builtin if present.
-if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
-   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
-  ECHO='print -r --'
-elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
-  ECHO='printf %s\n'
+  cd ..
+  rm -rf conftest.dir
 else
-  # Use this function as a fallback that always works.
-  func_fallback_echo ()
-  {
-    eval 'cat <<_LTECHO_EOF
-$1
-_LTECHO_EOF'
-  }
-  ECHO='func_fallback_echo'
+  am_cv_CXX_dependencies_compiler_type=none
 fi
 
-# func_echo_all arg...
-# Invoke $ECHO with all args, space-separated.
-func_echo_all ()
-{
-    $ECHO ""
-}
-
-case $ECHO in
-  printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
-$as_echo "printf" >&6; } ;;
-  print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
-$as_echo "print -r" >&6; } ;;
-  *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5
-$as_echo "cat" >&6; } ;;
-esac
-
-
-
-
-
-
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; }
+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
 
+ if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
+  am__fastdepCXX_TRUE=
+  am__fastdepCXX_FALSE='#'
+else
+  am__fastdepCXX_TRUE='#'
+  am__fastdepCXX_FALSE=
+fi
 
 
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+  if ${ac_cv_prog_CPP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+                    Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
 
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
 
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
 
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+  break
+fi
 
+    done
+    ac_cv_prog_CPP=$CPP
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
-$as_echo_n "checking for a sed that does not truncate output... " >&6; }
-if ${ac_cv_path_SED+:} false; then :
-  $as_echo_n "(cached) " >&6
+fi
+  CPP=$ac_cv_prog_CPP
 else
-            ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
-     for ac_i in 1 2 3 4 5 6 7; do
-       ac_script="$ac_script$as_nl$ac_script"
-     done
-     echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
-     { ac_script=; unset ac_script;}
-     if test -z "$SED"; then
-  ac_path_SED_found=false
-  # Loop through the user's path and test for each of PROGNAME-LIST
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
+  ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
 do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_prog in sed gsed; do
-    for ac_exec_ext in '' $ac_executable_extensions; do
-      ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
-      as_fn_executable_p "$ac_path_SED" || continue
-# Check for GNU ac_path_SED and select it if it is found.
-  # Check for GNU $ac_path_SED
-case `"$ac_path_SED" --version 2>&1` in
-*GNU*)
-  ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
-*)
-  ac_count=0
-  $as_echo_n 0123456789 >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    $as_echo '' >> "conftest.nl"
-    "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    as_fn_arith $ac_count + 1 && ac_count=$as_val
-    if test $ac_count -gt ${ac_path_SED_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_SED="$ac_path_SED"
-      ac_path_SED_max=$ac_count
-    fi
-    # 10*(2^10) chars as input seems more than enough
-    test $ac_count -gt 10 && break
-  done
-  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+                    Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
 
-      $ac_path_SED_found && break 3
-    done
-  done
-  done
-IFS=$as_save_IFS
-  if test -z "$ac_cv_path_SED"; then
-    as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
-  fi
 else
-  ac_cv_path_SED=$SED
+  # Broken: fails on valid input.
+continue
 fi
+rm -f conftest.err conftest.i conftest.$ac_ext
 
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
-$as_echo "$ac_cv_path_SED" >&6; }
- SED="$ac_cv_path_SED"
-  rm -f conftest.sed
-
-test -z "$SED" && SED=sed
-Xsed="$SED -e 1s/^X//"
-
-
-
+rm -f conftest.err conftest.i conftest.$ac_ext
 
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
 
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
+fi
 
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
+$as_echo_n "checking whether ln -s works... " >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
+$as_echo "no, using $LN_S" >&6; }
+fi
 
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
-$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if ${ac_cv_path_GREP+:} false; then :
+       for ac_prog in perl5 perl
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_SYSCONFTOOL_PERL+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -z "$GREP"; then
-  ac_path_GREP_found=false
-  # Loop through the user's path and test for each of PROGNAME-LIST
+  case $SYSCONFTOOL_PERL in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_SYSCONFTOOL_PERL="$SYSCONFTOOL_PERL" # Let the user override the test with a path.
+  ;;
+  *)
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-    for ac_prog in grep ggrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
-      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
-      as_fn_executable_p "$ac_path_GREP" || continue
-# Check for GNU ac_path_GREP and select it if it is found.
-  # Check for GNU $ac_path_GREP
-case `"$ac_path_GREP" --version 2>&1` in
-*GNU*)
-  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
-*)
-  ac_count=0
-  $as_echo_n 0123456789 >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    $as_echo 'GREP' >> "conftest.nl"
-    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    as_fn_arith $ac_count + 1 && ac_count=$as_val
-    if test $ac_count -gt ${ac_path_GREP_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_GREP="$ac_path_GREP"
-      ac_path_GREP_max=$ac_count
-    fi
-    # 10*(2^10) chars as input seems more than enough
-    test $ac_count -gt 10 && break
-  done
-  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-      $ac_path_GREP_found && break 3
-    done
-  done
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_SYSCONFTOOL_PERL="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
   done
 IFS=$as_save_IFS
-  if test -z "$ac_cv_path_GREP"; then
-    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
-  fi
-else
-  ac_cv_path_GREP=$GREP
-fi
 
+  ;;
+esac
+fi
+SYSCONFTOOL_PERL=$ac_cv_path_SYSCONFTOOL_PERL
+if test -n "$SYSCONFTOOL_PERL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SYSCONFTOOL_PERL" >&5
+$as_echo "$SYSCONFTOOL_PERL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
-$as_echo "$ac_cv_path_GREP" >&6; }
- GREP="$ac_cv_path_GREP"
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
-$as_echo_n "checking for egrep... " >&6; }
-if ${ac_cv_path_EGREP+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
-   then ac_cv_path_EGREP="$GREP -E"
-   else
-     if test -z "$EGREP"; then
-  ac_path_EGREP_found=false
-  # Loop through the user's path and test for each of PROGNAME-LIST
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_prog in egrep; do
-    for ac_exec_ext in '' $ac_executable_extensions; do
-      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
-      as_fn_executable_p "$ac_path_EGREP" || continue
-# Check for GNU ac_path_EGREP and select it if it is found.
-  # Check for GNU $ac_path_EGREP
-case `"$ac_path_EGREP" --version 2>&1` in
-*GNU*)
-  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
-*)
-  ac_count=0
-  $as_echo_n 0123456789 >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    $as_echo 'EGREP' >> "conftest.nl"
-    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    as_fn_arith $ac_count + 1 && ac_count=$as_val
-    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_EGREP="$ac_path_EGREP"
-      ac_path_EGREP_max=$ac_count
-    fi
-    # 10*(2^10) chars as input seems more than enough
-    test $ac_count -gt 10 && break
-  done
-  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
+  test -n "$SYSCONFTOOL_PERL" && break
+done
+test -n "$SYSCONFTOOL_PERL" || SYSCONFTOOL_PERL="perl"
 
-      $ac_path_EGREP_found && break 3
-    done
-  done
-  done
-IFS=$as_save_IFS
-  if test -z "$ac_cv_path_EGREP"; then
-    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
-  fi
-else
-  ac_cv_path_EGREP=$EGREP
-fi
 
-   fi
+       if test "$SYSCONFTOOL_PERL" = "perl"
+       then
+               as_fn_error $? "perl not found - please install perl" "$LINENO" 5
+       fi
+
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysconftool..." >&5
+$as_echo_n "checking for sysconftool...... " >&6; }
+       SYSCONFTOOL=""
+       for sysconf_dir in $ac_aux_dir . .. ../..
+       do
+               if test -f $srcdir/$sysconf_dir/sysconftool
+               then
+                       SYSCONFTOOL=$srcdir/$sysconf_dir/sysconftool
+                       break
+               fi
+       done
+
+       if test "$SYSCONFTOOL" = ""
+       then
+               as_fn_error $? "sysconftool missing - not in the package" "$LINENO" 5
+       fi
+
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SYSCONFTOOL" >&5
+$as_echo "$SYSCONFTOOL" >&6; }
+       SYSCONFTOOL="$SYSCONFTOOL_PERL $SYSCONFTOOL"
+
+
+
+case `pwd` in
+  *\ * | *\    *)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
+$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
+esac
+
+
+
+macro_version='2.4.6'
+macro_revision='2.4.6'
+
+
+
+
+
+
+
+
+
+
+
+
+
+ltmain=$ac_aux_dir/ltmain.sh
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if ${ac_cv_build+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
-$as_echo "$ac_cv_path_EGREP" >&6; }
- EGREP="$ac_cv_path_EGREP"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
-$as_echo_n "checking for fgrep... " >&6; }
-if ${ac_cv_path_FGREP+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if ${ac_cv_host+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
-   then ac_cv_path_FGREP="$GREP -F"
-   else
-     if test -z "$FGREP"; then
-  ac_path_FGREP_found=false
+  if test "x$host_alias" = x; then
+  ac_cv_host=$ac_cv_build
+else
+  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
+$as_echo_n "checking how to print strings... " >&6; }
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='printf %s\n'
+else
+  # Use this function as a fallback that always works.
+  func_fallback_echo ()
+  {
+    eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+  }
+  ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO ""
+}
+
+case $ECHO in
+  printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
+$as_echo "printf" >&6; } ;;
+  print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
+$as_echo "print -r" >&6; } ;;
+  *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5
+$as_echo "cat" >&6; } ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if ${ac_cv_path_SED+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+            ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+     for ac_i in 1 2 3 4 5 6 7; do
+       ac_script="$ac_script$as_nl$ac_script"
+     done
+     echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+     { ac_script=; unset ac_script;}
+     if test -z "$SED"; then
+  ac_path_SED_found=false
   # Loop through the user's path and test for each of PROGNAME-LIST
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-    for ac_prog in fgrep; do
+    for ac_prog in sed gsed; do
     for ac_exec_ext in '' $ac_executable_extensions; do
-      ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
-      as_fn_executable_p "$ac_path_FGREP" || continue
-# Check for GNU ac_path_FGREP and select it if it is found.
-  # Check for GNU $ac_path_FGREP
-case `"$ac_path_FGREP" --version 2>&1` in
+      ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+      as_fn_executable_p "$ac_path_SED" || continue
+# Check for GNU ac_path_SED and select it if it is found.
+  # Check for GNU $ac_path_SED
+case `"$ac_path_SED" --version 2>&1` in
 *GNU*)
-  ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
+  ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
 *)
   ac_count=0
   $as_echo_n 0123456789 >"conftest.in"
@@ -4806,14 +5117,14 @@ case `"$ac_path_FGREP" --version 2>&1` in
     cat "conftest.in" "conftest.in" >"conftest.tmp"
     mv "conftest.tmp" "conftest.in"
     cp "conftest.in" "conftest.nl"
-    $as_echo 'FGREP' >> "conftest.nl"
-    "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    $as_echo '' >> "conftest.nl"
+    "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
     diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
     as_fn_arith $ac_count + 1 && ac_count=$as_val
-    if test $ac_count -gt ${ac_path_FGREP_max-0}; then
+    if test $ac_count -gt ${ac_path_SED_max-0}; then
       # Best one so far, save it but keep looking for a better one
-      ac_cv_path_FGREP="$ac_path_FGREP"
-      ac_path_FGREP_max=$ac_count
+      ac_cv_path_SED="$ac_path_SED"
+      ac_path_SED_max=$ac_count
     fi
     # 10*(2^10) chars as input seems more than enough
     test $ac_count -gt 10 && break
@@ -4821,24 +5132,233 @@ case `"$ac_path_FGREP" --version 2>&1` in
   rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
 esac
 
-      $ac_path_FGREP_found && break 3
+      $ac_path_SED_found && break 3
     done
   done
   done
 IFS=$as_save_IFS
-  if test -z "$ac_cv_path_FGREP"; then
-    as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  if test -z "$ac_cv_path_SED"; then
+    as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
   fi
 else
-  ac_cv_path_FGREP=$FGREP
+  ac_cv_path_SED=$SED
 fi
 
-   fi
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5
-$as_echo "$ac_cv_path_FGREP" >&6; }
- FGREP="$ac_cv_path_FGREP"
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
+ SED="$ac_cv_path_SED"
+  rm -f conftest.sed
+
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$GREP"; then
+  ac_path_GREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in grep ggrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+      as_fn_executable_p "$ac_path_GREP" || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+  # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'GREP' >> "conftest.nl"
+    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_GREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_GREP="$ac_path_GREP"
+      ac_path_GREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_GREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_GREP"; then
+    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if ${ac_cv_path_EGREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+   then ac_cv_path_EGREP="$GREP -E"
+   else
+     if test -z "$EGREP"; then
+  ac_path_EGREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in egrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+      as_fn_executable_p "$ac_path_EGREP" || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+  # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'EGREP' >> "conftest.nl"
+    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_EGREP="$ac_path_EGREP"
+      ac_path_EGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_EGREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_EGREP"; then
+    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_EGREP=$EGREP
+fi
+
+   fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
+$as_echo_n "checking for fgrep... " >&6; }
+if ${ac_cv_path_FGREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
+   then ac_cv_path_FGREP="$GREP -F"
+   else
+     if test -z "$FGREP"; then
+  ac_path_FGREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in fgrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
+      as_fn_executable_p "$ac_path_FGREP" || continue
+# Check for GNU ac_path_FGREP and select it if it is found.
+  # Check for GNU $ac_path_FGREP
+case `"$ac_path_FGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'FGREP' >> "conftest.nl"
+    "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_FGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_FGREP="$ac_path_FGREP"
+      ac_path_FGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_FGREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_FGREP"; then
+    as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_FGREP=$FGREP
+fi
+
+   fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5
+$as_echo "$ac_cv_path_FGREP" >&6; }
+ FGREP="$ac_cv_path_FGREP"
+
 
 test -z "$GREP" && GREP=grep
 
@@ -8020,6 +8540,17 @@ done
 
 
 
+func_stripname_cnf ()
+{
+  case $2 in
+  .*) func_stripname_result=`$ECHO "$3" | $SED "s%^$1%%; s%\\\\$2\$%%"`;;
+  *)  func_stripname_result=`$ECHO "$3" | $SED "s%^$1%%; s%$2\$%%"`;;
+  esac
+} # func_stripname_cnf
+
+
+
+
 
 # Set options
 enable_dlopen=yes
@@ -12158,30 +12689,3348 @@ _LT_EOF
     lt_cv_dlopen_self_static=no
   fi
 fi
-rm -fr conftest*
-
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5
+$as_echo "$lt_cv_dlopen_self_static" >&6; }
+    fi
+
+    CPPFLAGS=$save_CPPFLAGS
+    LDFLAGS=$save_LDFLAGS
+    LIBS=$save_LIBS
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+striplib=
+old_striplib=
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5
+$as_echo_n "checking whether stripping libraries is possible... " >&6; }
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+  darwin*)
+    if test -n "$STRIP"; then
+      striplib="$STRIP -x"
+      old_striplib="$STRIP -S"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    fi
+    ;;
+  *)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    ;;
+  esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+  # Report what library types will actually be built
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5
+$as_echo_n "checking if libtool supports shared libraries... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5
+$as_echo "$can_build_shared" >&6; }
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5
+$as_echo_n "checking whether to build shared libraries... " >&6; }
+  test no = "$can_build_shared" && enable_shared=no
+
+  # On AIX, shared libraries and static libraries use the same namespace, and
+  # are all built from PIC.
+  case $host_os in
+  aix3*)
+    test yes = "$enable_shared" && enable_static=no
+    if test -n "$RANLIB"; then
+      archive_cmds="$archive_cmds~\$RANLIB \$lib"
+      postinstall_cmds='$RANLIB $lib'
+    fi
+    ;;
+
+  aix[4-9]*)
+    if test ia64 != "$host_cpu"; then
+      case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in
+      yes,aix,yes) ;;                  # shared object as lib.so file only
+      yes,svr4,*) ;;                   # shared object as lib.so archive member only
+      yes,*) enable_static=no ;;       # shared object in lib.a archive as well
+      esac
+    fi
+    ;;
+  esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5
+$as_echo "$enable_shared" >&6; }
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5
+$as_echo_n "checking whether to build static libraries... " >&6; }
+  # Make sure either enable_shared or enable_static is yes.
+  test yes = "$enable_shared" || enable_static=yes
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5
+$as_echo "$enable_static" >&6; }
+
+
+
+
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC=$lt_save_CC
+
+      if test -n "$CXX" && ( test no != "$CXX" &&
+    ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) ||
+    (test g++ != "$CXX"))); then
+  ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5
+$as_echo_n "checking how to run the C++ preprocessor... " >&6; }
+if test -z "$CXXCPP"; then
+  if ${ac_cv_prog_CXXCPP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+      # Double quotes because CXXCPP needs to be expanded
+    for CXXCPP in "$CXX -E" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+                    Syntax error
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+  break
+fi
+
+    done
+    ac_cv_prog_CXXCPP=$CXXCPP
+
+fi
+  CXXCPP=$ac_cv_prog_CXXCPP
+else
+  ac_cv_prog_CXXCPP=$CXXCPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5
+$as_echo "$CXXCPP" >&6; }
+ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+                    Syntax error
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+else
+  _lt_caught_CXX_error=yes
+fi
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+archive_cmds_need_lc_CXX=no
+allow_undefined_flag_CXX=
+always_export_symbols_CXX=no
+archive_expsym_cmds_CXX=
+compiler_needs_object_CXX=no
+export_dynamic_flag_spec_CXX=
+hardcode_direct_CXX=no
+hardcode_direct_absolute_CXX=no
+hardcode_libdir_flag_spec_CXX=
+hardcode_libdir_separator_CXX=
+hardcode_minus_L_CXX=no
+hardcode_shlibpath_var_CXX=unsupported
+hardcode_automatic_CXX=no
+inherit_rpath_CXX=no
+module_cmds_CXX=
+module_expsym_cmds_CXX=
+link_all_deplibs_CXX=unknown
+old_archive_cmds_CXX=$old_archive_cmds
+reload_flag_CXX=$reload_flag
+reload_cmds_CXX=$reload_cmds
+no_undefined_flag_CXX=
+whole_archive_flag_spec_CXX=
+enable_shared_with_static_runtimes_CXX=no
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+objext_CXX=$objext
+
+# No sense in running all these tests if we already determined that
+# the CXX compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test yes != "$_lt_caught_CXX_error"; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="int some_variable = 0;"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code='int main(int, char *[]) { return(0); }'
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+  # save warnings/boilerplate of simple test code
+  ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+
+  ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC=$CC
+  lt_save_CFLAGS=$CFLAGS
+  lt_save_LD=$LD
+  lt_save_GCC=$GCC
+  GCC=$GXX
+  lt_save_with_gnu_ld=$with_gnu_ld
+  lt_save_path_LD=$lt_cv_path_LD
+  if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+    lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+  else
+    $as_unset lt_cv_prog_gnu_ld
+  fi
+  if test -n "${lt_cv_path_LDCXX+set}"; then
+    lt_cv_path_LD=$lt_cv_path_LDCXX
+  else
+    $as_unset lt_cv_path_LD
+  fi
+  test -z "${LDCXX+set}" || LD=$LDCXX
+  CC=${CXX-"c++"}
+  CFLAGS=$CXXFLAGS
+  compiler=$CC
+  compiler_CXX=$CC
+  func_cc_basename $compiler
+cc_basename=$func_cc_basename_result
+
+
+  if test -n "$compiler"; then
+    # We don't want -fno-exception when compiling C++ code, so set the
+    # no_builtin_flag separately
+    if test yes = "$GXX"; then
+      lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin'
+    else
+      lt_prog_compiler_no_builtin_flag_CXX=
+    fi
+
+    if test yes = "$GXX"; then
+      # Set up default GNU C++ configuration
+
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then :
+  withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test yes = "$GCC"; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return, which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | ?:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+       ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD=$ac_prog
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test yes = "$with_gnu_ld"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
+fi
+if ${lt_cv_path_LD+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$LD"; then
+  lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS=$lt_save_ifs
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD=$ac_dir/$ac_prog
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+       test no != "$with_gnu_ld" && break
+       ;;
+      *)
+       test yes != "$with_gnu_ld" && break
+       ;;
+      esac
+    fi
+  done
+  IFS=$lt_save_ifs
+else
+  lt_cv_path_LD=$LD # Let the user override the test with a path.
+fi
+fi
+
+LD=$lt_cv_path_LD
+if test -n "$LD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
+$as_echo "$LD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
+if ${lt_cv_prog_gnu_ld+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+
+
+
+
+      # Check if GNU C++ uses GNU ld as the underlying linker, since the
+      # archiving commands below assume that GNU ld is being used.
+      if test yes = "$with_gnu_ld"; then
+        archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
+        archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
+
+        hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir'
+        export_dynamic_flag_spec_CXX='$wl--export-dynamic'
+
+        # If archive_cmds runs LD, not CC, wlarc should be empty
+        # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+        #     investigate it a little bit more. (MM)
+        wlarc='$wl'
+
+        # ancient GNU ld didn't support --whole-archive et. al.
+        if eval "`$CC -print-prog-name=ld` --help 2>&1" |
+         $GREP 'no-whole-archive' > /dev/null; then
+          whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive'
+        else
+          whole_archive_flag_spec_CXX=
+        fi
+      else
+        with_gnu_ld=no
+        wlarc=
+
+        # A generic and very simple default shared library creation
+        # command for GNU C++ for the case where it uses the native
+        # linker, instead of GNU ld.  If possible, this setting should
+        # overridden to take advantage of the native linker features on
+        # the platform it is being used on.
+        archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+      fi
+
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+    else
+      GXX=no
+      with_gnu_ld=no
+      wlarc=
+    fi
+
+    # PORTME: fill in a description of your system's C++ link characteristics
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+    ld_shlibs_CXX=yes
+    case $host_os in
+      aix3*)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+        ;;
+      aix[4-9]*)
+        if test ia64 = "$host_cpu"; then
+          # On IA64, the linker does run time linking by default, so we don't
+          # have to do anything special.
+          aix_use_runtimelinking=no
+          exp_sym_flag='-Bexport'
+          no_entry_flag=
+        else
+          aix_use_runtimelinking=no
+
+          # Test if we are trying to use run time linking or normal
+          # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+          # have runtime linking enabled, and use it for executables.
+          # For shared libraries, we enable/disable runtime linking
+          # depending on the kind of the shared library created -
+          # when "with_aix_soname,aix_use_runtimelinking" is:
+          # "aix,no"   lib.a(lib.so.V) shared, rtl:no,  for executables
+          # "aix,yes"  lib.so          shared, rtl:yes, for executables
+          #            lib.a           static archive
+          # "both,no"  lib.so.V(shr.o) shared, rtl:yes
+          #            lib.a(lib.so.V) shared, rtl:no,  for executables
+          # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables
+          #            lib.a(lib.so.V) shared, rtl:no
+          # "svr4,*"   lib.so.V(shr.o) shared, rtl:yes, for executables
+          #            lib.a           static archive
+          case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+           for ld_flag in $LDFLAGS; do
+             case $ld_flag in
+             *-brtl*)
+               aix_use_runtimelinking=yes
+               break
+               ;;
+             esac
+           done
+           if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then
+             # With aix-soname=svr4, we create the lib.so.V shared archives only,
+             # so we don't have lib.a shared libs to link our executables.
+             # We have to force runtime linking in this case.
+             aix_use_runtimelinking=yes
+             LDFLAGS="$LDFLAGS -Wl,-brtl"
+           fi
+           ;;
+          esac
+
+          exp_sym_flag='-bexport'
+          no_entry_flag='-bnoentry'
+        fi
+
+        # When large executables or shared objects are built, AIX ld can
+        # have problems creating the table of contents.  If linking a library
+        # or program results in "error TOC overflow" add -mminimal-toc to
+        # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+        # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+        archive_cmds_CXX=''
+        hardcode_direct_CXX=yes
+        hardcode_direct_absolute_CXX=yes
+        hardcode_libdir_separator_CXX=':'
+        link_all_deplibs_CXX=yes
+        file_list_spec_CXX='$wl-f,'
+        case $with_aix_soname,$aix_use_runtimelinking in
+        aix,*) ;;      # no import file
+        svr4,* | *,yes) # use import file
+          # The Import File defines what to hardcode.
+          hardcode_direct_CXX=no
+          hardcode_direct_absolute_CXX=no
+          ;;
+        esac
+
+        if test yes = "$GXX"; then
+          case $host_os in aix4.[012]|aix4.[012].*)
+          # We only want to do this on AIX 4.2 and lower, the check
+          # below for broken collect2 doesn't work under 4.3+
+         collect2name=`$CC -print-prog-name=collect2`
+         if test -f "$collect2name" &&
+            strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+         then
+           # We have reworked collect2
+           :
+         else
+           # We have old collect2
+           hardcode_direct_CXX=unsupported
+           # It fails to find uninstalled libraries when the uninstalled
+           # path is not listed in the libpath.  Setting hardcode_minus_L
+           # to unsupported forces relinking
+           hardcode_minus_L_CXX=yes
+           hardcode_libdir_flag_spec_CXX='-L$libdir'
+           hardcode_libdir_separator_CXX=
+         fi
+          esac
+          shared_flag='-shared'
+         if test yes = "$aix_use_runtimelinking"; then
+           shared_flag=$shared_flag' $wl-G'
+         fi
+         # Need to ensure runtime linking is disabled for the traditional
+         # shared library, or the linker may eventually find shared libraries
+         # /with/ Import File - we do not want to mix them.
+         shared_flag_aix='-shared'
+         shared_flag_svr4='-shared $wl-G'
+        else
+          # not using gcc
+          if test ia64 = "$host_cpu"; then
+         # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+         # chokes on -Wl,-G. The following line is correct:
+         shared_flag='-G'
+          else
+           if test yes = "$aix_use_runtimelinking"; then
+             shared_flag='$wl-G'
+           else
+             shared_flag='$wl-bM:SRE'
+           fi
+           shared_flag_aix='$wl-bM:SRE'
+           shared_flag_svr4='$wl-G'
+          fi
+        fi
+
+        export_dynamic_flag_spec_CXX='$wl-bexpall'
+        # It seems that -bexpall does not export symbols beginning with
+        # underscore (_), so it is better to generate a list of symbols to
+       # export.
+        always_export_symbols_CXX=yes
+       if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then
+          # Warning - without using the other runtime loading flags (-brtl),
+          # -berok will link without error, but may produce a broken library.
+          # The "-G" linker flag allows undefined symbols.
+          no_undefined_flag_CXX='-bernotok'
+          # Determine the default libpath from the value encoded in an empty
+          # executable.
+          if test set = "${lt_cv_aix_libpath+set}"; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath__CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+         /^0/ {
+             s/^0  *\([^ ]*\) *$/\1/
+             p
+         }
+      }'
+  lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath__CXX"; then
+    lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  if test -z "$lt_cv_aix_libpath__CXX"; then
+    lt_cv_aix_libpath__CXX=/usr/lib:/lib
+  fi
+
+fi
+
+  aix_libpath=$lt_cv_aix_libpath__CXX
+fi
+
+          hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath"
+
+          archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag
+        else
+          if test ia64 = "$host_cpu"; then
+           hardcode_libdir_flag_spec_CXX='$wl-R $libdir:/usr/lib:/lib'
+           allow_undefined_flag_CXX="-z nodefs"
+           archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols"
+          else
+           # Determine the default libpath from the value encoded in an
+           # empty executable.
+           if test set = "${lt_cv_aix_libpath+set}"; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath__CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+         /^0/ {
+             s/^0  *\([^ ]*\) *$/\1/
+             p
+         }
+      }'
+  lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath__CXX"; then
+    lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  if test -z "$lt_cv_aix_libpath__CXX"; then
+    lt_cv_aix_libpath__CXX=/usr/lib:/lib
+  fi
+
+fi
+
+  aix_libpath=$lt_cv_aix_libpath__CXX
+fi
+
+           hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath"
+           # Warning - without using the other run time loading flags,
+           # -berok will link without error, but may produce a broken library.
+           no_undefined_flag_CXX=' $wl-bernotok'
+           allow_undefined_flag_CXX=' $wl-berok'
+           if test yes = "$with_gnu_ld"; then
+             # We only use this code for GNU lds that support --whole-archive.
+             whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive'
+           else
+             # Exported symbols can be pulled into shared objects from archives
+             whole_archive_flag_spec_CXX='$convenience'
+           fi
+           archive_cmds_need_lc_CXX=yes
+           archive_expsym_cmds_CXX='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d'
+           # -brtl affects multiple linker settings, -berok does not and is overridden later
+           compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`'
+           if test svr4 != "$with_aix_soname"; then
+             # This is similar to how AIX traditionally builds its shared
+             # libraries. Need -bnortl late, we may have -brtl in LDFLAGS.
+             archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname'
+           fi
+           if test aix != "$with_aix_soname"; then
+             archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp'
+           else
+             # used by -dlpreopen to get the symbols
+             archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$MV  $output_objdir/$realname.d/$soname $output_objdir'
+           fi
+           archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$RM -r $output_objdir/$realname.d'
+          fi
+        fi
+        ;;
+
+      beos*)
+       if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+         allow_undefined_flag_CXX=unsupported
+         # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+         # support --undefined.  This deserves some investigation.  FIXME
+         archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+       else
+         ld_shlibs_CXX=no
+       fi
+       ;;
+
+      chorus*)
+        case $cc_basename in
+          *)
+         # FIXME: insert proper C++ library support
+         ld_shlibs_CXX=no
+         ;;
+        esac
+        ;;
+
+      cygwin* | mingw* | pw32* | cegcc*)
+       case $GXX,$cc_basename in
+       ,cl* | no,cl*)
+         # Native MSVC
+         # hardcode_libdir_flag_spec is actually meaningless, as there is
+         # no search path for DLLs.
+         hardcode_libdir_flag_spec_CXX=' '
+         allow_undefined_flag_CXX=unsupported
+         always_export_symbols_CXX=yes
+         file_list_spec_CXX='@'
+         # Tell ltmain to make .lib files, not .a files.
+         libext=lib
+         # Tell ltmain to make .dll files, not .so files.
+         shrext_cmds=.dll
+         # FIXME: Setting linknames here is a bad hack.
+         archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames='
+         archive_expsym_cmds_CXX='if   test DEF = "`$SED -n     -e '\''s/^[     ]*//'\''     -e '\''/^\(;.*\)*$/d'\''     -e '\''s/^\(EXPORTS\|LIBRARY\)\([     ].*\)*$/DEF/p'\''     -e q     $export_symbols`" ; then
+              cp "$export_symbols" "$output_objdir/$soname.def";
+              echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp";
+            else
+              $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp;
+            fi~
+            $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+            linknames='
+         # The linker will not automatically build a static lib if we build a DLL.
+         # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true'
+         enable_shared_with_static_runtimes_CXX=yes
+         # Don't use ranlib
+         old_postinstall_cmds_CXX='chmod 644 $oldlib'
+         postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~
+            lt_tool_outputfile="@TOOL_OUTPUT@"~
+            case $lt_outputfile in
+              *.exe|*.EXE) ;;
+              *)
+                lt_outputfile=$lt_outputfile.exe
+                lt_tool_outputfile=$lt_tool_outputfile.exe
+                ;;
+            esac~
+            func_to_tool_file "$lt_outputfile"~
+            if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then
+              $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+              $RM "$lt_outputfile.manifest";
+            fi'
+         ;;
+       *)
+         # g++
+         # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,
+         # as there is no search path for DLLs.
+         hardcode_libdir_flag_spec_CXX='-L$libdir'
+         export_dynamic_flag_spec_CXX='$wl--export-all-symbols'
+         allow_undefined_flag_CXX=unsupported
+         always_export_symbols_CXX=no
+         enable_shared_with_static_runtimes_CXX=yes
+
+         if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+           archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+           # If the export-symbols file already is a .def file, use it as
+           # is; otherwise, prepend EXPORTS...
+           archive_expsym_cmds_CXX='if   test DEF = "`$SED -n     -e '\''s/^[   ]*//'\''     -e '\''/^\(;.*\)*$/d'\''     -e '\''s/^\(EXPORTS\|LIBRARY\)\([     ].*\)*$/DEF/p'\''     -e q     $export_symbols`" ; then
+              cp $export_symbols $output_objdir/$soname.def;
+            else
+              echo EXPORTS > $output_objdir/$soname.def;
+              cat $export_symbols >> $output_objdir/$soname.def;
+            fi~
+            $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+         else
+           ld_shlibs_CXX=no
+         fi
+         ;;
+       esac
+       ;;
+      darwin* | rhapsody*)
+
+
+  archive_cmds_need_lc_CXX=no
+  hardcode_direct_CXX=no
+  hardcode_automatic_CXX=yes
+  hardcode_shlibpath_var_CXX=unsupported
+  if test yes = "$lt_cv_ld_force_load"; then
+    whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+
+  else
+    whole_archive_flag_spec_CXX=''
+  fi
+  link_all_deplibs_CXX=yes
+  allow_undefined_flag_CXX=$_lt_dar_allow_undefined
+  case $cc_basename in
+     ifort*|nagfor*) _lt_dar_can_shared=yes ;;
+     *) _lt_dar_can_shared=$GCC ;;
+  esac
+  if test yes = "$_lt_dar_can_shared"; then
+    output_verbose_link_cmd=func_echo_all
+    archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil"
+    module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil"
+    archive_expsym_cmds_CXX="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil"
+    module_expsym_cmds_CXX="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil"
+       if test yes != "$lt_cv_apple_cc_single_mod"; then
+      archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil"
+      archive_expsym_cmds_CXX="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil"
+    fi
+
+  else
+  ld_shlibs_CXX=no
+  fi
+
+       ;;
+
+      os2*)
+       hardcode_libdir_flag_spec_CXX='-L$libdir'
+       hardcode_minus_L_CXX=yes
+       allow_undefined_flag_CXX=unsupported
+       shrext_cmds=.dll
+       archive_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
+         $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
+         $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
+         $ECHO EXPORTS >> $output_objdir/$libname.def~
+         emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~
+         $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
+         emximp -o $lib $output_objdir/$libname.def'
+       archive_expsym_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
+         $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
+         $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
+         $ECHO EXPORTS >> $output_objdir/$libname.def~
+         prefix_cmds="$SED"~
+         if test EXPORTS = "`$SED 1q $export_symbols`"; then
+           prefix_cmds="$prefix_cmds -e 1d";
+         fi~
+         prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~
+         cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~
+         $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
+         emximp -o $lib $output_objdir/$libname.def'
+       old_archive_From_new_cmds_CXX='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
+       enable_shared_with_static_runtimes_CXX=yes
+       ;;
+
+      dgux*)
+        case $cc_basename in
+          ec++*)
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+          ghcx*)
+           # Green Hills C++ Compiler
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+          *)
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+        esac
+        ;;
+
+      freebsd2.*)
+        # C++ shared libraries reported to be fairly broken before
+       # switch to ELF
+        ld_shlibs_CXX=no
+        ;;
+
+      freebsd-elf*)
+        archive_cmds_need_lc_CXX=no
+        ;;
+
+      freebsd* | dragonfly*)
+        # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+        # conventions
+        ld_shlibs_CXX=yes
+        ;;
+
+      haiku*)
+        archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+        link_all_deplibs_CXX=yes
+        ;;
+
+      hpux9*)
+        hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir'
+        hardcode_libdir_separator_CXX=:
+        export_dynamic_flag_spec_CXX='$wl-E'
+        hardcode_direct_CXX=yes
+        hardcode_minus_L_CXX=yes # Not in the search PATH,
+                                            # but as the default
+                                            # location of the library.
+
+        case $cc_basename in
+          CC*)
+            # FIXME: insert proper C++ library support
+            ld_shlibs_CXX=no
+            ;;
+          aCC*)
+            archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
+            # Commands to make compiler produce verbose output that lists
+            # what "hidden" libraries, object files and flags are used when
+            # linking a shared library.
+            #
+            # There doesn't appear to be a way to prevent this compiler from
+            # explicitly linking system object files so we need to strip them
+            # from the output so that they don't get included in the library
+            # dependencies.
+            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+            ;;
+          *)
+            if test yes = "$GXX"; then
+              archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
+            else
+              # FIXME: insert proper C++ library support
+              ld_shlibs_CXX=no
+            fi
+            ;;
+        esac
+        ;;
+
+      hpux10*|hpux11*)
+        if test no = "$with_gnu_ld"; then
+         hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir'
+         hardcode_libdir_separator_CXX=:
+
+          case $host_cpu in
+            hppa*64*|ia64*)
+              ;;
+            *)
+             export_dynamic_flag_spec_CXX='$wl-E'
+              ;;
+          esac
+        fi
+        case $host_cpu in
+          hppa*64*|ia64*)
+            hardcode_direct_CXX=no
+            hardcode_shlibpath_var_CXX=no
+            ;;
+          *)
+            hardcode_direct_CXX=yes
+            hardcode_direct_absolute_CXX=yes
+            hardcode_minus_L_CXX=yes # Not in the search PATH,
+                                                # but as the default
+                                                # location of the library.
+            ;;
+        esac
+
+        case $cc_basename in
+          CC*)
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+          aCC*)
+           case $host_cpu in
+             hppa*64*)
+               archive_cmds_CXX='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+               ;;
+             ia64*)
+               archive_cmds_CXX='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+               ;;
+             *)
+               archive_cmds_CXX='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+               ;;
+           esac
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           #
+           # There doesn't appear to be a way to prevent this compiler from
+           # explicitly linking system object files so we need to strip them
+           # from the output so that they don't get included in the library
+           # dependencies.
+           output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+           ;;
+          *)
+           if test yes = "$GXX"; then
+             if test no = "$with_gnu_ld"; then
+               case $host_cpu in
+                 hppa*64*)
+                   archive_cmds_CXX='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+                   ;;
+                 ia64*)
+                   archive_cmds_CXX='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+                   ;;
+                 *)
+                   archive_cmds_CXX='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+                   ;;
+               esac
+             fi
+           else
+             # FIXME: insert proper C++ library support
+             ld_shlibs_CXX=no
+           fi
+           ;;
+        esac
+        ;;
+
+      interix[3-9]*)
+       hardcode_direct_CXX=no
+       hardcode_shlibpath_var_CXX=no
+       hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir'
+       export_dynamic_flag_spec_CXX='$wl-E'
+       # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+       # Instead, shared libraries are loaded at an image base (0x10000000 by
+       # default) and relocated if they conflict, which is a slow very memory
+       # consuming and fragmenting process.  To avoid this, we pick a random,
+       # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+       # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+       archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+       archive_expsym_cmds_CXX='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+       ;;
+      irix5* | irix6*)
+        case $cc_basename in
+          CC*)
+           # SGI C++
+           archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
+
+           # Archives containing C++ object files must be created using
+           # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+           # necessary to make sure instantiated templates are included
+           # in the archive.
+           old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs'
+           ;;
+          *)
+           if test yes = "$GXX"; then
+             if test no = "$with_gnu_ld"; then
+               archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
+             else
+               archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib'
+             fi
+           fi
+           link_all_deplibs_CXX=yes
+           ;;
+        esac
+        hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir'
+        hardcode_libdir_separator_CXX=:
+        inherit_rpath_CXX=yes
+        ;;
+
+      linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+        case $cc_basename in
+          KCC*)
+           # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+           # KCC will only create a shared library if the output file
+           # ends with ".so" (or ".sl" for HP-UX), so rename the library
+           # to its proper name (with version) after linking.
+           archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+           archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib'
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           #
+           # There doesn't appear to be a way to prevent this compiler from
+           # explicitly linking system object files so we need to strip them
+           # from the output so that they don't get included in the library
+           # dependencies.
+           output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+
+           hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir'
+           export_dynamic_flag_spec_CXX='$wl--export-dynamic'
+
+           # Archives containing C++ object files must be created using
+           # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+           old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
+           ;;
+         icpc* | ecpc* )
+           # Intel C++
+           with_gnu_ld=yes
+           # version 8.0 and above of icpc choke on multiply defined symbols
+           # if we add $predep_objects and $postdep_objects, however 7.1 and
+           # earlier do not add the objects themselves.
+           case `$CC -V 2>&1` in
+             *"Version 7."*)
+               archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
+               archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
+               ;;
+             *)  # Version 8.0 or newer
+               tmp_idyn=
+               case $host_cpu in
+                 ia64*) tmp_idyn=' -i_dynamic';;
+               esac
+               archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+               archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
+               ;;
+           esac
+           archive_cmds_need_lc_CXX=no
+           hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir'
+           export_dynamic_flag_spec_CXX='$wl--export-dynamic'
+           whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive'
+           ;;
+          pgCC* | pgcpp*)
+            # Portland Group C++ compiler
+           case `$CC -V` in
+           *pgCC\ [1-5].* | *pgcpp\ [1-5].*)
+             prelink_cmds_CXX='tpldir=Template.dir~
+               rm -rf $tpldir~
+               $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+               compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+             old_archive_cmds_CXX='tpldir=Template.dir~
+                rm -rf $tpldir~
+                $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+                $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+                $RANLIB $oldlib'
+             archive_cmds_CXX='tpldir=Template.dir~
+                rm -rf $tpldir~
+                $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+                $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
+             archive_expsym_cmds_CXX='tpldir=Template.dir~
+                rm -rf $tpldir~
+                $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+                $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
+             ;;
+           *) # Version 6 and above use weak symbols
+             archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
+             archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
+             ;;
+           esac
+
+           hardcode_libdir_flag_spec_CXX='$wl--rpath $wl$libdir'
+           export_dynamic_flag_spec_CXX='$wl--export-dynamic'
+           whole_archive_flag_spec_CXX='$wl--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
+            ;;
+         cxx*)
+           # Compaq C++
+           archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
+           archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname  -o $lib $wl-retain-symbols-file $wl$export_symbols'
+
+           runpath_var=LD_RUN_PATH
+           hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+           hardcode_libdir_separator_CXX=:
+
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           #
+           # There doesn't appear to be a way to prevent this compiler from
+           # explicitly linking system object files so we need to strip them
+           # from the output so that they don't get included in the library
+           # dependencies.
+           output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
+           ;;
+         xl* | mpixl* | bgxl*)
+           # IBM XL 8.0 on PPC, with GNU ld
+           hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir'
+           export_dynamic_flag_spec_CXX='$wl--export-dynamic'
+           archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+           if test yes = "$supports_anon_versioning"; then
+             archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~
+                cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+                echo "local: *; };" >> $output_objdir/$libname.ver~
+                $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib'
+           fi
+           ;;
+         *)
+           case `$CC -V 2>&1 | sed 5q` in
+           *Sun\ C*)
+             # Sun C++ 5.9
+             no_undefined_flag_CXX=' -zdefs'
+             archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+             archive_expsym_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols'
+             hardcode_libdir_flag_spec_CXX='-R$libdir'
+             whole_archive_flag_spec_CXX='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
+             compiler_needs_object_CXX=yes
+
+             # Not sure whether something based on
+             # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+             # would be better.
+             output_verbose_link_cmd='func_echo_all'
+
+             # Archives containing C++ object files must be created using
+             # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+             # necessary to make sure instantiated templates are included
+             # in the archive.
+             old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+             ;;
+           esac
+           ;;
+       esac
+       ;;
+
+      lynxos*)
+        # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+
+      m88k*)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+       ;;
+
+      mvs*)
+        case $cc_basename in
+          cxx*)
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+         *)
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+       esac
+       ;;
+
+      netbsd*)
+        if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+         archive_cmds_CXX='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+         wlarc=
+         hardcode_libdir_flag_spec_CXX='-R$libdir'
+         hardcode_direct_CXX=yes
+         hardcode_shlibpath_var_CXX=no
+       fi
+       # Workaround some broken pre-1.5 toolchains
+       output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+       ;;
+
+      *nto* | *qnx*)
+        ld_shlibs_CXX=yes
+       ;;
+
+      openbsd* | bitrig*)
+       if test -f /usr/libexec/ld.so; then
+         hardcode_direct_CXX=yes
+         hardcode_shlibpath_var_CXX=no
+         hardcode_direct_absolute_CXX=yes
+         archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+         hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir'
+         if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then
+           archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib'
+           export_dynamic_flag_spec_CXX='$wl-E'
+           whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive'
+         fi
+         output_verbose_link_cmd=func_echo_all
+       else
+         ld_shlibs_CXX=no
+       fi
+       ;;
+
+      osf3* | osf4* | osf5*)
+        case $cc_basename in
+          KCC*)
+           # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+           # KCC will only create a shared library if the output file
+           # ends with ".so" (or ".sl" for HP-UX), so rename the library
+           # to its proper name (with version) after linking.
+           archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+           hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir'
+           hardcode_libdir_separator_CXX=:
+
+           # Archives containing C++ object files must be created using
+           # the KAI C++ compiler.
+           case $host in
+             osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;;
+             *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;;
+           esac
+           ;;
+          RCC*)
+           # Rational C++ 2.4.1
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+          cxx*)
+           case $host in
+             osf3*)
+               allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*'
+               archive_cmds_CXX='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
+               hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir'
+               ;;
+             *)
+               allow_undefined_flag_CXX=' -expect_unresolved \*'
+               archive_cmds_CXX='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
+               archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+                  echo "-hidden">> $lib.exp~
+                  $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp  `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~
+                  $RM $lib.exp'
+               hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+               ;;
+           esac
+
+           hardcode_libdir_separator_CXX=:
+
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           #
+           # There doesn't appear to be a way to prevent this compiler from
+           # explicitly linking system object files so we need to strip them
+           # from the output so that they don't get included in the library
+           # dependencies.
+           output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+           ;;
+         *)
+           if test yes,no = "$GXX,$with_gnu_ld"; then
+             allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*'
+             case $host in
+               osf3*)
+                 archive_cmds_CXX='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
+                 ;;
+               *)
+                 archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
+                 ;;
+             esac
+
+             hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir'
+             hardcode_libdir_separator_CXX=:
+
+             # Commands to make compiler produce verbose output that lists
+             # what "hidden" libraries, object files and flags are used when
+             # linking a shared library.
+             output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+           else
+             # FIXME: insert proper C++ library support
+             ld_shlibs_CXX=no
+           fi
+           ;;
+        esac
+        ;;
+
+      psos*)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+        ;;
+
+      sunos4*)
+        case $cc_basename in
+          CC*)
+           # Sun C++ 4.x
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+          lcc*)
+           # Lucid
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+          *)
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+        esac
+        ;;
+
+      solaris*)
+        case $cc_basename in
+          CC* | sunCC*)
+           # Sun C++ 4.2, 5.x and Centerline C++
+            archive_cmds_need_lc_CXX=yes
+           no_undefined_flag_CXX=' -zdefs'
+           archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+           archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+              $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+           hardcode_libdir_flag_spec_CXX='-R$libdir'
+           hardcode_shlibpath_var_CXX=no
+           case $host_os in
+             solaris2.[0-5] | solaris2.[0-5].*) ;;
+             *)
+               # The compiler driver will combine and reorder linker options,
+               # but understands '-z linker_flag'.
+               # Supported since Solaris 2.6 (maybe 2.5.1?)
+               whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract'
+               ;;
+           esac
+           link_all_deplibs_CXX=yes
+
+           output_verbose_link_cmd='func_echo_all'
+
+           # Archives containing C++ object files must be created using
+           # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+           # necessary to make sure instantiated templates are included
+           # in the archive.
+           old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+           ;;
+          gcx*)
+           # Green Hills C++ Compiler
+           archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib'
+
+           # The C++ compiler must be used to create the archive.
+           old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+           ;;
+          *)
+           # GNU C++ compiler with Solaris linker
+           if test yes,no = "$GXX,$with_gnu_ld"; then
+             no_undefined_flag_CXX=' $wl-z ${wl}defs'
+             if $CC --version | $GREP -v '^2\.7' > /dev/null; then
+               archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib'
+               archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+                  $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+               # Commands to make compiler produce verbose output that lists
+               # what "hidden" libraries, object files and flags are used when
+               # linking a shared library.
+               output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+             else
+               # g++ 2.7 appears to require '-G' NOT '-shared' on this
+               # platform.
+               archive_cmds_CXX='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib'
+               archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+                  $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+               # Commands to make compiler produce verbose output that lists
+               # what "hidden" libraries, object files and flags are used when
+               # linking a shared library.
+               output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+             fi
+
+             hardcode_libdir_flag_spec_CXX='$wl-R $wl$libdir'
+             case $host_os in
+               solaris2.[0-5] | solaris2.[0-5].*) ;;
+               *)
+                 whole_archive_flag_spec_CXX='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract'
+                 ;;
+             esac
+           fi
+           ;;
+        esac
+        ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+      no_undefined_flag_CXX='$wl-z,text'
+      archive_cmds_need_lc_CXX=no
+      hardcode_shlibpath_var_CXX=no
+      runpath_var='LD_RUN_PATH'
+
+      case $cc_basename in
+        CC*)
+         archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+         archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+         archive_expsym_cmds_CXX='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+      esac
+      ;;
+
+      sysv5* | sco3.2v5* | sco5v6*)
+       # Note: We CANNOT use -z defs as we might desire, because we do not
+       # link with -lc, and that would cause any symbols used from libc to
+       # always be unresolved, which means just about no library would
+       # ever link correctly.  If we're not using GNU ld we use -z text
+       # though, which does catch some bad symbols but isn't as heavy-handed
+       # as -z defs.
+       no_undefined_flag_CXX='$wl-z,text'
+       allow_undefined_flag_CXX='$wl-z,nodefs'
+       archive_cmds_need_lc_CXX=no
+       hardcode_shlibpath_var_CXX=no
+       hardcode_libdir_flag_spec_CXX='$wl-R,$libdir'
+       hardcode_libdir_separator_CXX=':'
+       link_all_deplibs_CXX=yes
+       export_dynamic_flag_spec_CXX='$wl-Bexport'
+       runpath_var='LD_RUN_PATH'
+
+       case $cc_basename in
+          CC*)
+           archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+           archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+           old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~
+              '"$old_archive_cmds_CXX"
+           reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~
+              '"$reload_cmds_CXX"
+           ;;
+         *)
+           archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+           archive_expsym_cmds_CXX='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+           ;;
+       esac
+      ;;
+
+      tandem*)
+        case $cc_basename in
+          NCC*)
+           # NonStop-UX NCC 3.20
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+          *)
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+        esac
+        ;;
+
+      vxworks*)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+        ;;
+
+      *)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+        ;;
+    esac
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5
+$as_echo "$ld_shlibs_CXX" >&6; }
+    test no = "$ld_shlibs_CXX" && can_build_shared=no
+
+    GCC_CXX=$GXX
+    LD_CXX=$LD
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    # Dependencies to place before and after the object being linked:
+predep_objects_CXX=
+postdep_objects_CXX=
+predeps_CXX=
+postdeps_CXX=
+compiler_lib_search_path_CXX=
+
+cat > conftest.$ac_ext <<_LT_EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+_LT_EOF
+
+
+_lt_libdeps_save_CFLAGS=$CFLAGS
+case "$CC $CFLAGS " in #(
+*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
+*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
+*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
+esac
+
+if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  for p in `eval "$output_verbose_link_cmd"`; do
+    case $prev$p in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test x-L = "$p" ||
+          test x-R = "$p"; then
+        prev=$p
+        continue
+       fi
+
+       # Expand the sysroot to ease extracting the directories later.
+       if test -z "$prev"; then
+         case $p in
+         -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
+         -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
+         -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
+         esac
+       fi
+       case $p in
+       =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
+       esac
+       if test no = "$pre_test_object_deps_done"; then
+        case $prev in
+        -L | -R)
+          # Internal compiler library paths should come after those
+          # provided the user.  The postdeps already come after the
+          # user supplied libs so there is no need to process them.
+          if test -z "$compiler_lib_search_path_CXX"; then
+            compiler_lib_search_path_CXX=$prev$p
+          else
+            compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} $prev$p"
+          fi
+          ;;
+        # The "-l" case would never come before the object being
+        # linked, so don't bother handling this case.
+        esac
+       else
+        if test -z "$postdeps_CXX"; then
+          postdeps_CXX=$prev$p
+        else
+          postdeps_CXX="${postdeps_CXX} $prev$p"
+        fi
+       fi
+       prev=
+       ;;
+
+    *.lto.$objext) ;; # Ignore GCC LTO objects
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+        pre_test_object_deps_done=yes
+        continue
+       fi
+
+       if test no = "$pre_test_object_deps_done"; then
+        if test -z "$predep_objects_CXX"; then
+          predep_objects_CXX=$p
+        else
+          predep_objects_CXX="$predep_objects_CXX $p"
+        fi
+       else
+        if test -z "$postdep_objects_CXX"; then
+          postdep_objects_CXX=$p
+        else
+          postdep_objects_CXX="$postdep_objects_CXX $p"
+        fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling CXX test program"
+fi
+
+$RM -f confest.$objext
+CFLAGS=$_lt_libdeps_save_CFLAGS
+
+# PORTME: override above test on systems where it is broken
+case $host_os in
+interix[3-9]*)
+  # Interix 3.5 installs completely hosed .la files for C++, so rather than
+  # hack all around it, let's just trust "g++" to DTRT.
+  predep_objects_CXX=
+  postdep_objects_CXX=
+  postdeps_CXX=
+  ;;
+esac
+
+
+case " $postdeps_CXX " in
+*" -lc "*) archive_cmds_need_lc_CXX=no ;;
+esac
+ compiler_lib_search_dirs_CXX=
+if test -n "${compiler_lib_search_path_CXX}"; then
+ compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | $SED -e 's! -L! !g' -e 's!^ !!'`
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    lt_prog_compiler_wl_CXX=
+lt_prog_compiler_pic_CXX=
+lt_prog_compiler_static_CXX=
+
+
+  # C++ specific cases for pic, static, wl, etc.
+  if test yes = "$GXX"; then
+    lt_prog_compiler_wl_CXX='-Wl,'
+    lt_prog_compiler_static_CXX='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test ia64 = "$host_cpu"; then
+       # AIX 5 now supports IA64 processor
+       lt_prog_compiler_static_CXX='-Bstatic'
+      fi
+      lt_prog_compiler_pic_CXX='-fPIC'
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            lt_prog_compiler_pic_CXX='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the '-m68020' flag to GCC prevents building anything better,
+            # like '-m68040'.
+            lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | cygwin* | os2* | pw32* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      lt_prog_compiler_pic_CXX='-DDLL_EXPORT'
+      case $host_os in
+      os2*)
+       lt_prog_compiler_static_CXX='$wl-static'
+       ;;
+      esac
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic_CXX='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      lt_prog_compiler_pic_CXX=
+      ;;
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      lt_prog_compiler_static_CXX=
+      ;;
+    interix[3-9]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       lt_prog_compiler_pic_CXX=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+       ;;
+      *)
+       lt_prog_compiler_pic_CXX='-fPIC'
+       ;;
+      esac
+      ;;
+    *qnx* | *nto*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      lt_prog_compiler_pic_CXX='-fPIC -shared'
+      ;;
+    *)
+      lt_prog_compiler_pic_CXX='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix[4-9]*)
+       # All AIX code is PIC.
+       if test ia64 = "$host_cpu"; then
+         # AIX 5 now supports IA64 processor
+         lt_prog_compiler_static_CXX='-Bstatic'
+       else
+         lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp'
+       fi
+       ;;
+      chorus*)
+       case $cc_basename in
+       cxch68*)
+         # Green Hills C++ Compiler
+         # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+         ;;
+       esac
+       ;;
+      mingw* | cygwin* | os2* | pw32* | cegcc*)
+       # This hack is so that the source file can tell whether it is being
+       # built for inclusion in a dll (and should export symbols for example).
+       lt_prog_compiler_pic_CXX='-DDLL_EXPORT'
+       ;;
+      dgux*)
+       case $cc_basename in
+         ec++*)
+           lt_prog_compiler_pic_CXX='-KPIC'
+           ;;
+         ghcx*)
+           # Green Hills C++ Compiler
+           lt_prog_compiler_pic_CXX='-pic'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      freebsd* | dragonfly*)
+       # FreeBSD uses GNU C++
+       ;;
+      hpux9* | hpux10* | hpux11*)
+       case $cc_basename in
+         CC*)
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_static_CXX='$wl-a ${wl}archive'
+           if test ia64 != "$host_cpu"; then
+             lt_prog_compiler_pic_CXX='+Z'
+           fi
+           ;;
+         aCC*)
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_static_CXX='$wl-a ${wl}archive'
+           case $host_cpu in
+           hppa*64*|ia64*)
+             # +Z the default
+             ;;
+           *)
+             lt_prog_compiler_pic_CXX='+Z'
+             ;;
+           esac
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      interix*)
+       # This is c89, which is MS Visual C++ (no shared libs)
+       # Anyone wants to do a port?
+       ;;
+      irix5* | irix6* | nonstopux*)
+       case $cc_basename in
+         CC*)
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_static_CXX='-non_shared'
+           # CC pic flag -KPIC is the default.
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+       case $cc_basename in
+         KCC*)
+           # KAI C++ Compiler
+           lt_prog_compiler_wl_CXX='--backend -Wl,'
+           lt_prog_compiler_pic_CXX='-fPIC'
+           ;;
+         ecpc* )
+           # old Intel C++ for x86_64, which still supported -KPIC.
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_pic_CXX='-KPIC'
+           lt_prog_compiler_static_CXX='-static'
+           ;;
+         icpc* )
+           # Intel C++, used to be incompatible with GCC.
+           # ICC 10 doesn't accept -KPIC any more.
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_pic_CXX='-fPIC'
+           lt_prog_compiler_static_CXX='-static'
+           ;;
+         pgCC* | pgcpp*)
+           # Portland Group C++ compiler
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_pic_CXX='-fpic'
+           lt_prog_compiler_static_CXX='-Bstatic'
+           ;;
+         cxx*)
+           # Compaq C++
+           # Make sure the PIC flag is empty.  It appears that all Alpha
+           # Linux and Compaq Tru64 Unix objects are PIC.
+           lt_prog_compiler_pic_CXX=
+           lt_prog_compiler_static_CXX='-non_shared'
+           ;;
+         xlc* | xlC* | bgxl[cC]* | mpixl[cC]*)
+           # IBM XL 8.0, 9.0 on PPC and BlueGene
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_pic_CXX='-qpic'
+           lt_prog_compiler_static_CXX='-qstaticlink'
+           ;;
+         *)
+           case `$CC -V 2>&1 | sed 5q` in
+           *Sun\ C*)
+             # Sun C++ 5.9
+             lt_prog_compiler_pic_CXX='-KPIC'
+             lt_prog_compiler_static_CXX='-Bstatic'
+             lt_prog_compiler_wl_CXX='-Qoption ld '
+             ;;
+           esac
+           ;;
+       esac
+       ;;
+      lynxos*)
+       ;;
+      m88k*)
+       ;;
+      mvs*)
+       case $cc_basename in
+         cxx*)
+           lt_prog_compiler_pic_CXX='-W c,exportall'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      netbsd*)
+       ;;
+      *qnx* | *nto*)
+        # QNX uses GNU C++, but need to define -shared option too, otherwise
+        # it will coredump.
+        lt_prog_compiler_pic_CXX='-fPIC -shared'
+        ;;
+      osf3* | osf4* | osf5*)
+       case $cc_basename in
+         KCC*)
+           lt_prog_compiler_wl_CXX='--backend -Wl,'
+           ;;
+         RCC*)
+           # Rational C++ 2.4.1
+           lt_prog_compiler_pic_CXX='-pic'
+           ;;
+         cxx*)
+           # Digital/Compaq C++
+           lt_prog_compiler_wl_CXX='-Wl,'
+           # Make sure the PIC flag is empty.  It appears that all Alpha
+           # Linux and Compaq Tru64 Unix objects are PIC.
+           lt_prog_compiler_pic_CXX=
+           lt_prog_compiler_static_CXX='-non_shared'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      psos*)
+       ;;
+      solaris*)
+       case $cc_basename in
+         CC* | sunCC*)
+           # Sun C++ 4.2, 5.x and Centerline C++
+           lt_prog_compiler_pic_CXX='-KPIC'
+           lt_prog_compiler_static_CXX='-Bstatic'
+           lt_prog_compiler_wl_CXX='-Qoption ld '
+           ;;
+         gcx*)
+           # Green Hills C++ Compiler
+           lt_prog_compiler_pic_CXX='-PIC'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      sunos4*)
+       case $cc_basename in
+         CC*)
+           # Sun C++ 4.x
+           lt_prog_compiler_pic_CXX='-pic'
+           lt_prog_compiler_static_CXX='-Bstatic'
+           ;;
+         lcc*)
+           # Lucid
+           lt_prog_compiler_pic_CXX='-pic'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+       case $cc_basename in
+         CC*)
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_pic_CXX='-KPIC'
+           lt_prog_compiler_static_CXX='-Bstatic'
+           ;;
+       esac
+       ;;
+      tandem*)
+       case $cc_basename in
+         NCC*)
+           # NonStop-UX NCC 3.20
+           lt_prog_compiler_pic_CXX='-KPIC'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      vxworks*)
+       ;;
+      *)
+       lt_prog_compiler_can_build_shared_CXX=no
+       ;;
+    esac
+  fi
+
+case $host_os in
+  # For platforms that do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic_CXX=
+    ;;
+  *)
+    lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC"
+    ;;
+esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+if ${lt_cv_prog_compiler_pic_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_pic_CXX" >&6; }
+lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; }
+if ${lt_cv_prog_compiler_pic_works_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_pic_works_CXX=no
+   ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC"  ## exclude from sc_useless_quotes_in_assignment
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_pic_works_CXX=yes
+     fi
+   fi
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; }
+
+if test yes = "$lt_cv_prog_compiler_pic_works_CXX"; then
+    case $lt_prog_compiler_pic_CXX in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;;
+     esac
+else
+    lt_prog_compiler_pic_CXX=
+     lt_prog_compiler_can_build_shared_CXX=no
+fi
+
+fi
+
+
+
+
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
+if ${lt_cv_prog_compiler_static_works_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_static_works_CXX=no
+   save_LDFLAGS=$LDFLAGS
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_cv_prog_compiler_static_works_CXX=yes
+       fi
+     else
+       lt_cv_prog_compiler_static_works_CXX=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS=$save_LDFLAGS
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; }
+
+if test yes = "$lt_cv_prog_compiler_static_works_CXX"; then
+    :
+else
+    lt_prog_compiler_static_CXX=
+fi
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_c_o_CXX=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o_CXX=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; }
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_c_o_CXX=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o_CXX=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; }
+
+
+
+
+hard_links=nottested
+if test no = "$lt_cv_prog_compiler_c_o_CXX" && test no != "$need_locks"; then
+  # do not overwrite the value of need_locks provided by the user
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
+  hard_links=yes
+  $RM conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
+  if test no = "$hard_links"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+
+  export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+  case $host_os in
+  aix[4-9]*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to GNU nm, but means don't demangle to AIX nm.
+    # Without the "-l" option, or with the "-B" option, AIX nm treats
+    # weak defined symbols like other global defined symbols, whereas
+    # GNU nm marks them as "W".
+    # While the 'weak' keyword is ignored in the Export File, we need
+    # it in the Import File for the 'aix-soname' feature, so we have
+    # to replace the "-B" option with "-P" for AIX nm.
+    if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+      export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols'
+    else
+      export_symbols_cmds_CXX='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    export_symbols_cmds_CXX=$ltdll_cmds
+    ;;
+  cygwin* | mingw* | cegcc*)
+    case $cc_basename in
+    cl*)
+      exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+      ;;
+    *)
+      export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
+      exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
+      ;;
+    esac
+    ;;
+  *)
+    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+    ;;
+  esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5
+$as_echo "$ld_shlibs_CXX" >&6; }
+test no = "$ld_shlibs_CXX" && can_build_shared=no
+
+with_gnu_ld_CXX=$with_gnu_ld
+
+
+
+
+
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_CXX" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc_CXX=yes
+
+  if test yes,yes = "$GCC,$enable_shared"; then
+    case $archive_cmds_CXX in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
+if ${lt_cv_archive_cmds_need_lc_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  $RM conftest*
+       echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+       if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } 2>conftest.err; then
+         soname=conftest
+         lib=conftest
+         libobjs=conftest.$ac_objext
+         deplibs=
+         wl=$lt_prog_compiler_wl_CXX
+         pic_flag=$lt_prog_compiler_pic_CXX
+         compiler_flags=-v
+         linker_flags=-v
+         verstring=
+         output_objdir=.
+         libname=conftest
+         lt_save_allow_undefined_flag=$allow_undefined_flag_CXX
+         allow_undefined_flag_CXX=
+         if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+  (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+         then
+           lt_cv_archive_cmds_need_lc_CXX=no
+         else
+           lt_cv_archive_cmds_need_lc_CXX=yes
+         fi
+         allow_undefined_flag_CXX=$lt_save_allow_undefined_flag
+       else
+         cat conftest.err 1>&5
+       fi
+       $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5
+$as_echo "$lt_cv_archive_cmds_need_lc_CXX" >&6; }
+      archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
+
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=.so
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+
+
+case $host_os in
+aix3*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='$libname$release$shared_ext$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='$libname$release$shared_ext$major'
+  ;;
+
+aix[4-9]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test ia64 = "$host_cpu"; then
+    # AIX 5 supports IA64
+    library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line '#! .'.  This would cause the generated library to
+    # depend on '.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+          echo ' yes '
+          echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then
+       :
+      else
+       can_build_shared=no
+      fi
+      ;;
+    esac
+    # Using Import Files as archive members, it is possible to support
+    # filename-based versioning of shared library archives on AIX. While
+    # this would work for both with and without runtime linking, it will
+    # prevent static linking of such archives. So we do filename-based
+    # shared library versioning with .so extension only, which is used
+    # when both runtime linking and shared linking is enabled.
+    # Unfortunately, runtime linking may impact performance, so we do
+    # not want this to be the default eventually. Also, we use the
+    # versioned .so libs for executables only if there is the -brtl
+    # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only.
+    # To allow for filename-based versioning support, we need to create
+    # libNAME.so.V as an archive file, containing:
+    # *) an Import File, referring to the versioned filename of the
+    #    archive as well as the shared archive member, telling the
+    #    bitwidth (32 or 64) of that shared object, and providing the
+    #    list of exported symbols of that shared object, eventually
+    #    decorated with the 'weak' keyword
+    # *) the shared object with the F_LOADONLY flag set, to really avoid
+    #    it being seen by the linker.
+    # At run time we better use the real file rather than another symlink,
+    # but for link time we create the symlink libNAME.so -> libNAME.so.V
+
+    case $with_aix_soname,$aix_use_runtimelinking in
+    # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    aix,yes) # traditional libtool
+      dynamic_linker='AIX unversionable lib.so'
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+      ;;
+    aix,no) # traditional AIX only
+      dynamic_linker='AIX lib.a(lib.so.V)'
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='$libname$release.a $libname.a'
+      soname_spec='$libname$release$shared_ext$major'
+      ;;
+    svr4,*) # full svr4 only
+      dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)"
+      library_names_spec='$libname$release$shared_ext$major $libname$shared_ext'
+      # We do not specify a path in Import Files, so LIBPATH fires.
+      shlibpath_overrides_runpath=yes
+      ;;
+    *,yes) # both, prefer svr4
+      dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)"
+      library_names_spec='$libname$release$shared_ext$major $libname$shared_ext'
+      # unpreferred sharedlib libNAME.a needs extra handling
+      postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"'
+      postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"'
+      # We do not specify a path in Import Files, so LIBPATH fires.
+      shlibpath_overrides_runpath=yes
+      ;;
+    *,no) # both, prefer aix
+      dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)"
+      library_names_spec='$libname$release.a $libname.a'
+      soname_spec='$libname$release$shared_ext$major'
+      # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling
+      postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)'
+      postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"'
+      ;;
+    esac
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  case $host_cpu in
+  powerpc)
+    # Since July 2007 AmigaOS4 officially supports .so libraries.
+    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+    ;;
+  m68k)
+    library_names_spec='$libname.ixlibrary $libname.a'
+    # Create ${libname}_ixlibrary.a entries in /sys/libs.
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    ;;
+  esac
+  ;;
+
+beos*)
+  library_names_spec='$libname$shared_ext'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[45]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_version=no
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+  version_type=windows
+  shrext_cmds=.dll
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$cc_basename in
+  yes,*)
+    # gcc
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \$file`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+      fi'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext'
+
+      ;;
+    mingw* | cegcc*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext'
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext'
+      ;;
+    esac
+    dynamic_linker='Win32 ld.exe'
+    ;;
+
+  *,cl*)
+    # Native MSVC
+    libname_spec='$name'
+    soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext'
+    library_names_spec='$libname.dll.lib'
+
+    case $build_os in
+    mingw*)
+      sys_lib_search_path_spec=
+      lt_save_ifs=$IFS
+      IFS=';'
+      for lt_path in $LIB
+      do
+        IFS=$lt_save_ifs
+        # Let DOS variable expansion print the short 8.3 style file name.
+        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+      done
+      IFS=$lt_save_ifs
+      # Convert to MSYS style.
+      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
+      ;;
+    cygwin*)
+      # Convert to unix form, then to dos form, then back to unix form
+      # but this time dos style (no spaces!) so that the unix form looks
+      # like /cygdrive/c/PROGRA~1:/cygdr...
+      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      ;;
+    *)
+      sys_lib_search_path_spec=$LIB
+      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      # FIXME: find the short name or the path components, as spaces are
+      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    esac
+
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \$file`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+    dynamic_linker='Win32 link.exe'
+    ;;
+
+  *)
+    # Assume MSVC wrapper
+    library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib'
+    dynamic_linker='Win32 ld.exe'
+    ;;
+  esac
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='$libname$release$major$shared_ext $libname$shared_ext'
+  soname_spec='$libname$release$major$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[23].*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+      soname_spec='$libname$release$shared_ext$major'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2.*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+haiku*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  dynamic_linker="$host_os runtime_loader"
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
+  shlibpath_var=LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+    soname_spec='$libname$release$shared_ext$major'
+    if test 32 = "$HPUX_IA64_MODE"; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+      sys_lib_dlsearch_path_spec=/usr/lib/hpux32
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+      sys_lib_dlsearch_path_spec=/usr/lib/hpux64
+    fi
+    ;;
+  hppa*64*)
+    shrext_cmds='.sl'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+    soname_spec='$libname$release$shared_ext$major'
+    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+    soname_spec='$libname$release$shared_ext$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+  postinstall_cmds='chmod 555 $lib'
+  # or fails outright, so override atomically:
+  install_override_mode=555
+  ;;
+
+interix[3-9]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+       if test yes = "$lt_cv_prog_gnu_ld"; then
+               version_type=linux # correct to gnu/linux during the next big refactor
+       else
+               version_type=irix
+       fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='$libname$release$shared_ext$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff"
+  sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+linux*android*)
+  version_type=none # Android doesn't support versioned libraries.
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='$libname$release$shared_ext'
+  soname_spec='$libname$release$shared_ext'
+  finish_cmds=
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  dynamic_linker='Android linker'
+  # Don't embed -rpath directories since the linker doesn't support them.
+  hardcode_libdir_flag_spec_CXX='-L$libdir'
+  ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+
+  # Some binutils ld are patched to set DT_RUNPATH
+  if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_shlibpath_overrides_runpath=no
+    save_LDFLAGS=$LDFLAGS
+    save_libdir=$libdir
+    eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \
+        LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\""
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
+  lt_cv_shlibpath_overrides_runpath=yes
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+    LDFLAGS=$save_LDFLAGS
+    libdir=$save_libdir
+
+fi
+
+  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Add ABI-specific directories to the system library path.
+  sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib"
+
+  # Ideally, we could use ldconfig to report *all* directores which are
+  # searched for libraries, however this is still not possible.  Aside from not
+  # being certain /sbin/ldconfig is available, command
+  # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64,
+  # even though it is searched at run-time.  Try to do the best guess by
+  # appending ld.so.conf contents (and includes) to the search path.
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[      ]*hwcap[        ]/d;s/[:,      ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+    soname_spec='$libname$release$shared_ext$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+*nto* | *qnx*)
+  version_type=qnx
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='ldqnx.so'
+  ;;
+
+openbsd* | bitrig*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec=/usr/lib
+  need_lib_prefix=no
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
+    need_version=no
+  else
+    need_version=yes
+  fi
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+os2*)
+  libname_spec='$name'
+  version_type=windows
+  shrext_cmds=.dll
+  need_version=no
+  need_lib_prefix=no
+  # OS/2 can only load a DLL with a base name of 8 characters or less.
+  soname_spec='`test -n "$os2dllname" && libname="$os2dllname";
+    v=$($ECHO $release$versuffix | tr -d .-);
+    n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _);
+    $ECHO $n$v`$shared_ext'
+  library_names_spec='${libname}_dll.$libext'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=BEGINLIBPATH
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+  postinstall_cmds='base_file=`basename \$file`~
+    dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~
+    dldir=$destdir/`dirname \$dlpath`~
+    test -d \$dldir || mkdir -p \$dldir~
+    $install_prog $dir/$dlname \$dldir/$dlname~
+    chmod a+x \$dldir/$dlname~
+    if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+      eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+    fi'
+  postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~
+    dlpath=$dir/\$dldll~
+    $RM \$dlpath'
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='$libname$release$shared_ext$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test yes = "$with_gnu_ld"; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec; then
+    version_type=linux # correct to gnu/linux during the next big refactor
+    library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext'
+    soname_spec='$libname$shared_ext.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=sco
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  if test yes = "$with_gnu_ld"; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+       ;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+tpf*)
+  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+uts4*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
+test no = "$dynamic_linker" && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test yes = "$GCC"; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then
+  sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec
+fi
 
+if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then
+  sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5
-$as_echo "$lt_cv_dlopen_self_static" >&6; }
-    fi
 
-    CPPFLAGS=$save_CPPFLAGS
-    LDFLAGS=$save_LDFLAGS
-    LIBS=$save_LIBS
-    ;;
-  esac
+# remember unaugmented sys_lib_dlsearch_path content for libtool script decls...
+configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec
+
+# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code
+func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH"
+
+# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool
+configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH
+
+
 
-  case $lt_cv_dlopen_self in
-  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
-  *) enable_dlopen_self=unknown ;;
-  esac
 
-  case $lt_cv_dlopen_self_static in
-  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
-  *) enable_dlopen_self_static=unknown ;;
-  esac
-fi
 
 
 
 
 
 
-striplib=
-old_striplib=
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5
-$as_echo_n "checking whether stripping libraries is possible... " >&6; }
-if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
-  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
-  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
-# FIXME - insert some real tests, host_os isn't really good enough
-  case $host_os in
-  darwin*)
-    if test -n "$STRIP"; then
-      striplib="$STRIP -x"
-      old_striplib="$STRIP -S"
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-    else
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-    fi
-    ;;
-  *)
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-    ;;
-  esac
-fi
 
 
 
 
 
 
-  # Report what library types will actually be built
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5
-$as_echo_n "checking if libtool supports shared libraries... " >&6; }
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5
-$as_echo "$can_build_shared" >&6; }
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5
-$as_echo_n "checking whether to build shared libraries... " >&6; }
-  test no = "$can_build_shared" && enable_shared=no
 
-  # On AIX, shared libraries and static libraries use the same namespace, and
-  # are all built from PIC.
-  case $host_os in
-  aix3*)
-    test yes = "$enable_shared" && enable_static=no
-    if test -n "$RANLIB"; then
-      archive_cmds="$archive_cmds~\$RANLIB \$lib"
-      postinstall_cmds='$RANLIB $lib'
-    fi
-    ;;
 
-  aix[4-9]*)
-    if test ia64 != "$host_cpu"; then
-      case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in
-      yes,aix,yes) ;;                  # shared object as lib.so file only
-      yes,svr4,*) ;;                   # shared object as lib.so archive member only
-      yes,*) enable_static=no ;;       # shared object in lib.a archive as well
-      esac
-    fi
-    ;;
-  esac
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5
-$as_echo "$enable_shared" >&6; }
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5
-$as_echo_n "checking whether to build static libraries... " >&6; }
-  # Make sure either enable_shared or enable_static is yes.
-  test yes = "$enable_shared" || enable_static=yes
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5
-$as_echo "$enable_static" >&6; }
 
 
 
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
+hardcode_action_CXX=
+if test -n "$hardcode_libdir_flag_spec_CXX" ||
+   test -n "$runpath_var_CXX" ||
+   test yes = "$hardcode_automatic_CXX"; then
+
+  # We can hardcode non-existent directories.
+  if test no != "$hardcode_direct_CXX" &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" &&
+     test no != "$hardcode_minus_L_CXX"; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action_CXX=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action_CXX=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action_CXX=unsupported
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5
+$as_echo "$hardcode_action_CXX" >&6; }
 
+if test relink = "$hardcode_action_CXX" ||
+   test yes = "$inherit_rpath_CXX"; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test yes = "$shlibpath_overrides_runpath" ||
+     test no = "$enable_shared"; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
 fi
+
+
+
+
+
+
+
+  fi # test -n "$compiler"
+
+  CC=$lt_save_CC
+  CFLAGS=$lt_save_CFLAGS
+  LDCXX=$LD
+  LD=$lt_save_LD
+  GCC=$lt_save_GCC
+  with_gnu_ld=$lt_save_with_gnu_ld
+  lt_cv_path_LDCXX=$lt_cv_path_LD
+  lt_cv_path_LD=$lt_save_path_LD
+  lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+  lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+fi # test yes != "$_lt_caught_CXX_error"
+
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-CC=$lt_save_CC
-
 
 
 
@@ -13636,9 +17474,11 @@ test -n "$PASSWD" || PASSWD="passwd"
 if test "$GCC" = "yes"
 then
        CFLAGS="$CFLAGS -Wall"
+       CXXFLAGS="$CXXFLAGS -Wall"
 fi
 
 CFLAGS="$CFLAGS -Ilibs -I${srcdir}/libs"
+CXXFLAGS="$CXXFLAGS -Ilibs -I${srcdir}/libs"
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lm is needed for floor" >&5
 $as_echo_n "checking whether -lm is needed for floor... " >&6; }
 LIBS="$saveLIBS"
 
 
-save_LIBS="$LIBS"
-LIBS="-lcourier-unicode"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking courier-unicode library and version" >&5
+$as_echo_n "checking courier-unicode library and version... " >&6; }
+
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 #include <courier-unicode.h>
+#ifndef COURIER_UNICODE_VERSION
+#define COURIER_UNICODE_VERSION 0
+#endif
+
+#if COURIER_UNICODE_VERSION < 210
+#error "courier-unicode 2.1 library is required"
+#endif
+
 
 int
 main ()
 {
 
-       unicode_default_chset();
-
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  :
+if ac_fn_c_try_compile "$LINENO"; then :
+
 else
-  as_fn_error $? "The Courier Unicode Library 1.2 appears not to be installed. You may need to install a separate development subpackage, in addition to the main package" "$LINENO" 5
+  as_fn_error $? "
+ERROR: The Courier Unicode Library 2.1 header files appear not to be installed.
+You may need to upgrade the library or install a separate development
+subpackage in addition to the main package." "$LINENO" 5
+
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS="$save_LIBS"
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+
 
 
 
@@ -15038,6 +18893,7 @@ fi
        LIBS="$saveLIBS"
        HAVE_AUTHPGSQL=1
        CFLAGS="$PGSQL_CFLAGS $CFLAGS"
+       CXXFLAGS="$PGSQL_CFLAGS $CXXFLAGS"
        LIBAUTHPGSQL="libauthpgsql.la"
 fi
 
@@ -15189,6 +19045,7 @@ fi
        LIBS="$saveLIBS"
        HAVE_AUTHMYSQL=1
        CFLAGS="$MYSQL_CFLAGS $CFLAGS"
+       CXXFLAGS="$MYSQL_CFLAGS $CXXFLAGS"
 fi
 
 
@@ -15271,6 +19128,7 @@ fi
        LIBS="$saveLIBS"
        HAVE_AUTHSQLITE=1
        CFLAGS="$SQLITE_CFLAGS $CFLAGS"
+       CXXFLAGS="$SQLITE_CXXFLAGS $CFLAGS"
        LIBAUTHSQLITE="libauthsqlite.la"
 
 fi
@@ -15710,6 +19568,15 @@ _ACEOF
 
 fi
 
+ac_fn_c_check_func "$LINENO" "bcrypt" "ac_cv_func_bcrypt"
+if test "x$ac_cv_func_bcrypt" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_BCRYPT 1
+_ACEOF
+
+fi
+
 LIBS="$saveLIBS"
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for crypt() prototype" >&5
 $as_echo_n "checking for crypt() prototype... " >&6; }
@@ -16166,6 +20033,10 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
   as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
+  as_fn_error $? "conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${INSTALL_LTDL_TRUE}" && test -z "${INSTALL_LTDL_FALSE}"; then
   as_fn_error $? "conditional \"INSTALL_LTDL\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -16616,7 +20487,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by courier-authlib $as_me 0.66.4, which was
+This file was extended by courier-authlib $as_me 0.69.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -16682,7 +20553,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-courier-authlib config.status 0.66.4
+courier-authlib config.status 0.69.0
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
@@ -16946,6 +20817,60 @@ enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_sub
 enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`'
 old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`'
 striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`'
+predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`'
+postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`'
+predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`'
+postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`'
+LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`'
+reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`'
+reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`'
+GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`'
+inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`'
+always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`'
+include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`'
+prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`'
+predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`'
+postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`'
+predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`'
+postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`'
 
 LTCC='$LTCC'
 LTCFLAGS='$LTCFLAGS'
@@ -17027,7 +20952,38 @@ soname_spec \
 install_override_mode \
 finish_eval \
 old_striplib \
-striplib; do
+striplib \
+compiler_lib_search_dirs \
+predep_objects \
+postdep_objects \
+predeps \
+postdeps \
+compiler_lib_search_path \
+LD_CXX \
+reload_flag_CXX \
+compiler_CXX \
+lt_prog_compiler_no_builtin_flag_CXX \
+lt_prog_compiler_pic_CXX \
+lt_prog_compiler_wl_CXX \
+lt_prog_compiler_static_CXX \
+lt_cv_prog_compiler_c_o_CXX \
+export_dynamic_flag_spec_CXX \
+whole_archive_flag_spec_CXX \
+compiler_needs_object_CXX \
+with_gnu_ld_CXX \
+allow_undefined_flag_CXX \
+no_undefined_flag_CXX \
+hardcode_libdir_flag_spec_CXX \
+hardcode_libdir_separator_CXX \
+exclude_expsyms_CXX \
+include_expsyms_CXX \
+file_list_spec_CXX \
+compiler_lib_search_dirs_CXX \
+predep_objects_CXX \
+postdep_objects_CXX \
+predeps_CXX \
+postdeps_CXX \
+compiler_lib_search_path_CXX; do
     case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[\\\\\\\`\\"\\\$]*)
       eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes
@@ -17058,7 +21014,18 @@ postuninstall_cmds \
 finish_cmds \
 sys_lib_search_path_spec \
 configure_time_dlsearch_path \
-configure_time_lt_sys_library_path; do
+configure_time_lt_sys_library_path \
+reload_cmds_CXX \
+old_archive_cmds_CXX \
+old_archive_from_new_cmds_CXX \
+old_archive_from_expsyms_cmds_CXX \
+archive_cmds_CXX \
+archive_expsym_cmds_CXX \
+module_cmds_CXX \
+module_expsym_cmds_CXX \
+export_symbols_cmds_CXX \
+prelink_cmds_CXX \
+postlink_cmds_CXX; do
     case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[\\\\\\\`\\"\\\$]*)
       eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes
@@ -17086,6 +21053,8 @@ fi
 
 
 
+
+
 _ACEOF
 
 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
@@ -17843,7 +21812,7 @@ $as_echo X"$file" |
 
 
 # The names of the tagged configurations supported by this script.
-available_tags=''
+available_tags='CXX '
 
 # Configured defaults for sys_lib_dlsearch_path munging.
 : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"}
@@ -18248,6 +22217,20 @@ file_list_spec=$lt_file_list_spec
 # How to hardcode a shared library path into an executable.
 hardcode_action=$hardcode_action
 
+# The directories searched by this compiler when creating a shared library.
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs
+
+# Dependencies to place before and after the objects being linked to
+# create a shared library.
+predep_objects=$lt_predep_objects
+postdep_objects=$lt_postdep_objects
+predeps=$lt_predeps
+postdeps=$lt_postdeps
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path
+
 # ### END LIBTOOL CONFIG
 
 _LT_EOF
@@ -18340,6 +22323,159 @@ ltmain=$ac_aux_dir/ltmain.sh
     (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
   chmod +x "$ofile"
 
+
+    cat <<_LT_EOF >> "$ofile"
+
+# ### BEGIN LIBTOOL TAG CONFIG: CXX
+
+# The linker used to build libraries.
+LD=$lt_LD_CXX
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag_CXX
+reload_cmds=$lt_reload_cmds_CXX
+
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds_CXX
+
+# A language specific compiler.
+CC=$lt_compiler_CXX
+
+# Is the compiler the GNU compiler?
+with_gcc=$GCC_CXX
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_CXX
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_CXX
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_CXX
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_CXX
+
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX
+
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object=$lt_compiler_needs_object_CXX
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX
+
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds_CXX
+archive_expsym_cmds=$lt_archive_expsym_cmds_CXX
+
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds_CXX
+module_expsym_cmds=$lt_module_expsym_cmds_CXX
+
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld_CXX
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_CXX
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_CXX
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX
+
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX
+
+# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct_CXX
+
+# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes
+# DIR into the resulting binary and the resulting library dependency is
+# "absolute",i.e impossible to change by setting \$shlibpath_var if the
+# library is relocated.
+hardcode_direct_absolute=$hardcode_direct_absolute_CXX
+
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L_CXX
+
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX
+
+# Set to "yes" if building a shared library automatically hardcodes DIR
+# into the library and all subsequent libraries and executables linked
+# against it.
+hardcode_automatic=$hardcode_automatic_CXX
+
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath_CXX
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_CXX
+
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols_CXX
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_CXX
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_CXX
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_CXX
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds_CXX
+
+# Commands necessary for finishing linking programs.
+postlink_cmds=$lt_postlink_cmds_CXX
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec_CXX
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_CXX
+
+# The directories searched by this compiler when creating a shared library.
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX
+
+# Dependencies to place before and after the objects being linked to
+# create a shared library.
+predep_objects=$lt_predep_objects_CXX
+postdep_objects=$lt_postdep_objects_CXX
+predeps=$lt_predeps_CXX
+postdeps=$lt_postdeps_CXX
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
+
+# ### END LIBTOOL TAG CONFIG: CXX
+_LT_EOF
+
  ;;
 
   esac
index 54dbbc6..3dc2df3 100644 (file)
@@ -1,11 +1,11 @@
 dnl Process this file with autoconf to produce a configure script.
 dnl
 dnl
-dnl Copyright 1998 - 2015 Double Precision, Inc.  See COPYING for
+dnl Copyright 1998 - 2018 Double Precision, Inc.  See COPYING for
 dnl distribution information.
 
 AC_PREREQ(2.63)
-AC_INIT([courier-authlib],[0.66.4],[courier-users@lists.sourceforge.net])
+AC_INIT([courier-authlib],[0.69.0],[courier-users@lists.sourceforge.net])
 
 AC_CONFIG_SRCDIR([courierauth.h])
 
@@ -18,6 +18,7 @@ LPATH="$PATH:/usr/local/bin"
 dnl Checks for programs.
 AC_PROG_AWK
 AC_PROG_CC
+AC_PROG_CXX
 AC_PROG_CPP
 AC_PROG_INSTALL
 AC_PROG_LN_S
@@ -68,9 +69,11 @@ AC_SUBST(PASSWD)
 if test "$GCC" = "yes"
 then
        CFLAGS="$CFLAGS -Wall"
+       CXXFLAGS="$CXXFLAGS -Wall"
 fi
 
 CFLAGS="$CFLAGS -Ilibs -I${srcdir}/libs"
+CXXFLAGS="$CXXFLAGS -Ilibs -I${srcdir}/libs"
 
 AC_MSG_CHECKING(whether -lm is needed for floor)
 AC_TRY_LINK_FUNC(floor,
@@ -123,15 +126,7 @@ fi
 LIBS="$saveLIBS"
 AC_SUBST(NETLIBS)
 
-save_LIBS="$LIBS"
-LIBS="-lcourier-unicode"
-AC_LINK_IFELSE(
-[AC_LANG_PROGRAM([
-#include <courier-unicode.h>
-],[
-       unicode_default_chset();
-])],[:],[AC_MSG_ERROR([The Courier Unicode Library 1.2 appears not to be installed. You may need to install a separate development subpackage, in addition to the main package])])
-LIBS="$save_LIBS"
+AX_COURIER_UNICODE_VERSION
 
 dnl #########################################################################
 
@@ -526,6 +521,7 @@ else
        LIBS="$saveLIBS"
        HAVE_AUTHPGSQL=1
        CFLAGS="$PGSQL_CFLAGS $CFLAGS"
+       CXXFLAGS="$PGSQL_CFLAGS $CXXFLAGS"
        LIBAUTHPGSQL="libauthpgsql.la"
 fi
 
@@ -602,6 +598,7 @@ else
        LIBS="$saveLIBS"
        HAVE_AUTHMYSQL=1
        CFLAGS="$MYSQL_CFLAGS $CFLAGS"
+       CXXFLAGS="$MYSQL_CFLAGS $CXXFLAGS"
 fi
 AC_SUBST(LIBAUTHMYSQL)
 AC_SUBST(MYSQL_LIBS)
@@ -661,6 +658,7 @@ else
        LIBS="$saveLIBS"
        HAVE_AUTHSQLITE=1
        CFLAGS="$SQLITE_CFLAGS $CFLAGS"
+       CXXFLAGS="$SQLITE_CXXFLAGS $CFLAGS"
        LIBAUTHSQLITE="libauthsqlite.la"
 
 fi
@@ -737,6 +735,8 @@ saveLIBS="$LIBS"
 LIBS="$CRYPTLIBS $LIBS"
 AC_CHECK_FUNC(crypt, AC_DEFINE_UNQUOTED(HAVE_CRYPT, 1,
                     [ Whether we have the crypt() function ]))
+AC_CHECK_FUNC(bcrypt, AC_DEFINE_UNQUOTED(HAVE_BCRYPT, 1,
+                    [ Whether we have the bcrypt() function ]))
 LIBS="$saveLIBS"
 AC_CACHE_CHECK([for crypt() prototype],userdb_cv_NEED_CRYPT_PROTOTYPE,
 
index f140a8f..cf0f188 100644 (file)
@@ -3,7 +3,7 @@
 # distribution information.
 
 Name:           courier-authlib
-Version:        0.66.4
+Version:        0.69.0
 Release:        1
 
 License:        GPLv3
index ca551a1..3312d99 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright 1998 - 2010 Double Precision, Inc.  See COPYING for
+# Copyright 1998 - 2017 Double Precision, Inc.  See COPYING for
 # distribution information.
 
 # No dist tag from mock; detect mandrake, redhat, etc. the old fashioned way
@@ -14,7 +14,7 @@
 ################################################################################
 
 Name:           courier-authlib
-Version:        0.66.4
+Version:        0.69.0
 Release:        1%{?dist}%{?courier_release}
 Summary:        Courier authentication library
 
@@ -24,7 +24,7 @@ URL:            http://www.courier-mta.org
 
 ################################################################################
 
-Source:         http://dl.sourceforge.net/courier/%{name}-%{version}.tar.bz2
+Source:         http://downloads.sourceforge.net/courier/%{name}-%{version}.tar.bz2
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
@@ -45,6 +45,7 @@ BuildRequires:      %{_includedir}/ltdl.h
 
 %if 0%(rpm -q redhat-release >/dev/null 2>&1 || rpm -q fedora-release >/dev/null 2>&1 || exit 0; echo "1")
 BuildRequires:      redhat-rpm-config
+BuildRequires:      /usr/bin/ps
 %endif
 
 %if %using_systemd
@@ -56,6 +57,12 @@ Requires(post):     /sbin/chkconfig
 Requires(preun):    /sbin/chkconfig
 %endif
 
+%define need_perl_generators %(if rpm -q fedora-release >/dev/null 2>/dev/null; then echo "1"; exit 0; fi; echo "1"; exit 1)
+
+%if %need_perl_generators
+BuildRequires: perl-generators
+%endif
+
 ################################################################################
 
 %description
@@ -277,16 +284,15 @@ then
         /bin/systemctl stop courier-authlib.service || :
 fi
 %systemd_post courier-authlib.service
+if [ $1 -eq 1 ]
+then
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
 %else
 /sbin/chkconfig --del courier-authlib
 /sbin/chkconfig --add courier-authlib
 %endif
 %preun
-if test -x %{_sbindir}/authdaemond
-then
-       %{_sbindir}/authdaemond stop >/dev/null 2>&1 || /bin/true
-fi
-
 if test "$1" = "0"
 then
 %if %using_systemd
@@ -298,6 +304,10 @@ fi
 
 %postun
 %if %using_systemd
+if [ $1 -eq 0 ]
+then
+    /bin/systemctl daemon-reload
+fi
 %systemd_postun_with_restart courier-authlib.service
 %endif
 
@@ -354,4 +364,3 @@ rm -rf $RPM_BUILD_ROOT
 
 * Sun Oct  3 2004 Mr. Sam <sam@email-scan.com>                          0.50-1
 - Initial build.
-
index f2933bd..508c4d3 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright 1998 - 2010 Double Precision, Inc.  See COPYING for
+# Copyright 1998 - 2017 Double Precision, Inc.  See COPYING for
 # distribution information.
 
 # No dist tag from mock; detect mandrake, redhat, etc. the old fashioned way
@@ -24,7 +24,7 @@ URL:            http://www.courier-mta.org
 
 ################################################################################
 
-Source:         http://dl.sourceforge.net/courier/%{name}-%{version}.tar.bz2
+Source:         http://downloads.sourceforge.net/courier/%{name}-%{version}.tar.bz2
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
@@ -45,6 +45,7 @@ BuildRequires:      %{_includedir}/ltdl.h
 
 %if 0%(rpm -q redhat-release >/dev/null 2>&1 || rpm -q fedora-release >/dev/null 2>&1 || exit 0; echo "1")
 BuildRequires:      redhat-rpm-config
+BuildRequires:      /usr/bin/ps
 %endif
 
 %if %using_systemd
@@ -56,6 +57,12 @@ Requires(post):     /sbin/chkconfig
 Requires(preun):    /sbin/chkconfig
 %endif
 
+%define need_perl_generators %(if rpm -q fedora-release >/dev/null 2>/dev/null; then echo "1"; exit 0; fi; echo "1"; exit 1)
+
+%if %need_perl_generators
+BuildRequires: perl-generators
+%endif
+
 ################################################################################
 
 %description
@@ -277,16 +284,15 @@ then
         /bin/systemctl stop courier-authlib.service || :
 fi
 %systemd_post courier-authlib.service
+if [ $1 -eq 1 ]
+then
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
 %else
 /sbin/chkconfig --del courier-authlib
 /sbin/chkconfig --add courier-authlib
 %endif
 %preun
-if test -x %{_sbindir}/authdaemond
-then
-       %{_sbindir}/authdaemond stop >/dev/null 2>&1 || /bin/true
-fi
-
 if test "$1" = "0"
 then
 %if %using_systemd
@@ -298,6 +304,10 @@ fi
 
 %postun
 %if %using_systemd
+if [ $1 -eq 0 ]
+then
+    /bin/systemctl daemon-reload
+fi
 %systemd_postun_with_restart courier-authlib.service
 %endif
 
@@ -354,4 +364,3 @@ rm -rf $RPM_BUILD_ROOT
 
 * Sun Oct  3 2004 Mr. Sam <sam@email-scan.com>                          0.50-1
 - Initial build.
-
index c033328..9b73a14 100644 (file)
@@ -25,6 +25,9 @@
 /* Define to 1 if you have the `argz_stringify' function. */
 #define HAVE_ARGZ_STRINGIFY 1
 
+/* Whether we have the bcrypt() function */
+/* #undef HAVE_BCRYPT */
+
 /* Define to 1 if you have the `closedir' function. */
 #define HAVE_CLOSEDIR 1
 
 /* #undef LTDL_DLOPEN_DEPLIBS */
 
 /* Define to the system default library search path. */
-#define LT_DLSEARCH_PATH "/lib64:/usr/lib64:/lib:/usr/lib:/usr/lib64/atlas:/usr/lib64/bind99:/usr/lib64/dyninst:/usr/lib64/llvm:/usr/lib64/mysql"
+#define LT_DLSEARCH_PATH "/lib64:/usr/lib64:/lib:/usr/lib:/usr/lib64/atlas:/usr/lib64//bind9-export/:/usr/lib64/mysql:/usr/lib64/dyninst"
 
 /* The archive extension */
 #define LT_LIBEXT "a"
index e8618c3..57c45f7 100644 (file)
@@ -24,6 +24,9 @@
 /* Define to 1 if you have the `argz_stringify' function. */
 #undef HAVE_ARGZ_STRINGIFY
 
+/* Whether we have the bcrypt() function */
+#undef HAVE_BCRYPT
+
 /* Define to 1 if you have the `closedir' function. */
 #undef HAVE_CLOSEDIR
 
index 38fcd1a..0ee0faa 100644 (file)
@@ -145,6 +145,45 @@ int auth_callback_default_autocreate(struct authinfo *ainfo);
 
 char *courier_auth_ldap_escape(const char *str);
 
+struct cram_callback_info {
+       struct hmac_hashinfo *h;
+       char *user;
+       char *challenge;
+       char *response;
+       int (*callback_func)(struct authinfo *, void *);
+       void *callback_arg;
+       };
+
+extern int auth_cram_callback(struct authinfo *a, void *vp);
+
+/*
+** auth_get_cram parses out an authentication request.  It checks whether
+** we have the requisite hash function installed, and, if so, base64decodes
+** the challenge and the response.
+*/
+
+struct hmac_hashinfo;
+
+int auth_get_cram(const char *authtype,                        /* authtype */
+                 char *authdata,                       /* authdata */
+
+                 struct cram_callback_info *craminfo);
+               /* Initializes craminfo */
+
+/* auth_get_cram_silent() is auth_get_cram(), but without logging */
+
+int auth_get_cram_silent(const char *authtype, char *authdata,
+                        struct cram_callback_info *craminfo);
+
+/*
+** auth_verify_cram attempts to verify the secret cookie.
+*/
+
+int auth_verify_cram(struct hmac_hashinfo *,   /* The hash function */
+       const char *,                           /* The challenge */
+       const char *,                           /* The response */
+       const char *);                          /* Hashed secret, in hex */
+
 #if 0
 {
 #endif
index 578fa32..a068479 100644 (file)
--- a/cramlib.c
+++ b/cramlib.c
 #include       <string.h>
 #include       <errno.h>
 #include       "courierauthsasl.h"
-#include       "cramlib.h"
+#include       "courierauth.h"
 #include       "courierauthdebug.h"
 #include       "libhmac/hmac.h"
-#include       "cramlib.h"
 
 static int nybble(int c)
 {
diff --git a/cramlib.h b/cramlib.h
deleted file mode 100644 (file)
index a1f95b6..0000000
--- a/cramlib.h
+++ /dev/null
@@ -1,48 +0,0 @@
-#ifndef        cramlib_h
-#define        cramlib_h
-
-#include       "auth.h"
-
-/*
-** Copyright 1998 - 2004 Double Precision, Inc.  See COPYING for
-** distribution information.
-*/
-struct cram_callback_info {
-       struct hmac_hashinfo *h;
-       char *user;
-       char *challenge;
-       char *response;
-       int (*callback_func)(struct authinfo *, void *);
-       void *callback_arg;
-       };
-
-extern int auth_cram_callback(struct authinfo *a, void *vp);
-/*
-** auth_get_cram parses out an authentication request.  It checks whether
-** we have the requisite hash function installed, and, if so, base64decodes
-** the challenge and the response.
-*/
-
-struct hmac_hashinfo;
-
-int auth_get_cram(const char *authtype,                        /* authtype */
-                 char *authdata,                       /* authdata */
-
-                 struct cram_callback_info *craminfo);
-               /* Initializes craminfo */
-
-/* auth_get_cram_silent() is auth_get_cram(), but without logging */
-
-int auth_get_cram_silent(const char *authtype, char *authdata,
-                        struct cram_callback_info *craminfo);
-
-/*
-** auth_verify_cram attempts to verify the secret cookie.
-*/
-
-int auth_verify_cram(struct hmac_hashinfo *,   /* The hash function */
-       const char *,                           /* The challenge */
-       const char *,                           /* The response */
-       const char *);                          /* Hashed secret, in hex */
-
-#endif
index 6229fd6..b185e4b 100644 (file)
@@ -31,20 +31,6 @@ extern char *crypt(const char *, const char *);
 
 static const char crypt_salt[65]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789./";
 
-static const char *crypt_hash(const char *pw)
-{
-       random128binbuf randbuf;
-       char salt[3];
-
-       random128_binary(&randbuf);
-
-       salt[0]=crypt_salt[ randbuf[0] % 64 ];
-       salt[1]=crypt_salt[ randbuf[1] % 64 ];
-       salt[2]=0;
-
-       return (crypt(pw, salt));
-}
-
 static const char *ssha_hash_int(const char *pw)
 {
        random128binbuf randbuf;
@@ -132,8 +118,8 @@ char *authcryptpasswd(const char *password, const char *encryption_hint)
 
        if (!hash_func)
        {
-               hash_func= &crypt_hash;
-               pfix="{CRYPT}";
+               hash_func= &ssha_hash_int;
+               pfix="{SSHA}";
        }
 
        p= (*hash_func)(password);
diff --git a/depcomp b/depcomp
index fda2463..30379e2 100755 (executable)
--- a/depcomp
+++ b/depcomp
@@ -1,9 +1,9 @@
-#! /bin/sh
+#!/bin/sh
 # depcomp - compile a program generating dependencies as side-effects
 
-scriptversion=2013-05-30.07; # UTC
+scriptversion=2016-01-11.22; # UTC
 
-# Copyright (C) 1999-2015 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 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
@@ -251,6 +251,41 @@ hp)
   exit 1
   ;;
 
+sgi)
+  if test "$libtool" = yes; then
+    "$@" "-Wp,-MDupdate,$tmpdepfile"
+  else
+    "$@" -MDupdate "$tmpdepfile"
+  fi
+  stat=$?
+  if test $stat -ne 0; then
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+
+  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
+    echo "$object : \\" > "$depfile"
+    # Clip off the initial element (the dependent).  Don't try to be
+    # clever and replace this with sed code, as IRIX sed won't handle
+    # lines with more than a fixed number of characters (4096 in
+    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
+    # the IRIX cc adds comments like '#:fec' to the end of the
+    # dependency line.
+    tr ' ' "$nl" < "$tmpdepfile" \
+      | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
+      | tr "$nl" ' ' >> "$depfile"
+    echo >> "$depfile"
+    # The second pass generates a dummy entry for each header file.
+    tr ' ' "$nl" < "$tmpdepfile" \
+      | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+      >> "$depfile"
+  else
+    make_dummy_depfile
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
 xlc)
   # This case exists only to let depend.m4 do its work.  It works by
   # looking at the text of this script.  This case will never be run,
@@ -751,6 +786,6 @@ exit 0
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
+# time-stamp-time-zone: "UTC0"
 # time-stamp-end: "; # UTC"
 # End:
index 3f7a232..b1ecd33 100644 (file)
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -643,7 +643,7 @@ distdir: $(DISTFILES)
          ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
        || chmod -R a+r "$(distdir)"
 dist-gzip: distdir
-       tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+       tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
        $(am__post_remove_distdir)
 
 dist-bzip2: distdir
@@ -669,7 +669,7 @@ dist-shar: distdir
        @echo WARNING: "Support for shar distribution archives is" \
                       "deprecated." >&2
        @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
-       shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+       shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
        $(am__post_remove_distdir)
 
 dist-zip: distdir
@@ -687,7 +687,7 @@ dist dist-all:
 distcheck: dist
        case '$(DIST_ARCHIVES)' in \
        *.tar.gz*) \
-         GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+         eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
        *.tar.bz2*) \
          bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
        *.tar.lz*) \
@@ -697,7 +697,7 @@ distcheck: dist
        *.tar.Z*) \
          uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
        *.shar.gz*) \
-         GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+         eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
        *.zip*) \
          unzip $(distdir).zip ;;\
        esac
index f5ac395..166c0de 100644 (file)
@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.15 -*- Autoconf -*-
+# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9052,7 +9052,7 @@ m4_ifndef([_LT_PROG_F77],         [AC_DEFUN([_LT_PROG_F77])])
 m4_ifndef([_LT_PROG_FC],               [AC_DEFUN([_LT_PROG_FC])])
 m4_ifndef([_LT_PROG_CXX],              [AC_DEFUN([_LT_PROG_CXX])])
 
-# Copyright (C) 2002-2014 Free Software Foundation, Inc.
+# Copyright (C) 2002-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9067,7 +9067,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
 [am__api_version='1.15'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.15], [],
+m4_if([$1], [1.15.1], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -9083,14 +9083,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.15])dnl
+[AM_AUTOMAKE_VERSION([1.15.1])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9142,7 +9142,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
 
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9173,7 +9173,7 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9364,7 +9364,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9440,7 +9440,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 
 # Do all the work for Automake.                             -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9637,7 +9637,7 @@ for _am_header in $config_headers :; do
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9658,7 +9658,7 @@ if test x"${install_sh+set}" != xset; then
 fi
 AC_SUBST([install_sh])])
 
-# Copyright (C) 2003-2014 Free Software Foundation, Inc.
+# Copyright (C) 2003-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9679,7 +9679,7 @@ AC_SUBST([am__leading_dot])])
 
 # Check to see how 'make' treats includes.                 -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9729,7 +9729,7 @@ rm -f confinc confmf
 
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9768,7 +9768,7 @@ fi
 
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9797,7 +9797,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
 AC_DEFUN([_AM_IF_OPTION],
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9844,7 +9844,7 @@ AC_LANG_POP([C])])
 # For backward compatibility.
 AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9863,7 +9863,7 @@ AC_DEFUN([AM_RUN_LOG],
 
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9944,7 +9944,7 @@ AC_CONFIG_COMMANDS_PRE(
 rm -f conftest.file
 ])
 
-# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2009-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10004,7 +10004,7 @@ AC_SUBST([AM_BACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
 ])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10032,7 +10032,7 @@ fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006-2014 Free Software Foundation, Inc.
+# Copyright (C) 2006-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10051,7 +10051,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004-2014 Free Software Foundation, Inc.
+# Copyright (C) 2004-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
index 235548f..fb604f4 100644 (file)
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -609,7 +609,7 @@ distdir: $(DISTFILES)
          ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
        || chmod -R a+r "$(distdir)"
 dist-gzip: distdir
-       tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+       tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
        $(am__post_remove_distdir)
 
 dist-bzip2: distdir
@@ -635,7 +635,7 @@ dist-shar: distdir
        @echo WARNING: "Support for shar distribution archives is" \
                       "deprecated." >&2
        @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
-       shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+       shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
        $(am__post_remove_distdir)
 
 dist-zip: distdir
@@ -653,7 +653,7 @@ dist dist-all:
 distcheck: dist
        case '$(DIST_ARCHIVES)' in \
        *.tar.gz*) \
-         GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+         eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
        *.tar.bz2*) \
          bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
        *.tar.lz*) \
@@ -663,7 +663,7 @@ distcheck: dist
        *.tar.Z*) \
          uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
        *.shar.gz*) \
-         GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+         eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
        *.zip*) \
          unzip $(distdir).zip ;;\
        esac
index f5ac395..166c0de 100644 (file)
@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.15 -*- Autoconf -*-
+# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9052,7 +9052,7 @@ m4_ifndef([_LT_PROG_F77],         [AC_DEFUN([_LT_PROG_F77])])
 m4_ifndef([_LT_PROG_FC],               [AC_DEFUN([_LT_PROG_FC])])
 m4_ifndef([_LT_PROG_CXX],              [AC_DEFUN([_LT_PROG_CXX])])
 
-# Copyright (C) 2002-2014 Free Software Foundation, Inc.
+# Copyright (C) 2002-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9067,7 +9067,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
 [am__api_version='1.15'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.15], [],
+m4_if([$1], [1.15.1], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -9083,14 +9083,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.15])dnl
+[AM_AUTOMAKE_VERSION([1.15.1])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9142,7 +9142,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
 
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9173,7 +9173,7 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9364,7 +9364,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9440,7 +9440,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 
 # Do all the work for Automake.                             -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9637,7 +9637,7 @@ for _am_header in $config_headers :; do
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9658,7 +9658,7 @@ if test x"${install_sh+set}" != xset; then
 fi
 AC_SUBST([install_sh])])
 
-# Copyright (C) 2003-2014 Free Software Foundation, Inc.
+# Copyright (C) 2003-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9679,7 +9679,7 @@ AC_SUBST([am__leading_dot])])
 
 # Check to see how 'make' treats includes.                 -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9729,7 +9729,7 @@ rm -f confinc confmf
 
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9768,7 +9768,7 @@ fi
 
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9797,7 +9797,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
 AC_DEFUN([_AM_IF_OPTION],
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9844,7 +9844,7 @@ AC_LANG_POP([C])])
 # For backward compatibility.
 AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9863,7 +9863,7 @@ AC_DEFUN([AM_RUN_LOG],
 
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9944,7 +9944,7 @@ AC_CONFIG_COMMANDS_PRE(
 rm -f conftest.file
 ])
 
-# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2009-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10004,7 +10004,7 @@ AC_SUBST([AM_BACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
 ])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10032,7 +10032,7 @@ fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006-2014 Free Software Foundation, Inc.
+# Copyright (C) 2006-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10051,7 +10051,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004-2014 Free Software Foundation, Inc.
+# Copyright (C) 2004-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
index fbb95fa..5313beb 100644 (file)
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -610,7 +610,7 @@ distdir: $(DISTFILES)
          ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
        || chmod -R a+r "$(distdir)"
 dist-gzip: distdir
-       tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+       tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
        $(am__post_remove_distdir)
 
 dist-bzip2: distdir
@@ -636,7 +636,7 @@ dist-shar: distdir
        @echo WARNING: "Support for shar distribution archives is" \
                       "deprecated." >&2
        @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
-       shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+       shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
        $(am__post_remove_distdir)
 
 dist-zip: distdir
@@ -654,7 +654,7 @@ dist dist-all:
 distcheck: dist
        case '$(DIST_ARCHIVES)' in \
        *.tar.gz*) \
-         GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+         eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
        *.tar.bz2*) \
          bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
        *.tar.lz*) \
@@ -664,7 +664,7 @@ distcheck: dist
        *.tar.Z*) \
          uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
        *.shar.gz*) \
-         GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+         eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
        *.zip*) \
          unzip $(distdir).zip ;;\
        esac
index f5ac395..166c0de 100644 (file)
@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.15 -*- Autoconf -*-
+# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9052,7 +9052,7 @@ m4_ifndef([_LT_PROG_F77],         [AC_DEFUN([_LT_PROG_F77])])
 m4_ifndef([_LT_PROG_FC],               [AC_DEFUN([_LT_PROG_FC])])
 m4_ifndef([_LT_PROG_CXX],              [AC_DEFUN([_LT_PROG_CXX])])
 
-# Copyright (C) 2002-2014 Free Software Foundation, Inc.
+# Copyright (C) 2002-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9067,7 +9067,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
 [am__api_version='1.15'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.15], [],
+m4_if([$1], [1.15.1], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -9083,14 +9083,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.15])dnl
+[AM_AUTOMAKE_VERSION([1.15.1])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9142,7 +9142,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
 
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9173,7 +9173,7 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9364,7 +9364,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9440,7 +9440,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 
 # Do all the work for Automake.                             -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9637,7 +9637,7 @@ for _am_header in $config_headers :; do
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9658,7 +9658,7 @@ if test x"${install_sh+set}" != xset; then
 fi
 AC_SUBST([install_sh])])
 
-# Copyright (C) 2003-2014 Free Software Foundation, Inc.
+# Copyright (C) 2003-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9679,7 +9679,7 @@ AC_SUBST([am__leading_dot])])
 
 # Check to see how 'make' treats includes.                 -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9729,7 +9729,7 @@ rm -f confinc confmf
 
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9768,7 +9768,7 @@ fi
 
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9797,7 +9797,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
 AC_DEFUN([_AM_IF_OPTION],
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9844,7 +9844,7 @@ AC_LANG_POP([C])])
 # For backward compatibility.
 AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9863,7 +9863,7 @@ AC_DEFUN([AM_RUN_LOG],
 
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9944,7 +9944,7 @@ AC_CONFIG_COMMANDS_PRE(
 rm -f conftest.file
 ])
 
-# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2009-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10004,7 +10004,7 @@ AC_SUBST([AM_BACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
 ])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10032,7 +10032,7 @@ fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006-2014 Free Software Foundation, Inc.
+# Copyright (C) 2006-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10051,7 +10051,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004-2014 Free Software Foundation, Inc.
+# Copyright (C) 2004-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
index a32a468..1ce5c48 100644 (file)
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -570,7 +570,7 @@ distdir: $(DISTFILES)
          ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
        || chmod -R a+r "$(distdir)"
 dist-gzip: distdir
-       tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+       tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
        $(am__post_remove_distdir)
 
 dist-bzip2: distdir
@@ -596,7 +596,7 @@ dist-shar: distdir
        @echo WARNING: "Support for shar distribution archives is" \
                       "deprecated." >&2
        @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
-       shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+       shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
        $(am__post_remove_distdir)
 
 dist-zip: distdir
@@ -614,7 +614,7 @@ dist dist-all:
 distcheck: dist
        case '$(DIST_ARCHIVES)' in \
        *.tar.gz*) \
-         GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+         eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
        *.tar.bz2*) \
          bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
        *.tar.lz*) \
@@ -624,7 +624,7 @@ distcheck: dist
        *.tar.Z*) \
          uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
        *.shar.gz*) \
-         GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+         eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
        *.zip*) \
          unzip $(distdir).zip ;;\
        esac
index f5ac395..166c0de 100644 (file)
@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.15 -*- Autoconf -*-
+# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9052,7 +9052,7 @@ m4_ifndef([_LT_PROG_F77],         [AC_DEFUN([_LT_PROG_F77])])
 m4_ifndef([_LT_PROG_FC],               [AC_DEFUN([_LT_PROG_FC])])
 m4_ifndef([_LT_PROG_CXX],              [AC_DEFUN([_LT_PROG_CXX])])
 
-# Copyright (C) 2002-2014 Free Software Foundation, Inc.
+# Copyright (C) 2002-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9067,7 +9067,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
 [am__api_version='1.15'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.15], [],
+m4_if([$1], [1.15.1], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -9083,14 +9083,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.15])dnl
+[AM_AUTOMAKE_VERSION([1.15.1])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9142,7 +9142,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
 
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9173,7 +9173,7 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9364,7 +9364,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9440,7 +9440,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 
 # Do all the work for Automake.                             -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9637,7 +9637,7 @@ for _am_header in $config_headers :; do
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9658,7 +9658,7 @@ if test x"${install_sh+set}" != xset; then
 fi
 AC_SUBST([install_sh])])
 
-# Copyright (C) 2003-2014 Free Software Foundation, Inc.
+# Copyright (C) 2003-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9679,7 +9679,7 @@ AC_SUBST([am__leading_dot])])
 
 # Check to see how 'make' treats includes.                 -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9729,7 +9729,7 @@ rm -f confinc confmf
 
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9768,7 +9768,7 @@ fi
 
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9797,7 +9797,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
 AC_DEFUN([_AM_IF_OPTION],
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9844,7 +9844,7 @@ AC_LANG_POP([C])])
 # For backward compatibility.
 AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9863,7 +9863,7 @@ AC_DEFUN([AM_RUN_LOG],
 
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9944,7 +9944,7 @@ AC_CONFIG_COMMANDS_PRE(
 rm -f conftest.file
 ])
 
-# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2009-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10004,7 +10004,7 @@ AC_SUBST([AM_BACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
 ])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10032,7 +10032,7 @@ fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006-2014 Free Software Foundation, Inc.
+# Copyright (C) 2006-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10051,7 +10051,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004-2014 Free Software Foundation, Inc.
+# Copyright (C) 2004-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
index 333de47..3b59fcf 100644 (file)
@@ -41,5 +41,5 @@ lockmail.html: lockmail.sgml ../docbook/sgml2html
        ../docbook/sgml2html lockmail.sgml lockmail.html
 
 lockmail.1: lockmail.sgml ../docbook/sgml2man
-       ../docbook/sgml2man lockmail.sgml lockmail.1
+       ../docbook/sgml2man lockmail.sgml lockmail.1 "--stringparam man.base.url.for.relative.links http://www.courier-mta.org/"
 endif
index 9867eff..3fa07ae 100644 (file)
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -572,7 +572,7 @@ distdir: $(DISTFILES)
          ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
        || chmod -R a+r "$(distdir)"
 dist-gzip: distdir
-       tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+       tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
        $(am__post_remove_distdir)
 
 dist-bzip2: distdir
@@ -598,7 +598,7 @@ dist-shar: distdir
        @echo WARNING: "Support for shar distribution archives is" \
                       "deprecated." >&2
        @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
-       shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+       shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
        $(am__post_remove_distdir)
 
 dist-zip: distdir
@@ -616,7 +616,7 @@ dist dist-all:
 distcheck: dist
        case '$(DIST_ARCHIVES)' in \
        *.tar.gz*) \
-         GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+         eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
        *.tar.bz2*) \
          bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
        *.tar.lz*) \
@@ -626,7 +626,7 @@ distcheck: dist
        *.tar.Z*) \
          uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
        *.shar.gz*) \
-         GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+         eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
        *.zip*) \
          unzip $(distdir).zip ;;\
        esac
@@ -830,7 +830,7 @@ uninstall-am:
 @HAVE_SGML_TRUE@       ../docbook/sgml2html lockmail.sgml lockmail.html
 
 @HAVE_SGML_TRUE@lockmail.1: lockmail.sgml ../docbook/sgml2man
-@HAVE_SGML_TRUE@       ../docbook/sgml2man lockmail.sgml lockmail.1
+@HAVE_SGML_TRUE@       ../docbook/sgml2man lockmail.sgml lockmail.1 "--stringparam man.base.url.for.relative.links http://www.courier-mta.org/"
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
index f5ac395..166c0de 100644 (file)
@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.15 -*- Autoconf -*-
+# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9052,7 +9052,7 @@ m4_ifndef([_LT_PROG_F77],         [AC_DEFUN([_LT_PROG_F77])])
 m4_ifndef([_LT_PROG_FC],               [AC_DEFUN([_LT_PROG_FC])])
 m4_ifndef([_LT_PROG_CXX],              [AC_DEFUN([_LT_PROG_CXX])])
 
-# Copyright (C) 2002-2014 Free Software Foundation, Inc.
+# Copyright (C) 2002-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9067,7 +9067,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
 [am__api_version='1.15'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.15], [],
+m4_if([$1], [1.15.1], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -9083,14 +9083,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.15])dnl
+[AM_AUTOMAKE_VERSION([1.15.1])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9142,7 +9142,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
 
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9173,7 +9173,7 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9364,7 +9364,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9440,7 +9440,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 
 # Do all the work for Automake.                             -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9637,7 +9637,7 @@ for _am_header in $config_headers :; do
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9658,7 +9658,7 @@ if test x"${install_sh+set}" != xset; then
 fi
 AC_SUBST([install_sh])])
 
-# Copyright (C) 2003-2014 Free Software Foundation, Inc.
+# Copyright (C) 2003-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9679,7 +9679,7 @@ AC_SUBST([am__leading_dot])])
 
 # Check to see how 'make' treats includes.                 -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9729,7 +9729,7 @@ rm -f confinc confmf
 
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9768,7 +9768,7 @@ fi
 
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9797,7 +9797,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
 AC_DEFUN([_AM_IF_OPTION],
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9844,7 +9844,7 @@ AC_LANG_POP([C])])
 # For backward compatibility.
 AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9863,7 +9863,7 @@ AC_DEFUN([AM_RUN_LOG],
 
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9944,7 +9944,7 @@ AC_CONFIG_COMMANDS_PRE(
 rm -f conftest.file
 ])
 
-# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2009-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10004,7 +10004,7 @@ AC_SUBST([AM_BACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
 ])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10032,7 +10032,7 @@ fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006-2014 Free Software Foundation, Inc.
+# Copyright (C) 2006-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10051,7 +10051,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004-2014 Free Software Foundation, Inc.
+# Copyright (C) 2004-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
index 114bea6..f491f59 100644 (file)
@@ -3,13 +3,13 @@
 .\"<!-- distribution information. -->
 .\"     Title: lockmail
 .\"    Author: Sam Varshavchik
-.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\"      Date: 06/20/2015
+.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
+.\"      Date: 09/08/2017
 .\"    Manual: Double Precision, Inc.
 .\"    Source: Courier Mail Server
 .\"  Language: English
 .\"
-.TH "LOCKMAIL" "1" "06/20/2015" "Courier Mail Server" "Double Precision, Inc\&."
+.TH "LOCKMAIL" "1" "09/08/2017" "Courier Mail Server" "Double Precision, Inc\&."
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -179,7 +179,8 @@ will then terminate with the same exit code as
 .PP
 \fBlockmail\fR
 terminates with the same exit status as
-\fIprogram\fR\fBlockmail\fR
+\fIprogram\fR
+\fBlockmail\fR
 terminates with the
 EX_TEMPFAIL
 exit status if it was unable to obtain a lock, or if
@@ -199,5 +200,5 @@ Author
 .IP " 1." 4
 \fBmaildrop\fR(1)
 .RS 4
-\%[set $man.base.url.for.relative.links]/maildrop.html
+\%http://www.courier-mta.org/maildrop.html
 .RE
index 7bee62e..41ed51d 100644 (file)
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -536,7 +536,7 @@ distdir: $(DISTFILES)
          ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
        || chmod -R a+r "$(distdir)"
 dist-gzip: distdir
-       tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+       tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
        $(am__post_remove_distdir)
 
 dist-bzip2: distdir
@@ -562,7 +562,7 @@ dist-shar: distdir
        @echo WARNING: "Support for shar distribution archives is" \
                       "deprecated." >&2
        @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
-       shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+       shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
        $(am__post_remove_distdir)
 
 dist-zip: distdir
@@ -580,7 +580,7 @@ dist dist-all:
 distcheck: dist
        case '$(DIST_ARCHIVES)' in \
        *.tar.gz*) \
-         GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+         eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
        *.tar.bz2*) \
          bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
        *.tar.lz*) \
@@ -590,7 +590,7 @@ distcheck: dist
        *.tar.Z*) \
          uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
        *.shar.gz*) \
-         GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+         eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
        *.zip*) \
          unzip $(distdir).zip ;;\
        esac
index f5ac395..166c0de 100644 (file)
@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.15 -*- Autoconf -*-
+# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9052,7 +9052,7 @@ m4_ifndef([_LT_PROG_F77],         [AC_DEFUN([_LT_PROG_F77])])
 m4_ifndef([_LT_PROG_FC],               [AC_DEFUN([_LT_PROG_FC])])
 m4_ifndef([_LT_PROG_CXX],              [AC_DEFUN([_LT_PROG_CXX])])
 
-# Copyright (C) 2002-2014 Free Software Foundation, Inc.
+# Copyright (C) 2002-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9067,7 +9067,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
 [am__api_version='1.15'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.15], [],
+m4_if([$1], [1.15.1], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -9083,14 +9083,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.15])dnl
+[AM_AUTOMAKE_VERSION([1.15.1])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9142,7 +9142,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
 
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9173,7 +9173,7 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9364,7 +9364,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9440,7 +9440,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 
 # Do all the work for Automake.                             -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9637,7 +9637,7 @@ for _am_header in $config_headers :; do
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9658,7 +9658,7 @@ if test x"${install_sh+set}" != xset; then
 fi
 AC_SUBST([install_sh])])
 
-# Copyright (C) 2003-2014 Free Software Foundation, Inc.
+# Copyright (C) 2003-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9679,7 +9679,7 @@ AC_SUBST([am__leading_dot])])
 
 # Check to see how 'make' treats includes.                 -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9729,7 +9729,7 @@ rm -f confinc confmf
 
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9768,7 +9768,7 @@ fi
 
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9797,7 +9797,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
 AC_DEFUN([_AM_IF_OPTION],
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9844,7 +9844,7 @@ AC_LANG_POP([C])])
 # For backward compatibility.
 AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9863,7 +9863,7 @@ AC_DEFUN([AM_RUN_LOG],
 
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9944,7 +9944,7 @@ AC_CONFIG_COMMANDS_PRE(
 rm -f conftest.file
 ])
 
-# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2009-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10004,7 +10004,7 @@ AC_SUBST([AM_BACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
 ])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10032,7 +10032,7 @@ fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006-2014 Free Software Foundation, Inc.
+# Copyright (C) 2006-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10051,7 +10051,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004-2014 Free Software Foundation, Inc.
+# Copyright (C) 2004-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
index 113838c..53259ab 100644 (file)
@@ -83,11 +83,7 @@ get_access() {
        then
                if test "$srcfile" != "CVS"
                then
-                       for f in "$srcfile"/*
-                       do
-                               test -f $f || continue
-                               cat "$f" || return
-                       done
+                       find -L "$srcfile" -maxdepth 1 -type f -not -name "*~" -not -regex ".*\.dpkg-[a-z]*" -exec cat {} \;
                fi
        else
                cat "$srcfile" || return
@@ -115,6 +111,7 @@ docidr() {
                            foreach ( Net::CIDR::cidr2octets(
                                        Net::CIDR::range2cidr($net)))
                            {
+                               print ":" if $net =~ /:/;
                                print "$_\t$line\n";
                            }
                        }
index db8990b..d02d581 100644 (file)
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -560,7 +560,7 @@ distdir: $(DISTFILES)
          ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
        || chmod -R a+r "$(distdir)"
 dist-gzip: distdir
-       tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+       tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
        $(am__post_remove_distdir)
 
 dist-bzip2: distdir
@@ -586,7 +586,7 @@ dist-shar: distdir
        @echo WARNING: "Support for shar distribution archives is" \
                       "deprecated." >&2
        @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
-       shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+       shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
        $(am__post_remove_distdir)
 
 dist-zip: distdir
@@ -604,7 +604,7 @@ dist dist-all:
 distcheck: dist
        case '$(DIST_ARCHIVES)' in \
        *.tar.gz*) \
-         GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+         eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
        *.tar.bz2*) \
          bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
        *.tar.lz*) \
@@ -614,7 +614,7 @@ distcheck: dist
        *.tar.Z*) \
          uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
        *.shar.gz*) \
-         GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+         eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
        *.zip*) \
          unzip $(distdir).zip ;;\
        esac
index f5ac395..166c0de 100644 (file)
@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.15 -*- Autoconf -*-
+# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9052,7 +9052,7 @@ m4_ifndef([_LT_PROG_F77],         [AC_DEFUN([_LT_PROG_F77])])
 m4_ifndef([_LT_PROG_FC],               [AC_DEFUN([_LT_PROG_FC])])
 m4_ifndef([_LT_PROG_CXX],              [AC_DEFUN([_LT_PROG_CXX])])
 
-# Copyright (C) 2002-2014 Free Software Foundation, Inc.
+# Copyright (C) 2002-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9067,7 +9067,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
 [am__api_version='1.15'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.15], [],
+m4_if([$1], [1.15.1], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -9083,14 +9083,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.15])dnl
+[AM_AUTOMAKE_VERSION([1.15.1])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9142,7 +9142,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
 
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9173,7 +9173,7 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9364,7 +9364,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9440,7 +9440,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 
 # Do all the work for Automake.                             -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9637,7 +9637,7 @@ for _am_header in $config_headers :; do
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9658,7 +9658,7 @@ if test x"${install_sh+set}" != xset; then
 fi
 AC_SUBST([install_sh])])
 
-# Copyright (C) 2003-2014 Free Software Foundation, Inc.
+# Copyright (C) 2003-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9679,7 +9679,7 @@ AC_SUBST([am__leading_dot])])
 
 # Check to see how 'make' treats includes.                 -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9729,7 +9729,7 @@ rm -f confinc confmf
 
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9768,7 +9768,7 @@ fi
 
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9797,7 +9797,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
 AC_DEFUN([_AM_IF_OPTION],
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9844,7 +9844,7 @@ AC_LANG_POP([C])])
 # For backward compatibility.
 AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9863,7 +9863,7 @@ AC_DEFUN([AM_RUN_LOG],
 
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9944,7 +9944,7 @@ AC_CONFIG_COMMANDS_PRE(
 rm -f conftest.file
 ])
 
-# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2009-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10004,7 +10004,7 @@ AC_SUBST([AM_BACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
 ])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10032,7 +10032,7 @@ fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006-2014 Free Software Foundation, Inc.
+# Copyright (C) 2006-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10051,7 +10051,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004-2014 Free Software Foundation, Inc.
+# Copyright (C) 2004-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
index 8f4f0e1..798bf5f 100644 (file)
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -560,7 +560,7 @@ distdir: $(DISTFILES)
          ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
        || chmod -R a+r "$(distdir)"
 dist-gzip: distdir
-       tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+       tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
        $(am__post_remove_distdir)
 
 dist-bzip2: distdir
@@ -586,7 +586,7 @@ dist-shar: distdir
        @echo WARNING: "Support for shar distribution archives is" \
                       "deprecated." >&2
        @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
-       shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+       shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
        $(am__post_remove_distdir)
 
 dist-zip: distdir
@@ -604,7 +604,7 @@ dist dist-all:
 distcheck: dist
        case '$(DIST_ARCHIVES)' in \
        *.tar.gz*) \
-         GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+         eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
        *.tar.bz2*) \
          bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
        *.tar.lz*) \
@@ -614,7 +614,7 @@ distcheck: dist
        *.tar.Z*) \
          uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
        *.shar.gz*) \
-         GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+         eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
        *.zip*) \
          unzip $(distdir).zip ;;\
        esac
index f5ac395..166c0de 100644 (file)
@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.15 -*- Autoconf -*-
+# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9052,7 +9052,7 @@ m4_ifndef([_LT_PROG_F77],         [AC_DEFUN([_LT_PROG_F77])])
 m4_ifndef([_LT_PROG_FC],               [AC_DEFUN([_LT_PROG_FC])])
 m4_ifndef([_LT_PROG_CXX],              [AC_DEFUN([_LT_PROG_CXX])])
 
-# Copyright (C) 2002-2014 Free Software Foundation, Inc.
+# Copyright (C) 2002-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9067,7 +9067,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
 [am__api_version='1.15'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.15], [],
+m4_if([$1], [1.15.1], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -9083,14 +9083,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.15])dnl
+[AM_AUTOMAKE_VERSION([1.15.1])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9142,7 +9142,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
 
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9173,7 +9173,7 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9364,7 +9364,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9440,7 +9440,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 
 # Do all the work for Automake.                             -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9637,7 +9637,7 @@ for _am_header in $config_headers :; do
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9658,7 +9658,7 @@ if test x"${install_sh+set}" != xset; then
 fi
 AC_SUBST([install_sh])])
 
-# Copyright (C) 2003-2014 Free Software Foundation, Inc.
+# Copyright (C) 2003-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9679,7 +9679,7 @@ AC_SUBST([am__leading_dot])])
 
 # Check to see how 'make' treats includes.                 -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9729,7 +9729,7 @@ rm -f confinc confmf
 
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9768,7 +9768,7 @@ fi
 
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9797,7 +9797,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
 AC_DEFUN([_AM_IF_OPTION],
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9844,7 +9844,7 @@ AC_LANG_POP([C])])
 # For backward compatibility.
 AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9863,7 +9863,7 @@ AC_DEFUN([AM_RUN_LOG],
 
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9944,7 +9944,7 @@ AC_CONFIG_COMMANDS_PRE(
 rm -f conftest.file
 ])
 
-# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2009-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10004,7 +10004,7 @@ AC_SUBST([AM_BACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
 ])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10032,7 +10032,7 @@ fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006-2014 Free Software Foundation, Inc.
+# Copyright (C) 2006-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10051,7 +10051,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004-2014 Free Software Foundation, Inc.
+# Copyright (C) 2004-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
index b06b9c4..4052882 100644 (file)
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -530,7 +530,7 @@ distdir: $(DISTFILES)
          ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
        || chmod -R a+r "$(distdir)"
 dist-gzip: distdir
-       tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+       tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
        $(am__post_remove_distdir)
 
 dist-bzip2: distdir
@@ -556,7 +556,7 @@ dist-shar: distdir
        @echo WARNING: "Support for shar distribution archives is" \
                       "deprecated." >&2
        @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
-       shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+       shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
        $(am__post_remove_distdir)
 
 dist-zip: distdir
@@ -574,7 +574,7 @@ dist dist-all:
 distcheck: dist
        case '$(DIST_ARCHIVES)' in \
        *.tar.gz*) \
-         GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+         eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
        *.tar.bz2*) \
          bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
        *.tar.lz*) \
@@ -584,7 +584,7 @@ distcheck: dist
        *.tar.Z*) \
          uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
        *.shar.gz*) \
-         GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+         eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
        *.zip*) \
          unzip $(distdir).zip ;;\
        esac
index f5ac395..166c0de 100644 (file)
@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.15 -*- Autoconf -*-
+# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9052,7 +9052,7 @@ m4_ifndef([_LT_PROG_F77],         [AC_DEFUN([_LT_PROG_F77])])
 m4_ifndef([_LT_PROG_FC],               [AC_DEFUN([_LT_PROG_FC])])
 m4_ifndef([_LT_PROG_CXX],              [AC_DEFUN([_LT_PROG_CXX])])
 
-# Copyright (C) 2002-2014 Free Software Foundation, Inc.
+# Copyright (C) 2002-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9067,7 +9067,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
 [am__api_version='1.15'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.15], [],
+m4_if([$1], [1.15.1], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -9083,14 +9083,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.15])dnl
+[AM_AUTOMAKE_VERSION([1.15.1])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9142,7 +9142,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
 
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9173,7 +9173,7 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9364,7 +9364,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9440,7 +9440,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 
 # Do all the work for Automake.                             -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9637,7 +9637,7 @@ for _am_header in $config_headers :; do
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9658,7 +9658,7 @@ if test x"${install_sh+set}" != xset; then
 fi
 AC_SUBST([install_sh])])
 
-# Copyright (C) 2003-2014 Free Software Foundation, Inc.
+# Copyright (C) 2003-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9679,7 +9679,7 @@ AC_SUBST([am__leading_dot])])
 
 # Check to see how 'make' treats includes.                 -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9729,7 +9729,7 @@ rm -f confinc confmf
 
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9768,7 +9768,7 @@ fi
 
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9797,7 +9797,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
 AC_DEFUN([_AM_IF_OPTION],
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9844,7 +9844,7 @@ AC_LANG_POP([C])])
 # For backward compatibility.
 AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9863,7 +9863,7 @@ AC_DEFUN([AM_RUN_LOG],
 
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9944,7 +9944,7 @@ AC_CONFIG_COMMANDS_PRE(
 rm -f conftest.file
 ])
 
-# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2009-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10004,7 +10004,7 @@ AC_SUBST([AM_BACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
 ])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10032,7 +10032,7 @@ fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006-2014 Free Software Foundation, Inc.
+# Copyright (C) 2006-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10051,7 +10051,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004-2014 Free Software Foundation, Inc.
+# Copyright (C) 2004-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
index 931c3c9..5a48308 100644 (file)
@@ -39,7 +39,7 @@ rfc822.html: rfc822.sgml ../docbook/sgml2html
        ../docbook/sgml2html rfc822.sgml rfc822.html
 
 rfc822.3: rfc822.sgml ../docbook/sgml2html
-       ../docbook/sgml2man rfc822.sgml rfc822.3
+       ../docbook/sgml2man rfc822.sgml rfc822.3 "--stringparam man.base.url.for.relative.links http://www.courier-mta.org/"
 endif
 
 check-am:
index cadb754..8554fa7 100644 (file)
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -606,7 +606,7 @@ distdir: $(DISTFILES)
          ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
        || chmod -R a+r "$(distdir)"
 dist-gzip: distdir
-       tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+       tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
        $(am__post_remove_distdir)
 
 dist-bzip2: distdir
@@ -632,7 +632,7 @@ dist-shar: distdir
        @echo WARNING: "Support for shar distribution archives is" \
                       "deprecated." >&2
        @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
-       shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+       shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
        $(am__post_remove_distdir)
 
 dist-zip: distdir
@@ -650,7 +650,7 @@ dist dist-all:
 distcheck: dist
        case '$(DIST_ARCHIVES)' in \
        *.tar.gz*) \
-         GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+         eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
        *.tar.bz2*) \
          bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
        *.tar.lz*) \
@@ -660,7 +660,7 @@ distcheck: dist
        *.tar.Z*) \
          uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
        *.shar.gz*) \
-         GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+         eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
        *.zip*) \
          unzip $(distdir).zip ;;\
        esac
@@ -868,7 +868,7 @@ uninstall-am:
 @HAVE_SGML_TRUE@       ../docbook/sgml2html rfc822.sgml rfc822.html
 
 @HAVE_SGML_TRUE@rfc822.3: rfc822.sgml ../docbook/sgml2html
-@HAVE_SGML_TRUE@       ../docbook/sgml2man rfc822.sgml rfc822.3
+@HAVE_SGML_TRUE@       ../docbook/sgml2man rfc822.sgml rfc822.3 "--stringparam man.base.url.for.relative.links http://www.courier-mta.org/"
 
 check-am:
        ./testsuite | cmp -s - $(srcdir)/testsuite.txt
index 1590e7c..4b89f97 100644 (file)
@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.15 -*- Autoconf -*-
+# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9052,32 +9052,63 @@ m4_ifndef([_LT_PROG_F77],               [AC_DEFUN([_LT_PROG_F77])])
 m4_ifndef([_LT_PROG_FC],               [AC_DEFUN([_LT_PROG_FC])])
 m4_ifndef([_LT_PROG_CXX],              [AC_DEFUN([_LT_PROG_CXX])])
 
-# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
-# serial 1 (pkg-config-0.24)
-# 
-# Copyright Â© 2004 Scott James Remnant <scott@netsplit.com>.
-#
-# 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 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
+# pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
+# serial 11 (pkg-config-0.29.1)
 
-# PKG_PROG_PKG_CONFIG([MIN-VERSION])
-# ----------------------------------
+dnl Copyright Â© 2004 Scott James Remnant <scott@netsplit.com>.
+dnl Copyright Â© 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful, but
+dnl WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+dnl 02111-1307, USA.
+dnl
+dnl As a special exception to the GNU General Public License, if you
+dnl distribute this file as part of a program that contains a
+dnl configuration script generated by Autoconf, you may include it under
+dnl the same distribution terms that you use for the rest of that
+dnl program.
+
+dnl PKG_PREREQ(MIN-VERSION)
+dnl -----------------------
+dnl Since: 0.29
+dnl
+dnl Verify that the version of the pkg-config macros are at least
+dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
+dnl installed version of pkg-config, this checks the developer's version
+dnl of pkg.m4 when generating configure.
+dnl
+dnl To ensure that this macro is defined, also add:
+dnl m4_ifndef([PKG_PREREQ],
+dnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
+dnl
+dnl See the "Since" comment for each macro you use to see what version
+dnl of the macros you require.
+m4_defun([PKG_PREREQ],
+[m4_define([PKG_MACROS_VERSION], [0.29.1])
+m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
+    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
+])dnl PKG_PREREQ
+
+dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
+dnl ----------------------------------
+dnl Since: 0.16
+dnl
+dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
+dnl first found in the path. Checks that the version of pkg-config found
+dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
+dnl used since that's the first version where most current features of
+dnl pkg-config existed.
 AC_DEFUN([PKG_PROG_PKG_CONFIG],
 [m4_pattern_forbid([^_?PKG_[A-Z_]+$])
 m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
@@ -9099,18 +9130,19 @@ if test -n "$PKG_CONFIG"; then
                PKG_CONFIG=""
        fi
 fi[]dnl
-])# PKG_PROG_PKG_CONFIG
+])dnl PKG_PROG_PKG_CONFIG
 
-# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
-#
-# Check to see whether a particular set of modules exists.  Similar
-# to PKG_CHECK_MODULES(), but does not set variables or print errors.
-#
-# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
-# only at the first occurence in configure.ac, so if the first place
-# it's called might be skipped (such as if it is within an "if", you
-# have to call PKG_CHECK_EXISTS manually
-# --------------------------------------------------------------
+dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+dnl -------------------------------------------------------------------
+dnl Since: 0.18
+dnl
+dnl Check to see whether a particular set of modules exists. Similar to
+dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
+dnl
+dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+dnl only at the first occurence in configure.ac, so if the first place
+dnl it's called might be skipped (such as if it is within an "if", you
+dnl have to call PKG_CHECK_EXISTS manually
 AC_DEFUN([PKG_CHECK_EXISTS],
 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
 if test -n "$PKG_CONFIG" && \
@@ -9120,8 +9152,10 @@ m4_ifvaln([$3], [else
   $3])dnl
 fi])
 
-# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
-# ---------------------------------------------
+dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+dnl ---------------------------------------------
+dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
+dnl pkg_failed based on the result.
 m4_define([_PKG_CONFIG],
 [if test -n "$$1"; then
     pkg_cv_[]$1="$$1"
@@ -9133,10 +9167,11 @@ m4_define([_PKG_CONFIG],
  else
     pkg_failed=untried
 fi[]dnl
-])# _PKG_CONFIG
+])dnl _PKG_CONFIG
 
-# _PKG_SHORT_ERRORS_SUPPORTED
-# -----------------------------
+dnl _PKG_SHORT_ERRORS_SUPPORTED
+dnl ---------------------------
+dnl Internal check to see if pkg-config supports short errors.
 AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])
 if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
@@ -9144,19 +9179,17 @@ if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
 else
         _pkg_short_errors_supported=no
 fi[]dnl
-])# _PKG_SHORT_ERRORS_SUPPORTED
+])dnl _PKG_SHORT_ERRORS_SUPPORTED
 
 
-# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
-# [ACTION-IF-NOT-FOUND])
-#
-#
-# Note that if there is a possibility the first call to
-# PKG_CHECK_MODULES might not happen, you should be sure to include an
-# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
-#
-#
-# --------------------------------------------------------------
+dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+dnl   [ACTION-IF-NOT-FOUND])
+dnl --------------------------------------------------------------
+dnl Since: 0.4.0
+dnl
+dnl Note that if there is a possibility the first call to
+dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
+dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
 AC_DEFUN([PKG_CHECK_MODULES],
 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
 AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
@@ -9210,16 +9243,40 @@ else
         AC_MSG_RESULT([yes])
        $3
 fi[]dnl
-])# PKG_CHECK_MODULES
+])dnl PKG_CHECK_MODULES
 
 
-# PKG_INSTALLDIR(DIRECTORY)
-# -------------------------
-# Substitutes the variable pkgconfigdir as the location where a module
-# should install pkg-config .pc files. By default the directory is
-# $libdir/pkgconfig, but the default can be changed by passing
-# DIRECTORY. The user can override through the --with-pkgconfigdir
-# parameter.
+dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+dnl   [ACTION-IF-NOT-FOUND])
+dnl ---------------------------------------------------------------------
+dnl Since: 0.29
+dnl
+dnl Checks for existence of MODULES and gathers its build flags with
+dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
+dnl and VARIABLE-PREFIX_LIBS from --libs.
+dnl
+dnl Note that if there is a possibility the first call to
+dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
+dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
+dnl configure.ac.
+AC_DEFUN([PKG_CHECK_MODULES_STATIC],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+_save_PKG_CONFIG=$PKG_CONFIG
+PKG_CONFIG="$PKG_CONFIG --static"
+PKG_CHECK_MODULES($@)
+PKG_CONFIG=$_save_PKG_CONFIG[]dnl
+])dnl PKG_CHECK_MODULES_STATIC
+
+
+dnl PKG_INSTALLDIR([DIRECTORY])
+dnl -------------------------
+dnl Since: 0.27
+dnl
+dnl Substitutes the variable pkgconfigdir as the location where a module
+dnl should install pkg-config .pc files. By default the directory is
+dnl $libdir/pkgconfig, but the default can be changed by passing
+dnl DIRECTORY. The user can override through the --with-pkgconfigdir
+dnl parameter.
 AC_DEFUN([PKG_INSTALLDIR],
 [m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
 m4_pushdef([pkg_description],
@@ -9230,16 +9287,18 @@ AC_ARG_WITH([pkgconfigdir],
 AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
 m4_popdef([pkg_default])
 m4_popdef([pkg_description])
-]) dnl PKG_INSTALLDIR
+])dnl PKG_INSTALLDIR
 
 
-# PKG_NOARCH_INSTALLDIR(DIRECTORY)
-# -------------------------
-# Substitutes the variable noarch_pkgconfigdir as the location where a
-# module should install arch-independent pkg-config .pc files. By
-# default the directory is $datadir/pkgconfig, but the default can be
-# changed by passing DIRECTORY. The user can override through the
-# --with-noarch-pkgconfigdir parameter.
+dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
+dnl --------------------------------
+dnl Since: 0.27
+dnl
+dnl Substitutes the variable noarch_pkgconfigdir as the location where a
+dnl module should install arch-independent pkg-config .pc files. By
+dnl default the directory is $datadir/pkgconfig, but the default can be
+dnl changed by passing DIRECTORY. The user can override through the
+dnl --with-noarch-pkgconfigdir parameter.
 AC_DEFUN([PKG_NOARCH_INSTALLDIR],
 [m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
 m4_pushdef([pkg_description],
@@ -9250,13 +9309,15 @@ AC_ARG_WITH([noarch-pkgconfigdir],
 AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
 m4_popdef([pkg_default])
 m4_popdef([pkg_description])
-]) dnl PKG_NOARCH_INSTALLDIR
+])dnl PKG_NOARCH_INSTALLDIR
 
 
-# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
-# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
-# -------------------------------------------
-# Retrieves the value of the pkg-config variable for the given module.
+dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
+dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+dnl -------------------------------------------
+dnl Since: 0.28
+dnl
+dnl Retrieves the value of the pkg-config variable for the given module.
 AC_DEFUN([PKG_CHECK_VAR],
 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
 AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
@@ -9265,9 +9326,77 @@ _PKG_CONFIG([$1], [variable="][$3]["], [$2])
 AS_VAR_COPY([$1], [pkg_cv_][$1])
 
 AS_VAR_IF([$1], [""], [$5], [$4])dnl
-])# PKG_CHECK_VAR
+])dnl PKG_CHECK_VAR
+
+dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
+dnl   [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
+dnl   [DESCRIPTION], [DEFAULT])
+dnl ------------------------------------------
+dnl
+dnl Prepare a "--with-" configure option using the lowercase
+dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
+dnl PKG_CHECK_MODULES in a single macro.
+AC_DEFUN([PKG_WITH_MODULES],
+[
+m4_pushdef([with_arg], m4_tolower([$1]))
+
+m4_pushdef([description],
+           [m4_default([$5], [build with ]with_arg[ support])])
+
+m4_pushdef([def_arg], [m4_default([$6], [auto])])
+m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
+m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
+
+m4_case(def_arg,
+            [yes],[m4_pushdef([with_without], [--without-]with_arg)],
+            [m4_pushdef([with_without],[--with-]with_arg)])
+
+AC_ARG_WITH(with_arg,
+     AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
+    [AS_TR_SH([with_]with_arg)=def_arg])
+
+AS_CASE([$AS_TR_SH([with_]with_arg)],
+            [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
+            [auto],[PKG_CHECK_MODULES([$1],[$2],
+                                        [m4_n([def_action_if_found]) $3],
+                                        [m4_n([def_action_if_not_found]) $4])])
+
+m4_popdef([with_arg])
+m4_popdef([description])
+m4_popdef([def_arg])
+
+])dnl PKG_WITH_MODULES
+
+dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
+dnl   [DESCRIPTION], [DEFAULT])
+dnl -----------------------------------------------
+dnl
+dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
+dnl check._[VARIABLE-PREFIX] is exported as make variable.
+AC_DEFUN([PKG_HAVE_WITH_MODULES],
+[
+PKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
+
+AM_CONDITIONAL([HAVE_][$1],
+               [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
+])dnl PKG_HAVE_WITH_MODULES
+
+dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
+dnl   [DESCRIPTION], [DEFAULT])
+dnl ------------------------------------------------------
+dnl
+dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
+dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
+dnl and preprocessor variable.
+AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
+[
+PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
+
+AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
+        [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
+])dnl PKG_HAVE_DEFINE_WITH_MODULES
 
-# Copyright (C) 2002-2014 Free Software Foundation, Inc.
+# Copyright (C) 2002-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9282,7 +9411,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
 [am__api_version='1.15'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.15], [],
+m4_if([$1], [1.15.1], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -9298,14 +9427,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.15])dnl
+[AM_AUTOMAKE_VERSION([1.15.1])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9357,7 +9486,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
 
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9388,7 +9517,7 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9579,7 +9708,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9655,7 +9784,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 
 # Do all the work for Automake.                             -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9852,7 +9981,7 @@ for _am_header in $config_headers :; do
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9873,7 +10002,7 @@ if test x"${install_sh+set}" != xset; then
 fi
 AC_SUBST([install_sh])])
 
-# Copyright (C) 2003-2014 Free Software Foundation, Inc.
+# Copyright (C) 2003-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9894,7 +10023,7 @@ AC_SUBST([am__leading_dot])])
 
 # Check to see how 'make' treats includes.                 -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9944,7 +10073,7 @@ rm -f confinc confmf
 
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9983,7 +10112,7 @@ fi
 
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10012,7 +10141,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
 AC_DEFUN([_AM_IF_OPTION],
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10059,7 +10188,7 @@ AC_LANG_POP([C])])
 # For backward compatibility.
 AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10078,7 +10207,7 @@ AC_DEFUN([AM_RUN_LOG],
 
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10159,7 +10288,7 @@ AC_CONFIG_COMMANDS_PRE(
 rm -f conftest.file
 ])
 
-# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2009-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10219,7 +10348,7 @@ AC_SUBST([AM_BACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
 ])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10247,7 +10376,7 @@ fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006-2014 Free Software Foundation, Inc.
+# Copyright (C) 2006-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10266,7 +10395,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004-2014 Free Software Foundation, Inc.
+# Copyright (C) 2004-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
index 01c6ee7..753a8db 100755 (executable)
@@ -13497,13 +13497,8 @@ int
 main ()
 {
 
-int main()
-{
 time_t t=altzone;
 
-       return (0);
-}
-
   ;
   return 0;
 }
@@ -13520,13 +13515,8 @@ int
 main ()
 {
 
-int main()
-{
 int    n=daylight;
 
-       return (0);
-}
-
   ;
   return 0;
 }
@@ -13545,13 +13535,8 @@ int
 main ()
 {
 
-int main()
-{
 long   n=dummy.tm_gmtoff;
 
-       return (0);
-}
-
   ;
   return 0;
 }
index 8dfee01..62579e8 100644 (file)
@@ -64,23 +64,13 @@ AC_CACHE_CHECK([how to calculate alternate timezone],librfc822_cv_SYS_TIMEZONE,
 AC_TRY_COMPILE([
 #include       <time.h>
 ],[
-int main()
-{
 time_t t=altzone;
-
-       return (0);
-}
 ], librfc822_cv_SYS_TIMEZONE=altzone,
 
        AC_TRY_COMPILE([
 #include       <time.h>
 ],[
-int main()
-{
 int    n=daylight;
-
-       return (0);
-}
        ], librfc822_cv_SYS_TIMEZONE=daylight,
 
        AC_TRY_COMPILE([
@@ -88,12 +78,7 @@ int  n=daylight;
 
 extern struct tm dummy;
 ],[
-int main()
-{
 long   n=dummy.tm_gmtoff;
-
-       return (0);
-}
        ] ,librfc822_cv_SYS_TIMEZONE=tm_gmtoff,
                librfc822_cv_SYS_TIMEZONE=unknown
                        )
index 2c18c50..970d9b7 100644 (file)
@@ -376,7 +376,7 @@ static int encodeqp(const char *ptr, size_t len,
 ** DOENCODEWORD().
 */
 
-static int encode_word(const unicode_char *uc,
+static int encode_word(const char32_t *uc,
                       size_t ucsize,
                       int (*qp_allow)(char),
 
@@ -409,7 +409,7 @@ static int encode_word(const unicode_char *uc,
 ** and keep going as long as encode_word() keeps returning the same value.
 */
 
-static int encode_words(const unicode_char *uc,
+static int encode_words(const char32_t *uc,
                        size_t ucsize,
                        int (*qp_allow)(char),
 
@@ -454,7 +454,7 @@ static int encode_words(const unicode_char *uc,
 /*
 ** Encode a sequence of words.
 */
-static int do_encode_words_method(const unicode_char *uc,
+static int do_encode_words_method(const char32_t *uc,
                                  size_t ucsize,
                                  const char *charset,
                                  int (*qp_allow)(char),
@@ -537,7 +537,7 @@ static int cnt_conv(const char *dummy, size_t n, void *arg)
 ** Encode, or not encode, words.
 */
 
-static int do_encode_words(const unicode_char *uc,
+static int do_encode_words(const char32_t *uc,
                           size_t ucsize,
                           const char *charset,
                           int flag,
@@ -596,7 +596,7 @@ static int do_encode_words(const unicode_char *uc,
 /*
 ** RFC2047-encoding pass.
 */
-static int rfc2047_encode_callback(const unicode_char *uc,
+static int rfc2047_encode_callback(const char32_t *uc,
                                   size_t ucsize,
                                   const char *charset,
                                   int (*qp_allow)(char),
@@ -669,7 +669,7 @@ char *rfc2047_encode_str(const char *str, const char *charset,
 {
        size_t  i=1;
        char    *s, *p;
-       unicode_char *uc;
+       char32_t *uc;
        size_t ucsize;
        int err;
 
index 9966faf..5a3bb85 100644 (file)
@@ -131,7 +131,7 @@ int rfc822_display_name_int(const struct rfc822a *rfcp, int index,
 
        if (chset == NULL)
        {
-               s.chset="iso-8859-1";
+               s.chset="utf-8";
        }
        else
        {
@@ -991,7 +991,7 @@ int rfc2047_decoder(const char *text,
                }
 
                if (i)
-                       (*callback)("iso-8859-1", "", text, i, ptr);
+                       (*callback)("utf-8", "", text, i, ptr);
 
                text += i;
 
@@ -1006,7 +1006,7 @@ int rfc2047_decoder(const char *text,
 
                if (rc == 0)
                {
-                       (*callback)("iso-8859-1", "", text, 2, ptr);
+                       (*callback)("utf-8", "", text, 2, ptr);
                        text += 2;
                        continue;
                }
index 3999bba..19a0b58 100644 (file)
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -563,7 +563,7 @@ distdir: $(DISTFILES)
          ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
        || chmod -R a+r "$(distdir)"
 dist-gzip: distdir
-       tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+       tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
        $(am__post_remove_distdir)
 
 dist-bzip2: distdir
@@ -589,7 +589,7 @@ dist-shar: distdir
        @echo WARNING: "Support for shar distribution archives is" \
                       "deprecated." >&2
        @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
-       shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+       shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
        $(am__post_remove_distdir)
 
 dist-zip: distdir
@@ -607,7 +607,7 @@ dist dist-all:
 distcheck: dist
        case '$(DIST_ARCHIVES)' in \
        *.tar.gz*) \
-         GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+         eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
        *.tar.bz2*) \
          bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
        *.tar.lz*) \
@@ -617,7 +617,7 @@ distcheck: dist
        *.tar.Z*) \
          uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
        *.shar.gz*) \
-         GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+         eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
        *.zip*) \
          unzip $(distdir).zip ;;\
        esac
index f5ac395..166c0de 100644 (file)
@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.15 -*- Autoconf -*-
+# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9052,7 +9052,7 @@ m4_ifndef([_LT_PROG_F77],         [AC_DEFUN([_LT_PROG_F77])])
 m4_ifndef([_LT_PROG_FC],               [AC_DEFUN([_LT_PROG_FC])])
 m4_ifndef([_LT_PROG_CXX],              [AC_DEFUN([_LT_PROG_CXX])])
 
-# Copyright (C) 2002-2014 Free Software Foundation, Inc.
+# Copyright (C) 2002-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9067,7 +9067,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
 [am__api_version='1.15'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.15], [],
+m4_if([$1], [1.15.1], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -9083,14 +9083,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.15])dnl
+[AM_AUTOMAKE_VERSION([1.15.1])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9142,7 +9142,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
 
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9173,7 +9173,7 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9364,7 +9364,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9440,7 +9440,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 
 # Do all the work for Automake.                             -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9637,7 +9637,7 @@ for _am_header in $config_headers :; do
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9658,7 +9658,7 @@ if test x"${install_sh+set}" != xset; then
 fi
 AC_SUBST([install_sh])])
 
-# Copyright (C) 2003-2014 Free Software Foundation, Inc.
+# Copyright (C) 2003-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9679,7 +9679,7 @@ AC_SUBST([am__leading_dot])])
 
 # Check to see how 'make' treats includes.                 -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9729,7 +9729,7 @@ rm -f confinc confmf
 
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9768,7 +9768,7 @@ fi
 
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9797,7 +9797,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
 AC_DEFUN([_AM_IF_OPTION],
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9844,7 +9844,7 @@ AC_LANG_POP([C])])
 # For backward compatibility.
 AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9863,7 +9863,7 @@ AC_DEFUN([AM_RUN_LOG],
 
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9944,7 +9944,7 @@ AC_CONFIG_COMMANDS_PRE(
 rm -f conftest.file
 ])
 
-# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2009-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10004,7 +10004,7 @@ AC_SUBST([AM_BACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
 ])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10032,7 +10032,7 @@ fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006-2014 Free Software Foundation, Inc.
+# Copyright (C) 2006-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10051,7 +10051,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004-2014 Free Software Foundation, Inc.
+# Copyright (C) 2004-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
index 0f0a2da..30be9c8 100644 (file)
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -7272,10 +7272,12 @@ func_mode_link ()
       # -tp=*                Portland pgcc target processor selection
       # --sysroot=*          for sysroot support
       # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
+      # -specs=*             GCC specs files
       # -stdlib=*            select c++ std lib with clang
       -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
       -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
-      -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*)
+      -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
+      -specs=*)
         func_quote_for_eval "$arg"
        arg=$func_quote_for_eval_result
         func_append compile_command " $arg"
diff --git a/missing b/missing
index f62bbae..b7e571e 100755 (executable)
--- a/missing
+++ b/missing
@@ -1,9 +1,9 @@
-#! /bin/sh
+#!/bin/sh
 # Common wrapper for a few potentially missing GNU programs.
 
-scriptversion=2013-10-28.13; # UTC
+scriptversion=2016-01-11.22; # UTC
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 # Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
 
 # This program is free software; you can redistribute it and/or modify
@@ -210,6 +210,6 @@ exit $st
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
+# time-stamp-time-zone: "UTC0"
 # time-stamp-end: "; # UTC"
 # End:
diff --git a/preauthmysql.c b/preauthmysql.c
deleted file mode 100644 (file)
index 2f3af85..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
-** Copyright 1998 - 1999 Double Precision, Inc.  See COPYING for
-** distribution information.
-*/
-
-#if    HAVE_CONFIG_H
-#include       "courier_auth_config.h"
-#endif
-#include       <stdio.h>
-#include       <stdlib.h>
-#include       <string.h>
-#include       <errno.h>
-#include       <pwd.h>
-#if    HAVE_UNISTD_H
-#include       <unistd.h>
-#endif
-
-#include       "auth.h"
-#include       "authmysql.h"
-
-
-
-
-int    auth_mysql_pre(const char *user, const char *service,
-               int (*callback)(struct authinfo *, void *), void *arg)
-{
-struct authmysqluserinfo *authinfo;
-struct authinfo        aa;
-
-       authinfo=auth_mysql_getuserinfo(user, service);
-
-       if (!authinfo)          /* Fatal error - such as MySQL being down */
-               return (1);
-
-       if (!authinfo->home)    /* User not found */
-               return (-1);
-
-       memset(&aa, 0, sizeof(aa));
-
-       /*aa.sysusername=user;*/
-       aa.sysuserid= &authinfo->uid;
-       aa.sysgroupid= authinfo->gid;
-       aa.homedir=authinfo->home;
-       aa.maildir=authinfo->maildir && authinfo->maildir[0] ?
-               authinfo->maildir:0;
-       aa.address=authinfo->username;
-       aa.passwd=authinfo->cryptpw;
-       aa.clearpasswd=authinfo->clearpw;
-       aa.fullname=authinfo->fullname;
-       aa.quota=authinfo->quota && authinfo->quota[0] ?
-               authinfo->quota:0;
-       aa.options=authinfo->options;
-       return ((*callback)(&aa, arg));
-}
diff --git a/preauthmysql.cpp b/preauthmysql.cpp
new file mode 100644 (file)
index 0000000..1351752
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+** Copyright 1998 - 1999 Double Precision, Inc.  See COPYING for
+** distribution information.
+*/
+
+#if    HAVE_CONFIG_H
+#include       "courier_auth_config.h"
+#endif
+#include       <stdio.h>
+#include       <stdlib.h>
+#include       <string.h>
+#include       <errno.h>
+#include       <pwd.h>
+#if    HAVE_UNISTD_H
+#include       <unistd.h>
+#endif
+
+extern "C" {
+#include       "auth.h"
+}
+#include       "authmysql.h"
+
+int    auth_mysql_pre(const char *user, const char *service,
+               int (*callback)(struct authinfo *, void *), void *arg)
+{
+       authmysqluserinfo authinfo;
+       struct  authinfo        aa;
+
+       if (!auth_mysql_getuserinfo(user, service, authinfo))
+               /* Fatal error - such as MySQL being down */
+               return (1);
+
+       if (authinfo.home.size() == 0)  /* User not found */
+               return (-1);
+
+       memset(&aa, 0, sizeof(aa));
+
+       /*aa.sysusername=user;*/
+       aa.sysuserid= &authinfo.uid;
+       aa.sysgroupid= authinfo.gid;
+
+#define STR(z) (authinfo.z.size() ? authinfo.z.c_str():0)
+
+       aa.homedir=STR(home);
+       aa.maildir=STR(maildir);
+       aa.address=STR(username);
+       aa.passwd=STR(cryptpw);
+       aa.clearpasswd=STR(clearpw);
+       aa.fullname=STR(fullname);
+       aa.quota=STR(quota);
+       aa.options=STR(options);
+       return ((*callback)(&aa, arg));
+}
diff --git a/preauthpgsql.c b/preauthpgsql.c
deleted file mode 100644 (file)
index b83826c..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
-** Copyright 1998 - 2003 Double Precision, Inc.  See COPYING for
-** distribution information.
-*/
-
-#if    HAVE_CONFIG_H
-#include       "courier_auth_config.h"
-#endif
-#include       <stdio.h>
-#include       <stdlib.h>
-#include       <string.h>
-#include       <errno.h>
-#include       <pwd.h>
-#if    HAVE_UNISTD_H
-#include       <unistd.h>
-#endif
-
-#include       "auth.h"
-#include       "authpgsql.h"
-
-
-
-
-int    auth_pgsql_pre(const char *user, const char *service,
-               int (*callback)(struct authinfo *, void *), void *arg)
-{
-struct authpgsqluserinfo *authinfo;
-struct authinfo        aa;
-
-       authinfo=auth_pgsql_getuserinfo(user, service);
-
-       if (!authinfo)          /* Fatal error - such as PgSQL being down */
-               return (1);
-
-       if (!authinfo->home)    /* User not found */
-               return (-1);
-
-       memset(&aa, 0, sizeof(aa));
-
-       /*aa.sysusername=user;*/
-       aa.sysuserid= &authinfo->uid;
-       aa.sysgroupid= authinfo->gid;
-       aa.homedir=authinfo->home;
-       aa.maildir=authinfo->maildir && authinfo->maildir[0] ?
-               authinfo->maildir:0;
-       aa.address=authinfo->username;
-       aa.passwd=authinfo->cryptpw;
-       aa.clearpasswd=authinfo->clearpw;
-       aa.fullname=authinfo->fullname;
-       aa.quota=authinfo->quota && authinfo->quota[0] ?
-               authinfo->quota:0;
-       aa.options=authinfo->options;
-       return ((*callback)(&aa, arg));
-}
diff --git a/preauthsqlite.c b/preauthsqlite.c
deleted file mode 100644 (file)
index abb5649..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-** Copyright 1998 - 1999 Double Precision, Inc.  See COPYING for
-** distribution information.
-*/
-
-#if    HAVE_CONFIG_H
-#include       "courier_auth_config.h"
-#endif
-#include       <stdio.h>
-#include       <stdlib.h>
-#include       <string.h>
-#include       <errno.h>
-#include       <pwd.h>
-#if    HAVE_UNISTD_H
-#include       <unistd.h>
-#endif
-
-#include       "auth.h"
-#include       "authsqlite.h"
-
-int    auth_sqlite_pre(const char *user, const char *service,
-                       int (*callback)(struct authinfo *, void *), void *arg)
-{
-       struct authsqliteuserinfo *authinfo;
-       struct  authinfo        aa;
-
-       authinfo=auth_sqlite_getuserinfo(user, service);
-
-       if (!authinfo)          /* Fatal error - such as Sqlite being down */
-               return (1);
-
-       if (!authinfo->home)    /* User not found */
-               return (-1);
-
-       memset(&aa, 0, sizeof(aa));
-
-       /*aa.sysusername=user;*/
-       aa.sysuserid= &authinfo->uid;
-       aa.sysgroupid= authinfo->gid;
-       aa.homedir=authinfo->home;
-       aa.maildir=authinfo->maildir && authinfo->maildir[0] ?
-               authinfo->maildir:0;
-       aa.address=authinfo->username;
-       aa.passwd=authinfo->cryptpw;
-       aa.clearpasswd=authinfo->clearpw;
-       aa.fullname=authinfo->fullname;
-       aa.quota=authinfo->quota && authinfo->quota[0] ?
-               authinfo->quota:0;
-       aa.options=authinfo->options;
-       return ((*callback)(&aa, arg));
-}
index 8f30e3e..43f1d34 100644 (file)
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -656,7 +656,7 @@ distdir: $(DISTFILES)
          ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
        || chmod -R a+r "$(distdir)"
 dist-gzip: distdir
-       tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+       tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
        $(am__post_remove_distdir)
 
 dist-bzip2: distdir
@@ -682,7 +682,7 @@ dist-shar: distdir
        @echo WARNING: "Support for shar distribution archives is" \
                       "deprecated." >&2
        @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
-       shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+       shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
        $(am__post_remove_distdir)
 
 dist-zip: distdir
@@ -700,7 +700,7 @@ dist dist-all:
 distcheck: dist
        case '$(DIST_ARCHIVES)' in \
        *.tar.gz*) \
-         GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+         eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
        *.tar.bz2*) \
          bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
        *.tar.lz*) \
@@ -710,7 +710,7 @@ distcheck: dist
        *.tar.Z*) \
          uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
        *.shar.gz*) \
-         GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+         eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
        *.zip*) \
          unzip $(distdir).zip ;;\
        esac
index f5ac395..166c0de 100644 (file)
@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.15 -*- Autoconf -*-
+# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9052,7 +9052,7 @@ m4_ifndef([_LT_PROG_F77],         [AC_DEFUN([_LT_PROG_F77])])
 m4_ifndef([_LT_PROG_FC],               [AC_DEFUN([_LT_PROG_FC])])
 m4_ifndef([_LT_PROG_CXX],              [AC_DEFUN([_LT_PROG_CXX])])
 
-# Copyright (C) 2002-2014 Free Software Foundation, Inc.
+# Copyright (C) 2002-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9067,7 +9067,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
 [am__api_version='1.15'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.15], [],
+m4_if([$1], [1.15.1], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -9083,14 +9083,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.15])dnl
+[AM_AUTOMAKE_VERSION([1.15.1])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9142,7 +9142,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
 
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9173,7 +9173,7 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9364,7 +9364,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9440,7 +9440,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 
 # Do all the work for Automake.                             -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9637,7 +9637,7 @@ for _am_header in $config_headers :; do
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9658,7 +9658,7 @@ if test x"${install_sh+set}" != xset; then
 fi
 AC_SUBST([install_sh])])
 
-# Copyright (C) 2003-2014 Free Software Foundation, Inc.
+# Copyright (C) 2003-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9679,7 +9679,7 @@ AC_SUBST([am__leading_dot])])
 
 # Check to see how 'make' treats includes.                 -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9729,7 +9729,7 @@ rm -f confinc confmf
 
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9768,7 +9768,7 @@ fi
 
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9797,7 +9797,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
 AC_DEFUN([_AM_IF_OPTION],
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9844,7 +9844,7 @@ AC_LANG_POP([C])])
 # For backward compatibility.
 AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9863,7 +9863,7 @@ AC_DEFUN([AM_RUN_LOG],
 
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9944,7 +9944,7 @@ AC_CONFIG_COMMANDS_PRE(
 rm -f conftest.file
 ])
 
-# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2009-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10004,7 +10004,7 @@ AC_SUBST([AM_BACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
 ])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10032,7 +10032,7 @@ fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006-2014 Free Software Foundation, Inc.
+# Copyright (C) 2006-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -10051,7 +10051,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004-2014 Free Software Foundation, Inc.
+# Copyright (C) 2004-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
index 0256d8f..4cbafff 100644 (file)
@@ -2,14 +2,14 @@
 .\"  <!-- Copyright 1998 - 2007 Double Precision, Inc.  See COPYING for -->
 .\"  <!-- distribution information. -->
 .\"     Title: makeuserdb
-.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
-.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\"      Date: 06/20/2015
+.\"    Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
+.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
+.\"      Date: 09/08/2017
 .\"    Manual: Double Precision, Inc.
 .\"    Source: Double Precision, Inc.
 .\"  Language: English
 .\"
-.TH "MAKEUSERDB" "8" "06/20/2015" "Double Precision, Inc." "Double Precision, Inc."
+.TH "MAKEUSERDB" "8" "09/08/2017" "Double Precision, Inc." "Double Precision, Inc."
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
index 30a2450..55fa5cb 100644 (file)
@@ -2,14 +2,14 @@
 .\"  <!-- Copyright 1998 - 2007 Double Precision, Inc.  See COPYING for -->
 .\"  <!-- distribution information. -->
 .\"     Title: userdb
-.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
-.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\"      Date: 06/20/2015
+.\"    Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
+.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
+.\"      Date: 09/08/2017
 .\"    Manual: Double Precision, Inc.
 .\"    Source: Double Precision, Inc.
 .\"  Language: English
 .\"
-.TH "USERDB" "8" "06/20/2015" "Double Precision, Inc." "Double Precision, Inc."
+.TH "USERDB" "8" "09/08/2017" "Double Precision, Inc." "Double Precision, Inc."
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
index b3f8c1d..9f87495 100644 (file)
@@ -2,14 +2,14 @@
 .\"  <!-- Copyright 1998 - 2007 Double Precision, Inc.  See COPYING for -->
 .\"  <!-- distribution information. -->
 .\"     Title: userdbpw
-.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
-.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\"      Date: 06/20/2015
+.\"    Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
+.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
+.\"      Date: 09/08/2017
 .\"    Manual: Double Precision, Inc.
 .\"    Source: Double Precision, Inc.
 .\"  Language: English
 .\"
-.TH "USERDBPW" "8" "06/20/2015" "Double Precision, Inc." "Double Precision, Inc."
+.TH "USERDBPW" "8" "09/08/2017" "Double Precision, Inc." "Double Precision, Inc."
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
index 23620df..ad12fb5 100644 (file)
@@ -33,6 +33,9 @@
 #include       "libhmac/hmac.h"
 #endif
 
+#if    HAVE_BCRYPT
+#include       <pwd.h>
+#endif
 #include       <string.h>
 #include       <stdio.h>
 #include       <signal.h>
@@ -102,6 +105,9 @@ int n=1;
 int    md5=0;
 char   buf[BUFSIZ];
 char   salt[9];
+#if HAVE_BCRYPT
+char   *cryptsalt;
+#endif
 #if    HAVE_HMAC
 struct hmac_hashinfo   *hmac=0;
 #endif
@@ -243,7 +249,11 @@ struct hmac_hashinfo       *hmac=0;
        }
 #endif
 
-#if    HAVE_CRYPT
+#if    HAVE_BCRYPT
+       cryptsalt=bcrypt_gensalt(8);
+       printf("%s\n", crypt(buf, cryptsalt));
+       fflush(stdout);
+#elif  HAVE_CRYPT
        printf("%s\n", crypt(buf, salt));
        fflush(stdout);
 #endif