procmail
[Top] [All Lists]

Re: force maximum mailbox size limit

2000-11-07 14:56:55

I have just a few very minor comments to make on David's otherwise
excellent post.


"David W. Tamkin" <dattier(_at_)ripco(_dot_)com> writes:
...
 :0
 * LOGNAME ?? ^^\/.
 { INITIAL=$MATCH }

 :0
 * LOGNAME ?? ^^.\/.
 { SECOND=$MATCH }
 :0E
 { SECOND=: }

The 'standard' way of hashing spool directories repeats the last letter
if the username is too short, such that user "a" would have a mailspool
path of "/var/spool/mail/a/a/a".  I would thus change the second recipe
to read:
        :0
        * LOGNAME ?? ^^.\/.
        { SECOND=$MATCH }
        :0E
        { SECOND=$INITIAL }

A third level of hashing (not needed here) would chain off $SECOND:
        :0
        * LOGNAME ?? ^^..\/.
        { THIRD=$MATCH }
        :0E
        { THIRD=$SECOND }

...
Note that this tests the size of the box without the current message; if the
box has exactly 40000000 bytes and you get any size message in, it will be
accepted.  If you want to test based on the size that the box would be if
the message were added to it, add the size of the current message before
comparing to 40000000:

 :0 # positive difference means box would get bigger than forty million bytes
 * $ $MAILBOX_SIZE_^0
 * 1^1 >1
 * -40000000^0
 { rejection routine goes here }


For the obnoxiously picky: under the assumption that the message is
being delivered to an mbox-style mailspool, you need to add 1 to the
message length for each line beginning with "From " as they'll be
changed into ">From ".

        # positive difference means box would get bigger than
        # forty million bytes
        :0
        * $ $MAILBOX_SIZE_^0
        * 1^1 >1
        * 1^1 ^From( )
        * -40000000^0
        { rejection routine goes here }

That's actually off by one because it counts the "From " at the top of
the header, so you should increase the constant in the last condition
by one if you're feeling fanatical...


Philip Guenther
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>