From b52b7b50c22eeee2b40ff9ff4b6b274f188d1083 Mon Sep 17 00:00:00 2001 From: Devin Carraway Date: Sun, 5 Nov 2006 10:38:16 +0000 Subject: [PATCH] Support configured greylisting db location, and look in the distro-friendly directory /var/lib/qpsmtpd in addition to the previous $QPHOME locations. git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.3x@672 958fd67b-6ff1-0310-b445-bb7760255be9 --- Changes | 4 ++++ plugins/greylisting | 24 ++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/Changes b/Changes index b7b10f5..6e13ee5 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,10 @@ Add support for multiple plugin directories, whose paths are given by the 'plugin_dirs' configuration. (Devin Carraway, Nick Leverton) + Greylisting DBs may now be stored in a configured location, and are + looked for by default in /var/lib/qpsmtpd/greylisting in addition to the + previous locations relative to the qpsmtpd binary. (Devin Carraway) + 0.33 New Qpsmtpd::Postfix::Constants to encapsulate all of the current return codes from Postfix, plus script to generate it. (Hanno Hecker) diff --git a/plugins/greylisting b/plugins/greylisting index 89df1bc..3731ab2 100644 --- a/plugins/greylisting +++ b/plugins/greylisting @@ -78,6 +78,22 @@ deliveries); in 'off' mode we do nothing (useful for turning greylisting off globally if using per_recipient configs). Default: denysoft. +=item db_dir + +Path to a directory in which the greylisting DB will be stored. This +directory must be writable by the qpsmtpd user. By default, the first +usable directory from the following list will be used: + +=over 4 + +=item /var/lib/qpsmtpd/greylisting + +=item I/var/db (where BINDIR is the location of the qpsmtpd binary) + +=item I/config + +=back + =item per_recipient Flag to indicate whether to use per-recipient configs. @@ -85,7 +101,8 @@ Flag to indicate whether to use per-recipient configs. =item per_recipient_db Flag to indicate whether to use per-recipient greylisting -databases (default is to use a shared database). +databases (default is to use a shared database). Per-recipient configuration +directories, if determined, supercede I. =back @@ -191,7 +208,10 @@ sub denysoft_greylist { # Setup database location my $dbdir = $transaction->notes('per_rcpt_configdir') if $config->{per_recipient_db}; - $dbdir ||= -d "$QPHOME/var/db" ? "$QPHOME/var/db" : "$QPHOME/config"; + for my $d ($dbdir, $config->{db_dir}, "/var/lib/qpsmtpd/greylisting", + "$QPHOME/var/db", "$QPHOME/config") { + last if $dbdir ||= $d && -d $d && $d; + } my $db = "$dbdir/$DB"; $self->log(LOGINFO,"using $db as greylisting database");