From 3ffee33d33f21b5b97b2bf6b83dee64782a9915d Mon Sep 17 00:00:00 2001 From: Jared Johnson Date: Tue, 11 Nov 2014 16:59:40 -0600 Subject: [PATCH] Remove extraneous semicolons They confuse my editor --- bin/install_deps.pl | 24 ++++++++-------- lib/Qpsmtpd/Base.pm | 4 +-- lib/Qpsmtpd/Plugin.pm | 2 +- log/log2sql | 6 ++-- log/summarize | 2 +- plugins/auth/auth_vpopmaild | 4 +-- plugins/earlytalker | 2 +- plugins/headers | 4 +-- plugins/karma | 18 ++++++------ plugins/loadcheck | 2 +- qpsmtpd-forkserver | 2 +- t/packaging.t | 4 +-- t/plugin_tests/auth/auth_checkpassword | 4 +-- t/plugin_tests/auth/auth_vpopmail | 2 +- t/plugin_tests/auth/auth_vpopmail_sql | 8 +++--- t/plugin_tests/badmailfrom | 8 +++--- t/plugin_tests/badmailfromto | 2 +- t/plugin_tests/badrcptto | 8 +++--- t/plugin_tests/count_unrecognized_commands | 4 +-- t/plugin_tests/dmarc | 12 ++++---- t/plugin_tests/dnsbl | 8 +++--- t/plugin_tests/dspam | 8 +++--- t/plugin_tests/earlytalker | 16 +++++------ t/plugin_tests/greylisting | 18 ++++++------ t/plugin_tests/headers | 6 ++-- t/plugin_tests/helo | 28 +++++++++---------- t/plugin_tests/ident/geoip | 29 ++++++++++---------- t/plugin_tests/ident/p0f | 15 +++++----- t/plugin_tests/rcpt_ok | 12 ++++---- t/plugin_tests/relay | 12 ++++---- t/plugin_tests/resolvable_fromhost | 10 +++---- t/plugin_tests/sender_permitted_from | 4 +-- t/plugin_tests/spamassassin | 32 +++++++++++----------- t/plugin_tests/virus/clamdscan | 4 +-- t/qpsmtpd-base.t | 6 ++-- t/qpsmtpd-config.t | 6 ++-- 36 files changed, 168 insertions(+), 168 deletions(-) diff --git a/bin/install_deps.pl b/bin/install_deps.pl index c69797d..bb2f7cb 100755 --- a/bin/install_deps.pl +++ b/bin/install_deps.pl @@ -40,7 +40,7 @@ my @failed; foreach ( @$apps ) { my $name = $_->{app} or die 'missing app name'; install_app( $name, $_->{info} ); -}; +} foreach ( get_perl_modules() ) { #print Dumper($_); @@ -78,7 +78,7 @@ sub get_perl_modules { return get_perl_modules_from_Makefile_PL(); }; die "unable to find module list. Run this script in the dist dir\n"; -}; +} sub get_perl_modules_from_Makefile_PL { my $fh = new IO::File 'Makefile.PL', 'r' @@ -102,7 +102,7 @@ sub get_perl_modules_from_Makefile_PL { } $fh->close; return @modules; -}; +} sub get_perl_modules_from_ini { my $fh = new IO::File 'dist.ini', 'r' @@ -127,7 +127,7 @@ sub get_perl_modules_from_ini { $fh->close; #print Dumper(\@modules); return @modules; -}; +} sub install_app { my ( $app, $info) = @_; @@ -142,7 +142,7 @@ sub install_app { install_app_linux( $app, $info ); }; -}; +} sub install_app_darwin { my ($app, $info ) = @_; @@ -181,7 +181,7 @@ sub install_app_freebsd { system "make install clean" and warn "'make install clean' failed for port $app\n"; }; -}; +} sub install_app_linux { my ($app, $info ) = @_; @@ -197,7 +197,7 @@ sub install_app_linux { else { warn "no Linux package manager detected\n"; }; -}; +} sub install_module { @@ -220,7 +220,7 @@ sub install_module { return 1 if ! $EVAL_ERROR; install_module_cpan($module, $version); -}; +} sub install_module_cpan { @@ -309,7 +309,7 @@ sub install_module_linux { return install_module_linux_apt($module, $info); } warn "no Linux package manager detected\n"; -}; +} sub install_module_linux_yum { my ($module, $info) = @_; @@ -322,7 +322,7 @@ sub install_module_linux_yum { $package =~ s/::/-/g; }; system "/usr/bin/yum -y install $package"; -}; +} sub install_module_linux_apt { my ($module, $info) = @_; @@ -335,7 +335,7 @@ sub install_module_linux_apt { $package =~ s/::/-/g; }; system "/usr/bin/apt-get -y install $package"; -}; +} sub get_cpan_config { @@ -397,4 +397,4 @@ sub name_overrides { my ($match) = grep { $_->{module} eq $mod } @modules; return $match if $match; return { module=>$mod, info => { } }; -}; +} diff --git a/lib/Qpsmtpd/Base.pm b/lib/Qpsmtpd/Base.pm index f1612b9..5d3e8fa 100644 --- a/lib/Qpsmtpd/Base.pm +++ b/lib/Qpsmtpd/Base.pm @@ -6,7 +6,7 @@ use Net::IP; sub new { return bless {}, shift; -}; +} sub tildeexp { my ($self, $path) = @_; @@ -44,7 +44,7 @@ sub is_ipv6 { my ($self, $ip) = @_; return if !$ip; return Net::IP::ip_is_ipv6($ip); -}; +} sub get_resolver { my ($self, %args) = @_; diff --git a/lib/Qpsmtpd/Plugin.pm b/lib/Qpsmtpd/Plugin.pm index 62b3d12..b08fb85 100644 --- a/lib/Qpsmtpd/Plugin.pm +++ b/lib/Qpsmtpd/Plugin.pm @@ -276,7 +276,7 @@ sub store_auth_results { my $ar = join('; ', $auths, $result); $self->log(LOGDEBUG, "auth-results: $ar"); $self->qp->connection->notes('authentication_results', $ar ); -}; +} sub is_immune { my $self = shift; diff --git a/log/log2sql b/log/log2sql index f5f5909..5ef22b4 100755 --- a/log/log2sql +++ b/log/log2sql @@ -552,7 +552,7 @@ sub get_config { $values{$key} = $val; }; return %values; -}; +} sub get_config_contents { my $name = shift; @@ -569,7 +569,7 @@ sub get_config_contents { my @contents = <$fh>; return @contents; }; -}; +} sub check_plugins_table { my $rows = exec_query( 'SELECT COUNT(*) FROM plugin'); @@ -591,7 +591,7 @@ sub check_plugins_table { exec_query($aq, [$id, $alias]); }; }; -}; +} sub exec_query { my $query = shift; diff --git a/log/summarize b/log/summarize index b55640f..63e2fa2 100755 --- a/log/summarize +++ b/log/summarize @@ -100,7 +100,7 @@ sub get_default_field_widths { ); return %widths; -}; +} sub handle_plugin { my ($message, $plugin, $pid, $line) = @_; diff --git a/plugins/auth/auth_vpopmaild b/plugins/auth/auth_vpopmaild index e0e11ed..8b6ceef 100644 --- a/plugins/auth/auth_vpopmaild +++ b/plugins/auth/auth_vpopmaild @@ -81,7 +81,7 @@ sub get_response { }; return $response; -}; +} sub get_socket { my ($self) = @_; @@ -99,7 +99,7 @@ sub get_socket { return; }; return $socket; -}; +} __END__ diff --git a/plugins/earlytalker b/plugins/earlytalker index 21c49f9..14c5d7f 100644 --- a/plugins/earlytalker +++ b/plugins/earlytalker @@ -138,7 +138,7 @@ sub wait_length { return $self->connection->notes('earlytalker_wait'); } return $self->{_args}{wait}; -}; +} sub apr_connect_handler { my ($self, $transaction) = @_; diff --git a/plugins/headers b/plugins/headers index 8263f02..e3319cd 100644 --- a/plugins/headers +++ b/plugins/headers @@ -168,7 +168,7 @@ sub has_required_headers { $self->log(LOGINFO, "fail, no $h header" ); } return $errors; -}; +} sub has_singular_headers { my ($self, $header) = @_; @@ -187,7 +187,7 @@ sub has_singular_headers { $self->log(LOGINFO, "fail, too many $h headers" ); } return $errors; -}; +} sub invalid_date_range { my $self = shift; diff --git a/plugins/karma b/plugins/karma index a23dcbc..10bf61d 100644 --- a/plugins/karma +++ b/plugins/karma @@ -347,11 +347,11 @@ sub from_handler { if ( $sender->host && ".$tld" eq substr($sender->host,-$len,$len) ) { $self->log(LOGINFO, "penalizing .$tld envelope sender"); $self->adjust_karma(-$score); - }; - }; + } + } return DECLINED; -}; +} sub rcpt_handler { my ($self,$transaction, $recipient, %args) = @_; @@ -365,7 +365,7 @@ sub rcpt_handler { if ( $count > 1 ) { $self->log(LOGINFO, "recipients c: $count ($recipient)"); $self->connection->notes('recipient_count', $count); - }; + } return DECLINED if $self->is_immune(); @@ -379,13 +379,13 @@ sub rcpt_handler { if ( $history > 0 ) { $self->log(LOGINFO, "info, good history"); return DECLINED; - }; + } my $karma = $self->connection->notes('karma'); if ( $karma > 0 ) { $self->log(LOGINFO, "info, good connection"); return DECLINED; - }; + } # limit # of recipients if host has negative or unknown karma return DENY, "too many recipients for karma $karma (h: $history)"; @@ -401,7 +401,7 @@ sub data_handler { my $karma = $self->connection->notes('karma'); if ( $karma < -4 ) { # bad karma return $self->get_reject("very bad karma: $karma"); - }; + } return DECLINED; } @@ -461,8 +461,8 @@ sub illegal_envelope_format { if ( uc substr($addr,0,6) ne 'FROM:<' && uc substr($addr,0,4) ne 'TO:<' ) { $self->log(LOGINFO, "illegal envelope address format: $addr" ); $self->adjust_karma(-2); - }; -}; + } +} sub parse_db_record { my ($self, $value) = @_; diff --git a/plugins/loadcheck b/plugins/loadcheck index 7eb2fdb..25dfcd7 100644 --- a/plugins/loadcheck +++ b/plugins/loadcheck @@ -154,5 +154,5 @@ sub get_load_method { $self->log(LOGERROR, "unable to acquire system load"); return; -}; +} diff --git a/qpsmtpd-forkserver b/qpsmtpd-forkserver index 7cf8982..f5b32ed 100755 --- a/qpsmtpd-forkserver +++ b/qpsmtpd-forkserver @@ -235,7 +235,7 @@ $SIG{HUP} = sub { $qpsmtpd->load_plugins; $qpsmtpd->spool_dir; $qpsmtpd->size_threshold; -}; +} while (1) { REAPER(); diff --git a/t/packaging.t b/t/packaging.t index 7b7ed0c..ebf45b8 100644 --- a/t/packaging.t +++ b/t/packaging.t @@ -16,7 +16,7 @@ sub get_qp_version { my ($ver_line) = grep { $_ =~ /^our \$VERSION/ } @$rvfile; my ($ver) = $ver_line =~ /['"]([0-9\.]+)['"]/; return $ver; -}; +} sub get_rpm_version { my $rvfile = get_file_contents('packaging/rpm/VERSION') @@ -33,4 +33,4 @@ sub get_file_contents { }; my @r = <$fh>; return \@r; -}; +} diff --git a/t/plugin_tests/auth/auth_checkpassword b/t/plugin_tests/auth/auth_checkpassword index ca217e5..1ecebd4 100644 --- a/t/plugin_tests/auth/auth_checkpassword +++ b/t/plugin_tests/auth/auth_checkpassword @@ -10,12 +10,12 @@ sub register_tests { if ( ! $vpopdir ) { warn "skipping tests, vpopmail not installed\n"; return; - }; + } if ( ! -d "$vpopdir/domains/example.com" ) { warn "skipping tests, no example users set up.\n"; return; - }; + } $self->register_test("test_auth_checkpassword"); } diff --git a/t/plugin_tests/auth/auth_vpopmail b/t/plugin_tests/auth/auth_vpopmail index fd1e436..22470b4 100644 --- a/t/plugin_tests/auth/auth_vpopmail +++ b/t/plugin_tests/auth/auth_vpopmail @@ -25,7 +25,7 @@ sub test_auth_vpopmail { warn "vpopmail plugin not configured\n"; foreach ( 0..2) { ok( 1, "skipped") }; return; - }; + } my ($tran, $ret, $note, $u, $r, $p, $a ); $tran = $self->qp->transaction; diff --git a/t/plugin_tests/auth/auth_vpopmail_sql b/t/plugin_tests/auth/auth_vpopmail_sql index 73da60d..765cee4 100644 --- a/t/plugin_tests/auth/auth_vpopmail_sql +++ b/t/plugin_tests/auth/auth_vpopmail_sql @@ -10,7 +10,7 @@ sub register_tests { if ( $@ ) { warn "skipping auth_vpopmail_sql tests, is DBI installed?\n"; return; - }; + } $self->register_test("auth_vpopmail_sql"); } @@ -21,7 +21,7 @@ sub auth_vpopmail_sql { my $dbh = $self->get_db_handle() or do { foreach ( 0..2 ) { ok( 1, "skipped (no DB)" ); - }; + } return; }; ok( $dbh, "auth_vpopmail_sql, got a dbh" ); @@ -30,9 +30,9 @@ sub auth_vpopmail_sql { if ( ! $vuser || ! $vuser->{pw_passwd} ) { foreach ( 0..1 ) { ok( 1, "no example.com domain" ); - }; + } return; - }; + } ok( ref $vuser, "found example.com domain" ); ok( $self->auth_vmysql( diff --git a/t/plugin_tests/badmailfrom b/t/plugin_tests/badmailfrom index ce6c7da..38f245a 100644 --- a/t/plugin_tests/badmailfrom +++ b/t/plugin_tests/badmailfrom @@ -35,7 +35,7 @@ sub test_badmailfrom_is_immune_sender { $address = Qpsmtpd::Address->new( '' ); $transaction->sender($address); ok( ! $self->is_immune_sender( $transaction->sender, ['bad@example.com'] ), "false"); -}; +} sub test_badmailfrom_hook_mail { my $self = shift; @@ -60,7 +60,7 @@ sub test_badmailfrom_hook_mail { ($r, $err) = $self->hook_mail( $transaction, $address ); cmp_ok( $r, '==', DENY, "hook_mail rc"); cmp_ok( $err, 'eq', 'Yer a spammin bastert', "custom reason"); -}; +} sub test_badmailfrom_match { my $self = shift; @@ -87,7 +87,7 @@ sub test_badmailfrom_match { ok( ! $self->is_match( 'matt@test.net', 'test.not$', 'tnpi.net' ), "pattern non-match"); -}; +} sub _reset_connection_flags { my $self = shift; @@ -95,5 +95,5 @@ sub _reset_connection_flags { $self->qp->connection->notes('whitelisthost', 0); $self->connection->notes('naughty',0); $self->connection->notes('rejected', 0); -}; +} diff --git a/t/plugin_tests/badmailfromto b/t/plugin_tests/badmailfromto index c4f9389..f5e7339 100644 --- a/t/plugin_tests/badmailfromto +++ b/t/plugin_tests/badmailfromto @@ -30,5 +30,5 @@ sub test_badmailfromto_is_sender_immune { $transaction->sender( Qpsmtpd::Address->new( '' ) ); ok( ! $self->is_sender_immune( $transaction->sender, ['bad@example.com'] ), "false"); -}; +} diff --git a/t/plugin_tests/badrcptto b/t/plugin_tests/badrcptto index bf61670..efadcaf 100644 --- a/t/plugin_tests/badrcptto +++ b/t/plugin_tests/badrcptto @@ -19,7 +19,7 @@ sub _reset_connection_flags { $self->qp->connection->notes('whitelisthost', 0); $self->connection->notes('naughty',0); $self->connection->notes('rejected', 0); -}; +} sub test_is_match { my $self = shift; @@ -55,7 +55,7 @@ sub test_is_match { ok( ! $self->is_match( 'matt@example.com', 'example.not$', 'tnpi.com' ), "pattern non-match"); -}; +} sub test_hook_rcpt { my $self = shift; @@ -75,7 +75,7 @@ sub test_hook_rcpt { $recipient = Qpsmtpd::Address->new( '' ); ($r, $mess) = $self->hook_rcpt( $transaction, $recipient ); cmp_ok( $r, '==', DENY, "bad host match, +, $mess"); -}; +} sub test_get_host_and_to { my $self = shift; @@ -99,4 +99,4 @@ sub test_get_host_and_to { ($host, $to) = $self->get_host_and_to( $recipient ); cmp_ok( $host, 'eq', 'example.com', "case normalized +"); cmp_ok( $to, 'eq', 'user@example.com', "case normalized +"); -}; +} diff --git a/t/plugin_tests/count_unrecognized_commands b/t/plugin_tests/count_unrecognized_commands index 54c9c70..9f38e74 100644 --- a/t/plugin_tests/count_unrecognized_commands +++ b/t/plugin_tests/count_unrecognized_commands @@ -9,7 +9,7 @@ sub register_tests { my $self = shift; $self->register_test('test_hook_unrecognized_command'); -}; +} sub test_hook_unrecognized_command { my $self = shift; @@ -28,4 +28,4 @@ sub test_hook_unrecognized_command { cmp_ok( $code, '==', DENY_DISCONNECT, "over limit" ); cmp_ok( $self->connection->notes( 'unrec_cmd_count'), '==', 4, "correct increment" ); -}; +} diff --git a/t/plugin_tests/dmarc b/t/plugin_tests/dmarc index 6ffd4af..da20326 100644 --- a/t/plugin_tests/dmarc +++ b/t/plugin_tests/dmarc @@ -29,7 +29,7 @@ sub setup_test_headers { $transaction->body_write( "test message body " ); $self->qp->connection->relay_client(0); -}; +} sub test_fetch_dmarc_record { my $self = shift; @@ -37,12 +37,12 @@ sub test_fetch_dmarc_record { foreach ( qw/ tnpi.net nictool.com / ) { my @matches = $self->fetch_dmarc_record($_); cmp_ok( scalar @matches, '==', 1, 'fetch_dmarc_record'); - }; + } foreach ( qw/ example.com / ) { my @matches = $self->fetch_dmarc_record($_); cmp_ok( scalar @matches, '==', 0, 'fetch_dmarc_record'); - }; -}; + } +} sub test_get_organizational_domain { my $self = shift; @@ -53,7 +53,7 @@ sub test_get_organizational_domain { cmp_ok( $self->get_organizational_domain('test.www.tnpi.net'), 'eq', 'tnpi.net' ); cmp_ok( $self->get_organizational_domain('www.example.co.uk'), 'eq', 'example.co.uk' ); cmp_ok( $self->get_organizational_domain('plus.google.com'), 'eq', 'google.com' ); -}; +} sub test_discover_policy { my $self = shift; @@ -61,4 +61,4 @@ sub test_discover_policy { $self->setup_test_headers(); ok( $self->discover_policy( 'tnpi.net' ), 'discover_policy' ); -}; +} diff --git a/t/plugin_tests/dnsbl b/t/plugin_tests/dnsbl index ebaca73..49076e1 100644 --- a/t/plugin_tests/dnsbl +++ b/t/plugin_tests/dnsbl @@ -27,7 +27,7 @@ sub test_ip_whitelisted { $self->qp->connection->notes('whitelisthost', 'hello honey!'); ok( $self->ip_whitelisted(), "+"); $self->qp->connection->notes('whitelisthost', undef); -}; +} sub test_is_set_rblsmtpd { my $self = shift; @@ -43,7 +43,7 @@ sub test_is_set_rblsmtpd { $ENV{RBLSMTPD} = ''; cmp_ok( 1,'==',$self->is_set_rblsmtpd('10.1.1.1'), "empty"); -}; +} sub test_hook_connect { my $self = shift; @@ -62,7 +62,7 @@ sub test_hook_connect { } else { ok( 1, "connect +, skipped (is DNS working?)" ); - }; + } } sub test_reject_type { @@ -76,4 +76,4 @@ sub test_reject_type { $self->{_args}{reject_type} = 'disconnect'; cmp_ok( $self->get_reject_type(), '==', DENY_DISCONNECT, "disconnect"); -}; +} diff --git a/t/plugin_tests/dspam b/t/plugin_tests/dspam index 5f16157..93729de 100644 --- a/t/plugin_tests/dspam +++ b/t/plugin_tests/dspam @@ -56,7 +56,7 @@ sub test_log_and_return { $transaction->notes('dspam', { class=> 'Innocent', probability => .96, confidence=>1 } ); ($r) = $self->log_and_return( $transaction ); cmp_ok( $r, '==', DECLINED, "($r)"); -}; +} sub test_get_dspam_results { my $self = shift; @@ -79,8 +79,8 @@ sub test_get_dspam_results { $transaction->header->add('X-DSPAM-Result', $header); my $r = $self->get_dspam_results($transaction); ok( ref $r, "r: ($header)" ); - }; -}; + } +} sub test_reject_type { my $self = shift; @@ -93,4 +93,4 @@ sub test_reject_type { $self->{_args}{reject_type} = 'disconnect'; cmp_ok( $self->get_reject_type(), '==', DENY_DISCONNECT, "disconnect"); -}; +} diff --git a/t/plugin_tests/earlytalker b/t/plugin_tests/earlytalker index 414429c..e49fcc4 100644 --- a/t/plugin_tests/earlytalker +++ b/t/plugin_tests/earlytalker @@ -33,7 +33,7 @@ sub test_apr_connect_handler { $self->qp->connection->notes('whitelisthost', 0); ($code, $mess) = $self->apr_connect_handler(); cmp_ok( $code, '==', DECLINED, "not sure"); -}; +} sub test_apr_data_handler { my $self = shift; @@ -50,7 +50,7 @@ sub test_apr_data_handler { $self->qp->connection->notes('whitelisthost', 0); ($code, $mess) = $self->apr_data_handler(); cmp_ok( $code, '==', DECLINED, "not sure"); -}; +} sub test_connect_handler { my $self = shift; @@ -67,7 +67,7 @@ sub test_connect_handler { $self->qp->connection->notes('whitelisthost', 0); ($code, $mess) = $self->connect_handler(); cmp_ok( $code, '==', DECLINED, "not sure"); -}; +} sub test_data_handler { my $self = shift; @@ -84,14 +84,14 @@ sub test_data_handler { $self->qp->connection->notes('whitelisthost', 0); ($code, $mess) = $self->data_handler(); cmp_ok( $code, '==', DECLINED, "not sure"); -}; +} sub test_log_and_pass { my $self = shift; my ($code, $mess) = $self->log_and_pass(); cmp_ok( $code, '==', DECLINED, "default"); -}; +} sub test_log_and_deny { my $self = shift; @@ -108,7 +108,7 @@ sub test_log_and_deny { $self->{_args}{reject_type} = 'disconnect'; ($code, $mess) = $self->log_and_deny(); cmp_ok( $code, '==', DENY_DISCONNECT, "bad, disconnect"); -}; +} sub test_mail_handler { my $self = shift; @@ -130,7 +130,7 @@ sub test_mail_handler { $self->{_args}{reject_type} = 'disconnect'; ($code, $mess) = $self->mail_handler(); cmp_ok( $code, '==', DENY_DISCONNECT, "bad, disconnect"); -}; +} sub test_reject_type { my $self = shift; @@ -143,4 +143,4 @@ sub test_reject_type { $self->{_args}{reject_type} = 'disconnect'; cmp_ok( $self->get_reject_type(), '==', DENY_DISCONNECT, "disconnect"); -}; +} diff --git a/t/plugin_tests/greylisting b/t/plugin_tests/greylisting index a8b8eb2..9cf5c99 100644 --- a/t/plugin_tests/greylisting +++ b/t/plugin_tests/greylisting @@ -11,7 +11,7 @@ my $test_email = 'user@example.com'; my @greydbs = qw( denysoft_greylist.dbm denysoft_greylist.dbm.lock ); foreach ( @greydbs ) { unlink $_ if -f $_; -}; +} sub register_tests { my $self = shift; @@ -98,7 +98,7 @@ sub test_hook_data { $transaction->notes('whitelistrcpt', 1); ($code, $mess) = $self->hook_data( $transaction ); cmp_ok( $code, '==', DECLINED, "missing recipients"); -}; +} sub test_get_db_key { my $self = shift; @@ -128,14 +128,14 @@ sub test_get_db_key { $self->{_args}{recipient} = 1; $key = $self->get_db_key( $address, $address ); cmp_ok( $key, 'eq', "3232235777:$test_email:$test_email", "db key: $key"); -}; +} sub test_get_db_location { my $self = shift; my $db = $self->get_db_location(); ok( $db, "db location: $db"); -}; +} sub test_exclude { my ( $self ) = @_; @@ -144,7 +144,7 @@ sub test_exclude { ok( $self->exclude(), "Relay client results in exclude() hit" ); $self->connection->relay_client(0); ok( ! $self->exclude(), "Non-relay client results in exclude() miss" ); -}; +} sub test_greylist_geoip { my $self = shift; @@ -158,14 +158,14 @@ sub test_greylist_geoip { $self->connection->notes('geoip_country', $cc ); ok( $self->geoip_match(), "match + ($cc)"); ok( $self->exclude(), "match + ($cc) results in exclude() hit"); - }; + } foreach my $cc ( @invalid ) { $self->connection->notes('geoip_country', $cc ); ok( ! $self->geoip_match(), "bad - ($cc)"); ok( ! $self->exclude(), "miss - ($cc) results in exclude() miss"); - }; -}; + } +} sub test_greylist_p0f_genre { my $self = shift; @@ -226,5 +226,5 @@ sub _reset_transaction { $self->qp->transaction->notes('tls_enabled',0); $self->{_args}{p0f} = undef; $self->{_args}{geoip} = undef; -}; +} diff --git a/t/plugin_tests/headers b/t/plugin_tests/headers index 9451092..88133e3 100644 --- a/t/plugin_tests/headers +++ b/t/plugin_tests/headers @@ -33,7 +33,7 @@ sub setup_test_headers { $self->qp->transaction->notes('whitelistsender', 0); $self->connection->notes('whitelisthost', 0); $self->connection->notes('naughty', 0); -}; +} sub test_invalid_date_range { my $self = shift; @@ -73,7 +73,7 @@ sub test_invalid_date_range { my $past_1 = strftime "%a %b %e %H:%M:%S %Y", localtime time - 86400; #1d $r = $self->invalid_date_range( $past_1 ); ok( ! $r, "a little old +" ); -}; +} sub test_hook_data_post { my $self = shift; @@ -119,4 +119,4 @@ sub test_hook_data_post { $self->{_args}{reject_type} = 'perm'; ($code, $mess) = $self->hook_data_post( $transaction ); cmp_ok( DENY, '==', $code, "deny ( $code, $mess )" ); -}; +} diff --git a/t/plugin_tests/helo b/t/plugin_tests/helo index daa9a62..5e6f4ca 100644 --- a/t/plugin_tests/helo +++ b/t/plugin_tests/helo @@ -24,7 +24,7 @@ sub register_tests { sub test_helo_handler { my $self = shift; cmp_ok( $self->helo_handler(undef, undef), '==', DECLINED, "empty host"); -}; +} sub test_is_in_badhelo { my $self = shift; @@ -34,7 +34,7 @@ sub test_is_in_badhelo { ($err, $why) = $self->is_in_badhelo('example.com'); ok( ! $err, "example.com"); -}; +} sub test_is_regex_match { my $self = shift; @@ -47,7 +47,7 @@ sub test_is_regex_match { ($err, $why) = $self->is_regex_match('host-only', '!\.' ); ok( $err, "negated pattern, $why"); -}; +} sub test_invalid_localhost { my $self = shift; @@ -61,14 +61,14 @@ sub test_invalid_localhost { $self->qp->connection->remote_ip(undef); ($err, $why) = $self->invalid_localhost('not-localhost'); ok($err, "host: not-localhost, invalid remote ip"); - }; + } foreach my $ip (qw/ ::1 127.0.0.1 / ) { $self->qp->connection->remote_ip($ip); ($err, $why) = $self->invalid_localhost('not-localhost'); ok( ! $err, "localhost, correct remote IP ($ip)"); } -}; +} sub test_is_plain_ip { my $self = shift; @@ -81,7 +81,7 @@ sub test_is_plain_ip { ($err, $why) = $self->is_plain_ip('[254.254.254.254]'); ok( ! $err, "address literal"); -}; +} sub test_is_address_literal { my $self = shift; @@ -94,7 +94,7 @@ sub test_is_address_literal { ($err, $why) = $self->is_address_literal('254.254.254.254'); ok( ! $err, "address literal"); -}; +} sub test_no_forward_dns { my $self = shift; @@ -105,7 +105,7 @@ sub test_no_forward_dns { # reserved .test TLD: http://tools.ietf.org/html/rfc2606 ($err, $why) = $self->no_forward_dns('perl.test'); ok( $err, "perl.test"); -}; +} sub test_no_reverse_dns { my $self = shift; @@ -118,7 +118,7 @@ sub test_no_reverse_dns { ($err, $why) = $self->no_reverse_dns('mail.theartfarm.com', '66.128.51.165'); ok( ! $err, "66.128.51.165"); -}; +} sub test_no_matching_dns { my $self = shift; @@ -132,7 +132,7 @@ sub test_no_matching_dns { $self->qp->connection->notes('helo_forward_match', 1); ($err, $why) = $self->no_matching_dns('matt.test'); ok( ! $err, "pass"); -}; +} sub test_check_ip_match { my $self = shift; @@ -154,7 +154,7 @@ sub test_check_ip_match { $self->connection->notes('helo_forward_match', 0); $self->check_ip_match($t->{ip2}); ok( $self->connection->notes('helo_forward_match'), $t->{r}); - }; + } foreach my $t ( @bad_tests ) { $self->qp->connection->remote_ip($t->{ip}); @@ -162,8 +162,8 @@ sub test_check_ip_match { $self->connection->notes('helo_forward_match', 0); $self->check_ip_match($t->{ip2}); ok( ! $self->connection->notes('helo_forward_match'), $t->{r}); - }; -}; + } +} sub test_check_name_match { my $self = shift; @@ -179,5 +179,5 @@ sub test_check_name_match { $self->connection->notes('helo_reverse_match', 0); $self->check_name_match('mx0.example.com', 'mx0.example.net'); ok( ! $self->connection->notes('helo_reverse_match'), "domain"); -}; +} diff --git a/t/plugin_tests/ident/geoip b/t/plugin_tests/ident/geoip index 56e0b38..a1ac6dd 100644 --- a/t/plugin_tests/ident/geoip +++ b/t/plugin_tests/ident/geoip @@ -27,8 +27,8 @@ sub register_tests { $self->register_test('test_set_continent'); $self->register_test('test_set_distance'); $self->register_test('test_set_asn'); - }; -}; + } +} sub test_geoip2_lookup { my $self = shift; @@ -44,7 +44,7 @@ sub test_geoip2_lookup { cmp_ok( $self->connection->notes('geoip_country_name'), 'eq', 'United States', "24.24.24.24 is in country United States"); cmp_ok( $self->connection->notes('geoip_continent'), 'eq', 'NA', "24.24.24.24 is in continent NA"); cmp_ok( $self->connection->notes('geoip_city'), 'eq', 'Deer Park', "24.24.24.24 is in city of Deer Park"); -}; +} sub test_geoip_lookup { my $self = shift; @@ -53,7 +53,7 @@ sub test_geoip_lookup { cmp_ok( $self->geoip_lookup(), '==', DECLINED, "exit code"); cmp_ok( $self->connection->notes('geoip_country'), 'eq', 'US', "24.24.24.24 is in the US"); -}; +} sub test_geoip_load_db { my $self = shift; @@ -65,15 +65,15 @@ sub test_geoip_load_db { } else { ok( "no GeoIP city db" ); - }; + } if ( $self->{_geoip} ) { ok( ref $self->{_geoip}, "loaded GeoIP db" ); } else { ok( "no GeoIP db" ); - }; -}; + } +} sub test_geoip_init_cc { my $self = shift; @@ -85,7 +85,7 @@ sub test_geoip_init_cc { $self->{_args}{distance} = $test_ip; $self->init_my_country_code( $test_ip ); cmp_ok( $self->{_my_country_code}, 'eq', 'US', "country set and matches"); -}; +} sub test_set_country_code { my $self = shift; @@ -100,7 +100,7 @@ sub test_set_country_code { my $note = $self->connection->notes('geoip_country'); cmp_ok( $note, 'eq', 'US', "set_country_code set note to $cc"); -}; +} sub test_set_country_name { my $self = shift; @@ -118,7 +118,7 @@ sub test_set_country_name { my $note = $self->connection->notes('geoip_country_name'); cmp_ok( $note, 'eq', 'United States', "note has: $cn"); -}; +} sub test_set_continent { my $self = shift; @@ -140,8 +140,8 @@ sub test_set_continent { else { ok(1, "no continent data" ); ok(1, "no continent data" ); - }; -}; + } +} sub test_set_distance { my $self = shift; @@ -165,7 +165,8 @@ sub test_set_distance { ok( 1, "no distance data"); ok( 1, "no distance data"); } -}; +} + sub test_set_asn { my $self = shift; @@ -184,4 +185,4 @@ sub test_set_asn { $asn = $self->set_asn(); ok( $self->connection->notes('geoip_asn') =~ /^7819/, "note has: $asn"); -}; +} diff --git a/t/plugin_tests/ident/p0f b/t/plugin_tests/ident/p0f index 52ebccd..a944770 100644 --- a/t/plugin_tests/ident/p0f +++ b/t/plugin_tests/ident/p0f @@ -12,7 +12,7 @@ sub register_tests { $self->register_test('test_get_v3_query'); $self->register_test('test_store_v2_results'); $self->register_test('test_store_v3_results'); -}; +} sub test_query_p0f_v2 { #TODO @@ -25,11 +25,11 @@ sub test_query_p0f_v2 { # or c) is there a p0f test value? # parse and validate the response # using $self->test_v2_response() -}; +} sub test_query_p0f_v3 { #TODO: similar to v2 .... -}; +} sub test_get_v2_query { my $self = shift; @@ -44,7 +44,7 @@ sub test_get_v2_query { my $r = $self->get_v2_query(); ok( $r, 'r +' ); -}; +} sub test_get_v3_query { my $self = shift; @@ -54,7 +54,7 @@ sub test_get_v3_query { my $r = $self->get_v3_query(); ok( $r, 'any +' ); -}; +} sub test_store_v2_results { my $self = shift; @@ -67,7 +67,7 @@ sub test_store_v2_results { ok( $r, "r: +") or return; ok( $r->{genre} =~ /windows/i, "genre +" ); -}; +} sub test_store_v3_results { my $self = shift; @@ -79,6 +79,5 @@ sub test_store_v3_results { ok( $r, "result"); ok( $r->{genre} =~ /windows/i, "genre" ); -}; - +} diff --git a/t/plugin_tests/rcpt_ok b/t/plugin_tests/rcpt_ok index 549e5b5..8bed44f 100644 --- a/t/plugin_tests/rcpt_ok +++ b/t/plugin_tests/rcpt_ok @@ -31,7 +31,7 @@ sub test_hook_rcpt { ($r, $mess) = $self->hook_rcpt( $transaction, $address ); cmp_ok( $r, '==', OK, "example.com"); $self->qp->connection->relay_client(0); -}; +} sub test_is_in_rcpthosts { my $self = shift; @@ -44,11 +44,11 @@ sub test_is_in_rcpthosts { } else { ok(1, "is_in_rcpthosts (skip, no entries)" ); - }; + } ok( $self->is_in_rcpthosts( 'localhost' ), "is_in_rcpthosts +"); ok( ! $self->is_in_rcpthosts( 'example.com' ), "is_in_rcpthosts -"); -}; +} sub test_is_in_morercpthosts { my $self = shift; @@ -60,10 +60,10 @@ sub test_is_in_morercpthosts { } else { ok(1, "is_in_morercpthosts (skip, no entries)" ); - }; + } ok( ! $self->is_in_morercpthosts( 'example.com' ), "missing -"); -}; +} sub test_get_rcpt_host { my $self = shift; @@ -96,5 +96,5 @@ sub test_get_rcpt_host { $address = Qpsmtpd::Address->parse('<@example.com>'); ok( ! $self->get_rcpt_host( $address ), "missing user" ); -}; +} diff --git a/t/plugin_tests/relay b/t/plugin_tests/relay index 1f572ba..cb8e8b2 100644 --- a/t/plugin_tests/relay +++ b/t/plugin_tests/relay @@ -26,7 +26,7 @@ sub test_relay_only { cmp_ok( $r, '==', OK, "relay_only +"); $self->qp->connection->relay_client(0); -}; +} sub test_is_octet_match { my $self = shift; @@ -41,7 +41,7 @@ sub test_is_octet_match { $self->qp->connection->remote_ip('203.0.113.0'); ok( ! $self->is_octet_match(), "nope, -"); -}; +} sub test_is_in_cidr_block { my $self = shift; @@ -60,7 +60,7 @@ sub test_is_in_cidr_block { $self->{_cidr_blocks} = [ 'fdda:b13d:e431:be17::' ]; ok( ! $self->is_in_cidr_block(), "nope, -" ); -}; +} sub test_is_in_norelayclients { my $self = shift; @@ -71,11 +71,11 @@ sub test_is_in_norelayclients { foreach ( @matches ) { $self->qp->connection->remote_ip($_); ok( $self->is_in_norelayclients(), "match, + ($_)"); - }; + } foreach ( @false ) { $self->qp->connection->remote_ip($_); ok( ! $self->is_in_norelayclients(), "match, - ($_)"); - }; -}; + } +} diff --git a/t/plugin_tests/resolvable_fromhost b/t/plugin_tests/resolvable_fromhost index 899fca5..192a3b3 100644 --- a/t/plugin_tests/resolvable_fromhost +++ b/t/plugin_tests/resolvable_fromhost @@ -44,7 +44,7 @@ sub test_hook_mail { $self->{_args}{reject_type} = 'hard'; ($r) = $self->hook_mail( $transaction, $sender ); ok( $r == DENY, "($r)"); -}; +} sub test_check_dns { my $self = shift; @@ -61,7 +61,7 @@ sub test_get_and_validate_mx { ok( scalar $self->get_and_validate_mx( 'perl.com', $transaction ) ); ok( ! scalar $self->get_host_records( 'fake-domain-name-for-test.com', $transaction ) ); -}; +} sub test_get_host_records { my $self = shift; @@ -69,7 +69,7 @@ sub test_get_host_records { ok( scalar $self->get_host_records( 'perl.com', $transaction ) ); ok( ! scalar $self->get_host_records( 'fake-domain-name-for-test.com', $transaction ) ); -}; +} sub test_mx_address_resolves { my $self = shift; @@ -78,7 +78,7 @@ sub test_mx_address_resolves { ok( $self->mx_address_resolves('mail.perl.com', $fromhost) ); ok( ! $self->mx_address_resolves('no-such-mx.perl.com', $fromhost) ); -}; +} sub test_populate_invalid_networks { my $self = shift; @@ -93,5 +93,5 @@ sub test_populate_invalid_networks { # clean up afterwards $self->qp->config('invalid_resolvable_fromhost', undef ); $self->{invalid} = (); -}; +} diff --git a/t/plugin_tests/sender_permitted_from b/t/plugin_tests/sender_permitted_from index 8b69cea..dac9c93 100644 --- a/t/plugin_tests/sender_permitted_from +++ b/t/plugin_tests/sender_permitted_from @@ -27,6 +27,6 @@ sub test_is_special_recipient { foreach my $user ( qw/ postmaster abuse mailer-daemon root / ) { $address = Qpsmtpd::Address->new("$user\@example.com"); ok( $self->is_special_recipient( $address ), "special: $user"); - }; -}; + } +} diff --git a/t/plugin_tests/spamassassin b/t/plugin_tests/spamassassin index 2072ea8..972d015 100644 --- a/t/plugin_tests/spamassassin +++ b/t/plugin_tests/spamassassin @@ -53,7 +53,7 @@ sub test_connect_to_spamd { else { ok( 1 == 1, "socket connect FAILED"); ok( 1 == 1, "socket response FAILED"); - }; + } # Try a TCP/IP connection $self->{_args}{spamd_socket} = '127.0.0.1:783'; @@ -68,8 +68,8 @@ sub test_connect_to_spamd { else { ok( 1 == 1, "tcp/ip connect FAILED"); ok( 1 == 1, "tcp/ip response FAILED"); - }; -}; + } +} sub test_reject { my $self = shift; @@ -88,7 +88,7 @@ sub test_reject { $transaction->notes('spamassassin', { is_spam => 'Yes', score => 15 } ); ($r) = $self->reject($transaction); cmp_ok( DENY, '==', $r, "r: $r"); -}; +} sub test_munge_subject { my $self = shift; @@ -125,7 +125,7 @@ sub test_munge_subject { $self->munge_subject($transaction); $r = $transaction->header->get('Subject'); chomp $r; cmp_ok($r, 'eq', "$subject", "+"); -}; +} sub test_get_spam_results { my $self = shift; @@ -140,7 +140,7 @@ sub test_get_spam_results { my $r_ref = $self->get_spam_results($transaction); if ( $h =~ /hits=/ ) { $r_ref->{hits} = delete $r_ref->{score}; # SA v2 compat - }; + } my $r2 = _reassemble_header($r_ref); cmp_ok( $h, 'eq', $r2, $h ); @@ -149,11 +149,11 @@ sub test_get_spam_results { if ( $h =~ /hits=/ ) { ok( 1 ); next; - }; # caching is broken for SA v2 headers + } # caching is broken for SA v2 headers $r2 = _reassemble_header($r_ref); cmp_ok( $h, 'eq', $r2, $h ); - }; -}; + } +} sub test_parse_spam_header { my $self = shift; @@ -162,11 +162,11 @@ sub test_parse_spam_header { my $r_ref = $self->parse_spam_header($h); if ( $h =~ /hits=/ ) { $r_ref->{hits} = delete $r_ref->{score}; # SA v2 compat - }; + } my $r2 = _reassemble_header($r_ref); cmp_ok( $h, 'eq', $r2, $h ); - }; -}; + } +} sub setup_headers { my $self = shift; @@ -174,7 +174,7 @@ sub setup_headers { my $transaction = $self->qp->transaction; my $header = Mail::Header->new(Modify => 0, MailFrom => "COERCE"); $transaction->header( $header ); -}; +} sub test_message { return <<'EO_MESSAGE' @@ -186,7 +186,7 @@ What so proudly we. EO_MESSAGE -}; +} sub _reassemble_header { my $info_ref = shift; @@ -195,7 +195,7 @@ sub _reassemble_header { foreach ( qw/ hits score required tests autolearn version / ) { next if ! defined $info_ref->{$_}; $string .= " $_=$info_ref->{$_}"; - }; + } return $string; -}; +} diff --git a/t/plugin_tests/virus/clamdscan b/t/plugin_tests/virus/clamdscan index 283f343..52366a1 100644 --- a/t/plugin_tests/virus/clamdscan +++ b/t/plugin_tests/virus/clamdscan @@ -16,7 +16,7 @@ sub register_tests { warn "Could not load ClamAV::Client"; $self->register_test('test_register'); $self->register_test('test_get_clamd'); - }; + } $self->register_test('test_err_and_return'); $self->register_test('test_get_filename'); @@ -40,7 +40,7 @@ sub test_register { ok( ! $self->{_args}{deny_viruses}, "deny_viruses 2"); is( $self->{_args}{max_size}, 200, "max_size 2"); ok( !$self->{_args}{scan_all}, "scan_all 2"); -}; +} sub test_err_and_return { my $self = shift; diff --git a/t/qpsmtpd-base.t b/t/qpsmtpd-base.t index b0ed7ef..20f5148 100644 --- a/t/qpsmtpd-base.t +++ b/t/qpsmtpd-base.t @@ -36,7 +36,7 @@ sub __is_valid_ip { foreach my $ip ( @bad ) { ok( !$base->is_valid_ip($ip), "is_valid_ip, neg: $ip"); } -}; +} sub __is_localhost { @@ -47,7 +47,7 @@ sub __is_localhost { for my $rem_ip (qw/ 128.0.0.1 ::2 2607:f060:b008:feed::128.0.0.1 /) { ok( !$base->is_localhost($rem_ip), "!is_localhost, $rem_ip"); } -}; +} sub __tildeexp { my $path = $base->tildeexp('~root/foo.txt'); @@ -55,7 +55,7 @@ sub __tildeexp { $path = $base->tildeexp('no/tilde/in/path'); cmp_ok( $path, 'eq', 'no/tilde/in/path', 'tildeexp, no expansion'); -}; +} sub __get_resolver { my $res = $base->get_resolver(); diff --git a/t/qpsmtpd-config.t b/t/qpsmtpd-config.t index 625e5c9..8683f0b 100644 --- a/t/qpsmtpd-config.t +++ b/t/qpsmtpd-config.t @@ -71,7 +71,7 @@ sub __clear_cache { ok(! $Qpsmtpd::Config::config_cache{foo}, "clear_cache, config_cache") or diag Data::Dumper::Dumper($Qpsmtpd::Config::config_cache{foo}); ok(! $Qpsmtpd::Config::dir_memo{dir1}, "clear_cache, dir_memo") -}; +} sub __default { is($config->default('me'), hostname, "default, my hostname"); @@ -94,7 +94,7 @@ sub __get_qmail_map { my $r = $config->get_qmail_map('users', 't/config/users.cdb'); ok(keys %$r, 'get_qmail_map("users.cdb")'); ok($r->{'!example.com-'}, "get_qmail_map, known entry"); - }; + } } sub __from_file { @@ -121,4 +121,4 @@ sub __config_via_smtpd { '127.0.0.1,192.0.,2001:0DB8,2001:0DB8:0000:0000:0000:0000:0000:0001,2001:DB8::1,2001:DB8::1/32', 'config("relayclients") are trimmed' ); -}; +}