admin@cs.exeter.ac.uk (Khalid Sattar) (03/13/90)
With the recent discussion going on the the uk-mail-manager list about domain ordering I decided to find a sloution too. What I have come up with seems to work but would like comments from sendmail guru's to point out if I am wrong or have made wrong assumptions or headed in the right direction. I believe that one of the possible reason why the domain ordering causes confusion is because sendmail does not have a complete list of NRS sites and it tries expansions of a partial address by looking at the components of the supplied address. However with the ida sendmail is now possible to keep a full database of all NRS mail sites and thus lookup address as a whole. I have been trying on that assumption. I basically try and keep the user specified (possibly partial address) separate and tagging it with diffenent partial domain until either a match is found or I run out of domains. Here is an example - we have a site uk.ac.ex.ca which has been causing problems bacause it clashes with the Canada top level. When the user specifies any address, eg ex.ca I apply cs.exeter.ac.uk exeter.ac.uk ac.uk uk to "ex.ca" in turn until a match is found - if not found then I apply the abbreviated doamins cs.ex.ac.uk ex.ac.uk ac.uk uk if that fails I reverse the user supplied address (ex.ca -> ca.ex) and try again. If at the end there still no match then I return the user supplied address (ex.ca) which would then get handled by rule set 0 which will either find a top level domain or return an error. In the example above uk.ac.ex.ca, ac.ex.ca, ex.ca, ca, (in either NRS or RFC822 order) will match and return the fully qualified address where as fred.ca will return fred.ca and will get handle by ruleset 0 and sent to Canada using the appropriate gateway. For details read on... ---------------------------------------------------------------------- Here are my rule set 3, 26 and 27 (the later two are new ones which essentially do the work of S10 and S11). Please note that this is a testing of an idea so it may break somethings for the moment. Macro Z contains the abbreviated domain "cs.ex.ac.uk" Macro J contains the std domain "cs.exeter.ac.uk" X points to teh dbm database of all NRS mail sites My changes are preceded with a * S3 # handle special cases R$- $@$1 return "user" R~$- $@~$1 return "~ user" # basic textual canonicalisation R$*<$*>$* $2 basic RFC 822 parsing R$+\ at\ $+ $1@$2 " at " -> "@" for RFC 822 R$+%$+ $1@$2 convert '%'s to '@'s R$+@$+@$+ $1%$2@$3 then reduce to only one '@' # Address conversions. R@$+:$+ $:$>5@$1:$2 RFC822 to Percent form R$+::$+ $1!$2 decnet to uucp form R$+!$+ $:$>7$1!$2 uucp to Percent form R$+@$+.$+ $:$>13$1@$2.$3 NRS ordering to 822 ordering # Domain name expansion. OKX/u3/misc/admin/developments/sendmail-2.1/expya/Sites *R$+@$+ $:$>26$1@$2 # try qualifying the address *R$+@$+?$- $:?$>9$1@$2 # no match reverse address *R?$+@$+ $:$>26$1@$2 # no match try with flipped address *R$+@$+?$- $:$>13$1@$2 # no match flip address again R$+@$+ $:$>15$1@$2 standardise local domain name S26 *R$+@$+ $: $1@$(X $2 $: $2 ? $J $) # match - if not tag the domain *R$+@$+?$+ $: $>27 $1@$2 ? $3 *R$+@$+?$+ $: $>27 $1@$2 ? $Z # try with abbrev domain S27 *R$+@$+?$-$+ $1@$(X $2.$3$4 $: $2?$4 $) # apply partial domains *R$+@$+?$- $: $1@$( X $2.$3 $: $2?$3 $) Here is an example run from sendmail /usr/lib/sendmail -bt -Cexpya.cf ADDRESS TEST MODE Enter <ruleset> <address> [Note: No initial ruleset 3 call] | 3 khalid@ex.ca rewrite: ruleset 3 input: khalid @ ex . ca rewrite: ruleset 13 input: khalid @ ex . ca rewrite: ruleset 13 returns: khalid @ ex . ca rewrite: ruleset 26 input: khalid @ ex . ca rewrite: ruleset 27 input: khalid @ ex . ca ? cs . exeter . ac . uk rewrite: ruleset 27 returns: khalid @ ex . ca ? uk rewrite: ruleset 27 input: khalid @ ex . ca ? cs . ex . ac . uk rewrite: ruleset 27 returns: khalid @ ex . ca ? uk rewrite: ruleset 26 returns: khalid @ ex . ca ? uk rewrite: ruleset 9 input: khalid @ ex . ca rewrite: ruleset 9 returns: khalid @ ca . ex rewrite: ruleset 26 input: khalid @ ca . ex rewrite: ruleset 27 input: khalid @ ca . ex ? cs . exeter . ac . uk rewrite: ruleset 27 returns: khalid @ ca . ex . ac . uk rewrite: ruleset 26 returns: khalid @ ca . ex . ac . uk rewrite: ruleset 15 input: khalid @ ca . ex . ac . uk rewrite: ruleset 15 returns: khalid @ ca . ex . ac . uk rewrite: ruleset 3 returns: khalid @ ca . ex . ac . uk | 3 khalid@ubu.ca rewrite: ruleset 3 input: khalid @ ubu . ca rewrite: ruleset 13 input: khalid @ ubu . ca rewrite: ruleset 13 returns: khalid @ ubu . ca rewrite: ruleset 26 input: khalid @ ubu . ca rewrite: ruleset 27 input: khalid @ ubu . ca ? cs . exeter . ac . uk rewrite: ruleset 27 returns: khalid @ ubu . ca ? uk rewrite: ruleset 27 input: khalid @ ubu . ca ? cs . ex . ac . uk rewrite: ruleset 27 returns: khalid @ ubu . ca ? uk rewrite: ruleset 26 returns: khalid @ ubu . ca ? uk rewrite: ruleset 9 input: khalid @ ubu . ca rewrite: ruleset 9 returns: khalid @ ca . ubu rewrite: ruleset 26 input: khalid @ ca . ubu rewrite: ruleset 27 input: khalid @ ca . ubu ? cs . exeter . ac . uk rewrite: ruleset 27 returns: khalid @ ca . ubu ? uk rewrite: ruleset 27 input: khalid @ ca . ubu ? cs . ex . ac . uk rewrite: ruleset 27 returns: khalid @ ca . ubu ? uk rewrite: ruleset 26 returns: khalid @ ca . ubu ? uk rewrite: ruleset 13 input: khalid @ ca . ubu rewrite: ruleset 9 input: khalid @ ca . ubu rewrite: ruleset 9 returns: khalid @ ubu . ca rewrite: ruleset 13 returns: khalid @ ubu . ca rewrite: ruleset 15 input: khalid @ ubu . ca rewrite: ruleset 15 returns: khalid @ ubu . ca rewrite: ruleset 3 returns: khalid @ ubu . ca | 3 khalid@gb.rl rewrite: ruleset 3 input: khalid @ gb . rl rewrite: ruleset 13 input: khalid @ gb . rl rewrite: ruleset 9 input: khalid @ gb . rl rewrite: ruleset 9 returns: khalid @ rl . gb rewrite: ruleset 13 returns: khalid @ rl . gb rewrite: ruleset 26 input: khalid @ rl . gb rewrite: ruleset 27 input: khalid @ rl . gb ? cs . exeter . ac . uk rewrite: ruleset 27 returns: khalid @ rl . gb ? uk rewrite: ruleset 27 input: khalid @ rl . gb ? cs . ex . ac . uk rewrite: ruleset 27 returns: khalid @ rl . gb ? uk rewrite: ruleset 26 returns: khalid @ rl . gb ? uk rewrite: ruleset 9 input: khalid @ rl . gb rewrite: ruleset 9 returns: khalid @ gb . rl rewrite: ruleset 26 input: khalid @ gb . rl rewrite: ruleset 27 input: khalid @ gb . rl ? cs . exeter . ac . uk rewrite: ruleset 27 returns: khalid @ gb . rl . ac . uk rewrite: ruleset 26 returns: khalid @ gb . rl . ac . uk rewrite: ruleset 15 input: khalid @ gb . rl . ac . uk rewrite: ruleset 15 returns: khalid @ gb . rl . ac . uk rewrite: ruleset 3 returns: khalid @ gb . rl . ac . uk | 3 ks@acorn.co rewrite: ruleset 3 input: ks @ acorn . co rewrite: ruleset 13 input: ks @ acorn . co rewrite: ruleset 13 returns: ks @ acorn . co rewrite: ruleset 26 input: ks @ acorn . co rewrite: ruleset 27 input: ks @ acorn . co ? cs . exeter . ac . uk rewrite: ruleset 27 returns: ks @ acorn . co . uk rewrite: ruleset 26 returns: ks @ acorn . co . uk rewrite: ruleset 15 input: ks @ acorn . co . uk rewrite: ruleset 15 returns: ks @ acorn . co . uk rewrite: ruleset 3 returns: ks @ acorn . co . uk Comments suggestions welcomed. ====================================================================== Khalid Sattar JANET : admin@uk.ac.exeter.cs Computer Science Dept. UUCP : admin@expya.uucp University of Exeter BITNET : admin%uk.ac.exeter.cs@ukacrl Exeter, UK. Tel : +44 392 264062
admin@cs.exeter.ac.uk (Khalid Sattar) (03/16/90)
[ This message is resent as it is believed to have got lost in transition. Apologies if you have already seen it] With the recent discussion going on the the uk-mail-manager list about domain ordering I decided to find a sloution too. What I have come up with seems to work but would like comments from sendmail guru's to point out if I am wrong or have made wrong assumptions or headed in the right direction. I believe that one of the possible reason why the domain ordering causes confusion is because sendmail does not have a complete list of NRS sites and it tries expansions of a partial address by looking at the components of the supplied address. However with the ida sendmail is now possible to keep a full database of all NRS mail sites and thus lookup address as a whole. I have been trying on that assumption. I basically try and keep the user specified (possibly partial address) separate and tagging it with diffenent partial domain until either a match is found or I run out of domains. Here is an example - we have a site uk.ac.ex.ca which has been causing problems bacause it clashes with the Canada top level. When the user specifies any address, eg ex.ca I apply cs.exeter.ac.uk exeter.ac.uk ac.uk uk to "ex.ca" in turn until a match is found - if not found then I apply the abbreviated doamins cs.ex.ac.uk ex.ac.uk ac.uk uk if that fails I reverse the user supplied address (ex.ca -> ca.ex) and try again. If at the end there still no match then I return the user supplied address (ex.ca) which would then get handled by rule set 0 which will either find a top level domain or return an error. In the example above uk.ac.ex.ca, ac.ex.ca, ex.ca, ca, (in either NRS or RFC822 order) will match and return the fully qualified address where as fred.ca will return fred.ca and will get handle by ruleset 0 and sent to Canada using the appropriate gateway. For details read on... ---------------------------------------------------------------------- Here are my rule set 3, 26 and 27 (the later two are new ones which essentially do the work of S10 and S11). Please note that this is a testing of an idea so it may break somethings for the moment. Macro Z contains the abbreviated domain "cs.ex.ac.uk" Macro J contains the std domain "cs.exeter.ac.uk" X points to teh dbm database of all NRS mail sites My changes are preceded with a * S3 # handle special cases R$- $@$1 return "user" R~$- $@~$1 return "~ user" # basic textual canonicalisation R$*<$*>$* $2 basic RFC 822 parsing R$+\ at\ $+ $1@$2 " at " -> "@" for RFC 822 R$+%$+ $1@$2 convert '%'s to '@'s R$+@$+@$+ $1%$2@$3 then reduce to only one '@' # Address conversions. R@$+:$+ $:$>5@$1:$2 RFC822 to Percent form R$+::$+ $1!$2 decnet to uucp form R$+!$+ $:$>7$1!$2 uucp to Percent form R$+@$+.$+ $:$>13$1@$2.$3 NRS ordering to 822 ordering # Domain name expansion. OKX/u3/misc/admin/developments/sendmail-2.1/expya/Sites *R$+@$+ $:$>26$1@$2 # try qualifying the address *R$+@$+?$- $:?$>9$1@$2 # no match reverse address *R?$+@$+ $:$>26$1@$2 # no match try with flipped address *R$+@$+?$- $:$>13$1@$2 # no match flip address again R$+@$+ $:$>15$1@$2 standardise local domain name S26 *R$+@$+ $: $1@$(X $2 $: $2 ? $J $) # match - if not tag the domain *R$+@$+?$+ $: $>27 $1@$2 ? $3 *R$+@$+?$+ $: $>27 $1@$2 ? $Z # try with abbrev domain S27 *R$+@$+?$-$+ $1@$(X $2.$3$4 $: $2?$4 $) # apply partial domains *R$+@$+?$- $: $1@$( X $2.$3 $: $2?$3 $) Here is an example run from sendmail /usr/lib/sendmail -bt -Cexpya.cf ADDRESS TEST MODE Enter <ruleset> <address> [Note: No initial ruleset 3 call] | 3 khalid@ex.ca rewrite: ruleset 3 input: khalid @ ex . ca rewrite: ruleset 13 input: khalid @ ex . ca rewrite: ruleset 13 returns: khalid @ ex . ca rewrite: ruleset 26 input: khalid @ ex . ca rewrite: ruleset 27 input: khalid @ ex . ca ? cs . exeter . ac . uk rewrite: ruleset 27 returns: khalid @ ex . ca ? uk rewrite: ruleset 27 input: khalid @ ex . ca ? cs . ex . ac . uk rewrite: ruleset 27 returns: khalid @ ex . ca ? uk rewrite: ruleset 26 returns: khalid @ ex . ca ? uk rewrite: ruleset 9 input: khalid @ ex . ca rewrite: ruleset 9 returns: khalid @ ca . ex rewrite: ruleset 26 input: khalid @ ca . ex rewrite: ruleset 27 input: khalid @ ca . ex ? cs . exeter . ac . uk rewrite: ruleset 27 returns: khalid @ ca . ex . ac . uk rewrite: ruleset 26 returns: khalid @ ca . ex . ac . uk rewrite: ruleset 15 input: khalid @ ca . ex . ac . uk rewrite: ruleset 15 returns: khalid @ ca . ex . ac . uk rewrite: ruleset 3 returns: khalid @ ca . ex . ac . uk | 3 khalid@ubu.ca rewrite: ruleset 3 input: khalid @ ubu . ca rewrite: ruleset 13 input: khalid @ ubu . ca rewrite: ruleset 13 returns: khalid @ ubu . ca rewrite: ruleset 26 input: khalid @ ubu . ca rewrite: ruleset 27 input: khalid @ ubu . ca ? cs . exeter . ac . uk rewrite: ruleset 27 returns: khalid @ ubu . ca ? uk rewrite: ruleset 27 input: khalid @ ubu . ca ? cs . ex . ac . uk rewrite: ruleset 27 returns: khalid @ ubu . ca ? uk rewrite: ruleset 26 returns: khalid @ ubu . ca ? uk rewrite: ruleset 9 input: khalid @ ubu . ca rewrite: ruleset 9 returns: khalid @ ca . ubu rewrite: ruleset 26 input: khalid @ ca . ubu rewrite: ruleset 27 input: khalid @ ca . ubu ? cs . exeter . ac . uk rewrite: ruleset 27 returns: khalid @ ca . ubu ? uk rewrite: ruleset 27 input: khalid @ ca . ubu ? cs . ex . ac . uk rewrite: ruleset 27 returns: khalid @ ca . ubu ? uk rewrite: ruleset 26 returns: khalid @ ca . ubu ? uk rewrite: ruleset 13 input: khalid @ ca . ubu rewrite: ruleset 9 input: khalid @ ca . ubu rewrite: ruleset 9 returns: khalid @ ubu . ca rewrite: ruleset 13 returns: khalid @ ubu . ca rewrite: ruleset 15 input: khalid @ ubu . ca rewrite: ruleset 15 returns: khalid @ ubu . ca rewrite: ruleset 3 returns: khalid @ ubu . ca | 3 khalid@gb.rl rewrite: ruleset 3 input: khalid @ gb . rl rewrite: ruleset 13 input: khalid @ gb . rl rewrite: ruleset 9 input: khalid @ gb . rl rewrite: ruleset 9 returns: khalid @ rl . gb rewrite: ruleset 13 returns: khalid @ rl . gb rewrite: ruleset 26 input: khalid @ rl . gb rewrite: ruleset 27 input: khalid @ rl . gb ? cs . exeter . ac . uk rewrite: ruleset 27 returns: khalid @ rl . gb ? uk rewrite: ruleset 27 input: khalid @ rl . gb ? cs . ex . ac . uk rewrite: ruleset 27 returns: khalid @ rl . gb ? uk rewrite: ruleset 26 returns: khalid @ rl . gb ? uk rewrite: ruleset 9 input: khalid @ rl . gb rewrite: ruleset 9 returns: khalid @ gb . rl rewrite: ruleset 26 input: khalid @ gb . rl rewrite: ruleset 27 input: khalid @ gb . rl ? cs . exeter . ac . uk rewrite: ruleset 27 returns: khalid @ gb . rl . ac . uk rewrite: ruleset 26 returns: khalid @ gb . rl . ac . uk rewrite: ruleset 15 input: khalid @ gb . rl . ac . uk rewrite: ruleset 15 returns: khalid @ gb . rl . ac . uk rewrite: ruleset 3 returns: khalid @ gb . rl . ac . uk | 3 ks@acorn.co rewrite: ruleset 3 input: ks @ acorn . co rewrite: ruleset 13 input: ks @ acorn . co rewrite: ruleset 13 returns: ks @ acorn . co rewrite: ruleset 26 input: ks @ acorn . co rewrite: ruleset 27 input: ks @ acorn . co ? cs . exeter . ac . uk rewrite: ruleset 27 returns: ks @ acorn . co . uk rewrite: ruleset 26 returns: ks @ acorn . co . uk rewrite: ruleset 15 input: ks @ acorn . co . uk rewrite: ruleset 15 returns: ks @ acorn . co . uk rewrite: ruleset 3 returns: ks @ acorn . co . uk Comments suggestions welcomed. ====================================================================== Khalid Sattar JANET : admin@uk.ac.exeter.cs Computer Science Dept. UUCP : admin@expya.uucp University of Exeter BITNET : admin%uk.ac.exeter.cs@ukacrl Exeter, UK. Tel : +44 392 264062