Check rua is defined before trying to parse it (#257)

Because $pol->rue returns undef is there's no rua defined, an error is printed in the logs

FATAL PLUGIN ERROR [dmarc]:  URI string is required! at /usr/share/perl5/vendor_perl/Mail/DMARC/PurePerl.pm line 295
This commit is contained in:
Daniel B 2016-04-28 19:09:07 +02:00 committed by Matt Simerson
parent 9f599f9f47
commit d13eae3aec

View File

@ -144,7 +144,7 @@ sub check_dmarc {
my $pol; my $pol;
eval { $pol = $dmarc->result->published; }; eval { $pol = $dmarc->result->published; };
if ( $self->{_args}{reporting} && $pol ) { if ( $self->{_args}{reporting} && $pol ) {
if ( $dmarc->has_valid_reporting_uri($pol->rua) ) { if ( $pol->rua && $dmarc->has_valid_reporting_uri($pol->rua) ) {
eval { $dmarc->save_aggregate(); }; eval { $dmarc->save_aggregate(); };
$self->log(LOGERROR, $@ ) if $@; $self->log(LOGERROR, $@ ) if $@;
} }