suppress log error when $user unset

test for and return earlier when a null sender is encountered.
Prevents using an undefined variable.
This commit is contained in:
Matt Simerson 2012-04-07 22:03:30 -04:00 committed by Robert
parent 2591d57aab
commit 1701406f78

View File

@ -46,14 +46,13 @@ sub hook_mail {
my ($self, $transaction, $sender, %param) = @_; my ($self, $transaction, $sender, %param) = @_;
my $format = $sender->format; my $format = $sender->format;
my $host = lc $sender->host; return (DECLINED, "SPF - null sender") if $format eq '<>';
my $user = $sender->user;
my $client_ip = $self->qp->connection->remote_ip;
my $from = $sender->user . '@' . $host;
my $helo = $self->qp->connection->hello_host;
return (DECLINED, "SPF - null sender") return (DECLINED, "SPF - null sender")
unless ($format ne "<>" && $host && $user); unless ($sender->host && $sender->user);
my $client_ip = $self->qp->connection->remote_ip;
my $from = $sender->user . '@' . lc($sender->host);
my $helo = $self->qp->connection->hello_host;
# If we are receving from a relay permitted host, then we are probably # If we are receving from a relay permitted host, then we are probably
# not the delivery system, and so we shouldn't check # not the delivery system, and so we shouldn't check