divert(-1) # # Copyright (c) 2003, 2004 Victor Ustugov # This hack is under BSD License # Redistributions of source code must retain the above copyright notice # # special thanks to Artur Penttinen # # hacks disscussion's maillist - http://www.mta.org.ua/mailman/listinfo/sendmail-conf # # # parse Received field format # divert(0) ifdef(`_RECEIVED_PARSED_', `dnl', `dnl VERSIONID(`$Id: parse_received.m4,v 8.12-0.03 2004/07/23 15:03:02 corvax Exp $')dnl divert(-1) dnl define(`_RECEIVED_PARSED_')dnl dnl dnl LOCAL_RULESETS dnl dnl HReceived: $>+Check_Received dnl SCheck_Received dnl # stupid qmail formats R from $* ( HELO $+ ) ( $+ ) by $+ with $- ; $+ $: from $2 ( $1 [ $3 ] ) by $4 dnl # handle Exim format R from [ $+ ] ($* HELO = $+) by $+ $: from $3 ( $2 [ $1 ] ) by $4 R from $+ ( [ $+ ] HELO = $+ ident = $+ ) by $+ $: from $3 ( $1 [ $2 ] ) by $5; (ident=$4) R from $+ ( [ $+ ] HELO = $+ ) by $+ $: from $3 ( $1 [ $2 ] ) by $4 R from $+ ([ $+ ]) by $+ $: from $1 ( [ $2 ] ) by $3 dnl R from $+ by $+ with $+ $: from $1 ( [ ] ) by $2 with $3 dnl # handle CGPro format R from [ $+ ] ($* HELO $+) by $+ ($+) with $- id $+ $: from $3 ( $2 [ $1 ] ) by $4 dnl # MS Internet Mail R from ( $+ ) [ $+ ] by $+ with $+ $: from $1 ( [ $2 ] ) by $3 dnl # SMTPSVC R from $+ - $+ by $+ with $+ $: from $1 ( [ $2 ] ) by $3 dnl # SMail format for local clients R from (locally authorised $+) $+ [$+] with $- by $+ with $+ $: from $2 ( [ $3 ] ) by $5 dnl # handle SpiderMail format R from $+ ( $+ [ $+ ] with $- ) by $+ for $+ $: from $1 ( $2 [ $3 ] ) by $5 dnl # handle Domino MTA fmt R ( from $* [ $+ ] ) $+ $: from $1 ( [ $2 ] ) $3 dnl # handle MDaemon format R from $+ [ $+ ] by $+ [ $+ ] with $- ( $+ ) for $+ $: from $1 ( [ $2 ] ) by $3 with $5 for $7 dnl # sendmail from localhost R ( from $+ @ $+ ) by $+ for $+ $: from $2 ( $1@$2 [ $2 ] ) by $3 dnl # delete "may be forged" R from $+ ($+ [$+] $* ) by $+ $: from $1 ( $2 [ $3 ] ) by $5 # now we have formatted Received to normal syntax ')