home *** CD-ROM | disk | FTP | other *** search
- ###############################################################################
- ###############################################################################
- #####
- ##### @(#)rules.m4 UK-2.1 sendmail configuration 18/11/88
- #####
- ##### The rulesets
- #####
- ###############################################################################
- ###############################################################################
-
- ###############################################
- # Ruleset 0 -- Select mailer to be used #
- ###############################################
- S0
-
- # strip local domain name(s)
- R$+@$J $>3$1 process local part
-
- ifdef(`NEWSNAME',
- `# compare local-part with newsgroup names
- R$+ $:$>18$1 newsgroups in local-part')
-
- # local mail
- R$- $#local$:<$1> local mail - maybe aliased
- R~$- $#binmail$:<$1> local mail - no aliasing
-
- #
- # convert domain address into "<address>host.network" triple
- #
- R$+@$+ $:$>16$1@$2 routing and address conversion
-
- #
- # select mailer
- #
-
- # note that address part ($u) is returned as "<address>"; the brackets are
- # subsequently removed in ruleset 4 (or 3 in the case of the smtp channel).
- # Such addresses can then be ignored by the header rulesets which are called
- # in BSD4.3 based sendmail.
-
- ifdef(`ETHERNAME',
- `R<$+>$+.ether $#ether$@$2$:<$1> local ethernet mail')
- ifdef(`TCPNAME',
- `R<$+>$+.tcp $#tcp$@$2$:<$1> internet mail
- R$+@[$+] $#tcp$@[$2]$:<$1> pass domain literals to tcp')
- ifdef(`UUCPNAME',
- `R<~$+>$+.uucp <\\~$1>$2.uucp band-aid for uuxqt
- R<$+>$+.uucp $#uucp$@$2$:<$1> external uucp mail')
- ifdef(`JANETNAME',
- `R<$+>$+.janet $#niftp$@$2$:<$1> janet mail')
- ifdef(`NEWSNAME',
- `ifdef(`NEWSRELAYED',`',
- `R<$+>news $#news$:<$1> network news')')
- ifdef(`CSNETNAME',
- `R<$+>$+.csnet $#pmdf$@$2$:<$1> csnet mail')
- ifdef(`DECNETNAME',
- `R<$+@$+>$+.decnet $#mail11$@$3$:<$1> decnet mail')
- ifdef(`XEROXNAME',
- `R<$+>$+.xerox $#xerox$@$2$:<$1> xerox mail')
-
- R<$+>error $#error$:Local Domain Unknown
- R<$+>$+ $#error$:Configuration Error
-
- # anything else with an "@" in is an error
- R$+@$+ $#error$:Domain Unknown
-
- # anything else - e.g. filenames, pipes etc goes to local mailer
- R$+ $#local$:<$1> local
-
-
- ###############################################
- # Ruleset 1 -- Sender Field Pre-rewriting #
- ###############################################
- S1
- R$+@$J $@$1 strip local domain name
-
-
- ##################################################
- # Ruleset 2 -- Recipient Field Pre-rewriting #
- ##################################################
- S2
- R$+@$J $@$1 strip local domain name
-
-
- ##########################################
- # Ruleset 3 -- Name Canonicalisation #
- ##########################################
- 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
- ifdef(`NRSFORMAT',
- `R$+@$+.$+ $:$>13$1@$2.$3 NRS ordering to 822 ordering')
-
- # Domain name expansion.
- ifdef(`NAMESERVER',
- `R$+@$+ $:$1@$[$2$] canonical name from nameserver')
- R$+@$+ $:$>11$1@$2 expand incomplete domain names
- R$+@$+ $:$>10$1@$2 do domain name aliases
-
- R$+@$+ $:$>15$1@$2 standardise local domain name
-
- ###############################################
- # Ruleset 4 -- Final Output Post-rewriting #
- ###############################################
-
- # header rewriting is done in the per-mailer rulesets.
-
- S4
- R<$+> $:$1 remove brackets from $u addr
- R$+@$+ $@$1@$2 already ok
-
- # this ensures that $u has at least one '@' in (if percent style)
- R$+%$+ $1@$2 convert '%'s to '@'s
- R$+@$+@$+ $1%$2@$3 then reduce to only one '@'
-
-
- ########################################################
- # Ruleset 5 -- RFC source routing -> Percent style #
- ########################################################
-
- #
- # convert a routed address in RFC822 form to Percent form
- # e.g. @ucl-cs.arpa,@kcl-cs.uucp:jim@hwcs.uucp ->
- # jim%hwcs.uucp%kcl-cs.uucp@ucl-cs.arpa
- #
- S5
-
- R$+,$+ $1:$2 @a,@b,@c:u%d -> @a:@b:@c:u%d
- R$*@$* $1%$2 @a:@b:@c:u@d -> %a:%b:%c:u%d
-
- R%$+:$+ $:$2@$1 %a:%b:%c:u%d -> %b:%c:u%d@a
- R%$+:$+@$+ $2@$1@$3 %b:%c:u%d@a -> u%d@c@b@a
- R$+@$+@$+ $1%$2@$3 u%d@c@b@a -> u%d%c%b@a
-
- ifdef(`TCPNAME',`
- ##############################################################
- # Ruleset 6 -- Percent style source routing -> RFC style #
- ##############################################################
-
- #
- # convert a routed address in the Percent form to RFC822 form
- # e.g. jim%hwcs.uucp%kcl-cs.uucp@ucl-cs.arpa ->
- # @ucl-cs.arpa,@kcl-cs.uucp:jim@hwcs.uucp
- # BEWARE!
- # This ruleset is only safe to use for transport addr in SMTP headers
- # because we cannot determine whether to add brackets and a phrase
- #
- S6
-
- R$+@$+ $1%$2 u%d%c%b@a -> u%d%c%b%a
- R$+%$+%$+ $:@$3:$1@$2 u%d%c%b%a -> @c%b%a:u@d
- R$+%$+:$+ @$2:$1:$3 @c%b%a:u%d -> @a:@b:@c:u@d
- R$+:$+:$+ $1,$2:$3 @a:@b:@c:u@d -> @a,@b,@c:u@d
- ')
-
- ###############################################################
- # Ruleset 7 -- uucp style source routing -> Percent style #
- ###############################################################
-
- #
- # convert an address in uucp form to Percent form
- # e.g. kcl-cs.uucp!hwcs.uucp!jim -> jim%hwcs.uucp@kcl-cs.uucp
- #
- # also converts mixed addresses, giving '@' and '%' priority over '!'
- # e.g. hwcs!jim%kcl-cs.uucp@ucl-cs.arpa -> jim%hwcs%kcl-cs.uucp@ucl-cs.arpa
- #
- S7
-
- # handle mixed addresses (with '!'s, '@'s and maybe '%'s in)
- R$+!$+%$+ $1!$2@$3 c!d!u%b@a -> c!d!u@b@a
- R$+!$+@$+ $2@$1@$3 c!d!u@b@a -> u@d@c@b@a
-
- # handle pure uucp addresses
- R$+!$+ $:$2@$1 a!b!c!d!u -> b!c!d!u@a
- R$+!$+@$+ $2@$1@$3 b!c!d!u@a -> u@d@c@b@a
-
- R$+@$+@$+ $1%$2@$3 u@d@c@b@a -> u%d%c%b@a
-
- ###############################################################
- # Ruleset 8 -- Percent style to uucp style source routing #
- ###############################################################
-
- #
- # convert a Percent style address to uucp (domain1!domain2!user) form
- # e.g. jim%hwcs.uucp@kcl-cs.uucp -> kcl-cs.uucp!hwcs.uucp!jim
- #
- S8
-
- R$+%$+ $1@$2 u%d%c%b@a -> u@d@c@b@a
- R$+@$+ $:$2!$1 u@d@c@b@a -> d@c@b@a!u
- R$+@$+!$+ $2!$1!$3 d@c@b@a!u -> a!b!c!d!u
-
- ifdef(`NRSFORMAT',`
- #####################################################
- # Ruleset 9 -- NRS <-> RFC822 domain conversion #
- #####################################################
-
- #
- # swap the order of the sub-domains around.
- # e.g. steve@uk.ac.ucl-cs.44d => steve@44d.ucl-cs.ac.uk
- #
- # this assumes that no colons will appear in the rhs of the domain address
- #
- S9
-
- R$*@$+.$+ $1@$2:$3 u@a.b.c.d -> u@a:b:c:d
- R$*@$-:$+ $:$1@$3.$2 u@a:b:c:d -> u@b:c:d.a
- R$*@$-:$+.$+ $1@$3.$2.$4 u@b:c:d.a -> u@d.c.b.a
- ')
-