[svn:qpsmtpd] r688 - contrib/hjp/cf_wrapper
[email protected] Sat, 16 Dec 2006 02:38:25 -0800 (PST)
| Newsgroups | perl.cvs.qpsmtpd |
|---|---|
| Message-ID | <[email protected]> |
Author: hjp
Date: Sat Dec 16 02:38:24 2006
New Revision: 688
Added:
contrib/hjp/cf_wrapper/Makefile
contrib/hjp/cf_wrapper/Makerules
contrib/hjp/cf_wrapper/README
contrib/hjp/cf_wrapper/create_cf_wrapper_sets.mysql
contrib/hjp/cf_wrapper/qpsmtpd-plugin-cf_wrapper.spec
Modified:
contrib/hjp/cf_wrapper/cf_wrapper
Log:
Check if insert into database actually worked.
Added script to create table in mysql.
Added: contrib/hjp/cf_wrapper/Makefile
==============================================================================
--- (empty file)
+++ contrib/hjp/cf_wrapper/Makefile Sat Dec 16 02:38:24 2006
@@ -0,0 +1,16 @@
+NAME=cf_wrapper
+FILES = $(PKG).spec \
+ Makefile \
+ Makerules \
+ README \
+ cf_wrapper \
+ check_cookie \
+ create_cf_wrapper_sets.mysql \
+
+
+all:
+
+clean:
+ rm -f $(PKG).tar.gz *.tmp
+
+include Makerules
Added: contrib/hjp/cf_wrapper/Makerules
==============================================================================
--- (empty file)
+++ contrib/hjp/cf_wrapper/Makerules Sat Dec 16 02:38:24 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 $@ $^
+
Added: contrib/hjp/cf_wrapper/README
==============================================================================
--- (empty file)
+++ contrib/hjp/cf_wrapper/README Sat Dec 16 02:38:24 2006
@@ -0,0 +1,8 @@
+This plugin needs a RDBMS supported by DBI with a single table
+cf_wrapper_sets. If you use MySQL, you can create the table with the
+supplied script create_cf_wrapper_sets.mysql. If you use some other
+RDBMS, you may need to adapt it. Note that theoretically, email
+addresses may be up to 320 characters long (64 characters localpart + @
++ 255 characters domain name), so if your RDBMS supports varchar fields
+of 320 characters or more, you may want to change varchar(255) to
+varchar(320) to be on the safe side.
Modified: contrib/hjp/cf_wrapper/cf_wrapper
==============================================================================
--- contrib/hjp/cf_wrapper/cf_wrapper (original)
+++ contrib/hjp/cf_wrapper/cf_wrapper Sat Dec 16 02:38:24 2006
@@ -180,13 +180,18 @@
{},
$transaction->sender->address,
$r);
- $dbh->do("insert into cf_wrapper_sets(sender, recipient, cfw_set) values(?, ?, ?)",
- {},
- $transaction->sender->address,
- $r,
- $set);
+ my $rc = $dbh->do("insert into cf_wrapper_sets(sender, recipient, cfw_set) values(?, ?, ?)",
+ {},
+ $transaction->sender->address,
+ $r,
+ $set);
+ $self->log(LOGDEBUG, "rc=" . (defined $rc ? $rc : "(undef)"));
+ unless (defined $rc) {
+ $self->log(LOGERROR, "insert into cf_wrapper_sets failed: " . $dbh->errstr());
+ }
}
}
+ $dbh->commit();
}
return DENYSOFT, "recipients disagree on whether they want to accept or reject the message. Please try again with a subset.";
}
Added: contrib/hjp/cf_wrapper/create_cf_wrapper_sets.mysql
==============================================================================
--- (empty file)
+++ contrib/hjp/cf_wrapper/create_cf_wrapper_sets.mysql Sat Dec 16 02:38:24 2006
@@ -0,0 +1,7 @@
+create table cf_wrapper_sets (
+ sender varchar(255),
+ recipient varchar(255),
+ cfw_set int,
+ index (sender(32), recipient(32))
+);
+insert into cf_wrapper_sets(sender, recipient, cfw_set) values('', '', 0);
Added: contrib/hjp/cf_wrapper/qpsmtpd-plugin-cf_wrapper.spec
==============================================================================
--- (empty file)
+++ contrib/hjp/cf_wrapper/qpsmtpd-plugin-cf_wrapper.spec Sat Dec 16 02:38:24 2006
@@ -0,0 +1,64 @@
+Name: qpsmtpd-plugin-cf_wrapper
+Version: 199
+Release: 1
+Packager: [email protected]
+Summary: cf_wrapper plugin for qpsmtpd
+License: distributable
+Group: System Environment/Daemons
+URL: http://smtpd.develooper.com/
+BuildRoot: %{_tmppath}/%{name}-root
+Source0: %{name}.tar.gz
+BuildArch: noarch
+
+%description
+This plugin uses the results of transactions to categorize
+sender/recipient pairs into sets. These sets are then used to accept or
+temporarily reject the recipients, so that when a DATA command is
+processed there are only recipients in the same set which will hopefully
+either all accept or all reject the mail. If the result for the DATA
+command is not unanimous, a temporary failure will be generated and the
+set will be split into two subsets.
+
+%prep
+%setup -q -c %{name}
+
+%build
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%install
+rm -rf $RPM_BUILD_ROOT
+mkdir -p $RPM_BUILD_ROOT/usr/share/qpsmtpd/plugins
+cp cf_wrapper $RPM_BUILD_ROOT/usr/share/qpsmtpd/plugins
+cp check_cookie $RPM_BUILD_ROOT/usr/share/qpsmtpd/plugins
+
+[ -x /usr/lib/rpm/brp-compress ] && /usr/lib/rpm/brp-compress
+
+
+%files
+%defattr(-,root,root)
+/usr/share/qpsmtpd/plugins/cf_wrapper
+/usr/share/qpsmtpd/plugins/check_cookie
+%doc README create_cf_wrapper_sets.mysql
+
+%changelog
+* Tue Aug 08 2006 <[email protected]> 199-1
+- Log error if insert into cf_wrapper_sets fails.
+- Added copyright and licence notices.
+- Some minor fixes in PODs.
+
+* Sat Jan 28 2006 <[email protected]> 176-1
+- Fixed bug in retrieving the return code.
+
+* Fri Jan 27 2006 <[email protected]> 173-1
+- New upstream version 173 allows plugins to return a message in
+ addition to the return code.
+
+* Tue Nov 29 2005 <[email protected]> 165-1
+- New upstream version 165: Fixed docs and a typo in demo plugin
+ check_cookie
+
+* Fri Jul 15 2005 <[email protected]> 134-1
+- First RPM package.
+