aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac199
-rw-r--r--lib/Makefile.am4
-rw-r--r--lib/cache.c106
-rw-r--r--lib/db.c294
-rw-r--r--lib/dbcfg.c15
-rw-r--r--lib/greylist.c12
-rw-r--r--lib/libmf.h1
-rw-r--r--lib/mf-dbm.c658
-rw-r--r--lib/mf-dbm.h75
-rw-r--r--lib/mfdb.h9
-rw-r--r--lib/rate.c67
-rw-r--r--lib/tbf_rate.c60
-rw-r--r--lib/utils.c9
-rw-r--r--po/POTFILES.in1
-rw-r--r--src/Makefile.am3
-rw-r--r--src/builtin/db.bi410
-rw-r--r--src/calloutd.c2
-rw-r--r--src/main.c52
-rw-r--r--src/mfdbtool.c76
-rw-r--r--src/savsrv.c1
-rw-r--r--src/srvcfg.c19
21 files changed, 670 insertions, 1403 deletions
diff --git a/configure.ac b/configure.ac
index 0e975fc6..136e037b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -105,13 +105,13 @@ gl_INIT
105AH_BOTTOM([ 105AH_BOTTOM([
106/* program_name is used by lib/error.c */ 106/* program_name is used by lib/error.c */
107#define program_name program_invocation_name 107#define program_name program_invocation_name
108]) 108])
109 109
110# Check for GNU Mailutils 110# Check for GNU Mailutils
111AM_GNU_MAILUTILS([2.99.94], [all auth sieve cfg argp], [:]) 111AM_GNU_MAILUTILS([2.99.94], [all auth dbm sieve cfg argp], [:])
112AC_CHECK_TYPES([struct mu_argp_node_list],,,[#include <mailutils/libargp.h>]) 112AC_CHECK_TYPES([struct mu_argp_node_list],,,[#include <mailutils/libargp.h>])
113 113
114### Check for Emacs site-lisp directory 114### Check for Emacs site-lisp directory
115AM_PATH_LISPDIR 115AM_PATH_LISPDIR
116 116
117if test "$EMACS" != "no"; then 117if test "$EMACS" != "no"; then
@@ -142,200 +142,47 @@ if test $syslog_async = "yes"; then
142 AC_DEFINE_UNQUOTED([DEFAULT_SYSLOG_ASYNC],$DEFAULT_SYSLOG_ASYNC, 142 AC_DEFINE_UNQUOTED([DEFAULT_SYSLOG_ASYNC],$DEFAULT_SYSLOG_ASYNC,
143 [Define to 1 to use syslog_async by default]) 143 [Define to 1 to use syslog_async by default])
144 AC_SUBST([BUILD_SYSLOG_ASYNC], '$(SYSLOG_ASYNC_O)') 144 AC_SUBST([BUILD_SYSLOG_ASYNC], '$(SYSLOG_ASYNC_O)')
145 AC_DEFINE([USE_SYSLOG_ASYNC], [1], [Define if syslog-async is being used]) 145 AC_DEFINE([USE_SYSLOG_ASYNC], [1], [Define if syslog-async is being used])
146fi 146fi
147 147
148# Check for DBM flavor 148AC_ARG_VAR([DEFAULT_DB_TYPE],[Set default database type])
149AH_TEMPLATE(BDB2_CURSOR_LASTARG, 149
150 [Last argument to the cursor member of Berkeley 2 DB structure])
151
152dnl The cursor member of DB structure used to take three arguments in older
153dnl implementations of Berkeley DB. Newer versions (>= 4.0) declare
154dnl it as taking four arguments.
155dnl This macro checks which of the variants we have.
156AC_DEFUN([MU_DB2_CURSOR],
157 [AC_CACHE_CHECK([whether db->cursor takes 4 arguments],
158 [mu_cv_bdb2_cursor_four_args],
159 [AC_TRY_COMPILE([#include <db.h>],
160 [
161DB *db;
162db->cursor(NULL, NULL, NULL, 0)
163 ],
164 [mu_cv_bdb2_cursor_four_args=yes],
165 [mu_cv_bdb2_cursor_four_args=no])])
166 if test $mu_cv_bdb2_cursor_four_args = yes; then
167 AC_DEFINE(BDB2_CURSOR_LASTARG,[,0])
168 else
169 AC_DEFINE(BDB2_CURSOR_LASTARG,[])
170 fi])
171
172AH_TEMPLATE([WITH_BDB],
173 [Define to the major version of Berkeley DB library to use])
174
175use_dbm=no
176status_dbm=no
177
178AC_ARG_WITH([gdbm], 150AC_ARG_WITH([gdbm],
179 AC_HELP_STRING([--with-gdbm], 151 AC_HELP_STRING([--with-gdbm],
180 [use GNU DBM]), 152 [use GNU DBM by default]),
181 [ 153 [
182case "${withval}" in 154case "${withval}" in
183 yes) use_dbm=GDBM ;; 155 yes) DEFAULT_DB_TYPE=gdbm;;
184 no) use_dbm=no ;; 156 no) ;;
185 *) AC_MSG_ERROR(bad value ${withval} for --with-gdbm) ;; 157 *) AC_MSG_ERROR(bad value ${withval} for --with-gdbm) ;;
186esac]) 158esac])
187 159
188## Support --with-db2 for backward compatibility
189if test "${with_db2+set}" = set; then
190 case "${with_db2}" in
191 yes) use_dbm=BDB2 ;;
192 no) use_dbm=no ;;
193 *) AC_MSG_ERROR(bad value ${with_db2} for --with-db2) ;;
194 esac
195fi
196
197AC_ARG_WITH([berkeley-db], 160AC_ARG_WITH([berkeley-db],
198 AC_HELP_STRING([--with-berkeley-db@<:@=version@:>@], 161 AC_HELP_STRING([--with-berkeley-db],
199 [use Berkeley DB]), 162 [use Berkeley DB by default]),
200 [ 163 [
201case "${withval}" in 164case "${withval}" in
202 yes) use_dbm=BDB ;; 165 no) ;;
203 no) use_dbm=no ;; 166 *) DEFAULT_DB_TYPE=bdb;;
204 *) use_dbm=BDB="${withval}";;
205esac]) 167esac])
206 168
207## Set the variable status_dbm to $1 if: 169AH_TEMPLATE([DEFAULT_DB_TYPE], [Define default database type])
208## 170if test -n "$DEFAULT_DB_TYPE"; then
209## 1. Function $3 is defined in the library $2 171 if mu info $DEFAULT_DB_TYPE >/dev/null; then
210## 2. Header file db.h is available 172 AC_MSG_ERROR([requested DBM type $DEFAULT_DB_TYPE not supported by Mailutils])
211## 173 fi
212## Then check if the major version, minor version and patchlevel of the
213## library matches those from the header. If so, define WITH_BDB
214## to the version (i.e. $1 with all dots removed). Otherwise, report
215## an error and stop.
216##
217check_bdb() {
218 ver=`echo $1 | tr -d '.'`
219 major=`expr $ver : '\(.\).*'`
220 AC_CHECK_LIB($2, $3,
221 [AC_CHECK_HEADERS(db.h)
222 if test $ac_cv_header_db_h = yes; then
223 LIBS="$LIBS -l$2"
224 MU_DB2_CURSOR
225 status_dbm=$1
226 fi])
227 if test $status_dbm = no; then
228 :
229 else
230 AC_RUN_IFELSE(
231 [AC_LANG_PROGRAM([#include "db.h"],
232 [int v_major, v_minor, v_patch;
233 db_version(&v_major, &v_minor, &v_patch);
234 return !(DB_VERSION_MAJOR == $major
235 && v_major == DB_VERSION_MAJOR
236 && v_minor == DB_VERSION_MINOR
237 && v_patch == DB_VERSION_PATCH);
238 ])],
239 [AC_DEFINE_UNQUOTED(WITH_BDB,$ver)],
240 [status_dbm=no])
241 fi
242}
243
244AC_SUBST(MU_COMMON_INCLUDES)
245
246## Check for the Berkeley DB library version $1, assuming Slackware-like
247## installation layout (header files in /usr/incude/db$vn and library named
248## libdb-$version.so, where $version is the library version and $vn is
249## $version with all dots removed.
250##
251check_slackware_bdb() {
252 dir=db`echo $1|tr -d '.'`
253 save_CPPFLAGS=$CPPFLAGS
254 while test -n "$dir"
255 do
256 if test -d /usr/include/$dir; then
257 CPPFLAGS="$CPPFLAGS -I/usr/include/$dir"
258 break
259 elif test -d /usr/local/include/$dir; then
260 CPPFLAGS="$CPPFLAGS -I/usr/local/include/$dir"
261 break
262 fi
263 dir=`expr "$dir" : '\(.*\)[[0-9]]$'`
264 done
265 check_bdb $1 db-$1 db_create
266 CPPFLAGS=$save_CPPFLAGS
267 if test $status_dbm = "$1"; then
268 MU_COMMON_INCLUDES="$MU_COMMON_INCLUDES -I/usr/include/$dir"
269 fi
270}
271
272try_dbm() {
273 case "$1" in
274 GDBM)
275 AC_CHECK_LIB(gdbm, gdbm_open,
276 [AC_CHECK_HEADERS(gdbm.h,
277 AC_DEFINE(WITH_GDBM,1,
278 [Enable use of GNU DBM library]))
279 LIBS="$LIBS -lgdbm"
280 POPAUTH='popauth$(EXEEXT)'
281 status_dbm=GDBM]);;
282
283 BDB2) check_bdb 2 db db_open
284 test "$status_dbm" != "no" && status_dbm="Berkeley DB v. $status_dbm";;
285
286 BDB) for version in 4 3 2
287 do
288 case $version in
289 4|3) func=db_create;;
290 2) func=db_open;;
291 esac
292 check_bdb $version db $func
293 if test "$status_dbm" != no; then
294 status_dbm="Berkeley DB v. $status_dbm"
295 break;
296 fi
297 done;;
298
299 BDB=*)
300 name=`expr $1 : 'BDB=\(.*\)'`
301 case $name in
302 [[0-9]]*) check_slackware_bdb $name;;
303 *) for version in 4 3 2