[Mimedefang] MIMEDefang Notification
Jon Rowlan
jon.rowlan at sads.com
Sat Dec 13 17:28:46 EST 2014
> I'm not fully sure of your overall goal, but if your question is about
a regex to parse your sample
> line above, then how about something generally like this:
>
> my $line = "Domain.com esmtp:[9.9.9.9]:[8.8.8.8]";
> my ( $domain, $proto, $relays ) = ( $line =~
m/^(\S+)\s+(e?smtp)(:.+)$/i ); my @relays = ( $relays =~
> m/:\[([^]]+)\]/g );
Hi Matt,
This has been driving me nuts all day
I first tried to replace Larry's Regex with yours directly thus:
if( $mailerlookuptable{$domain} =~ m/^(\S+)\s+(e?smtp)(:.+)$/i ) {
And it simply failed to work although using your code directly in an
external PL script worked fine.
I then reverted to Larry's exact regex which I am positive worked last
week but now fails completely.
At first I thought that maybe there was a problem with not using Untie
but a reboot of the sever makes no difference.
In my filter initialize I have:
require DB_File;
use Fcntl;
tie %mailerlookuptable, "DB_File",
"/etc/mail/mailerlookuptable.db", O_RDONLY;
md_syslog('warning', "JWR00115 open return");
return;
In filter_recipient I have my own personal domain for testing purposes
like this:
if (index(lc $rcpt_addr,'rowlan.co.uk') != -1) {
($user,$domain) = split /\@/, $rcpt_addr;
md_syslog('warning', "JWR00115 checking user $user
against domain $domain");
# m = match operator
# to be matched between //
# trailing i = case insensitive
# ^ beginning of line symbol
# () grouping together
# \S = match non whitespace character
# + = one or more times
# \s = match whitespace character
# ? = match 1 or 0 times
# $ = end of line ... i.e. the text has to end at the
end of line, we are looking for EOL
# temporarily remmed
# if( $mailerlookuptable{$domain} =~
m/^(\S+)\s+(e?smtp)(:.+)$/i ) {
$host = hostname;
if( $mailerlookuptable{$domain} =~ /^smtp:\[(.+)\]/ ){
md_syslog('warning', "JWR00115 I am host $host
checking recipient $rcpt_addr against server $1 for domain $domain with
arg=$1");
# don't do anything for real yet
# return md_check_against_smtp_server($sender,
$rcpt_addr, $host, $1);
return ("CONTINUE", "OK");
} else {
md_syslog('warning', "JWR00115 not matched");
return ("CONTINUE", "OK");
}
}
And I always get the "not matched" message.
Am I either going mad or doing something silly? I am sure that I am
suffering from code blindness !
Regards
jON
p.s. Regex ... ouch ! Hard work indeed !!! :-)
More information about the MIMEDefang
mailing list