Author: hjp
Date: Sat Dec 16 08:45:18 2006
New Revision: 691
Added:
contrib/hjp/denysoft_greylist/Makerules
Modified:
contrib/hjp/denysoft_greylist/Makefile
contrib/hjp/denysoft_greylist/denysoft_greylist
contrib/hjp/denysoft_greylist/qpsmtpd-plugin-denysoft_greylist.spec
Log:
Use constants for log levels (finally!)
Modified: contrib/hjp/denysoft_greylist/Makefile
==============================================================================
--- contrib/hjp/denysoft_greylist/Makefile (original)
+++ contrib/hjp/denysoft_greylist/Makefile Sat Dec 16 08:45:18 2006
@@ -1,8 +1,13 @@
-PKG = qpsmtpd-plugin-denysoft_greylist
+NAME=denysoft_greylist
+FILES = $(PKG).spec \
+ Makefile \
+ Makerules \
+ denysoft_greylist \
+
+
all:
-rpm: $(PKG).tar.gz
- rpm -ta --clean --sign --rmsource $^
+clean:
+ rm -f $(PKG).tar.gz *.tmp
-$(PKG).tar.gz: $(PKG).spec denysoft_greylist
- tar cfz $@ $^
+include Makerules
Added: contrib/hjp/denysoft_greylist/Makerules
==============================================================================
--- (empty file)
+++ contrib/hjp/denysoft_greylist/Makerules Sat Dec 16 08:45:18 2006
@@ -0,0 +1,15 @@
+PKG = qpsmtpd-plugin-$(NAME)
+CONTRIB_BASE=~/wrk/qpsmtpd/contrib/hjp
+CONTRIB_FILES=$(patsubst %, $(CONTRIB_BASE)/$(NAME)/%, $(FILES))
+
+contrib: $(CONTRIB_FILES)
+
+$(CONTRIB_BASE)/$(NAME)/%: %
+ cp -p $^ $@
+
+rpm: $(PKG).tar.gz
+ rpm -ta --clean --sign --rmsource $^
+
+$(PKG).tar.gz: $(FILES)
+ tar cfz $@ $^
+
Modified: contrib/hjp/denysoft_greylist/denysoft_greylist
==============================================================================
--- contrib/hjp/denysoft_greylist/denysoft_greylist (original)
+++ contrib/hjp/denysoft_greylist/denysoft_greylist Sat Dec 16 08:45:18 2006
@@ -227,13 +227,13 @@
if (my $co = $self->qp->connection->notes('client_options')) {
if ($co->{denysoft_greylist}{skip}) {
- $self->log(2, "client is whitelisted, skipping greylist checks");
+ $self->log(LOGINFO, "client is whitelisted, skipping greylist checks");
return DECLINED
}
}
if (my $co = $transaction->notes('sender_options')) {
if ($co->{denysoft_greylist}{skip}) {
- $self->log(2, "sender is whitelisted, skipping greylist checks");
+ $self->log(LOGINFO, "sender is whitelisted, skipping greylist checks");
return DECLINED
}
}
@@ -243,17 +243,17 @@
# Check denysoft db
unless (open LOCK, ">" . $self->{_greylist_db} . ".lock") {
- $self->log(2, "opening lockfile failed: $!");
+ $self->log(LOGERROR, "opening lockfile $self->{_greylist_db}.lock failed:
$!");
return (DECLINED);
}
unless (flock LOCK, LOCK_EX) {
- $self->log(2, "flock of lockfile failed: $!");
+ $self->log(LOGERROR, "flock of lockfile failed: $!");
close LOCK;
return (DECLINED);
}
my %db = ();
unless (tie %db, 'AnyDBM_File', $self->{_greylist_db}, O_CREAT|O_RDWR, 0600)
{
- $self->log(2, "tie to database $self->{_greylist_db} failed: $!");
+ $self->log(LOGERROR, "tie to database $self->{_greylist_db} failed: $!");
close LOCK;
return (DECLINED);
}
@@ -265,12 +265,12 @@
my ($ts, $new, $black, $white) = (0,0,0,0);
if ($db{$key}) {
($ts, $new, $black, $white) = split /:/, $db{$key};
- $self->log(3, "ts: " . localtime($ts) . ", now: " . localtime);
+ $self->log(LOGINFO, "ts: " . localtime($ts) . ", now: " . localtime);
if (! $white) {
# Black IP - deny, but don't update timestamp
if (time - $ts < $self->{_greylist_black}) {
$db{$key} = sprintf $fmt, $ts, $new, ++$black, 0;
- $self->log(2, "key $key black DENYSOFT - $black failed connections");
+ $self->log(LOGINFO, "key $key black DENYSOFT - $black failed
connections");
untie %db;
close LOCK;
return $self->{_greylist_testonly} ? (DECLINED) : (DENYSOFT, $denymsg);
@@ -278,33 +278,33 @@
# Grey IP - accept unless timed out
elsif (time - $ts < $self->{_greylist_grey}) {
$db{$key} = sprintf $fmt, time, $new, $black, 1;
- $self->log(2, "key $key updated grey->white");
+ $self->log(LOGINFO, "key $key updated grey->white");
untie %db;
close LOCK;
return (DECLINED);
}
else {
- $self->log(3, "key $key has timed out (grey)");
+ $self->log(LOGINFO, "key $key has timed out (grey)");
}
}
# White IP - accept unless timed out
else {
if (time - $ts < $self->{_greylist_white}) {
$db{$key} = sprintf $fmt, time, $new, $black, ++$white;
- $self->log(2, "key $key is white, $white deliveries");
+ $self->log(LOGINFO, "key $key is white, $white deliveries");
untie %db;
close LOCK;
return (DECLINED);
}
else {
- $self->log(3, "key $key has timed out (white)");
+ $self->log(LOGINFO, "key $key has timed out (white)");
}
}
}
# New ip or entry timed out - record new and return DENYSOFT
$db{$key} = sprintf $fmt, time, ++$new, $black, 0;
- $self->log(2, "key $key initial DENYSOFT, unknown");
+ $self->log(LOGINFO, "key $key initial DENYSOFT, unknown");
untie %db;
close LOCK;
return $self->{_greylist_testonly} ? (DECLINED) : (DENYSOFT, $denymsg);
Modified: contrib/hjp/denysoft_greylist/qpsmtpd-plugin-denysoft_greylist.spec
==============================================================================
--- contrib/hjp/denysoft_greylist/qpsmtpd-plugin-denysoft_greylist.spec
(original)
+++ contrib/hjp/denysoft_greylist/qpsmtpd-plugin-denysoft_greylist.spec Sat Dec
16 08:45:18 2006
@@ -1,5 +1,5 @@
Name: qpsmtpd-plugin-denysoft_greylist
-Version: 163
+Version: 196
Release: 1
Packager: [EMAIL PROTECTED]
Summary: denysoft_greylist plugin for qpsmtpd
@@ -36,6 +36,11 @@
/usr/share/qpsmtpd/plugins/denysoft_greylist
%changelog
+* Sat Aug 05 2006 <[EMAIL PROTECTED]> 196-1
+- Use constants for log levels (finally!) (r194)
+- Added copyright and licence notices. (r187)
+- Some minor fixes in PODs. (r187)
+
* Wed Sep 21 2005 <[EMAIL PROTECTED]> 163-1
- Added Makefile to build rpm package.
- Added plugin parameter db for location of database. (r150)