From acd207af1bf340df75a64e8bc4d1e93caa13bbb2 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Tue, 17 Jul 2018 23:36:31 +0000 Subject: [PATCH] TrivialDB support (#223) Allow use of Samba TrivialDB instead of outdated BerkleyDB in the session helper. Require TrivialDB support for use of the time_quota helper. libdb v1.85 is no longer supported by distributors and upgrading to v5 only to deprecate use does not seem to be worthwhile. --- acinclude/tdb.m4 | 49 ++++++ configure.ac | 1 + doc/release-notes/release-5.sgml | 7 +- src/acl/external/session/Makefile.am | 3 +- src/acl/external/session/ext_session_acl.cc | 143 +++++++++++++++--- src/acl/external/session/required.m4 | 26 +++- src/acl/external/time_quota/Makefile.am | 2 +- .../external/time_quota/ext_time_quota_acl.cc | 93 ++++++------ src/acl/external/time_quota/required.m4 | 13 +- test-suite/buildtests/layer-01-minimal.opts | 1 + test-suite/buildtests/layer-02-maximus.opts | 1 + 11 files changed, 253 insertions(+), 86 deletions(-) create mode 100644 acinclude/tdb.m4 diff --git a/acinclude/tdb.m4 b/acinclude/tdb.m4 new file mode 100644 index 0000000000..20b2b2af08 --- /dev/null +++ b/acinclude/tdb.m4 @@ -0,0 +1,49 @@ +## Copyright (C) 1996-2018 The Squid Software Foundation and contributors +## +## Squid software is distributed under GPLv2+ license and includes +## contributions from numerous individuals and organizations. +## Please see the COPYING and CONTRIBUTORS files for details. +## + +dnl check for --with-tdb option +AC_DEFUN([SQUID_CHECK_LIBTDB],[ +AC_ARG_WITH(tdb, + AS_HELP_STRING([--without-tdb], + [Do not use Samba TrivialDB. Default: auto-detect]), [ +case "$with_tdb" in + yes|no|auto) + : # Nothing special to do here + ;; + *) + AS_IF([test ! -d "$withval"], + AC_MSG_ERROR([--with-tdb path ($with_tdb) does not point to a directory]) + ) + LIBTDB_PATH="-L$withval/lib" + CPPFLAGS="-I$withval/include $CPPFLAGS" + ;; +esac +]) +AH_TEMPLATE(USE_TRIVIALDB,[Samba TrivialDB support is available]) +AS_IF([test "x$with_tdb" != "xno"],[ + SQUID_STATE_SAVE(squid_libtdb_state) + LIBS="$LIBS $LIBTDB_PATH" + PKG_CHECK_MODULES([LIBTDB],[tdb],[CPPFLAGS="$CPPFLAGS $LIBTDB_CFLAGS"],[:]) + AC_CHECK_HEADERS([sys/stat.h tdb.h],,,[ +#if HAVE_SYS_STAT_H +#include +#endif + ]) + SQUID_STATE_ROLLBACK(squid_libtdb_state) #de-pollute LIBS + + AS_IF([test "x$with_tdb" = "xyes" -a "x$LIBTDB_LIBS" = "x"], + AC_MSG_ERROR([Required TrivialDB library not found]) + ) + AS_IF([test "x$LIBTDB_LIBS" != "x"],[ + CXXFLAGS="$LIBTDB_CFLAGS $CXXFLAGS" + LIBTDB_LIBS="$LIBTDB_PATH $LIBTDB_LIBS" + AC_DEFINE_UNQUOTED(USE_TRIVIALDB, HAVE_TDB_H, [Samba TrivialDB support is available]) + ],[with_tdb=no]) +]) +AC_MSG_NOTICE([Samba TrivialDB library support: ${with_tdb:=auto} ${LIBTDB_PATH} ${LIBTDB_LIBS}]) +AC_SUBST(LIBTDB_LIBS) +]) diff --git a/configure.ac b/configure.ac index 1ec245adde..c8cd9964a2 100644 --- a/configure.ac +++ b/configure.ac @@ -23,6 +23,7 @@ m4_include([acinclude/os-deps.m4]) m4_include([acinclude/krb5.m4]) m4_include([acinclude/pam.m4]) m4_include([acinclude/pkg.m4]) +m4_include([acinclude/tdb.m4]) m4_include([acinclude/lib-checks.m4]) m4_include([acinclude/ax_cxx_compile_stdcxx_11.m4]) m4_include([acinclude/ax_cxx_0x_types.m4]) diff --git a/doc/release-notes/release-5.sgml b/doc/release-notes/release-5.sgml index 174fb7cda2..63e583f129 100644 --- a/doc/release-notes/release-5.sgml +++ b/doc/release-notes/release-5.sgml @@ -114,7 +114,12 @@ This section gives an account of those changes in three categories: New options