[Mimedefang] over quota message

Kevin A. McGrail kmcgrail at pccc.com
Wed Feb 4 16:52:16 EST 2004


With the code below, as far as I can tell the quota is only tested for the
first recipient.

Further, I believe this is a limitation caused by the milter implementation.

If you use stream_by_recipient, it should "fix" the problem but I am
guessing a tempfail wouldn't really achieve what you want since it would not
be during the stateful connection to the sendmail process.

Therefore, checking quotas with mimedefang for the purpose of a tempfail is
really infeasible unless sendmail changes the milter implementation.

Am I correct?

Regards,
KAM

> Sort of.  The following (untested!) code won't work for aliases
> (sendmail expands them only after calling milter), but it should work
> for virtusertable entries and LDAP routing:
>
> use Quota;
>
> sub filter_recipient {
>     my ($recipient, $sender, $ip, $hostname, $first, $helo,
> $rcpt_mailer, $rcpt_host, $rcpt_addr) = @_;
>
>     if ($rcpt_mailer eq 'local' && (my $uid = (getpwnam($rcpt_addr))[2]))
{
> # Change this to your mail spool directory.
> my $dev = Quota::getqcarg('/var/mail');
>
> if (my ($bc, $bs, $bh, $bt, $ic, $is, $ih, $it)
>     = Quota::query($dev, $uid, 0)) {
>     my $time = time;
>     if (($bs && $bc >= $bs && $time >= $bt)
> || ($is && $ic >= $is && $time >= $it)
> || ($bh && $bc >= $bh)
> || ($ih && $ic >= $ih)) {
> return ('TEMPFAIL', 'Mailbox full', '450', '4.2.2');
>     }
> }
>     }
>
>     return ('CONTINUE', 'ok');
> }
>
> Don't forget to start mimedefang with option -t.



More information about the MIMEDefang mailing list