improve readability in SMTP::auth_parse_respond --- lib/Qpsmtpd/SMTP.pm | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/lib/Qpsmtpd/SMTP.pm b/lib/Qpsmtpd/SMTP.pm index 7c126dd..3df02f1 100644 --- a/lib/Qpsmtpd/SMTP.pm +++ b/lib/Qpsmtpd/SMTP.pm @@ -265,26 +265,25 @@ sub auth_parse_respond { unless ($ok == OK); $mechanism = lc($mechanism); - #they AUTH'd once already return $self->respond( 503, "but you already said AUTH ..." ) - if ( defined $self->{_auth} - and $self->{_auth} == OK ); + if ( defined $self->{_auth} && $self->{_auth} == OK ); + return $self->respond( 503, "AUTH not defined for HELO" ) if ( $self->connection->hello eq "helo" ); + return $self->respond( 503, "SSL/TLS required before AUTH" ) if ( ($self->config('tls_before_auth'))[0] - and $self->transaction->notes('tls_enabled') ); + && $self->transaction->notes('tls_enabled') ); - # if we don't have a plugin implementing this auth mechanism, 504 + # we don't have a plugin implementing this auth mechanism, 504 if( exists $auth_mechanisms{uc($mechanism)} ) { return $self->{_auth} = Qpsmtpd::Auth::SASL( $self, $mechanism, @stuff ); - } else { - $self->respond( 504, "Unimplemented authentification mechanism: $mechanism" ); - return DENY; - } + }; + $self->respond( 504, "Unimplemented authentification mechanism: $mechanism" ); + return DENY; } sub mail { -- 1.7.9.6