This Space for Rent

New Code!

Postoffice has been pushed up to version 1.3.4 to correct an interesting little bug that I introduced when I put in the sendmail filter code last spring, but didn't actually discover until this morning, when I woke up to discover an international phone call on our answering machine telling me that pell was doing connection timeouts since yesterday morning.

The bug, which was producing spectacularly wierd results (claiming that all connections were coming from my other webserver, denying the connection, then dropping coal into the goodness database) turned out to be coming from the sendmail filter library; When I wanted to connect to a remote filter (which I pretty much have to do if I want to use spamassassin, because pell is an a.out machine and spamassassin is a mass of dynamically loaded perl 5.6 code which won't even load on the version of perl (5.005.02) that's running on pell), I used a routine called attach_in, which I copied out of the library I'd written for retr last winter.

"copied out" is the important clue. When I copied it over to postoffice, I left behind a couple of perror() calls without even thinking about it. perror() is a nice debugging tool, but it doesn't work too well when it's called from inside a daemon that has closed stderr because it's running in the background. I didn't discover this for a long time, because when I enabled the sendmail filter code on pell, I started the sendmail filters on the other machine before I configured on pell. And the sendmail filters were running, so I never properly tested the case of trying to attach a filter to a remote process that isn't there.

*Well*, the spamassassin filter died yesterday at around 8am, and then smtp started slowly going intermittently to hell, letting in just enough mail to fool me into thinking that everything was happy while this went on in the background:

smtpd: attach_in( Connection refused
smtpd: attach_in( Connection refused
smtpd: AUDIT:  0:
smtpd: AUDIT:  1:
smtpd: AUDIT:  1:
smtpd: Coal for (

Umm, oops? By the time I got to it there were approximately 1500 pieces of coal for gehenna in Santa's list, and almost every connection was falling over dead because of the heaping pile of anthracite that was being kept as a stocking stuffer.

And 25 minutes later the tea kicked in and I realized that perror() was not what I wanted to do when a connect() call failed.

Sigh. So, New Code! for those of you who actually want to use postoffice as a mail server. I've even put in one tiny feature; the smtp DEBUG command now tells you what version of the code you're running, so you can pretend you're upgrading for the features instead of for the bugfixes.