Fix delivery direction when only LOCAL_DOMAIN was set. Thanks to enekux for the report.

This commit is contained in:
Darold Gilles 2017-11-15 23:44:17 +01:00
parent 76cda01d9f
commit 88d501ed24
2 changed files with 14 additions and 0 deletions

View file

@ -1882,6 +1882,13 @@ sub set_direction
} elsif ($CONFIG{MAIL_GW} && $CONFIG{MAIL_HUB}) {
# If sender relay is the gateway, it comes from outside
$direction = 'Ext_' if (grep($STATS{$id}{sender_relay} =~ /$_/i, split(/[\s\t,;]/, $CONFIG{MAIL_GW})));
} else {
# if message doesn't come from localhost or user defined loca relay it comes from outside
if (exists $CONFIG{LOCAL_HOST_DOMAIN}{$hostname} && ($#{$CONFIG{LOCAL_HOST_DOMAIN}{$hostname}} > -1) ) {
$direction = 'Ext_' if (!grep($STATS{$id}{sender_relay} =~ /\b$_$/, 'localhost', @{$CONFIG{LOCAL_HOST_DOMAIN}{$hostname}}));
} elsif (exists $CONFIG{LOCAL_DOMAIN} && ($#{$CONFIG{LOCAL_DOMAIN}} > -1)) {
$direction = 'Ext_' if (!grep($STATS{$id}{sender_relay} =~ /\b$_$/, 'localhost', @{$CONFIG{LOCAL_DOMAIN}}));
}
}
} else {
$direction = 'Unk_';

View file

@ -4158,6 +4158,13 @@ sub set_direction
} elsif ($CONFIG{MAIL_GW} && $CONFIG{MAIL_HUB}) {
# If sender relay is the gateway, it comes from outside
$direction = 'Ext_' if (grep($STATS->{$id}{sender_relay} =~ /$_/i, split(/[\s\t,;]/, $CONFIG{MAIL_GW})));
} else {
# if message doesn't come from localhost or user defined loca relay it comes from outside
if (exists $CONFIG{LOCAL_HOST_DOMAIN}{$hostname} && ($#{$CONFIG{LOCAL_HOST_DOMAIN}{$hostname}} > -1) ) {
$direction = 'Ext_' if (!grep($STATS->{$id}{sender_relay} =~ /\b$_$/, 'localhost', @{$CONFIG{LOCAL_HOST_DOMAIN}{$hostname}}));
} elsif (exists $CONFIG{LOCAL_DOMAIN} && ($#{$CONFIG{LOCAL_DOMAIN}} > -1)) {
$direction = 'Ext_' if (!grep($STATS->{$id}{sender_relay} =~ /\b$_$/, 'localhost', @{$CONFIG{LOCAL_DOMAIN}}));
}
}
} else {
$direction = 'Unk_';