diff --git a/ChangeLog b/ChangeLog
index 02e968c..42336cb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+0.71.3
+
+2021-04-12  Sam Varshavchik  <mrsam@courier-mta.com>
+
+	* authldaplib.cpp: Fix authbind authentication failures.
+
+0.71.2
+
+2021-02-19  Sam Varshavchik  <mrsam@courier-mta.com>
+
+	* spec file: additional fixes.
+
 0.71.1
 
 2021-02-07  Sam Varshavchik  <mrsam@courier-mta.com>
diff --git a/Makefile.am b/Makefile.am
index ddeefb8..5cc6764 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -300,7 +300,7 @@ EXTRA_DIST=$(HTMLFILES) sysconftool COPYING COPYING.GPL\
 	README.authmysql.myownquery \
 	README.authdebug.html.in \
 	courier-authlib.spec \
-	courier-authlib.lpspec pgpkeys.txt \
+	pgpkeys.txt \
 	README_authlib.html.in \
 	authlib.html.in authlib.3.in \
 	authpasswd.html authpasswd.1 \
@@ -602,8 +602,8 @@ distrelease:
 	$(MAKE) rpm
 	$(MAKE)
 	$(MAKE)
-	rm -f @PACKAGE@.spec @PACKAGE@.lpspec
-	$(MAKE) @PACKAGE@.spec @PACKAGE@.lpspec
+	rm -f @PACKAGE_NAME@.spec
+	$(MAKE) @PACKAGE_NAME@.spec
 	$(MAKE) dist
 
 rpm: rpm-build
@@ -613,18 +613,6 @@ rpm-build:
 	$(MAKE) dist
 	$(MAKE) dorpm
 
-lpm: lpm-build
-
-lpm-build:
-	$(MAKE) bump.rpm.release
-	$(MAKE) dist
-	$(MAKE) dolpm
-
-dolpm:
-	rm -rf lpm
-	mkdir lpm
-	lpbuild `test "@REPOSITORY@" == "" || echo --define "repository=1"` --srcbuild -o lpm @PACKAGE@-@VERSION@.tar.bz2
-
 publish: publish-@REPOSITORY@
 
 publish-dev:
@@ -662,30 +650,27 @@ dorpm:
 		--define '_build_name_fmt %%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' \
 		--define '_tmppath %{_var}/tmp' \
 		--define '__spec_prep_pre %{___build_pre}' \
-		@PACKAGE@-@VERSION@.tar.bz2
+		@PACKAGE_NAME@-@PACKAGE_VERSION@.tar.bz2
 
-bump.rpm.release: @PACKAGE@.spec @PACKAGE@.lpspec
+bump.rpm.release: @PACKAGE_NAME@.spec
 	test -f $(srcdir)/rpm.release && . $(srcdir)/rpm.release; \
 	NEXT_RELEASE=100; \
-	test "$$VERSION" = "@VERSION@" && NEXT_RELEASE="$$RELEASE"; \
+	test "$$VERSION" = "@PACKAGE_VERSION@" && NEXT_RELEASE="$$RELEASE"; \
 	RELEASE=`expr $$NEXT_RELEASE + 1`; \
-	echo "VERSION=@VERSION@" >$(srcdir)/rpm.release; \
+	echo "VERSION=@PACKAGE_VERSION@" >$(srcdir)/rpm.release; \
 	echo "RELEASE=$$RELEASE" >>$(srcdir)/rpm.release; \
 	sed 's/^Release: .*/Release: '$$RELEASE'%{?dist}%{?courier_release}/' \
-		<@PACKAGE@.spec >@PACKAGE@.spec.new; \
-	mv @PACKAGE@.spec.new @PACKAGE@.spec; \
-	sed 's/^Release: .*/Release: '$$RELEASE'/' \
-		<@PACKAGE@.lpspec >@PACKAGE@.lpspec.new; \
-	mv @PACKAGE@.lpspec.new @PACKAGE@.lpspec
+		<@PACKAGE_NAME@.spec >@PACKAGE_NAME@.spec.new; \
+	mv @PACKAGE_NAME@.spec.new @PACKAGE_NAME@.spec;
 
 upload-beta:
-	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 courier authlib-devel `echo @VERSION@|sed 's/.*\(........\)/\1/'` @PACKAGE@-@VERSION@.tar.bz2 @PACKAGE@-@VERSION@.tar.bz2.sig
+	rm -f @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.bz2.sig; gpg --detach-sign --default-key mrsam@courier-mta.com @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.bz2; test -f @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.bz2.sig || exit 1
+	~/src/sftools/release.pl mrsam courier authlib-devel `echo @PACKAGE_VERSION@|sed 's/.*\(........\)/\1/'` @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.bz2 @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.bz2.sig
 
 upload-dist:
-	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 courier authlib @VERSION@ @PACKAGE@-@VERSION@.tar.bz2 @PACKAGE@-@VERSION@.tar.bz2.sig
+	rm -f @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.bz2.sig; gpg --detach-sign --default-key mrsam@courier-mta.com @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.bz2; test -f @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.bz2.sig || exit 1
+	set -e; v="@PACKAGE_NAME@/@PACKAGE_VERSION@/`date +%Y%m%d%H%M%S`"; git tag -s $$v -m 'Tag version @PACKAGE_VERSION@'; cd libs; git tag -s $$v -m 'Tag version @PACKAGE_VERSION@'
+	socksify ~/src/sftools/release.pl mrsam courier authlib @PACKAGE_VERSION@ @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.bz2 @PACKAGE_NAME@-@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
diff --git a/Makefile.in b/Makefile.in
index 583a39f..2f93336 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -113,9 +113,8 @@ mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = courier_auth_config.h
 CONFIG_CLEAN_FILES = authdaemond authdaemonrc authsystem.passwd \
 	README.authdebug.html dbobj.config dbobj.h \
-	courier-authlib.spec courier-authlib.lpspec \
-	courier-authlib.sysvinit courier-authlib.service \
-	userdb-test-cram-md5.pl
+	courier-authlib.spec courier-authlib.sysvinit \
+	courier-authlib.service userdb-test-cram-md5.pl
 CONFIG_CLEAN_VPATH_FILES =
 am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" \
 	"$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(pkglibexecdir)" \
@@ -460,7 +459,6 @@ DIST_SUBDIRS = $(SUBDIRS)
 am__DIST_COMMON = $(srcdir)/Makefile.in \
 	$(srcdir)/README.authdebug.html.in $(srcdir)/authdaemond.in \
 	$(srcdir)/authdaemonrc.in $(srcdir)/authsystem.passwd.in \
-	$(srcdir)/courier-authlib.lpspec.in \
 	$(srcdir)/courier-authlib.service.in \
 	$(srcdir)/courier-authlib.spec.in \
 	$(srcdir)/courier-authlib.sysvinit.in \
@@ -683,6 +681,7 @@ pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
@@ -835,7 +834,7 @@ EXTRA_DIST = $(HTMLFILES) sysconftool COPYING COPYING.GPL\
 	README.authmysql.myownquery \
 	README.authdebug.html.in \
 	courier-authlib.spec \
-	courier-authlib.lpspec pgpkeys.txt \
+	pgpkeys.txt \
 	README_authlib.html.in \
 	authlib.html.in authlib.3.in \
 	authpasswd.html authpasswd.1 \
@@ -993,8 +992,6 @@ dbobj.h: $(top_builddir)/config.status $(srcdir)/dbobj.h.in
 	cd $(top_builddir) && $(SHELL) ./config.status $@
 courier-authlib.spec: $(top_builddir)/config.status $(srcdir)/courier-authlib.spec.in
 	cd $(top_builddir) && $(SHELL) ./config.status $@
-courier-authlib.lpspec: $(top_builddir)/config.status $(srcdir)/courier-authlib.lpspec.in
-	cd $(top_builddir) && $(SHELL) ./config.status $@
 courier-authlib.sysvinit: $(top_builddir)/config.status $(srcdir)/courier-authlib.sysvinit.in
 	cd $(top_builddir) && $(SHELL) ./config.status $@
 courier-authlib.service: $(top_builddir)/config.status $(srcdir)/courier-authlib.service.in
@@ -2409,8 +2406,8 @@ distrelease:
 	$(MAKE) rpm
 	$(MAKE)
 	$(MAKE)
-	rm -f @PACKAGE@.spec @PACKAGE@.lpspec
-	$(MAKE) @PACKAGE@.spec @PACKAGE@.lpspec
+	rm -f @PACKAGE_NAME@.spec
+	$(MAKE) @PACKAGE_NAME@.spec
 	$(MAKE) dist
 
 rpm: rpm-build
@@ -2420,18 +2417,6 @@ rpm-build:
 	$(MAKE) dist
 	$(MAKE) dorpm
 
-lpm: lpm-build
-
-lpm-build:
-	$(MAKE) bump.rpm.release
-	$(MAKE) dist
-	$(MAKE) dolpm
-
-dolpm:
-	rm -rf lpm
-	mkdir lpm
-	lpbuild `test "@REPOSITORY@" == "" || echo --define "repository=1"` --srcbuild -o lpm @PACKAGE@-@VERSION@.tar.bz2
-
 publish: publish-@REPOSITORY@
 
 publish-dev:
@@ -2469,30 +2454,27 @@ dorpm:
 		--define '_build_name_fmt %%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' \
 		--define '_tmppath %{_var}/tmp' \
 		--define '__spec_prep_pre %{___build_pre}' \
-		@PACKAGE@-@VERSION@.tar.bz2
+		@PACKAGE_NAME@-@PACKAGE_VERSION@.tar.bz2
 
-bump.rpm.release: @PACKAGE@.spec @PACKAGE@.lpspec
+bump.rpm.release: @PACKAGE_NAME@.spec
 	test -f $(srcdir)/rpm.release && . $(srcdir)/rpm.release; \
 	NEXT_RELEASE=100; \
-	test "$$VERSION" = "@VERSION@" && NEXT_RELEASE="$$RELEASE"; \
+	test "$$VERSION" = "@PACKAGE_VERSION@" && NEXT_RELEASE="$$RELEASE"; \
 	RELEASE=`expr $$NEXT_RELEASE + 1`; \
-	echo "VERSION=@VERSION@" >$(srcdir)/rpm.release; \
+	echo "VERSION=@PACKAGE_VERSION@" >$(srcdir)/rpm.release; \
 	echo "RELEASE=$$RELEASE" >>$(srcdir)/rpm.release; \
 	sed 's/^Release: .*/Release: '$$RELEASE'%{?dist}%{?courier_release}/' \
-		<@PACKAGE@.spec >@PACKAGE@.spec.new; \
-	mv @PACKAGE@.spec.new @PACKAGE@.spec; \
-	sed 's/^Release: .*/Release: '$$RELEASE'/' \
-		<@PACKAGE@.lpspec >@PACKAGE@.lpspec.new; \
-	mv @PACKAGE@.lpspec.new @PACKAGE@.lpspec
+		<@PACKAGE_NAME@.spec >@PACKAGE_NAME@.spec.new; \
+	mv @PACKAGE_NAME@.spec.new @PACKAGE_NAME@.spec;
 
 upload-beta:
-	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 courier authlib-devel `echo @VERSION@|sed 's/.*\(........\)/\1/'` @PACKAGE@-@VERSION@.tar.bz2 @PACKAGE@-@VERSION@.tar.bz2.sig
+	rm -f @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.bz2.sig; gpg --detach-sign --default-key mrsam@courier-mta.com @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.bz2; test -f @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.bz2.sig || exit 1
+	~/src/sftools/release.pl mrsam courier authlib-devel `echo @PACKAGE_VERSION@|sed 's/.*\(........\)/\1/'` @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.bz2 @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.bz2.sig
 
 upload-dist:
