On Fri, Nov 27, 2009 at 11:11 AM, Andy Smith <a.smith@???> wrote:
> Thanks Todd,
>
> that sounds like it could work for me. Is it smooth sailing with this
> approach or do you have any issues with your current sendmail system?
Haven't really had any major issues. The code is very solid and well written.
The one minor issue is something that I am working on a solution for
WRT Exim. At the point that the MTA hands off to the LDA (maildrop),
it has already been determined that it will be accepted by Sendmail or
Exim. It is at this point that the quota check is made, so if the
account is over quota, the email gets TEMPFAIL'd (errorlevel returned
is 77) and sits in the queue. An NDR message gets sent at the end of
the queue lifetime if it can't be delivered into the home directory.
There are two possibilities AFAICS:
1. Check the quota before accepting it (ie after the RCPT phase or
after the SMTP data phase).
2. Write some kind of wrapper that handles the TEMPFAIL condition.
To me, #1 seems much better because you can reject or defer at SMTP
time so you don't have to generate an NDR. #1 seems easy at first
blush, but doing it with a perl function (for example) is a problem
because the file is (in my case) owned by a different user than exim
runs as, and is mode 700, so it can't be read from within exim.
I think I'm going to try to make a quickie daemon that runs as the
virtual user (or root if that's preferred), connect to the daemon, ask
for the info for user@???, the daemon returns the quota limit
and the current usage. Then either in an ACL or in perl, figure out
if the current message would put it over the limit. Doing this check
at RCPT time means that you have to trust the SIZE= part of the SMTP
conversation (if it's provided). Doing after the DATA phase means you
(I think) have the exact size of the email. I'll have to dig to see
what expansion variables I have access to after the DATA phase.
Are there any other ways of doing this? If there are, nothing has
come to mind and I welcome suggestions.
--
Regards... Todd
The best thing about pair programming is that you have the perfect
audience for your genius. -- Kent Beck