If anyone is interested in what I was discussing in this past email,
I've got a small patch to 1.2.8 that'll give a compile-time option to
enable explicit delivery after the spam command. This would be useful
spam filter scripts that don't make the delivery in the case of ham.
This allows you to spam protect forwards as well as local delivery...a
must for my blackberry users. Please forgive the messiness. I'm no
programmer.
Example maildrop filter:
VHOME=`/usr/sbin/vuserinfo -d [EMAIL PROTECTED]
SPAMFOLDER=".Spam"
`/usr/bin/test -d $VHOME/Maildir/$SPAMFOLDER`
if( $RETURNCODE != 0 )
{
`/usr/bin/maildirmake $VHOME/Maildir/$SPAMFOLDER`
}
if ( $SIZE < 262144 )
{
exception {
xfilter "/usr/bin/spamc -f -u [EMAIL PROTECTED]"
}
if (/^X-Spam-Flag: *YES/)
{
exception {
EXITCODE=99
to "$VHOME/Maildir/$SPAMFOLDER"
}
}
}
Diff patch to qmailadmin 1.2.8:
diff -ur qmailadmin-1.2.8/config.h.in
qmailadmin-1.2.8-spamdelivery/config.h.in
--- qmailadmin-1.2.8/config.h.in Mon Jul 4 19:25:13 2005
+++ qmailadmin-1.2.8-spamdelivery/config.h.in Wed Jul 20 18:37:27 2005
@@ -148,6 +148,9 @@
#undef QMAILDIR
/* "" */
+#undef SPAM_DELIVERY
+
+/* "" */
#undef SPAM_COMMAND
/* Define to 1 if you have the ANSI C header files. */
diff -ur qmailadmin-1.2.8/configure qmailadmin-1.2.8-spamdelivery/configure
--- qmailadmin-1.2.8/configure Mon Jul 4 19:25:13 2005
+++ qmailadmin-1.2.8-spamdelivery/configure Wed Jul 20 18:37:27 2005
@@ -4524,6 +4524,28 @@
;;
esac
+# Check whether --enable-spam-requires-delivery or
--disable-spam-requires-delivery was given.
+if test "${enable_spam_requires_delivery+set}" = set; then
+ enableval="$enable_spam_requires_delivery"
+ SPAM_DELIVERY="$enableval"
+fi;
+
+case $SPAM_DELIVERY in
+1*|y*|Y*)
+ SPAM_DELIVERY=yes
+
+cat >>confdefs.h <<_ACEOF
+#define SPAM_DELIVERY 1
+_ACEOF
+
+ echo "checking whether spam-command requires explicit delivery...
yes"
+ ;;
+*)
+ SPAM_DELIVERY=no
+ echo "checking whether spam-command requires explicit
delivery.... no"
+ ;;
+esac
+
spam_command="|preline /usr/local/bin/maildrop /etc/mailfilter"
# Check whether --enable-spam_command or --disable-spam_command was given.
if test "${enable_spam_command+set}" = set; then
@@ -5834,6 +5856,7 @@
echo " modify spam check = "$MODIFY_SPAM""
if test "$MODIFY_SPAM" = "yes"
then
+ echo "spam cmd req. del. = "$SPAM_DELIVERY""
echo " spam command = "$spam_command""
fi
diff -ur qmailadmin-1.2.8/user.c qmailadmin-1.2.8-spamdelivery/user.c
--- qmailadmin-1.2.8/user.c Sun Jan 23 13:35:12 2005
+++ qmailadmin-1.2.8-spamdelivery/user.c Wed Jul 20 18:37:27 2005
@@ -936,6 +936,32 @@
* since it can be removed.
*/
+ if ( (strcmp (cforward, "forward") != 0) || saveacopy ) {
+
+ if (strcmp (cforward, "blackhole") == 0) {
+ fprintf (fs, "# delete\n");
+ emptydotqmail = 0;
+ } else if (spam_check == 1) {
+ fprintf (fs, "%s\n", SPAM_COMMAND);
+#ifdef SPAM_DELIVERY
+ fprintf (fs, "%s/" MAILDIR "/\n", vpw->pw_dir);
+#endif
+ emptydotqmail = 0;
+ } else {
+ fprintf (fs, "%s/" MAILDIR "/\n", vpw->pw_dir);
+ /* this isn't enough to consider the .qmail file non-empty */
+ }
+ }
+
+ if (vacation) {
+ err = makevacation (fs, vpw->pw_dir);
+ emptydotqmail = 0;
+ } else {
+ /* delete old vacation directory */
+ snprintf (NewBuf, sizeof(NewBuf), "%s/vacation", vpw->pw_dir);
+ vdelfiles (NewBuf);
+ }
+
/* if they want to forward */
if (strcmp (cforward, "forward") == 0 ) {
@@ -963,29 +989,6 @@
}
}
- }
-
- if ( (strcmp (cforward, "forward") != 0) || saveacopy ) {
-
- if (strcmp (cforward, "blackhole") == 0) {
- fprintf (fs, "# delete\n");
- emptydotqmail = 0;
- } else if (spam_check == 1) {
- fprintf (fs, "%s\n", SPAM_COMMAND);
- emptydotqmail = 0;
- } else {
- fprintf (fs, "%s/" MAILDIR "/\n", vpw->pw_dir);
- /* this isn't enough to consider the .qmail file non-empty */
- }
- }
-
- if (vacation) {
- err = makevacation (fs, vpw->pw_dir);
- emptydotqmail = 0;
- } else {
- /* delete old vacation directory */
- snprintf (NewBuf, sizeof(NewBuf), "%s/vacation", vpw->pw_dir);
- vdelfiles (NewBuf);
}
fclose (fs);
Soutien technique / Technical Support wrote:
Reading the thread on spam filtering and forwarding, I've come up with
a simpler question that would help in my situation. Currently, when
both the spam filter and a forwarding address are specified, the spam
filter comes after the forward in the .qmail file. My spam filter
uses an exitcode to specify whether the forward should take place.
The spam filter does not do the delivery itself. Because of this, I
would like to have it add the local delivery line when the spam filter
is selected. The spam filter would also have to appear as the first
element in the .qmail file. Could anyone help me by pointing out an
approximate location on the source to start looking into making these
changes for myself, or indicate if these additions have already been
done by someone else in a similar situation? Thank you