From dbaa9dbd6c9bed3a079651e89feba24f941435ec Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Sat, 7 Apr 2012 20:11:16 -0400 Subject: [PATCH] POD corrections, additional tests, plugin consistency on files in plugins dir: fixed a number of POD errors formatted some # comments into POD removed bare 1; (these are plugins, not perl modules) most instances of this were copy/pasted from a previous plugin that had it removed instances of # vim ts=N ... they weren't consistent, many didn't match .perltidyrc on modules that failed perl -c tests, added 'use Qpsmtpd::Constants;' Conflicts: plugins/async/check_earlytalker plugins/async/dns_whitelist_soft plugins/async/dnsbl plugins/async/queue/smtp-forward plugins/async/require_resolvable_fromhost plugins/async/rhsbl plugins/async/uribl plugins/auth/auth_checkpassword plugins/auth/auth_cvm_unix_local plugins/auth/auth_flat_file plugins/auth/auth_ldap_bind plugins/auth/auth_vpopmail plugins/auth/auth_vpopmail_sql plugins/auth/authdeny plugins/check_badmailfromto plugins/check_badrcptto_patterns plugins/check_bogus_bounce plugins/check_earlytalker plugins/check_norelay plugins/check_spamhelo plugins/connection_time plugins/dns_whitelist_soft plugins/dnsbl plugins/domainkeys plugins/greylisting plugins/hosts_allow plugins/http_config plugins/logging/adaptive plugins/logging/apache plugins/logging/connection_id plugins/logging/transaction_id plugins/logging/warn plugins/milter plugins/queue/exim-bsmtp plugins/queue/maildir plugins/queue/postfix-queue plugins/queue/smtp-forward plugins/quit_fortune plugins/random_error plugins/rcpt_map plugins/rcpt_regexp plugins/relay_only plugins/require_resolvable_fromhost plugins/rhsbl plugins/sender_permitted_from plugins/spamassassin plugins/tls plugins/tls_cert plugins/uribl plugins/virus/aveclient plugins/virus/bitdefender plugins/virus/clamav plugins/virus/clamdscan plugins/virus/hbedv plugins/virus/kavscanner plugins/virus/klez_filter plugins/virus/sophie plugins/virus/uvscan --- plugins/async/check_earlytalker | 3 -- plugins/async/dns_whitelist_soft | 2 -- plugins/async/dnsbl | 2 -- plugins/async/require_resolvable_fromhost | 2 -- plugins/async/rhsbl | 2 -- plugins/async/uribl | 2 -- plugins/auth/auth_checkpassword | 24 ++++++------- plugins/auth/auth_cvm_unix_local | 6 ++-- plugins/auth/auth_vpopmail | 5 ++- plugins/auth/auth_vpopmail_sql | 1 - plugins/auth/authdeny | 17 ++++++--- plugins/check_badmailfrom | 2 +- plugins/check_badmailfrom_patterns | 2 -- plugins/check_badrcptto | 2 ++ plugins/check_earlytalker | 8 ++--- plugins/check_relay | 2 ++ plugins/content_log | 4 +-- plugins/count_unrecognized_commands | 3 +- plugins/dnsbl | 2 -- plugins/domainkeys | 3 +- plugins/dont_require_anglebrackets | 16 ++++++--- plugins/greylisting | 6 ++-- plugins/help | 5 +-- plugins/hosts_allow | 2 -- plugins/ident/geoip | 4 +-- plugins/ident/p0f | 2 +- plugins/logging/adaptive | 3 -- plugins/logging/apache | 3 -- plugins/logging/connection_id | 2 -- plugins/logging/file | 2 +- plugins/logging/syslog | 2 +- plugins/logging/transaction_id | 2 -- plugins/logging/warn | 2 -- plugins/milter | 2 +- plugins/noop_counter | 5 +-- plugins/parse_addr_withhelo | 28 +++++++++------ plugins/queue/exim-bsmtp | 7 +--- plugins/queue/postfix-queue | 1 - plugins/queue/qmail-queue | 3 +- plugins/random_error | 3 +- plugins/rcpt_map | 2 -- plugins/rcpt_ok | 18 +++++++--- plugins/rcpt_regexp | 2 -- plugins/require_resolvable_fromhost | 2 -- plugins/rhsbl | 1 - plugins/sender_permitted_from | 1 + plugins/spamassassin | 7 +--- plugins/tls | 4 +-- plugins/tls_cert | 2 ++ plugins/uribl | 3 -- plugins/virus/bitdefender | 7 ++-- plugins/virus/clamav | 4 +-- plugins/virus/clamdscan | 6 ++-- plugins/virus/hbedv | 1 - plugins/virus/kavscanner | 1 - t/01-syntax.t | 42 +++++++++++++++++++++++ t/02-pod.t | 8 +++++ 57 files changed, 167 insertions(+), 138 deletions(-) mode change 100755 => 100644 plugins/tls_cert create mode 100644 t/01-syntax.t create mode 100644 t/02-pod.t diff --git a/plugins/async/check_earlytalker b/plugins/async/check_earlytalker index 4af3ccd..4778dd4 100644 --- a/plugins/async/check_earlytalker +++ b/plugins/async/check_earlytalker @@ -133,6 +133,3 @@ sub hook_mail { return DECLINED; } - -1; - diff --git a/plugins/async/dns_whitelist_soft b/plugins/async/dns_whitelist_soft index 824a50d..04b913b 100644 --- a/plugins/async/dns_whitelist_soft +++ b/plugins/async/dns_whitelist_soft @@ -50,8 +50,6 @@ sub hook_rcpt { return DECLINED; } -1; - =head1 NAME dns_whitelist_soft - dns-based whitelist override for other qpsmtpd plugins diff --git a/plugins/async/dnsbl b/plugins/async/dnsbl index c9aeded..9d4ba18 100644 --- a/plugins/async/dnsbl +++ b/plugins/async/dnsbl @@ -99,8 +99,6 @@ sub hook_rcpt { return DECLINED; } -1; - =head1 NAME dnsbl - handle DNS BlackList lookups diff --git a/plugins/async/require_resolvable_fromhost b/plugins/async/require_resolvable_fromhost index 95bfbbd..de680ae 100644 --- a/plugins/async/require_resolvable_fromhost +++ b/plugins/async/require_resolvable_fromhost @@ -169,5 +169,3 @@ sub is_valid { } return 1; } - -# vim: ts=4 sw=4 expandtab syn=perl diff --git a/plugins/async/rhsbl b/plugins/async/rhsbl index 43378e6..6cd0b72 100644 --- a/plugins/async/rhsbl +++ b/plugins/async/rhsbl @@ -66,8 +66,6 @@ sub hook_rcpt { return DECLINED; } -1; - =head1 NAME rhsbl - handle RHSBL lookups diff --git a/plugins/async/uribl b/plugins/async/uribl index 8d9a67f..c99eefe 100644 --- a/plugins/async/uribl +++ b/plugins/async/uribl @@ -123,8 +123,6 @@ sub collect_results { return \@matches; } -1; - =head1 NAME uribl - URIBL blocking plugin for qpsmtpd diff --git a/plugins/auth/auth_checkpassword b/plugins/auth/auth_checkpassword index 609a92b..dc75c51 100644 --- a/plugins/auth/auth_checkpassword +++ b/plugins/auth/auth_checkpassword @@ -60,20 +60,20 @@ While writing this plugin, I first wrote myself a little test script, which helped me identify the sudo closefrom_override issue. Here is that script: - #!/usr/bin/perl - use strict; - my $sudo = "/usr/local/bin/sudo"; - $sudo .= " -C4 -u vpopmail"; - my $vchkpw = "/usr/local/vpopmail/bin/vchkpw"; - my $true = "/usr/bin/true"; + #!/usr/bin/perl + use strict; + my $sudo = "/usr/local/bin/sudo"; + $sudo .= " -C4 -u vpopmail"; + my $vchkpw = "/usr/local/vpopmail/bin/vchkpw"; + my $true = "/usr/bin/true"; - open(CPW,"|$sudo $vchkpw $true 3<&0"); - printf(CPW "%s\0%s\0Y123456\0",'user@example.com','pa55word'); - close(CPW); + open(CPW,"|$sudo $vchkpw $true 3<&0"); + printf(CPW "%s\0%s\0Y123456\0",'user@example.com','pa55word'); + close(CPW); - my $status = $?; - print "FAIL\n" and exit if ( $status != 0 ); - print "OK\n"; + my $status = $?; + print "FAIL\n" and exit if ( $status != 0 ); + print "OK\n"; Save that script to vchkpw.pl and then run it as the same user that qpsmtpd runs as: diff --git a/plugins/auth/auth_cvm_unix_local b/plugins/auth/auth_cvm_unix_local index 490f975..1bc00b1 100644 --- a/plugins/auth/auth_cvm_unix_local +++ b/plugins/auth/auth_cvm_unix_local @@ -44,8 +44,7 @@ use Socket; use constant SMTP_PORT => getservbyname("smtp", "tcp") || 25; use constant SSMTP_PORT => getservbyname("ssmtp", "tcp") || 465; -sub register -{ +sub register { my ( $self, $qp, %arg ) = @_; unless ($arg{cvm_socket}) @@ -78,8 +77,7 @@ sub register # $self->register_hook("auth-cram-md5", "authcvm_hash"); } -sub authcvm_plain -{ +sub authcvm_plain { my ( $self, $transaction, $method, $user, $passClear, $passHash, $ticket ) = @_; diff --git a/plugins/auth/auth_vpopmail b/plugins/auth/auth_vpopmail index 9316a63..504f273 100644 --- a/plugins/auth/auth_vpopmail +++ b/plugins/auth/auth_vpopmail @@ -40,6 +40,10 @@ Please see the LICENSE file included with qpsmtpd for details. =cut +use strict; + +use Qpsmtpd::Constants; + sub register { my ($self, $qp) = @_; @@ -50,7 +54,6 @@ sub register { sub auth_vpopmail { use vpopmail; - use Qpsmtpd::Constants; use Digest::HMAC_MD5 qw(hmac_md5_hex); my ($self, $transaction, $method, $user, $passClear, $passHash, $ticket) = diff --git a/plugins/auth/auth_vpopmail_sql b/plugins/auth/auth_vpopmail_sql index cb6b247..e65903d 100644 --- a/plugins/auth/auth_vpopmail_sql +++ b/plugins/auth/auth_vpopmail_sql @@ -61,7 +61,6 @@ Copyright (c) 2004 John Peacock This plugin is licensed under the same terms as the qpsmtpd package itself. Please see the LICENSE file included with qpsmtpd for details. - =cut sub register { diff --git a/plugins/auth/authdeny b/plugins/auth/authdeny index f4c023c..d027cf4 100644 --- a/plugins/auth/authdeny +++ b/plugins/auth/authdeny @@ -1,9 +1,16 @@ #!perl -Tw -# -# This plugin doesn't actually check anything and will fail any -# user no matter what they type. It is strictly a proof of concept for -# the Qpsmtpd::Auth module. Don't run this in production!!! -# + +=head1 NAME + +auth_deny + +=head1 SYNOPSIS + +This plugin doesn't actually check anything and will fail any +user no matter what they type. It is strictly a proof of concept for +the Qpsmtpd::Auth module. Don't run this in production!!! + +=cut sub hook_auth { my ( $self, $transaction, $method, $user, $passClear, $passHash, $ticket ) = diff --git a/plugins/check_badmailfrom b/plugins/check_badmailfrom index d3679de..dd088a6 100644 --- a/plugins/check_badmailfrom +++ b/plugins/check_badmailfrom @@ -1,4 +1,4 @@ -# -*- perl -*- +#!perl -Tw =head1 NAME diff --git a/plugins/check_badmailfrom_patterns b/plugins/check_badmailfrom_patterns index 906b382..53f1fa1 100644 --- a/plugins/check_badmailfrom_patterns +++ b/plugins/check_badmailfrom_patterns @@ -1,7 +1,5 @@ #!perl -Tw -=pod - =head1 SYNOPSIS This plugin checks the badmailfrom_patterns config. This allows diff --git a/plugins/check_badrcptto b/plugins/check_badrcptto index 5d900e0..2bedbc0 100644 --- a/plugins/check_badrcptto +++ b/plugins/check_badrcptto @@ -1,3 +1,5 @@ +#!perl -Tw + # this plugin checks the badrcptto config (like badmailfrom, but for rcpt address # rather than sender address) use Qpsmtpd::DSN; diff --git a/plugins/check_earlytalker b/plugins/check_earlytalker index 09580c4..5af2d99 100644 --- a/plugins/check_earlytalker +++ b/plugins/check_earlytalker @@ -56,10 +56,11 @@ The default is I only. =cut -use IO::Select; - -use warnings; use strict; +use warnings; + +use IO::Select; +use Qpsmtpd::Constants; sub register { my ($self, $qp, @args) = @_; @@ -209,6 +210,5 @@ sub mail_handler { return DECLINED; } - 1; diff --git a/plugins/check_relay b/plugins/check_relay index eeec9d8..8333404 100644 --- a/plugins/check_relay +++ b/plugins/check_relay @@ -1,3 +1,5 @@ +#!perl -Tw + # this plugin checks the relayclients config file and # $ENV{RELAYCLIENT} to see if relaying is allowed. # diff --git a/plugins/content_log b/plugins/content_log index 27bb53c..8520b0c 100644 --- a/plugins/content_log +++ b/plugins/content_log @@ -1,5 +1,5 @@ -# -*- perl -*- -# +#!perl -Tw + # A simple example of a plugin that logs all incoming mail to a file. # Useful for debugging other plugins or keeping an archive of things. diff --git a/plugins/count_unrecognized_commands b/plugins/count_unrecognized_commands index 92110e2..9113cbc 100644 --- a/plugins/count_unrecognized_commands +++ b/plugins/count_unrecognized_commands @@ -1,4 +1,5 @@ -# -*- perl -*- +#!perl -Tw + =head1 NAME count_unrecognized_commands - Count unrecognized commands and disconnect when we have too many diff --git a/plugins/dnsbl b/plugins/dnsbl index 15bcbce..8236210 100644 --- a/plugins/dnsbl +++ b/plugins/dnsbl @@ -195,7 +195,6 @@ sub hook_rcpt { } } return DECLINED; - } sub hook_disconnect { @@ -206,7 +205,6 @@ sub hook_disconnect { return DECLINED; } -1; =head1 Usage diff --git a/plugins/domainkeys b/plugins/domainkeys index 9e90005..4e3ce95 100644 --- a/plugins/domainkeys +++ b/plugins/domainkeys @@ -89,7 +89,6 @@ sub hook_data_post { } } -=cut =head1 NAME @@ -115,3 +114,5 @@ Copyright (C) 2005-2006 John Peacock. Portions Copyright (C) 2004 Anthony D. Urso. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. + +=cut diff --git a/plugins/dont_require_anglebrackets b/plugins/dont_require_anglebrackets index ac06bef..3595c42 100644 --- a/plugins/dont_require_anglebrackets +++ b/plugins/dont_require_anglebrackets @@ -1,7 +1,15 @@ -# -# dont_require_anglebrackets - accept addresses in MAIL FROM:/RCPT TO: -# commands without surrounding <> -# +#!perl -Tw + +=head1 NAME + +dont_require_anglebrackets + +=head1 SYNOPSIS + +accept addresses in MAIL FROM:/RCPT TO: commands without surrounding <> + +=cut + sub hook_mail_pre { my ($self,$transaction, $addr) = @_; unless ($addr =~ /^<.*>$/) { diff --git a/plugins/greylisting b/plugins/greylisting index c8c7f88..c3c6b96 100644 --- a/plugins/greylisting +++ b/plugins/greylisting @@ -105,8 +105,6 @@ Flag to indicate whether to use per-recipient greylisting databases (default is to use a shared database). Per-recipient configuration directories, if determined, supercede I. -=back - =item p0f Enable greylisting only when certain p0f criteria is met. The single @@ -124,6 +122,8 @@ away: p0f genre,windows,link,dsl,distance,3 +=back + =head1 BUGS Database locking is implemented using flock, which may not work on @@ -142,6 +142,7 @@ BEGIN { @AnyDBM_File::ISA = qw(DB_File GDBM_File NDBM_File) } use AnyDBM_File; use Fcntl qw(:DEFAULT :flock); use strict; +use Qpsmtpd::Constants; my $VERSION = '0.08'; @@ -340,4 +341,3 @@ sub p0f_match { } # arch-tag: 6ef5919e-404b-4c87-bcfe-7e9f383f3901 - diff --git a/plugins/help b/plugins/help index 373f7b0..9baa3f9 100644 --- a/plugins/help +++ b/plugins/help @@ -1,6 +1,4 @@ -# -# -# +#!perl -Tw =head1 NAME @@ -142,4 +140,3 @@ sub read_helpfile { return $help; } -# vim: ts=4 sw=4 expandtab syn=perl diff --git a/plugins/hosts_allow b/plugins/hosts_allow index 452f521..82a56e9 100644 --- a/plugins/hosts_allow +++ b/plugins/hosts_allow @@ -77,5 +77,3 @@ sub hook_pre_connection { return (DECLINED); } - -# vim: sw=4 ts=4 expandtab syn=perl diff --git a/plugins/ident/geoip b/plugins/ident/geoip index 2e325c7..7b25f36 100644 --- a/plugins/ident/geoip +++ b/plugins/ident/geoip @@ -1,6 +1,6 @@ -# -*- perl -*- +#!perl -Tw -=pod +=head1 SYNOPSIS This plugin uses MaxMind's GeoIP service and the Geo::IP perl module to do a lookup on incoming connections and record the country of origin. diff --git a/plugins/ident/p0f b/plugins/ident/p0f index c92634e..aa8cb4c 100644 --- a/plugins/ident/p0f +++ b/plugins/ident/p0f @@ -1,4 +1,4 @@ -# -*- perl -*- +#!perl -Tw =head1 NAME diff --git a/plugins/logging/adaptive b/plugins/logging/adaptive index ec34c37..f622582 100644 --- a/plugins/logging/adaptive +++ b/plugins/logging/adaptive @@ -94,9 +94,6 @@ sub hook_reset_transaction { # slog return DECLINED; } -=cut - - =head1 NAME adaptive - An adaptive logging plugin for qpsmtpd diff --git a/plugins/logging/apache b/plugins/logging/apache index 9f3d815..184461d 100644 --- a/plugins/logging/apache +++ b/plugins/logging/apache @@ -73,8 +73,6 @@ sub hook_logging { return DECLINED; } -=cut - =head1 DESCRIPTION The logging/apache plugin uses the apache logging mechanism to write its @@ -113,4 +111,3 @@ Please see the LICENSE file included with qpsmtpd for details. =cut -# vim: ts=4 sw=4 expandtab syn=perl diff --git a/plugins/logging/connection_id b/plugins/logging/connection_id index c7b61df..bbcc7fc 100644 --- a/plugins/logging/connection_id +++ b/plugins/logging/connection_id @@ -42,8 +42,6 @@ sub hook_logging { return DECLINED; } -=cut - =head1 NAME connection_id - plugin to demo use of the connection id diff --git a/plugins/logging/file b/plugins/logging/file index 16b5c2a..b1b807d 100644 --- a/plugins/logging/file +++ b/plugins/logging/file @@ -121,6 +121,7 @@ use warnings; use IO::File; use Sys::Hostname; use POSIX qw(strftime); +use Qpsmtpd::Constants; sub register { my ($self, $qp, @args) = @_; @@ -279,4 +280,3 @@ sub hook_logging { return DECLINED; } -# vi: tabstop=4 shiftwidth=4 expandtab: diff --git a/plugins/logging/syslog b/plugins/logging/syslog index 7ef0b33..540232b 100644 --- a/plugins/logging/syslog +++ b/plugins/logging/syslog @@ -107,6 +107,7 @@ Please see the LICENSE file included with qpsmtpd for details. use strict; use warnings; +use Qpsmtpd::Constants; use Sys::Syslog qw(:DEFAULT setlogsock); sub register { @@ -183,4 +184,3 @@ sub hook_logging { return DECLINED; } -# vi: tabstop=4 shiftwidth=4 expandtab diff --git a/plugins/logging/transaction_id b/plugins/logging/transaction_id index 836f311..d70c30b 100644 --- a/plugins/logging/transaction_id +++ b/plugins/logging/transaction_id @@ -41,8 +41,6 @@ sub hook_logging { return DECLINED; } -=cut - =head1 NAME transaction_id - plugin to demo use of the transaction id diff --git a/plugins/logging/warn b/plugins/logging/warn index 6d6a200..896452b 100644 --- a/plugins/logging/warn +++ b/plugins/logging/warn @@ -40,8 +40,6 @@ sub hook_logging { return DECLINED; } -=cut - =head1 NAME warn - Default logging plugin for qpsmtpd diff --git a/plugins/milter b/plugins/milter index 79beee6..b715f06 100644 --- a/plugins/milter +++ b/plugins/milter @@ -27,6 +27,7 @@ This plugin has so far only been tested with Brightmail's milter module. =cut use Net::Milter; +use Qpsmtpd::Constants; no warnings; sub register { @@ -233,4 +234,3 @@ sub hook_data_post { return DECLINED; } - diff --git a/plugins/noop_counter b/plugins/noop_counter index 8e84ce3..b6e8cae 100644 --- a/plugins/noop_counter +++ b/plugins/noop_counter @@ -1,6 +1,4 @@ -# -# -# +#!perl -Tw =head1 NAME @@ -62,4 +60,3 @@ sub reset_noop_counter { *hook_help = # HELP \&reset_noop_counter; -# vim: ts=4 sw=4 expandtab syn=perl diff --git a/plugins/parse_addr_withhelo b/plugins/parse_addr_withhelo index f26f8db..4409a20 100644 --- a/plugins/parse_addr_withhelo +++ b/plugins/parse_addr_withhelo @@ -1,13 +1,21 @@ -# parse_addr_withhelo -# -# strict RFC 821 forbids parameters after the -# MAIL FROM: -# and -# RCPT TO: -# -# load this plugin to enforce, else the default EHLO parsing with -# parameters is done. -# +#!perl -Tw + +=head1 NAME + +parse_addr_withhelo + +=head1 SYNOPSIS + +strict RFC 821 forbids parameters after the + + MAIL FROM: + and + RCPT TO: + +load this plugin to enforce, else the default EHLO parsing with +parameters is done. + +=cut sub hook_mail_parse { my $self = shift; diff --git a/plugins/queue/exim-bsmtp b/plugins/queue/exim-bsmtp index 619ea4a..effbfbe 100644 --- a/plugins/queue/exim-bsmtp +++ b/plugins/queue/exim-bsmtp @@ -31,8 +31,6 @@ actually redundant with rsmtp, but harmless). =back -=cut - =head1 LICENSE Copyright (c) 2004 by Devin Carraway @@ -63,6 +61,7 @@ use warnings; use IO::File; use Sys::Hostname qw(hostname); use File::Temp qw(tempfile); +use Qpsmtpd::Constants; sub register { my ($self, $qp, %args) = @_; @@ -144,7 +143,3 @@ sub hook_queue { return (OK, "Queued!"); } - -1; - -# vi: ts=4 sw=4 expandtab syn=perl: diff --git a/plugins/queue/postfix-queue b/plugins/queue/postfix-queue index 17b7158..69d85e5 100644 --- a/plugins/queue/postfix-queue +++ b/plugins/queue/postfix-queue @@ -196,4 +196,3 @@ sub hook_queue { return (OK, "Queued! $msg_id (Queue-Id: $qid)"); } -# vim: sw=2 ts=8 syn=perl diff --git a/plugins/queue/qmail-queue b/plugins/queue/qmail-queue index b228c19..1aa07e4 100644 --- a/plugins/queue/qmail-queue +++ b/plugins/queue/qmail-queue @@ -1,4 +1,5 @@ -# -*- perl -*- +#!perl -Tw + =head1 NAME qmail-queue diff --git a/plugins/random_error b/plugins/random_error index 68246f5..88a2a82 100644 --- a/plugins/random_error +++ b/plugins/random_error @@ -33,7 +33,7 @@ sub NEXT() { DECLINED } sub random_fail { my $fpct = $_[0]->qp->connection->notes('random_fail_%'); -=head calculating the probability of failure +=head1 calculating the probability of failure There are six tests a message must pass to reach the queueing stage, and we wish to provide random failure for each one, with the combined probability being out @@ -83,4 +83,3 @@ sub hook_data_post { goto &random_fail } - diff --git a/plugins/rcpt_map b/plugins/rcpt_map index 558f7e0..cb0189f 100644 --- a/plugins/rcpt_map +++ b/plugins/rcpt_map @@ -187,5 +187,3 @@ sub hook_rcpt { return @{$map{$rcpt}}; } - -# vim: ts=4 sw=4 expandtab syn=perl diff --git a/plugins/rcpt_ok b/plugins/rcpt_ok index a27fa67..aac329e 100644 --- a/plugins/rcpt_ok +++ b/plugins/rcpt_ok @@ -1,7 +1,17 @@ -# this plugin checks the standard rcpthosts config -# -# It should be configured to be run _LAST_! -# +#!perl -Tw + +=head1 NAME + +rcpt_ok + +=head1 SYNOPSIS + +this plugin checks the standard rcpthosts config + +It should be configured to be run _LAST_! + +=cut + use Qpsmtpd::DSN; sub hook_rcpt { diff --git a/plugins/rcpt_regexp b/plugins/rcpt_regexp index ae6a2fe..be0c7c2 100644 --- a/plugins/rcpt_regexp +++ b/plugins/rcpt_regexp @@ -96,5 +96,3 @@ sub hook_rcpt { } return (DECLINED); } - -# vim: ts=4 sw=4 expandtab syn=perl diff --git a/plugins/require_resolvable_fromhost b/plugins/require_resolvable_fromhost index 50a0920..4125021 100644 --- a/plugins/require_resolvable_fromhost +++ b/plugins/require_resolvable_fromhost @@ -148,5 +148,3 @@ sub mx_valid { } return 0; } - -# vim: ts=2 sw=2 expandtab syn=perl diff --git a/plugins/rhsbl b/plugins/rhsbl index b56f9be..8b3ccb3 100644 --- a/plugins/rhsbl +++ b/plugins/rhsbl @@ -133,7 +133,6 @@ sub hook_disconnect { return DECLINED; } -1; =head1 NAME diff --git a/plugins/sender_permitted_from b/plugins/sender_permitted_from index 8e7626d..6f4b75f 100644 --- a/plugins/sender_permitted_from +++ b/plugins/sender_permitted_from @@ -37,6 +37,7 @@ whomever wrote the original SPF plugin, upon which I based this. use strict; use Mail::SPF 2.000; use Data::Dumper; +use Qpsmtpd::Constants; sub register { my ($self, $qp, @args) = @_; diff --git a/plugins/spamassassin b/plugins/spamassassin index 5e590fc..b59216e 100644 --- a/plugins/spamassassin +++ b/plugins/spamassassin @@ -257,7 +257,7 @@ sub get_spam_score { my $status = $transaction->header->get('X-Spam-Status') or return; my ($score) = ($status =~ m/hits=(-?\d+\.\d+)/)[0]; return $score; - +} sub _cleanup_spam_header { my ($self, $transaction, $header_name) = @_; @@ -273,9 +273,4 @@ sub _cleanup_spam_header { $transaction->header->add($old_header_name, $header) if $action eq 'rename'; $transaction->header->delete($header_name); } - - -} - - } diff --git a/plugins/tls b/plugins/tls index c804233..f31a2be 100644 --- a/plugins/tls +++ b/plugins/tls @@ -10,7 +10,7 @@ tls - plugin to support STARTTLS tls [B] -=over indentlevel +=over 4 =item B @@ -325,5 +325,3 @@ sub event_read { $qp->disconnect(); } } - -1; diff --git a/plugins/tls_cert b/plugins/tls_cert old mode 100755 new mode 100644 index 7a68378..825f6b9 --- a/plugins/tls_cert +++ b/plugins/tls_cert @@ -1,4 +1,6 @@ #!perl -Tw +use warnings; + # Very basic script to create TLS certificates for qpsmtpd use File::Temp qw/ tempfile tempdir /; use Getopt::Long; diff --git a/plugins/uribl b/plugins/uribl index 8e7adbb..fa5b182 100644 --- a/plugins/uribl +++ b/plugins/uribl @@ -510,6 +510,3 @@ sub init_resolver { $self->{resolver}->udp_timeout($self->{timeout}); } -1; - -# vi: ts=4 sw=4 expandtab syn=perl diff --git a/plugins/virus/bitdefender b/plugins/virus/bitdefender index 0bbdbbf..3ea8fe4 100644 --- a/plugins/virus/bitdefender +++ b/plugins/virus/bitdefender @@ -60,11 +60,12 @@ Please see the LICENSE file included with qpsmtpd for details. =cut -use File::Path; - use strict; use warnings; +use File::Path; +use Qpsmtpd::Constants; + sub register { my ( $self, $qp, @args ) = @_; @@ -129,5 +130,3 @@ sub hook_data_post { return (DECLINED); } -1; - diff --git a/plugins/virus/clamav b/plugins/virus/clamav index 2c5ca3e..f480f29 100644 --- a/plugins/virus/clamav +++ b/plugins/virus/clamav @@ -109,6 +109,8 @@ Please see the LICENSE file included with qpsmtpd for details. use strict; use warnings; +use Qpsmtpd::Constants; + sub register { my ($self, $qp, @args) = @_; my %args; @@ -227,5 +229,3 @@ sub hook_data_post { return (DECLINED); } -1; - diff --git a/plugins/virus/clamdscan b/plugins/virus/clamdscan index 76b91b4..33c98fe 100644 --- a/plugins/virus/clamdscan +++ b/plugins/virus/clamdscan @@ -102,11 +102,12 @@ Please see the LICENSE file included with qpsmtpd for details. =cut -use ClamAV::Client; - use strict; use warnings; +use ClamAV::Client; +use Qpsmtpd::Constants; + sub register { my ( $self, $qp, @args ) = @_; @@ -231,4 +232,3 @@ sub hook_data_post { return (DECLINED); } -# vi: set ts=4 sw=4 et: diff --git a/plugins/virus/hbedv b/plugins/virus/hbedv index 070af27..5a1bd7b 100644 --- a/plugins/virus/hbedv +++ b/plugins/virus/hbedv @@ -1,6 +1,5 @@ #!perl -Tw # H+B EDV-AV plugin. -# =head1 NAME diff --git a/plugins/virus/kavscanner b/plugins/virus/kavscanner index 89095df..c148f54 100644 --- a/plugins/virus/kavscanner +++ b/plugins/virus/kavscanner @@ -174,4 +174,3 @@ sub hook_data_post { return (DECLINED); } -# vim: ts=2 sw=2 expandtab diff --git a/t/01-syntax.t b/t/01-syntax.t new file mode 100644 index 0000000..67fa5da --- /dev/null +++ b/t/01-syntax.t @@ -0,0 +1,42 @@ +use Config qw/ myconfig /; +use Data::Dumper; +use English qw/ -no_match_vars /; +use File::Find; +use Test::More 'no_plan'; + +use lib 'lib'; + +my $this_perl = $Config{'perlpath'} || $EXECUTABLE_NAME; +#ok( $Config{'perlpath'}, "config: $Config{'perlpath'}" ); +#ok( $EXECUTABLE_NAME, "var: $EXECUTABLE_NAME" ); +#ok( $this_perl, "this_perl: $this_perl" ); + +my @skip_syntax = qw( + plugins/milter + plugins/auth/auth_ldap_bind + plugins/ident/geoip + plugins/logging/apache + lib/Apache/Qpsmtpd.pm + lib/Danga/Client.pm + lib/Danga/TimeoutSocket.pm + lib/Qpsmtpd/ConfigServer.pm + lib/Qpsmtpd/PollServer.pm + lib/Qpsmtpd/Plugin/Async/DNSBLBase.pm +); +my %skip_syntax = map { $_ => 1 } @skip_syntax; +#print Dumper(\@skip_syntax); + +my @files = find( {wanted=>\&test_syntax, no_chdir=>1}, 'plugins', 'lib' ); + +sub test_syntax { + my $f = $File::Find::name; + chomp $f; + return if ! -f $f; + return if $skip_syntax{$f}; + return if $f =~ /async/; # requires ParaDNS + my $r = `$this_perl -c $f 2>&1`; + my $exit_code = sprintf ("%d", $CHILD_ERROR >> 8); + ok( $exit_code == 0, "syntax $f"); +}; + + diff --git a/t/02-pod.t b/t/02-pod.t new file mode 100644 index 0000000..3a06a23 --- /dev/null +++ b/t/02-pod.t @@ -0,0 +1,8 @@ +#!perl + +use Test::More; +eval "use Test::Pod 1.14"; +plan skip_all => "Test::Pod 1.14 required for testing POD" if $@; + +my @poddirs = qw( lib plugins ); +all_pod_files_ok( all_pod_files( @poddirs ) );