on 4/5/05 5:41 PM, Kurt Bigler <[EMAIL PROTECTED]> wrote:

> on 4/5/05 6:28 AM, Kyle Wheeler <[EMAIL PROTECTED]> wrote:
> 
>> | preline yourfilter | maildir /path/to/vpopdomains/`echo $USER | tr A-Z
>> a-z`/`echo $EXT | tr A-Z a-z`/Maildir/
> 
> Thanks, that's great.
> 
>>> In the mean time, what is the best (simplest, most reliable) way to
>>> achieve this simplistic delivery functionality?
>> 
>> I think "maildir" (or "safecat") is what you want to use. If you think
>> the environment manipulation is a bit much, I agree, but them's the
>> breaks, at the moment.
> 
> Ok, but that's not too bad.  It just bugs me to have to install yet another
> package, just to do what vpopmail already knows how to do.
> 
> But thanks, that's what I needed to know!
> 
> But I have a question to the vpopmail developers:
> 
> If I were to implement this, as a option to vdelivermail, say:
> 
> -d      Deliver only.  Do not preline and skip all .qmail processing
> 
> would you find this to be something worth integrating?  I'm not sure that
> I'd have time now, but it seems worth asking the question.

I actually implemented this in my copy of vdelivermail.c.  It was actually
easier than I thought, and there were fewer issues, apparently, although I'm
not intimately familiar enough to know that I haven't missed something.

Here's what I did:

I tentatively reclaimed the unused there-for-compatibility command-line
argument 1.  If that argument equals '-d', intended to mean "Deliver Only"
(but could also mean Disable .qmail processing), then processing proceeds as
if the .qmail file did not exist, which I guess is just what Kyle Wheeler
was suggesting.  That appears to be all there is do it.

This change allows you do basic filtering in your .qmail files without
needing any of:

    procmail
    maildrop
    maildir/safecat

In my book this is a very good thing.  It not only avoids the need for
dependencies on extra packages, but offers all the advantages that
vdelivermail already provides, including quota checking.  As README.quotas
says:

> NOTE: Non-system domain quotas are only enforcable when vdelivermail is the
> local delivery agent.  If you pipe your mail into anything else, like
> maildrop, then the non-system domain quota will be ignored.

So with this change, you can now have the following line in your user/.qmail
file:

    | myfilter | vdelivermail -d bounce-no-mailbox

and it will not result in infinite vdelivermail recursion.  And so you can
have a pure-vpopmail solution for your QmailAdmin-enabled Spam Detection
option.

Here are the changes to vdelivermail.c in vpopmail-5.4.10 needed to
implement this:


==============================================================
--- vdelivermail.orig.c Wed Apr  6 05:07:36 2005
+++ vdelivermail.c      Wed Apr  6 05:15:06 2005
@@ -52,6 +52,7 @@
 struct vqpasswd *vpw;
 off_t message_size = 0;
 char bounce[AUTH_SIZE];
+char option[AUTH_SIZE];/*kkb*/
 int CurrentQuotaSizeFd;
 
 #ifdef QMAIL_EXT
@@ -177,6 +178,11 @@
         vexit(111);
     }
 
+       /*kkb begin*/
+       /* get the obsolete/option argument */
+    strncpy(option, argv[1], sizeof(option));
+       /*kkb end*/
+
     /* get the last parameter in the .qmail-default file */
     strncpy(bounce, argv[2], sizeof(bounce));
 
@@ -733,6 +739,14 @@
  int deliver_err;
    
     chdir(dir);
+
+       /*kkb begin*/
+    if ( strcmp(option, "-d") == 0 ) {
+
+        /* feature disabled, so just return */
+        return(-1);
+       }
+       /*kkb end*/
 
     /* format the file name */
     if ( (fs = fopen(".qmail","r")) == NULL ) {
==============================================================


It was probably eaiser for me to do that than it would have been to download
and make procmail, maildrop, or safecat!

If there's not something wrong with this that I'm missing, I'd love to see
this (or something similar) get integrated into vpopmail.

-Kurt

Reply via email to