woods@snowmass.scd.ucar.edu (Greg Woods) (12/13/89)
Brief History: In going to subdomains here, I was having a problem that putting rules into ruleset 3 to try and canonicalize everything would allow me to send mail to user@host.sub (as opposed to user@host.sub.ucar.edu) but did not get the To: line canonicalized properly, even though ruleset 3 is clearly called to process the To: address. This is with sendmail 5.61. The problem, it turns out, is that the resolver is called with different parameters when parsing To: lines than it is when parsing envelope headers! AAAUGH! I beat my head against the wall for days over this, nor can I see any good reason for it. When parsing envelope headers, it automatically appends the default domain, and any sub-parts of the default domain at least down to two levels (i.e. if my domain is set to "scd.ucar.edu", as this machine is, it will first try "user@host.sub.scd.ucar.edu", and if that fails, it will try "user@host.sub.ucar.edu" (the case I was looking for), and if that still fails it would finally try "user@host.sub" by itself. When parsing To: lines it does not do this, it just tries the actual address without appending anything. I discovered this while running with -d21.2 on the command line (thanks to the person who suggested trying that). The fix was a rather hideous kludge where I try appending ucar.edu explicitly with a trailing period (which gets removed iff the attempted resolution is successful) and then stripping off the ucar.edu if it does not resolve. Ugly. I wind up with rules like $+<@$+>$* $:$1<@$[$2$]>$3 attempt CNAME lookup R$+<@$+>$* $:$1<@$[$2.ucar.edu.$]>$3 ucar.edu CNAME lookup R$+<@$+.ucar.edu.>$* $1<@$2>$3 lookup failed Where the first rule is sufficient for envelope headers but the latter two kludges are needed to get the To: line right. --Greg