-	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 courier authlib @VERSION@ @PACKAGE@-@VERSION@.tar.bz2 @PACKAGE@-@VERSION@.tar.bz2.sig
+	rm -f @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.bz2.sig; gpg --detach-sign --default-key mrsam@courier-mta.com @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.bz2; test -f @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.bz2.sig || exit 1
+	set -e; v="@PACKAGE_NAME@/@PACKAGE_VERSION@/`date +%Y%m%d%H%M%S`"; git tag -s $$v -m 'Tag version @PACKAGE_VERSION@'; cd libs; git tag -s $$v -m 'Tag version @PACKAGE_VERSION@'
+	socksify ~/src/sftools/release.pl mrsam courier authlib @PACKAGE_VERSION@ @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.bz2 @PACKAGE_NAME@-@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
diff --git a/aclocal.m4 b/aclocal.m4
index 62f1d04..25bffd1 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -20,80 +20,41 @@ 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++])
-])
+dnl Checks for the correct version of the courier-unicode library.
 
 AC_DEFUN([AX_COURIER_UNICODE_VERSION],[
 
 AC_MSG_CHECKING(courier-unicode library and version)
 
-v="$1"
+vers="$1"
 
-if test "$v" = ""
+if test "$vers" = ""
 then
-	v=2.2
+	vers=2.2.3
 fi
 
-set -- `echo "$v" | tr '.' ' '`
+set -- `echo "$vers" | tr '.' ' '`
 
 v=$[]1
-r=$[]2
+r=`echo "00"$[]2 | sed 's/.*(...)$/$[]1/'`
+
 p=$[]3
 
 if test "$p" = ""
    then p="0"
 fi
 
+p=`echo "00"$p | sed 's/.*(...)$/$[]1/'`
+
+if test "$v$r$p" -lt 2002002
+then
+   r=$[]2
+   p=$[]3
+   if test "$p" = ""
+       then p="0"
+   fi
+fi
+
 AC_TRY_COMPILE([
 #include <courier-unicode.h>
 #ifndef COURIER_UNICODE_VERSION
@@ -101,12 +62,12 @@ AC_TRY_COMPILE([
 #endif
 
 #if COURIER_UNICODE_VERSION < ]$v$r$p[
-#error "courier-unicode ]$1[ library is required"
+#error "courier-unicode ]$vers[ library is required"
 #endif
 
 ],[],[],
 AC_MSG_ERROR([
-ERROR: The Courier Unicode Library ]$1[ header files appear not to be installed.
+ERROR: The Courier Unicode Library ]$vers[ 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.])
 )
diff --git a/authdaemonrc.in b/authdaemonrc.in
index e05ce3c..0773f71 100644
--- a/authdaemonrc.in
+++ b/authdaemonrc.in
@@ -1,4 +1,4 @@
-##VERSION: $Id:$
+##VERSION: $Id: 7b218a8185f424046f3ef3322a37443983e443e3-20210515150130$
 #
 # Copyright 2000-2005 Double Precision, Inc.  See COPYING for
 # distribution information.
diff --git a/authldaplib.cpp b/authldaplib.cpp
index 0b14625..a161d8f 100644
--- a/authldaplib.cpp
+++ b/authldaplib.cpp
@@ -1411,7 +1411,7 @@ int authldap_lookup::verify_password_authbind(const std::string &dn)
 	if (!bind_connection.bind(dn, pass))
 	{
 		bind_connection.close();
-		return 1;
+		return -1;
 	}
 
 	if (authldaprc.protocol_version == 2)
diff --git a/authldaprc b/authldaprc
index 77131a8..9d9a332 100644
--- a/authldaprc
+++ b/authldaprc
@@ -1,4 +1,4 @@
-##VERSION: $Id: 7ee49247d1dbf52d4bb8e0b1a180f2411aa3628a-20160107214650$
+##VERSION: $Id: c473c49f63772e95a791fb3b90275796c033920e-20211107164046$
 #
 # Copyright 2000-2016 Double Precision, Inc.  See COPYING for
 # distribution information.
@@ -241,6 +241,9 @@ LDAP_TLS		0
 # into the following search string.  "@user@" and "@realm@" are placeholders
 # for the user and the realm portions of the login ID.
 #
+# This is an LDAP search filter, so \40 can be used to represent a literal
+# @ character in the search string.
+#
 # LDAP_EMAILMAP		(&(userid=@user@)(realm=@realm@))
 
 ##NAME: LDAP_EMAILMAP_BASEDN:0
diff --git a/authmysqlrc b/authmysqlrc
index 567ce19..c4e8727 100644
--- a/authmysqlrc
+++ b/authmysqlrc
@@ -1,4 +1,4 @@
-##VERSION: $Id: 01c3b327e4d5b8f4123500ce4c8d0ef7a690c10d-20160418083235$
+##VERSION: $Id: 01c3b327e4d5b8f4123500ce4c8d0ef7a690c10d-20210515150130$
 #
 # Copyright 2000-2007 Double Precision, Inc.  See COPYING for
 # distribution information.
diff --git a/authpgsqlrc b/authpgsqlrc
index 923dcc3..aefe190 100644
--- a/authpgsqlrc
+++ b/authpgsqlrc
@@ -1,4 +1,4 @@
-##VERSION: $Id: c6a82fc8c0bd0e858ca7c133640ed14769e3e04c-20160501082012$
+##VERSION: $Id: c6a82fc8c0bd0e858ca7c133640ed14769e3e04c-20210515150130$
 #
 # Copyright 2000-2004 Double Precision, Inc.  See COPYING for
 # distribution information.
diff --git a/authsasl.c b/authsasl.c
index 8924cac..e2007fe 100644
--- a/authsasl.c
+++ b/authsasl.c
@@ -154,7 +154,7 @@ int auth_sasl_ex(const char *method,
 
 	if ((*authdata_ptr=strdup(externalauth)) == NULL)
 	{
-		free(authtype_ptr);
+		free(*authtype_ptr);
 		return AUTHSASL_ABORTED;
 	}
 
diff --git a/authsqliterc b/authsqliterc
index 21d5cd6..a3bbbee 100644
--- a/authsqliterc
+++ b/authsqliterc
@@ -1,4 +1,4 @@
-##VERSION: $Id: 33c3875d1a259c6bca0f14cafb3a3e9b69b340e7-20160507115108$
+##VERSION: $Id: 098f1a6ea09983825bf6156d57a871f5fcf27b35-20210515150130$
 #
 # Copyright 2012 Double Precision, Inc.  See COPYING for
 # distribution information.
diff --git a/configure b/configure
index 6f8257f..fb8fe43 100755
--- 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.71.1.
+# Generated by GNU Autoconf 2.69 for courier-authlib 0.71.4.
 #
 # 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.71.1'
-PACKAGE_STRING='courier-authlib 0.71.1'
+PACKAGE_VERSION='0.71.4'
+PACKAGE_STRING='courier-authlib 0.71.4'
 PACKAGE_BUGREPORT='courier-users@lists.sourceforge.net'
 PACKAGE_URL=''
 
@@ -822,6 +822,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -945,6 +946,7 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1197,6 +1199,15 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1334,7 +1345,7 @@ fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1447,7 +1458,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.71.1 to adapt to many kinds of systems.
+\`configure' configures courier-authlib 0.71.4 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1487,6 +1498,7 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -1517,7 +1529,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of courier-authlib 0.71.1:";;
+     short | recursive ) echo "Configuration of courier-authlib 0.71.4:";;
    esac
   cat <<\_ACEOF
 
@@ -1671,7 +1683,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-courier-authlib configure 0.71.1
+courier-authlib configure 0.71.4
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2261,7 +2273,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.71.1, which was
+It was created by courier-authlib $as_me 0.71.4, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3127,7 +3139,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='courier-authlib'
- VERSION='0.71.1'
+ VERSION='0.71.4'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -17659,36 +17671,35 @@ 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; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lm is needed for linking" >&5
+$as_echo_n "checking whether -lm is needed for linking... " >&6; }
+
+OLDLIBS="$LIBS"
+LIBS="$LIBS -lm"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char floor ();
+
 int
 main ()
 {
-return floor ();
+
+
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+	LIBM="-lm"
+else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-else
-  LIBM="-lm"
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
+LIBS="$OLDLIBS"
 
 
 # Check whether --with-pkgconfdir was given.
@@ -17703,194 +17714,122 @@ saveLIBS="$LIBS"
 NETLIBS=""
 USENSL=no
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5
-$as_echo_n "checking for socket in -lsocket... " >&6; }
-if ${ac_cv_lib_socket_socket+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsocket  $LIBS"
+LIBS="$OLDLIBS -lsocket"
+
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char socket ();
+#include <sys/types.h>
+#include <sys/socket.h>
+
 int
 main ()
 {
-return socket ();
+
+(void)socket(0, 0, 0);
+
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_socket_socket=yes
-else
-  ac_cv_lib_socket_socket=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_socket" >&5
-$as_echo "$ac_cv_lib_socket_socket" >&6; }
-if test "x$ac_cv_lib_socket_socket" = xyes; then :
-  result=yes
-else
-  result=no
-fi
 
-if test $result = yes; then
-        NETLIBS="-lsocket"
-else
-        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5
-$as_echo_n "checking for socket in -lsocket... " >&6; }
-if ${ac_cv_lib_socket_socket+:} false; then :
-  $as_echo_n "(cached) " >&6
+   NETLIBS="-lsocket"
+
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsocket -lnsl $LIBS"
+
+
+LIBS="$saveLIBS -lsocket -lnsl"
+
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char socket ();
+#include <sys/types.h>
+#include <sys/socket.h>
+
 int
 main ()
 {
-return socket ();
+
+(void)socket(0, 0, 0);
+
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_socket_socket=yes
-else
-  ac_cv_lib_socket_socket=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_socket" >&5
-$as_echo "$ac_cv_lib_socket_socket" >&6; }
-if test "x$ac_cv_lib_socket_socket" = xyes; then :
-  result=yes
-else
-  result=no
-fi
 
-        if test $result = yes; then
-                NETLIBS = "-lsocket -lnsl"
-                USENSL=yes
-        else
-                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for connect in -lsocket" >&5
-$as_echo_n "checking for connect in -lsocket... " >&6; }
-if ${ac_cv_lib_socket_connect+:} false; then :
-  $as_echo_n "(cached) " >&6
+   NETLIBS="-lsocket -lnsl"
+   USENSL=yes
+
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsocket  $LIBS"
+
+
+LIBS="$saveLIBS -lsocket"
+
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char connect ();
+#include <sys/types.h>
+#include <sys/socket.h>
+
 int
 main ()
 {
-return connect ();
+
+(void)connect(0, 0, 0);
+
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_socket_connect=yes
-else
-  ac_cv_lib_socket_connect=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_connect" >&5
-$as_echo "$ac_cv_lib_socket_connect" >&6; }
-if test "x$ac_cv_lib_socket_connect" = xyes; then :
-  result=yes
-else
-  result=no
-fi
 
-                if test $result = yes; then
-                        NETLIBS="-lsocket"
-                else
-                        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for connect in -lsocket" >&5
-$as_echo_n "checking for connect in -lsocket... " >&6; }
-if ${ac_cv_lib_socket_connect+:} false; then :
-  $as_echo_n "(cached) " >&6
+   NETLIBS="-lsocket"
+
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsocket -lnsl $LIBS"
+
+
+LIBS="$saveLIBS -lsocket -lnsl"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char connect ();
+#include <sys/types.h>
+#include <sys/socket.h>
+
 int
 main ()
 {
-return connect ();
+
+(void)connect(0, 0, 0);
+
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_socket_connect=yes
-else
-  ac_cv_lib_socket_connect=no
+
+   NETLIBS="-lsocket -lnsl"
+   USENSL=yes
+
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_connect" >&5
-$as_echo "$ac_cv_lib_socket_connect" >&6; }
-if test "x$ac_cv_lib_socket_connect" = xyes; then :
-  result=yes
-else
-  result=no
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
-                        if test $result = yes; then
-                                NETLIBS="-lsocket -lnsl"
-                                USENSL=yes
-                        fi
-                fi
-        fi
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
 if test $USENSL != yes; then
-	LIBS="$LIBS $NETLIBS"
+	LIBS="$saveLIBS $NETLIBS"
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -17972,23 +17911,35 @@ LIBS="$saveLIBS"
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking courier-unicode library and version" >&5
 $as_echo_n "checking courier-unicode library and version... " >&6; }
 
-v="2.1"
+vers="2.1"
 
-if test "$v" = ""
+if test "$vers" = ""
 then
-	v=2.2
+	vers=2.2.3
 fi
 
-set -- `echo "$v" | tr '.' ' '`
+set -- `echo "$vers" | tr '.' ' '`
 
 v=$1
-r=$2
+r=`echo "00"$2 | sed 's/.*(...)$/$1/'`
+
 p=$3
 
 if test "$p" = ""
    then p="0"
 fi
 
+p=`echo "00"$p | sed 's/.*(...)$/$1/'`
+
+if test "$v$r$p" -lt 2002002
+then
+   r=$2
+   p=$3
+   if test "$p" = ""
+       then p="0"
+   fi
+fi
+
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -17998,7 +17949,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #endif
 
 #if COURIER_UNICODE_VERSION < $v$r$p
-#error "courier-unicode 2.1 library is required"
+#error "courier-unicode $vers library is required"
 #endif
 
 
@@ -18014,7 +17965,7 @@ if ac_fn_c_try_compile "$LINENO"; then :
 
 else
   as_fn_error $? "
-ERROR: The Courier Unicode Library 2.1 header files appear not to be installed.
+ERROR: The Courier Unicode Library $vers 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
 
@@ -20137,7 +20088,7 @@ done
 subdirs="$subdirs libs/bdbobj libs/gdbmobj libs/md5 libs/sha1 libs/libhmac libs/numlib libs/makedat userdb libs/rfc822 libs/random128 libs/liblock liblog"
 
 
-ac_config_files="$ac_config_files Makefile authdaemond authdaemonrc authsystem.passwd README.authdebug.html dbobj.config dbobj.h courier-authlib.spec courier-authlib.lpspec courier-authlib.sysvinit courier-authlib.service userdb-test-cram-md5.pl"
+ac_config_files="$ac_config_files Makefile authdaemond authdaemonrc authsystem.passwd README.authdebug.html dbobj.config dbobj.h courier-authlib.spec courier-authlib.sysvinit courier-authlib.service userdb-test-cram-md5.pl"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -20726,7 +20677,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.71.1, which was
+This file was extended by courier-authlib $as_me 0.71.4, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -20792,7 +20743,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.71.1
+courier-authlib config.status 0.71.4
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
@@ -21313,7 +21264,6 @@ do
     "dbobj.config") CONFIG_FILES="$CONFIG_FILES dbobj.config" ;;
     "dbobj.h") CONFIG_FILES="$CONFIG_FILES dbobj.h" ;;
     "courier-authlib.spec") CONFIG_FILES="$CONFIG_FILES courier-authlib.spec" ;;
-    "courier-authlib.lpspec") CONFIG_FILES="$CONFIG_FILES courier-authlib.lpspec" ;;
     "courier-authlib.sysvinit") CONFIG_FILES="$CONFIG_FILES courier-authlib.sysvinit" ;;
     "courier-authlib.service") CONFIG_FILES="$CONFIG_FILES courier-authlib.service" ;;
     "userdb-test-cram-md5.pl") CONFIG_FILES="$CONFIG_FILES userdb-test-cram-md5.pl" ;;
diff --git a/configure.ac b/configure.ac
index d4bc4c4..896c6ec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,11 +1,11 @@
 dnl Process this file with autoconf to produce a configure script.
 dnl
 dnl
-dnl Copyright 1998 - 2020 Double Precision, Inc.  See COPYING for
+dnl Copyright 1998 - 2021 Double Precision, Inc.  See COPYING for
 dnl distribution information.
 
 AC_PREREQ(2.63)
-AC_INIT([courier-authlib],[0.71.1],[courier-users@lists.sourceforge.net])
+AC_INIT([courier-authlib],[0.71.4],[courier-users@lists.sourceforge.net])
 
 AC_CONFIG_SRCDIR([courierauth.h])
 
@@ -76,11 +76,17 @@ 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,
-	AC_MSG_RESULT(no),
-	LIBM="-lm"
-	AC_MSG_RESULT(yes))
+AC_MSG_CHECKING(whether -lm is needed for linking)
+
+OLDLIBS="$LIBS"
+LIBS="$LIBS -lm"
+AC_TRY_LINK([
+], [
+],
+	AC_MSG_RESULT(yes)
+	LIBM="-lm",
+	AC_MSG_RESULT(no))
+LIBS="$OLDLIBS"
 
 AC_ARG_WITH(pkgconfdir,
 [  --with-pkgconfdir=d     Install config files in directory ],
@@ -91,30 +97,60 @@ saveLIBS="$LIBS"
 NETLIBS=""
 USENSL=no
 
-AC_CHECK_LIB(socket,socket,result=yes,result=no)
-if test $result = yes; then
-        NETLIBS="-lsocket"
-else
-        AC_CHECK_LIB(socket,socket,result=yes,result=no,-lnsl)
-        if test $result = yes; then
-                NETLIBS = "-lsocket -lnsl"
-                USENSL=yes
-        else
-                AC_CHECK_LIB(socket,connect,result=yes,result=no)
-                if test $result = yes; then
-                        NETLIBS="-lsocket"
-                else
-                        AC_CHECK_LIB(socket,connect,result=yes,result=no,-lnsl)
-                        if test $result = yes; then
-                                NETLIBS="-lsocket -lnsl"
-                                USENSL=yes
-                        fi
-                fi
-        fi
-fi
+LIBS="$OLDLIBS -lsocket"
+
+AC_TRY_LINK([
+#include <sys/types.h>
+#include <sys/socket.h>
+], [
+(void)socket(0, 0, 0);
+], [
+   NETLIBS="-lsocket"
+],
+[
+
+LIBS="$saveLIBS -lsocket -lnsl"
+
+AC_TRY_LINK([
+#include <sys/types.h>
+#include <sys/socket.h>
+], [
+(void)socket(0, 0, 0);
+], [
+   NETLIBS="-lsocket -lnsl"
+   USENSL=yes
+], [
+
+LIBS="$saveLIBS -lsocket"
+
+AC_TRY_LINK([
+#include <sys/types.h>
+#include <sys/socket.h>
+], [
+(void)connect(0, 0, 0);
+], [
+   NETLIBS="-lsocket"
+],
+[
+
+LIBS="$saveLIBS -lsocket -lnsl"
+AC_TRY_LINK([
+#include <sys/types.h>
+#include <sys/socket.h>
+], [
+(void)connect(0, 0, 0);
+], [
+   NETLIBS="-lsocket -lnsl"
+   USENSL=yes
+],
+[
+])
+])
+])
+])
 
 if test $USENSL != yes; then
-	LIBS="$LIBS $NETLIBS"
+	LIBS="$saveLIBS $NETLIBS"
 	AC_TRY_LINK_FUNC(inet_addr, [ : ],
 	[
 	        AC_CHECK_LIB(nsl,inet_addr,result=yes,result=no)
@@ -982,5 +1018,5 @@ done
 
 AC_CONFIG_SUBDIRS(libs/bdbobj libs/gdbmobj libs/md5 libs/sha1 libs/libhmac libs/numlib libs/makedat userdb libs/rfc822 libs/random128 libs/liblock liblog)
 
-AC_CONFIG_FILES(Makefile authdaemond authdaemonrc authsystem.passwd README.authdebug.html dbobj.config dbobj.h courier-authlib.spec courier-authlib.lpspec courier-authlib.sysvinit courier-authlib.service userdb-test-cram-md5.pl)
+AC_CONFIG_FILES(Makefile authdaemond authdaemonrc authsystem.passwd README.authdebug.html dbobj.config dbobj.h courier-authlib.spec courier-authlib.sysvinit courier-authlib.service userdb-test-cram-md5.pl)
 AC_OUTPUT
diff --git a/courier-authlib.lpspec b/courier-authlib.lpspec
deleted file mode 100644
index c653659..0000000
--- a/courier-authlib.lpspec
+++ /dev/null
@@ -1,253 +0,0 @@
-#
-# Copyright 2005-2010 Double Precision, Inc.  See COPYING for
-# distribution information.
-
-Name:           courier-authlib
-Version:        0.71.1
-Release:        1
-
-License:        GPLv3
-URL:            http://www.courier-mta.org
-
-################################################################################
-
-Source:         http://dl.sourceforge.net/courier/%{name}-%{version}.tar.bz2
-
-################################################################################
-
-BuildRequires:      libtool
-BuildRequires:      openldap-devel
-BuildRequires:      mysql-devel zlib-devel sqlite-devel
-BuildRequires:      postgresql-devel
-BuildRequires:      gdbm-devel
-BuildRequires:      pam-devel
-BuildRequires:      expect
-BuildRequires:      gcc-c++
-BuildRequires:      courier-unicode-devel
-
-BuildRequires:      /usr/include/ltdl.h
-
-
-%{?repository: Repository(pgpkeys.txt): http://download.lpmtool.com//courier-authlib}
-
-%package
-Summary:        Courier authentication library
-Group:          System Environment/Daemons
-Requires:       /bin/systemctl
-
-The Courier authentication library provides authentication services for
-other Courier applications.
-
-%package devel
-Summary:    Development libraries for the Courier authentication library
-Group:      Development/Libraries
-Requires:   courier-authlib = %{__version}-%{__release}
-
-This package contains the development libraries and files needed to compile
-Courier packages that use this authentication library.  Install this
-package in order to build the rest of the Courier packages.  After they are
-built and installed this package can be removed.  Files in this package
-are not needed at runtime.
-
-################################################################################
-%package userdb
-Summary:    userdb support for the Courier authentication library
-Group:      System Environment/Daemons
-Requires:   courier-authlib = %{__version}-%{__release}
-
-This package installs the userdb support for the Courier authentication
-library.  Userdb is a simple way to manage virtual mail accounts using
-a GDBM-based database file.
-<p>
-Install this package in order to be able to authenticate with userdb.
-
-################################################################################
-%package ldap
-Summary:    LDAP support for the Courier authentication library
-Group:      System Environment/Daemons
-Requires:   courier-authlib = %{__version}-%{__release}
-
-This package installs LDAP support for the Courier authentication library.
-Install this package in order to be able to authenticate using LDAP.
-
-################################################################################
-%package mysql
-Summary:    MySQL support for the Courier authentication library
-Group:      System Environment/Daemons
-Requires:   courier-authlib = %{__version}-%{__release}
-
-This package installs MySQL support for the Courier authentication library.
-Install this package in order to be able to authenticate using MySQL.
-
-%package sqlite
-Summary:    SQLite support for the Courier authentication library
-Group:      System Environment/Daemons
-Requires:   courier-authlib = %{__version}-%{__release}
-
-This package installs SQLite support for the Courier authentication library.
-Install this package in order to be able to authenticate using an SQLite-based
-database file.
-
-################################################################################
-%package pgsql
-Summary:    PostgreSQL support for the Courier authentication library
-Group:      System Environment/Daemons
-Requires:   courier-authlib = %{__version}-%{__release}
-
-This package installs PostgreSQL support for the Courier authentication
-library.
-Install this package in order to be able to authenticate using PostgreSQL.
-
-%begin
-%setup
-%configure --with-redhat -C
-%begin build
-%{__make} -s %{_smp_mflags}
-
-%begin install
-rm -rf $__installdir
-MAKEFLAGS= %{__make} -j 1 install DESTDIR=$__installdir
-%{__rm} -f $__installdir%{_libdir}/courier-authlib/*.a
-%{__install} -m 555 sysconftool $__installdir%{_libexecdir}/courier-authlib
-
-./courierauthconfig --configfiles >configtmp
-. ./configtmp
-
-d=`pwd`
-cd $RPM_BUILD_ROOT%{_localstatedir}/spool/authdaemon || exit 1
-$d/authmksock ./socket || exit 1
-cd $d || exit 1
-touch $__installdir%{_localstatedir}/spool/authdaemon/pid.lock || exit 1
-touch $__installdir%{_localstatedir}/spool/authdaemon/pid || exit 1
-%{__chmod} 777 $__installdir%{_localstatedir}/spool/authdaemon/socket || exit 1
-
-cat >configfiles.base <<EOF
-%defattr(-,$mailuser,$mailgroup,-)
-%{_sysconfdir}/authlib
-%{_libexecdir}/courier-authlib
-%dir %{_libdir}/courier-authlib
-%dir %attr(750,$mailuser,$mailgroup) %{_localstatedir}/spool/authdaemon
-EOF
-
-echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.mysql
-echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.sqlite
-echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.ldap
-echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.pgsql
-echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.userdb
-echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.devel
-
-for f in $__installdir%{_sbindir}/*
-do
-	fn=`basename $f`
-	case "$fn" in
-	*userdb*)
-		echo "%{_sbindir}/$fn" >>configfiles.userdb
-		;;
-	*)
-		echo "%{_sbindir}/$fn" >>configfiles.base
-		;;
-	esac
-done
-
-for f in $__installdir%{_libdir}/courier-authlib/*
-do
-	fn=`basename $f`
-	case "$fn" in
-	libauthldap*)
-		echo "%{_libdir}/courier-authlib/$fn" >>configfiles.ldap
-		;;
-	libauthmysql*)
-		echo "%{_libdir}/courier-authlib/$fn" >>configfiles.mysql
-		;;
-	libauthsqlite*)
-		echo "%{_libdir}/courier-authlib/$fn" >>configfiles.sqlite
-		;;
-	libauthpgsql*)
-		echo "%{_libdir}/courier-authlib/$fn" >>configfiles.pgsql
-		;;
-	libauthldap*)
-		echo "%{_libdir}/courier-authlib/$fn" >>configfiles.ldap
-		;;
-	libauthuserdb*)
-		echo "%{_libdir}/courier-authlib/$fn" >>configfiles.userdb
-		;;
-	*)
-		echo "%{_libdir}/courier-authlib/$fn" >>configfiles.base
-		;;
-	esac
-done
-%{__mkdir_p} $__installdir%{_datadir}
-%{__install} -m 555 courier-authlib.sysvinit $__installdir%{_datadir}
-
-%{__mkdir_p} $__installdir/lib/systemd/system
-%{__install} -m 644 courier-authlib.service $__installdir/lib/systemd/system
-
-%post
-%{_libexecdir}/courier-authlib/sysconftool %{_sysconfdir}/authlib/*.dist >/dev/null
-
-if test -f /etc/rc.d/init.d/courier-authlib
-then
-        /sbin/chkconfig --del courier-authlib
-        /bin/systemctl stop courier-authlib.service || :
-fi
-
-/bin/systemctl daemon-reload || :
-/bin/systemctl enable courier-authlib.service &> /dev/null || :
-
-%preun
-if test -x %{_sbindir}/authdaemond
-then
-	%{_sbindir}/authdaemond >/dev/null 2>&1 || /bin/true
-fi
-
-if test "$1" = "0"
-then
-        /bin/systemctl stop courier-authlib.service
-        /bin/systemctl disable courier-authlib.service
-fi
-
-%postun
-/bin/systemctl daemon-reload || :
-
-%files -f configfiles.base
-%defattr(-,root,root,-)
-%doc README README*html README.authmysql.myownquery README.ldap
-%doc NEWS COPYING* AUTHORS ChangeLog
-/lib/systemd/system/*
-%attr(755, bin, bin) %{_datadir}/courier-authlib.sysvinit
-%ghost %attr(600, root, root) %{_localstatedir}/spool/authdaemon/pid.lock
-%ghost %attr(644, root, root) %{_localstatedir}/spool/authdaemon/pid
-%ghost %attr(-, root, root) %{_localstatedir}/spool/authdaemon/socket
-%{_mandir}/man1/*
-
-%files -f configfiles.userdb userdb
-%{_mandir}/man8/*userdb*
-
-%files -f configfiles.devel devel
-%defattr(-,root,root,-)
-%{_bindir}/courierauthconfig
-%{_includedir}/*
-%{_mandir}/man3/*
-%doc authlib.html auth_*.html
-
-%files -f configfiles.ldap ldap
-%defattr(-,root,root,-)
-%doc authldap.schema authldap.ldif
-
-%files -f configfiles.mysql mysql
-
-%files -f configfiles.sqlite sqlite
-
-%files -f configfiles.pgsql pgsql
-
-%changelog
-* Thu Sep  7 2006 Chris Petersen <rpm@forevermore.net>                  0.58-2
-- Make the spec a little prettier
-- Replace BuildPreReq with BuildRequires
-- Remove period from summaries (rpmlint)
-- Fix release tag to use %{?dist} macro if it's present
-- Change distro-detection to use "rh" and "fc" for version detection, and add support for mandriva
-
-* Sun Oct  3 2004 Mr. Sam <sam@email-scan.com>                          0.50-1
-- Initial build.
-
diff --git a/courier-authlib.lpspec.in b/courier-authlib.lpspec.in
deleted file mode 100644
index c3cef98..0000000
--- a/courier-authlib.lpspec.in
+++ /dev/null
@@ -1,253 +0,0 @@
-#
-# Copyright 2005-2010 Double Precision, Inc.  See COPYING for
-# distribution information.
-
-Name:           courier-authlib
-Version:        @VERSION@
-Release:        1
-
-License:        GPLv3
-URL:            http://www.courier-mta.org
-
-################################################################################
-
-Source:         http://dl.sourceforge.net/courier/%{name}-%{version}.tar.bz2
-
-################################################################################
-
-BuildRequires:      libtool
-BuildRequires:      openldap-devel
-BuildRequires:      mysql-devel zlib-devel sqlite-devel
-BuildRequires:      postgresql-devel
-BuildRequires:      gdbm-devel
-BuildRequires:      pam-devel
-BuildRequires:      expect
-BuildRequires:      gcc-c++
-BuildRequires:      courier-unicode-devel
-
-BuildRequires:      /usr/include/ltdl.h
-
-
-%{?repository: Repository(pgpkeys.txt): http://download.lpmtool.com/@REPOSITORY@/courier-authlib}
-
-%package
-Summary:        Courier authentication library
-Group:          System Environment/Daemons
-Requires:       /bin/systemctl
-
-The Courier authentication library provides authentication services for
-other Courier applications.
-
-%package devel
-Summary:    Development libraries for the Courier authentication library
-Group:      Development/Libraries
-Requires:   courier-authlib = %{__version}-%{__release}
-
-This package contains the development libraries and files needed to compile
-Courier packages that use this authentication library.  Install this
-package in order to build the rest of the Courier packages.  After they are
-built and installed this package can be removed.  Files in this package
-are not needed at runtime.
-
-################################################################################
-%package userdb
-Summary:    userdb support for the Courier authentication library
-Group:      System Environment/Daemons
-Requires:   courier-authlib = %{__version}-%{__release}
-
-This package installs the userdb support for the Courier authentication
-library.  Userdb is a simple way to manage virtual mail accounts using
-a GDBM-based database file.
-<p>
-Install this package in order to be able to authenticate with userdb.
-
-################################################################################
-%package ldap
-Summary:    LDAP support for the Courier authentication library
-Group:      System Environment/Daemons
-Requires:   courier-authlib = %{__version}-%{__release}
-
-This package installs LDAP support for the Courier authentication library.
-Install this package in order to be able to authenticate using LDAP.
-
-################################################################################
-%package mysql
-Summary:    MySQL support for the Courier authentication library
-Group:      System Environment/Daemons
-Requires:   courier-authlib = %{__version}-%{__release}
-
-This package installs MySQL support for the Courier authentication library.
-Install this package in order to be able to authenticate using MySQL.
-
-%package sqlite
-Summary:    SQLite support for the Courier authentication library
-Group:      System Environment/Daemons
-Requires:   courier-authlib = %{__version}-%{__release}
-
-This package installs SQLite support for the Courier authentication library.
-Install this package in order to be able to authenticate using an SQLite-based
-database file.
-
-################################################################################
-%package pgsql
-Summary:    PostgreSQL support for the Courier authentication library
-Group:      System Environment/Daemons
-Requires:   courier-authlib = %{__version}-%{__release}
-
-This package installs PostgreSQL support for the Courier authentication
-library.
-Install this package in order to be able to authenticate using PostgreSQL.
-
-%begin
-%setup
-%configure --with-redhat -C
-%begin build
-%{__make} -s %{_smp_mflags}
-
-%begin install
-rm -rf $__installdir
-MAKEFLAGS= %{__make} -j 1 install DESTDIR=$__installdir
-%{__rm} -f $__installdir%{_libdir}/courier-authlib/*.a
-%{__install} -m 555 sysconftool $__installdir%{_libexecdir}/courier-authlib
-
-./courierauthconfig --configfiles >configtmp
-. ./configtmp
-
-d=`pwd`
-cd $RPM_BUILD_ROOT%{_localstatedir}/spool/authdaemon || exit 1
-$d/authmksock ./socket || exit 1
-cd $d || exit 1
-touch $__installdir%{_localstatedir}/spool/authdaemon/pid.lock || exit 1
-touch $__installdir%{_localstatedir}/spool/authdaemon/pid || exit 1
-%{__chmod} 777 $__installdir%{_localstatedir}/spool/authdaemon/socket || exit 1
-
-cat >configfiles.base <<EOF
-%defattr(-,$mailuser,$mailgroup,-)
-%{_sysconfdir}/authlib
-%{_libexecdir}/courier-authlib
-%dir %{_libdir}/courier-authlib
-%dir %attr(750,$mailuser,$mailgroup) %{_localstatedir}/spool/authdaemon
-EOF
-
-echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.mysql
-echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.sqlite
-echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.ldap
-echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.pgsql
-echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.userdb
-echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.devel
-
-for f in $__installdir%{_sbindir}/*
-do
-	fn=`basename $f`
-	case "$fn" in
-	*userdb*)
-		echo "%{_sbindir}/$fn" >>configfiles.userdb
-		;;
-	*)
-		echo "%{_sbindir}/$fn" >>configfiles.base
-		;;
-	esac
-done
-
-for f in $__installdir%{_libdir}/courier-authlib/*
-do
-	fn=`basename $f`
-	case "$fn" in
-	libauthldap*)
-		echo "%{_libdir}/courier-authlib/$fn" >>configfiles.ldap
-		;;
-	libauthmysql*)
-		echo "%{_libdir}/courier-authlib/$fn" >>configfiles.mysql
-		;;
-	libauthsqlite*)
-		echo "%{_libdir}/courier-authlib/$fn" >>configfiles.sqlite
-		;;
-	libauthpgsql*)
-		echo "%{_libdir}/courier-authlib/$fn" >>configfiles.pgsql
-		;;
-	libauthldap*)
-		echo "%{_libdir}/courier-authlib/$fn" >>configfiles.ldap
-		;;
-	libauthuserdb*)
-		echo "%{_libdir}/courier-authlib/$fn" >>configfiles.userdb
-		;;
-	*)
-		echo "%{_libdir}/courier-authlib/$fn" >>configfiles.base
-		;;
-	esac
-done
-%{__mkdir_p} $__installdir%{_datadir}
-%{__install} -m 555 courier-authlib.sysvinit $__installdir%{_datadir}
-
-%{__mkdir_p} $__installdir/lib/systemd/system
-%{__install} -m 644 courier-authlib.service $__installdir/lib/systemd/system
-
-%post
-%{_libexecdir}/courier-authlib/sysconftool %{_sysconfdir}/authlib/*.dist >/dev/null
-
-if test -f /etc/rc.d/init.d/courier-authlib
-then
-        /sbin/chkconfig --del courier-authlib
-        /bin/systemctl stop courier-authlib.service || :
-fi
-
-/bin/systemctl daemon-reload || :
-/bin/systemctl enable courier-authlib.service &> /dev/null || :
-
-%preun
-if test -x %{_sbindir}/authdaemond
-then
-	%{_sbindir}/authdaemond >/dev/null 2>&1 || /bin/true
-fi
-
-if test "$1" = "0"
-then
-        /bin/systemctl stop courier-authlib.service
-        /bin/systemctl disable courier-authlib.service
-fi
-
-%postun
-/bin/systemctl daemon-reload || :
-
-%files -f configfiles.base
-%defattr(-,root,root,-)
-%doc README README*html README.authmysql.myownquery README.ldap
-%doc NEWS COPYING* AUTHORS ChangeLog
-/lib/systemd/system/*
-%attr(755, bin, bin) %{_datadir}/courier-authlib.sysvinit
-%ghost %attr(600, root, root) %{_localstatedir}/spool/authdaemon/pid.lock
-%ghost %attr(644, root, root) %{_localstatedir}/spool/authdaemon/pid
-%ghost %attr(-, root, root) %{_localstatedir}/spool/authdaemon/socket
-%{_mandir}/man1/*
-
-%files -f configfiles.userdb userdb
-%{_mandir}/man8/*userdb*
-
-%files -f configfiles.devel devel
-%defattr(-,root,root,-)
-%{_bindir}/courierauthconfig
-%{_includedir}/*
-%{_mandir}/man3/*
-%doc authlib.html auth_*.html
-
-%files -f configfiles.ldap ldap
-%defattr(-,root,root,-)
-%doc authldap.schema authldap.ldif
-
-%files -f configfiles.mysql mysql
-
-%files -f configfiles.sqlite sqlite
-
-%files -f configfiles.pgsql pgsql
-
-%changelog
-* Thu Sep  7 2006 Chris Petersen <rpm@forevermore.net>                  0.58-2
-- Make the spec a little prettier
-- Replace BuildPreReq with BuildRequires
-- Remove period from summaries (rpmlint)
-- Fix release tag to use %{?dist} macro if it's present
-- Change distro-detection to use "rh" and "fc" for version detection, and add support for mandriva
-
-* Sun Oct  3 2004 Mr. Sam <sam@email-scan.com>                          0.50-1
-- Initial build.
-
diff --git a/courier-authlib.spec b/courier-authlib.spec
index 93a5320..e021e58 100644
--- a/courier-authlib.spec
+++ b/courier-authlib.spec
@@ -14,7 +14,7 @@
 ################################################################################
 
 Name:           courier-authlib
-Version:        0.71.1
+Version:        0.71.4
 Release:        1%{?dist}%{?courier_release}
 Summary:        Courier authentication library
 
@@ -58,7 +58,7 @@ 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)
+%define need_perl_generators %(if rpm -q fedora-release >/dev/null 2>/dev/null; then echo "1"; exit 0; fi; echo "0"; exit 1)
 
 %if %need_perl_generators
 BuildRequires: perl-generators
diff --git a/courier-authlib.spec.in b/courier-authlib.spec.in
index f775b22..748df9b 100644
--- a/courier-authlib.spec.in
+++ b/courier-authlib.spec.in
@@ -14,7 +14,7 @@
 ################################################################################
 
 Name:           courier-authlib
-Version:        @VERSION@
+Version:        @PACKAGE_VERSION@
 Release:        1%{?dist}%{?courier_release}
 Summary:        Courier authentication library
 
@@ -58,7 +58,7 @@ 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)
+%define need_perl_generators %(if rpm -q fedora-release >/dev/null 2>/dev/null; then echo "1"; exit 0; fi; echo "0"; exit 1)
 
 %if %need_perl_generators
 BuildRequires: perl-generators
diff --git a/debian/changelog b/debian/changelog
index 74a7b15..fd42390 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+courier-authlib (0.71.4-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- Debian Janitor <janitor@jelmer.uk>  Tue, 15 Mar 2022 21:38:01 -0000
+
 courier-authlib (0.71.1-2) unstable; urgency=medium
 
   * Tighten permissions on /run/courier/authdaemon.  Closes: #984810.
diff --git a/debian/patches/0001-Don-t-mangle-permissions-on-install-time-as-it-s-tak.patch b/debian/patches/0001-Don-t-mangle-permissions-on-install-time-as-it-s-tak.patch
index 4a6b414..edca592 100644
--- a/debian/patches/0001-Don-t-mangle-permissions-on-install-time-as-it-s-tak.patch
+++ b/debian/patches/0001-Don-t-mangle-permissions-on-install-time-as-it-s-tak.patch
@@ -7,9 +7,11 @@ Subject: Don't mangle permissions on install time as it's take care of in
  Makefile.am | 14 --------------
  1 file changed, 14 deletions(-)
 
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -121,8 +121,6 @@
+Index: courier-authlib/Makefile.am
+===================================================================
+--- courier-authlib.orig/Makefile.am
++++ courier-authlib/Makefile.am
+@@ -121,8 +121,6 @@ install-authpgsqlrc:
  	$(mkinstalldirs) $(DESTDIR)`dirname @authpgsqlrc@` || :
  	$(INSTALL_DATA) -m 660 $(srcdir)/authpgsqlrc \
  		$(DESTDIR)@authpgsqlrc@.dist
@@ -18,7 +20,7 @@ Subject: Don't mangle permissions on install time as it's take care of in
  
  uninstall-authpgsqlrc:
  	rm -f $(DESTDIR)@authpgsqlrc@.dist
-@@ -154,8 +152,6 @@
+@@ -154,8 +152,6 @@ install-authldaprc:
  	$(mkinstalldirs) $(DESTDIR)`dirname @authldaprc@` || :
  	$(INSTALL_DATA) -m 660 $(srcdir)/authldaprc \
  		$(DESTDIR)@authldaprc@.dist
@@ -27,7 +29,7 @@ Subject: Don't mangle permissions on install time as it's take care of in
  
  uninstall-authldaprc:
  	rm -f $(DESTDIR)@authldaprc@.dist
-@@ -185,8 +181,6 @@
+@@ -185,8 +181,6 @@ install-authmysqlrc:
  	$(mkinstalldirs) $(DESTDIR)`dirname @authmysqlrc@` || :
  	$(INSTALL_DATA) -m 660 $(srcdir)/authmysqlrc \
  		$(DESTDIR)@authmysqlrc@.dist
@@ -36,7 +38,7 @@ Subject: Don't mangle permissions on install time as it's take care of in
  
  uninstall-authmysqlrc:
  	rm -f $(DESTDIR)@authmysqlrc@.dist
-@@ -216,8 +210,6 @@
+@@ -216,8 +210,6 @@ install-authsqliterc:
  	$(mkinstalldirs) $(DESTDIR)`dirname @authsqliterc@` || :
  	$(INSTALL_DATA) -m 660 $(srcdir)/authsqliterc \
  		$(DESTDIR)@authsqliterc@.dist
@@ -45,7 +47,7 @@ Subject: Don't mangle permissions on install time as it's take care of in
  
  uninstall-authsqliterc:
  	rm -f $(DESTDIR)@authsqliterc@.dist
-@@ -265,8 +257,6 @@
+@@ -265,8 +257,6 @@ install-authdaemonrc:
  	sed 's/@ALLMODULES@/$(modules:lib%.la=%)/' <authdaemonrc >authdaemonrc.tmp
  	$(INSTALL_DATA) -m 660 authdaemonrc.tmp $(DESTDIR)@authdaemonrc@.dist
  	rm -f authdaemonrc.tmp
@@ -54,7 +56,7 @@ Subject: Don't mangle permissions on install time as it's take care of in
  
  uninstall-authdaemonrc:
  	rm -f $(DESTDIR)@authdaemonrc@.dist
-@@ -444,13 +434,9 @@
+@@ -444,13 +434,9 @@ install-exec-hook:
  	$(mkinstalldirs) $(DESTDIR)$(sbindir) || :
  	$(mkinstalldirs) $(DESTDIR)$(pkglibexecdir) || :
  	chmod 755 $(DESTDIR)$(pkglibexecdir)
diff --git a/debian/patches/0002-Rip-AC_PROG_SYSCONFTOOL-macro-to-m4-directory.patch b/debian/patches/0002-Rip-AC_PROG_SYSCONFTOOL-macro-to-m4-directory.patch
index a69aa10..c11bc05 100644
--- a/debian/patches/0002-Rip-AC_PROG_SYSCONFTOOL-macro-to-m4-directory.patch
+++ b/debian/patches/0002-Rip-AC_PROG_SYSCONFTOOL-macro-to-m4-directory.patch
@@ -9,8 +9,10 @@ Subject: Rip AC_PROG_SYSCONFTOOL macro to m4/ directory
  3 files changed, 41 insertions(+)
  create mode 100644 m4/sysconftool.m4
 
---- a/Makefile.am
-+++ b/Makefile.am
+Index: courier-authlib/Makefile.am
+===================================================================
+--- courier-authlib.orig/Makefile.am
++++ courier-authlib/Makefile.am
 @@ -2,6 +2,8 @@
  # Copyright 1998 - 2020 Double Precision, Inc.  See COPYING for
  # distribution information.
@@ -20,9 +22,11 @@ Subject: Rip AC_PROG_SYSCONFTOOL macro to m4/ directory
  AUTOMAKE_OPTIONS=dist-bzip2
  
  SUBDIRS=libs/gdbmobj libs/bdbobj libs/md5 libs/sha1 libs/libhmac libs/numlib libs/makedat userdb libs/rfc822 libs/random128 libs/liblock liblog
---- a/configure.ac
-+++ b/configure.ac
-@@ -9,6 +9,8 @@
+Index: courier-authlib/configure.ac
+===================================================================
+--- courier-authlib.orig/configure.ac
++++ courier-authlib/configure.ac
+@@ -9,6 +9,8 @@ AC_INIT([courier-authlib],[0.71.4],[cour
  
  AC_CONFIG_SRCDIR([courierauth.h])
  
@@ -31,8 +35,10 @@ Subject: Rip AC_PROG_SYSCONFTOOL macro to m4/ directory
  AM_INIT_AUTOMAKE
  AC_CONFIG_HEADERS([courier_auth_config.h])
  >confdefs.h  # Kill PACKAGE_ macros
+Index: courier-authlib/m4/sysconftool.m4
+===================================================================
 --- /dev/null
-+++ b/m4/sysconftool.m4
++++ courier-authlib/m4/sysconftool.m4
 @@ -0,0 +1,37 @@
 +# Configure sysconftool
 +# Copyright 2000-2005 Double Precision, Inc.  See COPYING for
diff --git a/debian/patches/0005-libcourierauth-libraries-are-normal-shared-libraries.patch b/debian/patches/0005-libcourierauth-libraries-are-normal-shared-libraries.patch
index 841a8f1..4d5fc6c 100644
--- a/debian/patches/0005-libcourierauth-libraries-are-normal-shared-libraries.patch
+++ b/debian/patches/0005-libcourierauth-libraries-are-normal-shared-libraries.patch
@@ -7,9 +7,11 @@ Subject: libcourierauth* libraries are normal shared libraries,
  Makefile.am | 14 +++++++-------
  1 file changed, 7 insertions(+), 7 deletions(-)
 
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -19,9 +19,9 @@
+Index: courier-authlib/Makefile.am
+===================================================================
+--- courier-authlib.orig/Makefile.am
++++ courier-authlib/Makefile.am
+@@ -19,9 +19,9 @@ modules=@LIBAUTHUSERDB@ \
  pkglibexecdir=$(libexecdir)/courier-authlib
  pkglibexec_SCRIPTS=authsystem.passwd
  
diff --git a/debian/patches/0007-add-missing-include.patch b/debian/patches/0007-add-missing-include.patch
index 88a0eb9..1231a17 100644
--- a/debian/patches/0007-add-missing-include.patch
+++ b/debian/patches/0007-add-missing-include.patch
@@ -2,8 +2,10 @@ Description: include a missing header file
 Author: Markus Wanner <markus@bluegap.ch>
 Last-Update: 2017-07-02
 
---- a/libs/rfc822/rfc2047.c
-+++ b/libs/rfc822/rfc2047.c
+Index: courier-authlib/libs/rfc822/rfc2047.c
+===================================================================
+--- courier-authlib.orig/libs/rfc822/rfc2047.c
++++ courier-authlib/libs/rfc822/rfc2047.c
 @@ -8,6 +8,7 @@
  #include	<ctype.h>
  #include	<string.h>
diff --git a/debian/patches/0008-fix-perl-shebang.patch b/debian/patches/0008-fix-perl-shebang.patch
index 1371111..4814837 100644
--- a/debian/patches/0008-fix-perl-shebang.patch
+++ b/debian/patches/0008-fix-perl-shebang.patch
@@ -1,5 +1,7 @@
---- a/samplepipe.pl
-+++ b/samplepipe.pl
+Index: courier-authlib/samplepipe.pl
+===================================================================
+--- courier-authlib.orig/samplepipe.pl
++++ courier-authlib/samplepipe.pl
 @@ -1,4 +1,4 @@
 -#!/usr/local/bin/perl -w
 +#!/usr/bin/perl -w
diff --git a/debian/patches/0009-cross.patch b/debian/patches/0009-cross.patch
index f2822ab..f15d110 100644
--- a/debian/patches/0009-cross.patch
+++ b/debian/patches/0009-cross.patch
@@ -1,9 +1,11 @@
 From: Helmut Grohne <helmut@subdivi.de>
 Subject: consider $ac_tool_prefix for pkg-config for cross compilation
 
---- a/configure.ac
-+++ b/configure.ac
-@@ -556,6 +556,7 @@
+Index: courier-authlib/configure.ac
+===================================================================
+--- courier-authlib.orig/configure.ac
++++ courier-authlib/configure.ac
+@@ -592,6 +592,7 @@ AC_ARG_WITH(mysql-includes,
  	MYSQL_CFLAGS="-I$withval"
  )
  
@@ -11,7 +13,7 @@ Subject: consider $ac_tool_prefix for pkg-config for cross compilation
  AC_PATH_PROGS(MYSQL_CONFIG, mysql_config, mysql_config, $LPATH)
  
  if test -x "$MYSQL_CONFIG"
-@@ -566,6 +567,7 @@
+@@ -602,6 +603,7 @@ then
  	eval "MYSQL_CFLAGS=\"\`echo $MYSQL_CFLAGS\`\""
  	eval "MYSQL_LIBS=\"\`echo $MYSQL_LIBS\`\""
  fi
@@ -19,7 +21,7 @@ Subject: consider $ac_tool_prefix for pkg-config for cross compilation
  
  if test "$doauthmysql" = ""
  then
-@@ -633,10 +635,11 @@
+@@ -669,10 +671,11 @@ AC_ARG_WITH(sqlite-includes,
  	SQLITE_CFLAGS="-I$withval"
  )
  
diff --git a/liblog/courierlogger.1 b/liblog/courierlogger.1
index c807602..7713a50 100644
--- a/liblog/courierlogger.1
+++ b/liblog/courierlogger.1
@@ -4,12 +4,12 @@
 .\"     Title: courierlogger
 .\"    Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
-.\"      Date: 10/28/2020
+.\"      Date: 05/21/2021
 .\"    Manual: Double Precision, Inc.
 .\"    Source: Double Precision, Inc.
 .\"  Language: English
 .\"
-.TH "COURIERLOGGER" "1" "10/28/2020" "Double Precision, Inc." "Double Precision, Inc."
+.TH "COURIERLOGGER" "1" "05/21/2021" "Double Precision, Inc." "Double Precision, Inc."
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
diff --git a/libs/bdbobj/Makefile.in b/libs/bdbobj/Makefile.in
index a4e42dc..0c6643e 100644
--- a/libs/bdbobj/Makefile.in
+++ b/libs/bdbobj/Makefile.in
@@ -350,6 +350,7 @@ pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
diff --git a/libs/bdbobj/bdbobj2.c b/libs/bdbobj/bdbobj2.c
index d4311b7..f289b52 100644
--- a/libs/bdbobj/bdbobj2.c
+++ b/libs/bdbobj/bdbobj2.c
@@ -70,6 +70,9 @@ DBT	key, value;
 	}
 #endif
 
+	if (!key.data)
+		return 0;
+
 	*keylen=key.size;
 	*vallen=value.size;
 	if ((*val=(char *)malloc(*vallen + 1)) == 0)	return (0);
diff --git a/libs/bdbobj/configure b/libs/bdbobj/configure
index 2b1ca23..728a9b3 100755
--- a/libs/bdbobj/configure
+++ b/libs/bdbobj/configure
@@ -739,6 +739,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -826,6 +827,7 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1078,6 +1080,15 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1215,7 +1226,7 @@ fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1368,6 +1379,7 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
diff --git a/libs/gdbmobj/Makefile.in b/libs/gdbmobj/Makefile.in
index 674a131..e80f7cf 100644
--- a/libs/gdbmobj/Makefile.in
+++ b/libs/gdbmobj/Makefile.in
@@ -351,6 +351,7 @@ pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
diff --git a/libs/gdbmobj/configure b/libs/gdbmobj/configure
index 22187aa..3e3642b 100755
--- a/libs/gdbmobj/configure
+++ b/libs/gdbmobj/configure
@@ -739,6 +739,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -826,6 +827,7 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1078,6 +1080,15 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1215,7 +1226,7 @@ fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1368,6 +1379,7 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -17270,53 +17282,6 @@ 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
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the C++ compiler needs -fhandle-exceptions" >&5
-$as_echo_n "checking if the C++ compiler needs -fhandle-exceptions... " >&6; }
-if ${ac_cv_need_handlexceptions+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-throw;
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
-  ac_cv_need_handlexceptions=no
-else
-  ac_cv_need_handlexceptions=yes
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_need_handlexceptions" >&5
-$as_echo "$ac_cv_need_handlexceptions" >&6; }
-
-if test "$ac_cv_need_handlexceptions" = "yes"
-then
-	case "$CXXFLAGS" in
-	*handle-exceptions*)
-		;;
-	*)
-		CXXFLAGS="-fhandle-exceptions $CXXFLAGS"
-		CXXFLAGS=`echo "$CXXFLAGS" | sed 's/-O2//'`
-		;;
-	esac
-fi
-
 ac_config_files="$ac_config_files Makefile"
 
 cat >confcache <<\_ACEOF
diff --git a/libs/gdbmobj/configure.ac b/libs/gdbmobj/configure.ac
index ca1cb22..6dfd317 100644
--- a/libs/gdbmobj/configure.ac
+++ b/libs/gdbmobj/configure.ac
@@ -49,27 +49,4 @@ AC_SYS_LARGEFILE
 
 dnl Checks for library functions.
 
-AC_LANG_CPLUSPLUS
-AC_CACHE_CHECK([if the C++ compiler needs -fhandle-exceptions],
-	ac_cv_need_handlexceptions,
-
-AC_TRY_COMPILE([],
-[
-throw;
-], ac_cv_need_handlexceptions=no,
-ac_cv_need_handlexceptions=yes)
-)
-
-if test "$ac_cv_need_handlexceptions" = "yes"
-then
-	case "$CXXFLAGS" in
-	*handle-exceptions*)
-		;;
-	*)
-		CXXFLAGS="-fhandle-exceptions $CXXFLAGS"
-		CXXFLAGS=`echo "$CXXFLAGS" | sed 's/-O2//'`
-		;;
-	esac
-fi
-
 AC_OUTPUT(Makefile)
diff --git a/libs/libhmac/Makefile.in b/libs/libhmac/Makefile.in
index 4420572..54da50e 100644
--- a/libs/libhmac/Makefile.in
+++ b/libs/libhmac/Makefile.in
@@ -328,6 +328,7 @@ pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
diff --git a/libs/libhmac/configure b/libs/libhmac/configure
index 7ff7632..16cbef7 100755
--- a/libs/libhmac/configure
+++ b/libs/libhmac/configure
@@ -731,6 +731,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -813,6 +814,7 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1065,6 +1067,15 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1202,7 +1213,7 @@ fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1355,6 +1366,7 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
diff --git a/libs/liblock/Makefile.in b/libs/liblock/Makefile.in
index 0c7451c..7b05c15 100644
--- a/libs/liblock/Makefile.in
+++ b/libs/liblock/Makefile.in
@@ -329,6 +329,7 @@ pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
diff --git a/libs/liblock/configure b/libs/liblock/configure
index 2f3d02f..effb1a7 100755
--- a/libs/liblock/configure
+++ b/libs/liblock/configure
@@ -737,6 +737,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -821,6 +822,7 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1073,6 +1075,15 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1210,7 +1221,7 @@ fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1363,6 +1374,7 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -12728,12 +12740,12 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 #include <sys/types.h>
+off64_t	n;
 
 int
 main ()
 {
 
-off64_t	n;
 
 	n=0;
 
@@ -12782,12 +12794,12 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #if     HAVE_SYS_FCNTL_H
 #include        <sys/fcntl.h>
 #endif
+flock_t t;
 
 int
 main ()
 {
 
-flock_t t;
 
   ;
   return 0;
@@ -12882,12 +12894,12 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 
 #define	LL_OFFSET_TYPE	$LL_OFFSET_TYPE
 #include "${srcdir}/lockfcntl.c"
+int n;
 
 int
 main ()
 {
 
-int n;
 
   ;
   return 0;
@@ -12921,12 +12933,12 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 
 #define	LL_OFFSET_TYPE	$LL_OFFSET_TYPE
 #include "${srcdir}/lockflock.c"
+int n;
 
 int
 main ()
 {
 
-int n;
 
   ;
   return 0;
@@ -12960,12 +12972,12 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 
 #define	LL_OFFSET_TYPE	$LL_OFFSET_TYPE
 #include "${srcdir}/locklockf.c"
+int n;
 
 int
 main ()
 {
 
-int n;
 
   ;
   return 0;
diff --git a/libs/liblock/configure.ac b/libs/liblock/configure.ac
index 728ef1e..5e1745c 100644
--- a/libs/liblock/configure.ac
+++ b/libs/liblock/configure.ac
@@ -42,8 +42,8 @@ AC_CACHE_CHECK( [for off64_t], liblock_cv_hasoff64t,
 liblock_cv_hasoff64t="no"
 AC_TRY_COMPILE([
 #include <sys/types.h>
-],[
 off64_t	n;
+],[
 
 	n=0;
 ], liblock_cv_hasoff64t="yes")
@@ -72,8 +72,8 @@ AC_TRY_COMPILE([
 #if     HAVE_SYS_FCNTL_H
 #include        <sys/fcntl.h>
 #endif
-],[
 flock_t t;
+],[
 ], liblock_cv_hasflock_t="yes"))
 
 if test "$liblock_cv_hasflock_t" = "yes"
@@ -95,8 +95,8 @@ liblock_cv_hasfcntl="no"
 AC_TRY_LINK([
 #define	LL_OFFSET_TYPE	$LL_OFFSET_TYPE
 #include "${srcdir}/lockfcntl.c"
-],[
 int n;
+],[
 ], liblock_cv_hasfcntl="yes"))
 if test "$liblock_cv_hasfcntl" = "yes"
 then
@@ -109,8 +109,8 @@ liblock_cv_hasflock="no"
 AC_TRY_LINK([
 #define	LL_OFFSET_TYPE	$LL_OFFSET_TYPE
 #include "${srcdir}/lockflock.c"
-],[
 int n;
+],[
 ], liblock_cv_hasflock="yes"))
 if test "$liblock_cv_hasflock" = "yes"
 then
@@ -123,8 +123,8 @@ liblock_cv_haslockf="no"
 AC_TRY_LINK([
 #define	LL_OFFSET_TYPE	$LL_OFFSET_TYPE
 #include "${srcdir}/locklockf.c"
-],[
 int n;
+],[
 ], liblock_cv_haslockf="yes"))
 if test "$liblock_cv_haslockf" = "yes"
 then
diff --git a/libs/liblock/lockmail.1 b/libs/liblock/lockmail.1
index 29df428..ab6e46d 100644
--- a/libs/liblock/lockmail.1
+++ b/libs/liblock/lockmail.1
@@ -4,12 +4,12 @@
 .\"     Title: lockmail
 .\"    Author: Sam Varshavchik
 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
-.\"      Date: 10/28/2020
+.\"      Date: 05/21/2021
 .\"    Manual: Double Precision, Inc.
 .\"    Source: Courier Mail Server
 .\"  Language: English
 .\"
-.TH "LOCKMAIL" "1" "10/28/2020" "Courier Mail Server" "Double Precision, Inc\&."
+.TH "LOCKMAIL" "1" "05/21/2021" "Courier Mail Server" "Double Precision, Inc\&."
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
diff --git a/libs/liblock/locktest.c b/libs/liblock/locktest.c
index eb5cc4a..f9ee6fc 100644
--- a/libs/liblock/locktest.c
+++ b/libs/liblock/locktest.c
@@ -13,6 +13,13 @@
 #if	USE_LOCKF
 #include	"locklockf.c"
 #endif
+#if	HAVE_UNISTD_H
+#include	<unistd.h>
+#endif
+#include <sys/types.h>
+#if HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
 #include	<signal.h>
 #include	<stdlib.h>
 #include	<string.h>
diff --git a/libs/makedat/Makefile.in b/libs/makedat/Makefile.in
index 3ca9d04..0c00b57 100644
--- a/libs/makedat/Makefile.in
+++ b/libs/makedat/Makefile.in
@@ -318,6 +318,7 @@ pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
diff --git a/libs/makedat/configure b/libs/makedat/configure
index 583cee6..0efb9da 100755
--- a/libs/makedat/configure
+++ b/libs/makedat/configure
@@ -734,6 +734,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -818,6 +819,7 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1070,6 +1072,15 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1207,7 +1218,7 @@ fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1360,6 +1371,7 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
diff --git a/libs/makedat/makedat.in b/libs/makedat/makedat.in
index 53259ab..4278a3a 100644
--- a/libs/makedat/makedat.in
+++ b/libs/makedat/makedat.in
@@ -1,7 +1,7 @@
 #! @SHELL@
 #
 #
-# Copyright 1998 - 2004 Double Precision, Inc.  See COPYING for
+# Copyright 1998 - 2021 Double Precision, Inc.  See COPYING for
 # distribution information.
 #
 # Generic wrapper for makedat.
@@ -83,10 +83,16 @@ get_access() {
 	then
 		if test "$srcfile" != "CVS"
 		then
-			find -L "$srcfile" -maxdepth 1 -type f -not -name "*~" -not -regex ".*\.dpkg-[a-z]*" -exec cat {} \;
+			find -L "$srcfile" -maxdepth 1 -type f -not -name "*~" -not -regex ".*\.dpkg-[a-z]*" -print |
+			while read F
+			do
+				@CAT@ "$F"
+				echo
+			done
 		fi
 	else
-		cat "$srcfile" || return
+		@CAT@ "$srcfile" || return
+		echo
 	fi
 	echo "."
 }
diff --git a/libs/md5/Makefile.in b/libs/md5/Makefile.in
index 1e537cb..7d38386 100644
--- a/libs/md5/Makefile.in
+++ b/libs/md5/Makefile.in
@@ -323,6 +323,7 @@ pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
diff --git a/libs/md5/configure b/libs/md5/configure
index 5f57f63..898889b 100755
--- a/libs/md5/configure
+++ b/libs/md5/configure
@@ -731,6 +731,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -815,6 +816,7 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1067,6 +1069,15 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1204,7 +1215,7 @@ fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1357,6 +1368,7 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -12464,12 +12476,13 @@ $as_echo "#define STDC_HEADERS 1" >>confdefs.h
 fi
 
 
-for ac_header in sys/types.h
+for ac_header in sys/types.h stdint.h
 do :
-  ac_fn_c_check_header_mongrel "$LINENO" "sys/types.h" "ac_cv_header_sys_types_h" "$ac_includes_default"
-if test "x$ac_cv_header_sys_types_h" = xyes; then :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
-#define HAVE_SYS_TYPES_H 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -12494,12 +12507,15 @@ $as_echo_n "checking for uint32_t... " >&6; }
 #if HAVE_SYS_TYPES_H
 #include	<sys/types.h>
 #endif
+#if HAVE_STDINT_H
+#include	<stdint.h>
+#endif
+uint32_t i;
 
 int
 main ()
 {
 
-			uint32_t	i=0;
 
   ;
   return 0;
@@ -12522,12 +12538,15 @@ $as_echo_n "checking for u_int_32_t... " >&6; }
 #if HAVE_SYS_TYPES_H
 #include	<sys/types.h>
 #endif
+#if HAVE_STDINT_H
+#include	<stdint.h>
+#endif
+u_int32_t	i;
 
 int
 main ()
 {
 
-				u_int32_t	i=0;
 
   ;
   return 0;
diff --git a/libs/md5/configure.ac b/libs/md5/configure.ac
index 0f53ceb..4a90c95 100644
--- a/libs/md5/configure.ac
+++ b/libs/md5/configure.ac
@@ -35,7 +35,7 @@ dnl Checks for libraries.
 dnl Checks for header files.
 AC_HEADER_STDC
 
-AC_CHECK_HEADERS(sys/types.h)
+AC_CHECK_HEADERS(sys/types.h stdint.h)
 
 
 AC_ARG_WITH(int32,
@@ -49,8 +49,11 @@ AC_ARG_WITH(int32,
 #if HAVE_SYS_TYPES_H
 #include	<sys/types.h>
 #endif
+#if HAVE_STDINT_H
+#include	<stdint.h>
+#endif
+uint32_t i;
 		],[
-			uint32_t	i=0;
 		], [ AC_MSG_RESULT(yes) ; int32="uint32_t"], [
 
 		AC_MSG_RESULT(no)
@@ -60,8 +63,11 @@ AC_ARG_WITH(int32,
 #if HAVE_SYS_TYPES_H
 #include	<sys/types.h>
 #endif
+#if HAVE_STDINT_H
+#include	<stdint.h>
+#endif
+u_int32_t	i;
 			],[
-				u_int32_t	i=0;
 			], [AC_MSG_RESULT(yes); int32="u_int32_t"],[
 
 			AC_MSG_RESULT(no)
diff --git a/libs/md5/md5.h b/libs/md5/md5.h
index 2124879..7a99ea1 100644
--- a/libs/md5/md5.h
+++ b/libs/md5/md5.h
@@ -24,6 +24,9 @@ extern "C" {
 #include	<sys/types.h>
 #endif
 
+#if	HAVE_STDINT_H
+#include	<stdint.h>
+#endif
 #define	MD5_DIGEST_SIZE	16
 #define	MD5_BLOCK_SIZE	64
 
diff --git a/libs/numlib/Makefile.in b/libs/numlib/Makefile.in
index 7ea4c86..047af8d 100644
--- a/libs/numlib/Makefile.in
+++ b/libs/numlib/Makefile.in
@@ -319,6 +319,7 @@ pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
diff --git a/libs/numlib/changeuidgid.c b/libs/numlib/changeuidgid.c
index adaee40..ce69839 100644
--- a/libs/numlib/changeuidgid.c
+++ b/libs/numlib/changeuidgid.c
@@ -47,16 +47,21 @@ void libmail_changeuidgid(uid_t uid, gid_t gid)
 	}
 }
 
-void libmail_changeusername(const char *uname, const gid_t *forcegrp)
+/**
+ * Obtain the uid associated to uname and, optionally, the user primary gid
+ */
+uid_t libmail_getuid(const char *uname, gid_t *pw_gid)
 {
-struct passwd *pw;
-uid_t	changeuid;
-gid_t	changegid;
+	size_t bufsize;
+	char *buf;
+	struct passwd pwbuf;
+	struct passwd *pw;
 
-/* uname might be a pointer returned from a previous called to getpw(),
-** and libc has a problem getting it back.
-*/
-char	*p=malloc(strlen(uname)+1);
+	/*
+	** uname might be a pointer returned from a previous called to getpw(),
+	** and libc has a problem getting it back.
+	*/
+	char	*p=malloc(strlen(uname)+1);
 
 	if (!p)
 	{
@@ -65,8 +70,29 @@ char	*p=malloc(strlen(uname)+1);
 	}
 	strcpy(p, uname);
 
+#ifdef _SC_GETGR_R_SIZE_MAX
+	bufsize = sysconf(_SC_GETGR_R_SIZE_MAX);
+	if (bufsize == -1)          /* Value was indeterminate */
+	{
+#endif
+		bufsize = 16384;        /* Should be more than enough */
+	}
+
+	buf = malloc(bufsize);
+	if (buf == NULL)
+	{
+		perror("malloc");
+		exit(1);
+	}
+
+
 	errno=ENOENT;
-	if ((pw=getpwnam(p)) == 0)
+
+	getpwnam_r(p, &pwbuf, buf, bufsize, &pw);
+
+	free(buf);
+
+	if (pw == 0)
 	{
 		free(p);
 		perror("getpwnam");
@@ -74,11 +100,19 @@ char	*p=malloc(strlen(uname)+1);
 	}
 	free(p);
 
-	changeuid=pw->pw_uid;
+	if ( pw_gid ) *pw_gid = pw->pw_gid;
+
+	return pw->pw_uid;
+}
+
+void libmail_changeusername(const char *uname, const gid_t *forcegrp)
+{
+uid_t	changeuid;
+gid_t	changegid;
 
-	if ( !forcegrp )	forcegrp= &pw->pw_gid;
+	changeuid=libmail_getuid(uname, &changegid);
 
-	changegid= *forcegrp;
+	if ( forcegrp )	changegid= *forcegrp;
 
 	if ( setgid( changegid ))
 	{
@@ -87,7 +121,7 @@ char	*p=malloc(strlen(uname)+1);
 	}
 
 #if HAVE_INITGROUPS
-	if ( getuid() == 0 && initgroups(pw->pw_name, changegid) )
+	if ( getuid() == 0 && initgroups(uname, changegid) )
 	{
 		perror("initgroups");
 		exit(1);
@@ -108,3 +142,58 @@ char	*p=malloc(strlen(uname)+1);
 		exit(1);
 	}
 }
+
+gid_t libmail_getgid(const char *gname)
+{
+	gid_t g;
+	struct group grp;
+	struct group *result;
+	char *buf;
+	size_t bufsize;
+	int s;
+	char	*p=malloc(strlen(gname)+1);
+
+	if (!p)
+	{
+		perror("malloc");
+		exit(1);
+	}
+	strcpy(p, gname);
+
+#ifdef _SC_GETGR_R_SIZE_MAX
+	bufsize = sysconf(_SC_GETGR_R_SIZE_MAX);
+	if (bufsize == -1)          /* Value was indeterminate */
+#endif
+	{
+		bufsize = 16384;        /* Should be more than enough */
+	}
+
+	buf = malloc(bufsize);
+	if (buf == NULL)
+	{
+		perror("malloc");
+		exit(1);
+	}
+
+	s = getgrnam_r(p, &grp, buf, bufsize, &result);
+	free(p);
+
+	if (result == NULL)
+	{
+		if (s == 0)
+		{
+			fprintf(stderr, "CRIT: Group %s not found\n", gname);
+		}
+		else
+		{
+			errno = s;
+			perror("getpwnam_r");
+		}
+		exit(1);
+	}
+
+	g = grp.gr_gid;
+	free(buf);
+
+	return g;
+}
diff --git a/libs/numlib/configure b/libs/numlib/configure
index 7a38572..cc94d45 100755
--- a/libs/numlib/configure
+++ b/libs/numlib/configure
@@ -729,6 +729,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -812,6 +813,7 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1064,6 +1066,15 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1201,7 +1212,7 @@ fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1354,6 +1365,7 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
diff --git a/libs/numlib/numlib.h b/libs/numlib/numlib.h
index 1aa3386..ecc75ad 100644
--- a/libs/numlib/numlib.h
+++ b/libs/numlib/numlib.h
@@ -95,6 +95,9 @@ void libmail_changeusername(const char *, const gid_t *);
 	** no aux group IDs for the user, any AUX ids are cleared.
 	*/
 
+uid_t libmail_getuid(const char *, gid_t *);
+gid_t libmail_getgid(const char *);
+
 #ifdef	__cplusplus
 }
 #endif
diff --git a/libs/random128/Makefile.in b/libs/random128/Makefile.in
index e9a28d6..68cfe62 100644
--- a/libs/random128/Makefile.in
+++ b/libs/random128/Makefile.in
@@ -313,6 +313,7 @@ pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
diff --git a/libs/random128/configure b/libs/random128/configure
index 1460a55..e8a008b 100755
--- a/libs/random128/configure
+++ b/libs/random128/configure
@@ -731,6 +731,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -815,6 +816,7 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1067,6 +1069,15 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1204,7 +1215,7 @@ fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1357,6 +1368,7 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
diff --git a/libs/rfc822/Makefile.in b/libs/rfc822/Makefile.in
index f5798e7..59c9c17 100644
--- a/libs/rfc822/Makefile.in
+++ b/libs/rfc822/Makefile.in
@@ -346,6 +346,7 @@ pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
diff --git a/libs/rfc822/config.h.in b/libs/rfc822/config.h.in
index 735af1a..a558600 100644
--- a/libs/rfc822/config.h.in
+++ b/libs/rfc822/config.h.in
@@ -21,18 +21,12 @@
 /* Define to 1 if you have the <stdlib.h> header file. */
 #undef HAVE_STDLIB_H
 
-/* Define to 1 if you have the `strcasecmp' function. */
-#undef HAVE_STRCASECMP
-
 /* Define to 1 if you have the <strings.h> header file. */
 #undef HAVE_STRINGS_H
 
 /* Define to 1 if you have the <string.h> header file. */
 #undef HAVE_STRING_H
 
-/* Define to 1 if you have the `strncasecmp' function. */
-#undef HAVE_STRNCASECMP
-
 /* Define to 1 if you have the <sys/stat.h> header file. */
 #undef HAVE_SYS_STAT_H
 
diff --git a/libs/rfc822/configure b/libs/rfc822/configure
index 0ed360f..9cb7259 100755
--- a/libs/rfc822/configure
+++ b/libs/rfc822/configure
@@ -736,6 +736,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -825,6 +826,7 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1077,6 +1079,15 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1214,7 +1225,7 @@ fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1367,6 +1378,7 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -13086,12 +13098,13 @@ $as_echo "#define STDC_HEADERS 1" >>confdefs.h
 
 fi
 
-for ac_header in locale.h
+for ac_header in locale.h strings.h
 do :
-  ac_fn_c_check_header_mongrel "$LINENO" "locale.h" "ac_cv_header_locale_h" "$ac_includes_default"
-if test "x$ac_cv_header_locale_h" = xyes; then :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
-#define HAVE_LOCALE_H 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -13647,13 +13660,12 @@ $as_echo_n "checking if Libidn should be used... " >&6; }
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libidn" >&5
 $as_echo "$libidn" >&6; }
 
-for ac_func in strcasecmp strncasecmp setlocale
+for ac_func in setlocale
 do :
-  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+  ac_fn_c_check_func "$LINENO" "setlocale" "ac_cv_func_setlocale"
+if test "x$ac_cv_func_setlocale" = xyes; then :
   cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define HAVE_SETLOCALE 1
 _ACEOF
 
 fi
@@ -13669,12 +13681,13 @@ else
 /* end confdefs.h.  */
 
 #include	<time.h>
+time_t  t;
 
 int
 main ()
 {
 
-time_t	t=altzone;
+t=altzone;
 
   ;
   return 0;
@@ -13687,12 +13700,13 @@ else
 /* end confdefs.h.  */
 
 #include	<time.h>
+int n;
 
 int
 main ()
 {
 
-int	n=daylight;
+	n=daylight;
 
   ;
   return 0;
@@ -13707,12 +13721,13 @@ else
 #include	<time.h>
 
 extern struct tm dummy;
+long n;
 
 int
 main ()
 {
 
-long	n=dummy.tm_gmtoff;
+	n=dummy.tm_gmtoff;
 
   ;
   return 0;
diff --git a/libs/rfc822/configure.ac b/libs/rfc822/configure.ac
index 03fdb4b..a8d7efd 100644
--- a/libs/rfc822/configure.ac
+++ b/libs/rfc822/configure.ac
@@ -29,7 +29,7 @@ dnl Checks for libraries.
 
 dnl Checks for header files.
 AC_HEADER_STDC
-AC_CHECK_HEADERS(locale.h)
+AC_CHECK_HEADERS(locale.h strings.h)
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
@@ -58,28 +58,31 @@ fi
 AC_MSG_CHECKING([if Libidn should be used])
 AC_MSG_RESULT($libidn)
 
-AC_CHECK_FUNCS(strcasecmp strncasecmp setlocale)
+AC_CHECK_FUNCS(setlocale)
 
 AC_CACHE_CHECK([how to calculate alternate timezone],librfc822_cv_SYS_TIMEZONE,
 
 AC_TRY_COMPILE([
 #include	<time.h>
+time_t  t;
 ],[
-time_t	t=altzone;
+t=altzone;
 ], librfc822_cv_SYS_TIMEZONE=altzone,
 
 	AC_TRY_COMPILE([
 #include	<time.h>
+int n;
 ],[
-int	n=daylight;
+	n=daylight;
 	], librfc822_cv_SYS_TIMEZONE=daylight,
 
 	AC_TRY_COMPILE([
 #include	<time.h>
 
 extern struct tm dummy;
+long n;
 ],[
-long	n=dummy.tm_gmtoff;
+	n=dummy.tm_gmtoff;
 	] ,librfc822_cv_SYS_TIMEZONE=tm_gmtoff,
 		librfc822_cv_SYS_TIMEZONE=unknown
 			)
diff --git a/libs/rfc822/imapsubj.c b/libs/rfc822/imapsubj.c
index 2f6adfd..97da19c 100644
--- a/libs/rfc822/imapsubj.c
+++ b/libs/rfc822/imapsubj.c
@@ -10,19 +10,10 @@
 #include	<ctype.h>
 #include	<stdlib.h>
 #include	<string.h>
-#include	"rfc822.h"
-
-#if	HAVE_STRCASECMP
-
-#else
-#define	strcasecmp	stricmp
-#endif
-
-#if	HAVE_STRNCASECMP
-
-#else
-#define	strncasecmp	strnicmp
+#if	HAVE_STRINGS_H
+#include	<strings.h>
 #endif
+#include	"rfc822.h"
 
 /* Skip over blobs */
 
diff --git a/libs/rfc822/rfc822.3 b/libs/rfc822/rfc822.3
index fbd4ad5..f7d6c3d 100644
--- a/libs/rfc822/rfc822.3
+++ b/libs/rfc822/rfc822.3
@@ -4,12 +4,12 @@
 .\"     Title: rfc822
 .\"    Author: Sam Varshavchik
 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
-.\"      Date: 10/28/2020
+.\"      Date: 05/21/2021
 .\"    Manual: Double Precision, Inc.
 .\"    Source: Courier Mail Server
 .\"  Language: English
 .\"
-.TH "RFC822" "3" "10/28/2020" "Courier Mail Server" "Double Precision, Inc\&."
+.TH "RFC822" "3" "05/21/2021" "Courier Mail Server" "Double Precision, Inc\&."
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
diff --git a/libs/sha1/Makefile.in b/libs/sha1/Makefile.in
index 97ddac7..b11cdb9 100644
--- a/libs/sha1/Makefile.in
+++ b/libs/sha1/Makefile.in
@@ -325,6 +325,7 @@ pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
diff --git a/libs/sha1/configure b/libs/sha1/configure
index d5bf5cb..337d72f 100755
--- a/libs/sha1/configure
+++ b/libs/sha1/configure
@@ -731,6 +731,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -816,6 +817,7 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1068,6 +1070,15 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1205,7 +1216,7 @@ fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1358,6 +1369,7 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -12312,12 +12324,13 @@ CFLAGS="$CFLAGS -I$srcdir/.. -I.."
 
 
 
-for ac_header in sys/types.h
+for ac_header in sys/types.h stdint.h
 do :
-  ac_fn_c_check_header_mongrel "$LINENO" "sys/types.h" "ac_cv_header_sys_types_h" "$ac_includes_default"
-if test "x$ac_cv_header_sys_types_h" = xyes; then :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
-#define HAVE_SYS_TYPES_H 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -12341,12 +12354,15 @@ $as_echo_n "checking for uint32_t... " >&6; }
 #if HAVE_SYS_TYPES_H
 #include	<sys/types.h>
 #endif
+#if HAVE_STDINT_H
+#include	<stdint.h>
+#endif
+uint32_t i;
 
 int
 main ()
 {
 
-			uint32_t	i=0;
 
   ;
   return 0;
@@ -12369,12 +12385,15 @@ $as_echo_n "checking for u_int_32_t... " >&6; }
 #if HAVE_SYS_TYPES_H
 #include	<sys/types.h>
 #endif
+#if HAVE_STDINT_H
+#include	<stdint.h>
+#endif
+u_int32_t i;
 
 int
 main ()
 {
 
-				u_int32_t	i=0;
 
   ;
   return 0;
@@ -12537,12 +12556,15 @@ $as_echo_n "checking for uint64_t... " >&6; }
 #if HAVE_SYS_TYPES_H
 #include	<sys/types.h>
 #endif
+#if HAVE_STDINT_H
+#include	<stdint.h>
+#endif
+uint64_t	i;
 
 int
 main ()
 {
 
-			uint64_t	i=0;
 
   ;
   return 0;
@@ -12565,12 +12587,15 @@ $as_echo_n "checking for u_int_64_t... " >&6; }
 #if HAVE_SYS_TYPES_H
 #include	<sys/types.h>
 #endif
+#if HAVE_STDINT_H
+#include	<stdint.h>
+#endif
+u_int64_t	i;
 
 int
 main ()
 {
 
-				u_int64_t	i=0;
 
   ;
   return 0;
diff --git a/libs/sha1/configure.ac b/libs/sha1/configure.ac
index d424b26..6bc8351 100644
--- a/libs/sha1/configure.ac
+++ b/libs/sha1/configure.ac
@@ -32,7 +32,7 @@ dnl Checks for libraries.
 
 dnl Checks for header files.
 
-AC_CHECK_HEADERS(sys/types.h)
+AC_CHECK_HEADERS(sys/types.h stdint.h)
 
 AC_ARG_WITH(int32,
 [  --with-int32='type'     use 'type' for an unsigned 32 bit integer type
@@ -45,8 +45,11 @@ AC_ARG_WITH(int32,
 #if HAVE_SYS_TYPES_H
 #include	<sys/types.h>
 #endif
+#if HAVE_STDINT_H
+#include	<stdint.h>
+#endif
+uint32_t i;
 		],[
-			uint32_t	i=0;
 		], [ AC_MSG_RESULT(yes) ; int32="uint32_t"], [
 
 		AC_MSG_RESULT(no)
@@ -56,8 +59,11 @@ AC_ARG_WITH(int32,
 #if HAVE_SYS_TYPES_H
 #include	<sys/types.h>
 #endif
+#if HAVE_STDINT_H
+#include	<stdint.h>
+#endif
+u_int32_t i;
 			],[
-				u_int32_t	i=0;
 			], [AC_MSG_RESULT(yes); int32="u_int32_t"],[
 
 			AC_MSG_RESULT(no)
@@ -99,8 +105,11 @@ AC_ARG_WITH(int64,
 #if HAVE_SYS_TYPES_H
 #include	<sys/types.h>
 #endif
+#if HAVE_STDINT_H
+#include	<stdint.h>
+#endif
+uint64_t	i;
 		],[
-			uint64_t	i=0;
 		], [ AC_MSG_RESULT(yes) ; int64="uint64_t"], [
 
 		AC_MSG_RESULT(no)
@@ -110,8 +119,11 @@ AC_ARG_WITH(int64,
 #if HAVE_SYS_TYPES_H
 #include	<sys/types.h>
 #endif
+#if HAVE_STDINT_H
+#include	<stdint.h>
+#endif
+u_int64_t	i;
 			],[
-				u_int64_t	i=0;
 			], [AC_MSG_RESULT(yes); int64="u_int64_t"],[
 
 			AC_MSG_RESULT(no)
diff --git a/libs/sha1/sha1.h b/libs/sha1/sha1.h
index 3bd397c..d63e88e 100644
--- a/libs/sha1/sha1.h
+++ b/libs/sha1/sha1.h
@@ -14,6 +14,9 @@
 #if	HAVE_SYS_TYPES_H
 #include	<sys/types.h>
 #endif
+#if	HAVE_STDINT_H
+#include	<stdint.h>
+#endif
 
 #define	SHA1_DIGEST_SIZE	20
 #define	SHA1_BLOCK_SIZE		64
diff --git a/sysconftool b/sysconftool
index e9b2066..016c22b 100755
--- a/sysconftool
+++ b/sysconftool
@@ -12,7 +12,7 @@ my $noclobber;
 my $force;
 my $require;
 
-my $myversion="0.17.20191110";
+my $myversion="0.18";
 
 exit 1 unless GetOptions("v" => \$ver, "n" => \$noclobber,
 			 "f" => \$force, "r=s" => \$require);