Merge pull request #222 from jaredj/invalid-return
Don't interpret invalid return codes as OK
This commit is contained in:
commit
dfaeb1d795
@ -302,6 +302,10 @@ sub run_continuation {
|
|||||||
$self->log(LOGERROR, $log_msg . "undef!");
|
$self->log(LOGERROR, $log_msg . "undef!");
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
if ( !return_code($r[0]) ) {
|
||||||
|
$self->log(LOGERROR, $log_msg . $r[0]);
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
if ($tran) {
|
if ($tran) {
|
||||||
my $tnotes = $tran->notes($name);
|
my $tnotes = $tran->notes($name);
|
||||||
|
15
t/qpsmtpd.t
15
t/qpsmtpd.t
@ -149,12 +149,13 @@ sub __run_continuation {
|
|||||||
descr => 'DECLINED -> DENY',
|
descr => 'DECLINED -> DENY',
|
||||||
},
|
},
|
||||||
# TODO: ignore invalid return codes rather than treating them like OK
|
# TODO: ignore invalid return codes rather than treating them like OK
|
||||||
#{
|
{
|
||||||
# hooks => [ [123456,undef], [DENY, 'goaway'] ],
|
hooks => [ [123456,undef], [DENY, 'goaway'] ],
|
||||||
# expected_response => '550/goaway',
|
expected_response => '550/goaway',
|
||||||
# disconnected => 0,
|
disconnected => 0,
|
||||||
# descr => 'INVALID -> DENY',
|
logged => 'LOGERROR:Plugin ___FakeHook___, hook helo returned 123456',
|
||||||
#},
|
descr => 'INVALID -> DENY',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
hooks => [ sub { die "dead\n" }, [DENY, 'begone'] ],
|
hooks => [ sub { die "dead\n" }, [DENY, 'begone'] ],
|
||||||
expected_response => '550/begone',
|
expected_response => '550/begone',
|
||||||
@ -182,7 +183,7 @@ sub __run_continuation {
|
|||||||
$smtpd->run_continuation;
|
$smtpd->run_continuation;
|
||||||
my $response = join '/', @{ $smtpd->{_response} || [] };
|
my $response = join '/', @{ $smtpd->{_response} || [] };
|
||||||
is( $response, $t->{expected_response},
|
is( $response, $t->{expected_response},
|
||||||
"run_continuation(): Respond to $t->{descr} with $response" );
|
"run_continuation(): Respond to $t->{descr} with $t->{expected_response}" );
|
||||||
if ( $t->{disconnected} ) {
|
if ( $t->{disconnected} ) {
|
||||||
ok( $smtpd->connection->notes('disconnected'),
|
ok( $smtpd->connection->notes('disconnected'),
|
||||||
"run_continuation() disconnects on $t->{descr}" );
|
"run_continuation() disconnects on $t->{descr}" );
|
||||||
|
Loading…
Reference in New Issue
Block a user