[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
new canonicalize()
Hi,
I made an attempt to rewrite/simplify/purify canonicalize()
I run it in parallel with old canonicalize() on two of our loaded
machines and havent seen any difference yet. Maybe it will be of
any use to someone on this list. Regards,
alexis
PS And of course because of sift instead of ssift it has no problem
with quoted local parts.
#
# $Id: canonicalize.cf,v 1.1 1997/12/17 14:01:28 alexis Exp $
#
# Alexis Yushin, NLnet Development, 1997
#
# Name Canonicalization
#
provide canonicalize
#
# Canonicalizes an RFC822/RFC976 ``route-addr'' address.
#
canonicalize (address) {
local localpart domain route
sift "$address" in
# Zmailer internal special cases
((\|.+)|(>.+)|(:include:.+))
echo "$address" # pass through unqouted
return # pipes and files
;;
((<>)|(:;))
echo @ # special case
return
;;
(.*)<@(.*)>(.*) # defocus
address="\1@\2\3"
continue
;;
# RFC822 source routing
(@.+),(.+)
address="\1:\2" # change all "," to ":"
continue
;;
(@.+):(.+:.+)
address="\1,\2" # undo all but the last one
continue
;;
(@[^,:]+)(.+:)(.+)
echo "<\1>\2\3" # focus
return
;;
(.*)::(.*)
address="\2@\1" # turn into localpart@domain
continue
;;
# Pure ``localpart@domain''
(.*)(@[^@]*)
echo "\1<\2>"
return
;;
# localpart only
# RFC976 processing: '!' and '%' kludges
([^!]*)\.([^!]*)!(.*) # domain uucp
canonicalize "\3@\1.\2"
return
;;
([^!.]*)!(.*) # pure uucp
canonicalize "\2@\1.uucp"
return
;;
(.*)%([^%]*)
canonicalize "\1@\2"
return
;;
tfis
echo "$address"
}
--
Where the wild horses run