So, tonight I decided to patch one of my servers with Chkuser so that I can bounce e-mails at the RCPT TO phase of the SMTP transaction. It would save bandwidth over the current solution, which is to /dev/null all e-mail that doesn't have a valid recipient. Furthermore, it would serve as a way to notify legitimate senders that the address they tried to e-mail is dead.
And, this is another thing I like about Qmail and the rest of DJB's programs. I could just run qmail-smtpd on the command line and feed it SMTP commands. And this is without installing the patched program, so I didn't have to worry about the mailserver doing weird things as I was testing it.
Anyway, I patched it, then did some testing. I tested it on the domain dmuth.org which was being handled through Vpopmail. I didn't actually have any e-mail accounts for the domain, just a forwarder so that the dmuth user would be forwarded elsewhere. Well, when I tried using dashed addresses for my dmuth account, I got something like:
rcpt to: dmuth@nospamdmuth.org
250 ok
rcpt to: dmuth-test@nospamdmuth.org
511 sorry, no mailbox here by that name (#5.1.1 - chkuser)
Despite the fact that I had both a .qmail-dmuth and .qmail-dmuth-default file hanging out in /home/vpopmail/domains/dmuth.org, I was still getting a 511 error. Very annoying. After much swearing and investigation, I finally discovered that this was happening because there was no actual 'dmuth' user. After creating a user called 'dmuth', chkuser worked just fine:
rcpt to: dmuth@nospamdmuth.org
250 ok
rcpt to: dmuth-test@nospamdmuth.org
250 ok
It's a workaround for an unusual configuration, but at least it works. When I send mail to dmuth@nospamdmuth.org, vdeliver seems to give the .qmail-dmuth file higher precedence over the existance of a dmuth user, and forwards the mail off to it's proper destination.
I'm not 100% sure where the "bug" here is. I think that it's in chkuser.c where the checking for a real user happens in case 8 before the checking of aliases is in case 9. But I don't know enough about the internals of Qmail (or DJB's undocumented functions) to try fixing it. I guess I'll submit a bug report tomorrow...
BTW, I'd like to thank
(no subject)
Date: 2004-10-12 05:35 am (UTC)