Archive for September, 2007

aliasing and the queue

Tuesday, September 4th, 2007

boy! have the previous weeks been insane or what?  i started working in smtp but got sidetracked into the queue.  there are a few dark corners left in the system and i think this is one of them.  there is some interesting code in queue.  anyhow, i pretty much got sidetracked inside the RewriteAddress() function of smtp. this is one innefficient function as it parses the email address three times in an effort to determine if the address is local, remote, or relay.  it supports some pretty odd things that i’d never heard of before.  the first is called the “bang path”.  it allows one to describe how a message gets from point a to point be.  it is old holdover code from the uucp days before proper email came about.  the sencond thing that it supports is the “percent hack”.  this code allows you to specify how to relay mail.  for example:  pfelt%endpoint.com@relay.com will send the mail to relay.com who will then rewrite the address to pfelt@endpoint.com.  i’ve not ever heard of anyone using this system and i can’t find it anywhere in the specs.  perhaps that is why it is called a hack.

this got me going in the queue because i had had a chat with rprice a while back about aliasing.  in the old nims/netmail code there was an agent that was designed to do aliasing.  this meant that we had to accept all mail into the system and perform aliasing later, rejecting the mail then if the user didn’t exist.  this taxed resources more than it should have as we couldn’t reject the mail at smtp time.  he thought that aliasing should be a part of smtp, and i agreed with him.  then i thought that it would be handy if it were in a central place so anyone could resolve addresses properly.  alex and i chatted about it and thought queue would be the ideal place.

it took a while to come up with something for a lot of reasons.  one being employment getting in the way, but i finally got something going.  it works pretty well except for a bug or two.  based off the email conversation, i’m going to reimplement a couple of things a little differently.  the output is going to change to use 2000 level responses, allowing us to use groups.  this will also require that we change the AliasStruct to have a BongoArray of strings instead of just one string.  that shouldn’t be too bad now that i understand how to read in arrays :)

the major bug is that i can’t currently do an alias like pfelt@domain.com => someotheruser  (wanting the end email to be someotheruser@domain.com).  if that is tried currently it segfaults.  i’m thinking of changing the recursive function to return an int instead of a bool which should allow me to determine what portions have been sent to the client.  with the bool that i’ve got, i’ve either sent the new email to the client or not.

alex has done some amazing stuff with connio and the dns code.  i’m in awe at what he’s done actually.  connio was a mess with the macros that prevented real debugging of the code.   because of this, i’m going to be trying to set up a funky config to let me test bongo inbound and outbound on select users of my domain.  it should be interesting.  i’ll post what i find.