SMTP.pm: test if unrec cmd is set (suppress warning)

and decrease log message priority in rcpt_response
This commit is contained in:
Matt Simerson 2012-06-23 00:18:40 -04:00
parent cc58769cbf
commit 6a7598e3bf

View File

@ -47,8 +47,13 @@ sub command_counter {
} }
sub dispatch { sub dispatch {
my $self = shift; my $self = shift;
my ($cmd) = lc shift; my ($cmd) = shift;
if ( ! $cmd ) {
$self->run_hooks("unrecognized_command", '', @_);
return 1;
};
$cmd = lc $cmd;
$self->{_counter}++; $self->{_counter}++;
@ -304,13 +309,12 @@ sub mail {
$self->reset_transaction; $self->reset_transaction;
unless ($self->connection->hello) { if ( ! $self->connection->hello) {
return $self->respond(503, "please say hello first ..."); return $self->respond(503, "please say hello first ...");
} };
else {
$self->log(LOGDEBUG, "full from_parameter: $line"); $self->log(LOGDEBUG, "full from_parameter: $line");
$self->run_hooks("mail_parse", $line); $self->run_hooks("mail_parse", $line);
}
} }
sub mail_parse_respond { sub mail_parse_respond {
@ -451,13 +455,13 @@ sub rcpt_respond {
} }
elsif ($rc == DENY_DISCONNECT) { elsif ($rc == DENY_DISCONNECT) {
$msg->[0] ||= 'delivery denied'; $msg->[0] ||= 'delivery denied';
$self->log(LOGINFO, "delivery denied (@$msg)"); $self->log(LOGDEBUG, "delivery denied (@$msg)");
$self->respond(550, @$msg); $self->respond(550, @$msg);
$self->disconnect; $self->disconnect;
} }
elsif ($rc == DENYSOFT_DISCONNECT) { elsif ($rc == DENYSOFT_DISCONNECT) {
$msg->[0] ||= 'relaying denied'; $msg->[0] ||= 'relaying denied';
$self->log(LOGINFO, "delivery denied (@$msg)"); $self->log(LOGDEBUG, "delivery denied (@$msg)");
$self->respond(421, @$msg); $self->respond(421, @$msg);
$self->disconnect; $self->disconnect;
} }