From 6a7598e3bf16e44c735cecfb9dee38bac59e0282 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Sat, 23 Jun 2012 00:18:40 -0400 Subject: [PATCH] SMTP.pm: test if unrec cmd is set (suppress warning) and decrease log message priority in rcpt_response --- lib/Qpsmtpd/SMTP.pm | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/Qpsmtpd/SMTP.pm b/lib/Qpsmtpd/SMTP.pm index 5394646..4247503 100644 --- a/lib/Qpsmtpd/SMTP.pm +++ b/lib/Qpsmtpd/SMTP.pm @@ -47,8 +47,13 @@ sub command_counter { } sub dispatch { - my $self = shift; - my ($cmd) = lc shift; + my $self = shift; + my ($cmd) = shift; + if ( ! $cmd ) { + $self->run_hooks("unrecognized_command", '', @_); + return 1; + }; + $cmd = lc $cmd; $self->{_counter}++; @@ -304,13 +309,12 @@ sub mail { $self->reset_transaction; - unless ($self->connection->hello) { + if ( ! $self->connection->hello) { return $self->respond(503, "please say hello first ..."); - } - else { + }; + $self->log(LOGDEBUG, "full from_parameter: $line"); $self->run_hooks("mail_parse", $line); - } } sub mail_parse_respond { @@ -451,13 +455,13 @@ sub rcpt_respond { } elsif ($rc == DENY_DISCONNECT) { $msg->[0] ||= 'delivery denied'; - $self->log(LOGINFO, "delivery denied (@$msg)"); + $self->log(LOGDEBUG, "delivery denied (@$msg)"); $self->respond(550, @$msg); $self->disconnect; } elsif ($rc == DENYSOFT_DISCONNECT) { $msg->[0] ||= 'relaying denied'; - $self->log(LOGINFO, "delivery denied (@$msg)"); + $self->log(LOGDEBUG, "delivery denied (@$msg)"); $self->respond(421, @$msg); $self->disconnect; }