This Space for Rent

New Code!

Postoffice has been pushed up to version 1.1.3. This version adds vm-pop3d-style virtual domain support, fixes a potentially nasty bug with /etc/alias expansions into programs (I was not setuid'ing away from root to execute those programs because I was passing uid = -1 to setreuid()), adds an option to allow clients to give almost any address as an argument to MAIL FROM:, and puts a hack in to allow multiple simultaneous connections from localhost because a certain mailing list program written in p*th*n has the bizarre behavior trying to open a separate connection to the smtp server for every message (and this is talking to the mail server on the machine where the CMLPWiP is running, so they don't even have the excuse of not wanting to sort the addresses they are mailing to), and if any of those connections fail with a 4xx status, the stupid program decides that none of the messages got out and they all need to be resent. Over and over and over and over, until I put the "stupid p*th*n denial-of-service hack" in to allow denial of service attacks from localhost.

But, aside from the bugs, the virtual domain code is fairly spiffy. Postoffice uses the dns to figure out what the machine is known as, so it doesn't need any special code to accept mail. So all I needed was to add the code to read passwords and aliases out of the virtual domain directories, and to write mail into virtual domain mailboxes. The first pass at it was a pretty gross bit of manual hackery, with implicit knowledge of more stuff than I care to think about and lots of duplicated except for a line or two code (sometimes in the same function, and switched by a isvhost() function that did lots of strcasecmps(), but after getting it working, I went back and ripped all the code out in favor setting up mail domains; When Postoffice decides that a piece of mail should be delivered locally, it calls the function getdomain(), which returns a magic domain pointer which is then passed as an argument to the functions

passwdfile()
the password file for this domain.
aliasfile()
the alias file for this domain.
mailbox()
the mailbox for a user in this domain.

This meant that a whole bunch of the special case code I needed to put in (all of it constantly checking isvhost(u->domain)) just went away, and when it went away it also swept out some of the magic constant code that was in the original non-virtual-domain code. There are still some special cases (in a virtual domain, the alias '*' matches everything, while in domain 0 -- the standard Un*x domain -- '*' is simply a alias that will never match because postoffice won't allow '*' as a username, and when I'm logging alias loops I need to show the virtual domain part of the alias to avoid confusing system administrators) but all of this code, including debugging, new manpages and the horrible warts for alias loops, is only 497 lines longer than version 1.1.1 is.

I'm pleased with it. Maybe for the next release I'll catch up on the documentation.

Comments


I am really looking forward to the documentation!

I've looked over the code (briefly) and the code of vm-pop3d. I'm using a vpop3d thing that was written for linuxconfig several years ago. It functions like vm-pop3d.

But I'm hacking sendmail to get it to do what I want. And with each upgrade of sendmail, it is getting harder to hack.

I like your solution of writing you own. I have wanted to do that for awhile, but I can't get the other partner of NGender Consulting Group to play in that game. And I code a lot better in a team. :)

I'm going to dive in with your code soon. I ran configure.sh and was greated by a failed dependency. But I was out of time, so I'll play more later.

Love to you and your Sweetie and your joint productions. :)

Lynn Dobbs Wed Feb 2 10:03:33 2005

What does configure.sh fail on? There shouldn't be that many dependencies in there (berkeley db is the big one, and I know that doesn't work on some of the modern Linuxes because they use gdbm, which doesn't seem to be all that bothered about not supporting any of the database interfaces it's supposed to be a replica of.)

David Parsona Wed Feb 2 15:01:35 2005

"postoffice requires ndbm" You're right, though, I do have gdbm. I'm assuming it doesn't work, eh? I'll hunt around for the other.

Was I suppose to get an email of your response to my comment?

Lynn Dobbs Wed Feb 2 22:05:25 2005

Nope. I never even thought of it. Would it be useful?

I'll see if I can get postoffice to build with gdbm tonight, if I've got any energy, and then I'll release version 1.1.5!

David Parsons Wed Feb 2 22:35:45 2005

It would be handy to have the blog send an email to the commenter if there is a reply to a comment. Otherwise, the commenter is on the hook for look back through your blog over and over for some period of time.

And as often as Julie writes in hers, I have to check back for weeks. :)

I'm really sorry to hear that you are fighting a two-month sickness. Every year? Damn. That's nasty.

Love.

Lynn Dobbs Thu Feb 3 09:47:56 2005

Comments are closed