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
This commit is contained in:
Matt Simerson 2012-04-07 20:11:16 -04:00 committed by Ask Bjørn Hansen
parent 61de599c1b
commit dbaa9dbd6c
57 changed files with 167 additions and 138 deletions

View File

@ -133,6 +133,3 @@ sub hook_mail {
return DECLINED; return DECLINED;
} }
1;

View File

@ -50,8 +50,6 @@ sub hook_rcpt {
return DECLINED; return DECLINED;
} }
1;
=head1 NAME =head1 NAME
dns_whitelist_soft - dns-based whitelist override for other qpsmtpd plugins dns_whitelist_soft - dns-based whitelist override for other qpsmtpd plugins

View File

@ -99,8 +99,6 @@ sub hook_rcpt {
return DECLINED; return DECLINED;
} }
1;
=head1 NAME =head1 NAME
dnsbl - handle DNS BlackList lookups dnsbl - handle DNS BlackList lookups

View File

@ -169,5 +169,3 @@ sub is_valid {
} }
return 1; return 1;
} }
# vim: ts=4 sw=4 expandtab syn=perl

View File

@ -66,8 +66,6 @@ sub hook_rcpt {
return DECLINED; return DECLINED;
} }
1;
=head1 NAME =head1 NAME
rhsbl - handle RHSBL lookups rhsbl - handle RHSBL lookups

View File

@ -123,8 +123,6 @@ sub collect_results {
return \@matches; return \@matches;
} }
1;
=head1 NAME =head1 NAME
uribl - URIBL blocking plugin for qpsmtpd uribl - URIBL blocking plugin for qpsmtpd

View File

@ -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 which helped me identify the sudo closefrom_override issue. Here is
that script: that script:
#!/usr/bin/perl #!/usr/bin/perl
use strict; use strict;
my $sudo = "/usr/local/bin/sudo"; my $sudo = "/usr/local/bin/sudo";
$sudo .= " -C4 -u vpopmail"; $sudo .= " -C4 -u vpopmail";
my $vchkpw = "/usr/local/vpopmail/bin/vchkpw"; my $vchkpw = "/usr/local/vpopmail/bin/vchkpw";
my $true = "/usr/bin/true"; my $true = "/usr/bin/true";
open(CPW,"|$sudo $vchkpw $true 3<&0"); open(CPW,"|$sudo $vchkpw $true 3<&0");
printf(CPW "%s\0%s\0Y123456\0",'user@example.com','pa55word'); printf(CPW "%s\0%s\0Y123456\0",'user@example.com','pa55word');
close(CPW); close(CPW);
my $status = $?; my $status = $?;
print "FAIL\n" and exit if ( $status != 0 ); print "FAIL\n" and exit if ( $status != 0 );
print "OK\n"; print "OK\n";
Save that script to vchkpw.pl and then run it as the same user that Save that script to vchkpw.pl and then run it as the same user that
qpsmtpd runs as: qpsmtpd runs as:

View File

@ -44,8 +44,7 @@ use Socket;
use constant SMTP_PORT => getservbyname("smtp", "tcp") || 25; use constant SMTP_PORT => getservbyname("smtp", "tcp") || 25;
use constant SSMTP_PORT => getservbyname("ssmtp", "tcp") || 465; use constant SSMTP_PORT => getservbyname("ssmtp", "tcp") || 465;
sub register sub register {
{
my ( $self, $qp, %arg ) = @_; my ( $self, $qp, %arg ) = @_;
unless ($arg{cvm_socket}) unless ($arg{cvm_socket})
@ -78,8 +77,7 @@ sub register
# $self->register_hook("auth-cram-md5", "authcvm_hash"); # $self->register_hook("auth-cram-md5", "authcvm_hash");
} }
sub authcvm_plain sub authcvm_plain {
{
my ( $self, $transaction, $method, $user, $passClear, $passHash, $ticket ) = my ( $self, $transaction, $method, $user, $passClear, $passHash, $ticket ) =
@_; @_;

View File

@ -40,6 +40,10 @@ Please see the LICENSE file included with qpsmtpd for details.
=cut =cut
use strict;
use Qpsmtpd::Constants;
sub register { sub register {
my ($self, $qp) = @_; my ($self, $qp) = @_;
@ -50,7 +54,6 @@ sub register {
sub auth_vpopmail { sub auth_vpopmail {
use vpopmail; use vpopmail;
use Qpsmtpd::Constants;
use Digest::HMAC_MD5 qw(hmac_md5_hex); use Digest::HMAC_MD5 qw(hmac_md5_hex);
my ($self, $transaction, $method, $user, $passClear, $passHash, $ticket) = my ($self, $transaction, $method, $user, $passClear, $passHash, $ticket) =

View File

@ -61,7 +61,6 @@ Copyright (c) 2004 John Peacock
This plugin is licensed under the same terms as the qpsmtpd package itself. This plugin is licensed under the same terms as the qpsmtpd package itself.
Please see the LICENSE file included with qpsmtpd for details. Please see the LICENSE file included with qpsmtpd for details.
=cut =cut
sub register { sub register {

View File

@ -1,9 +1,16 @@
#!perl -Tw #!perl -Tw
#
# This plugin doesn't actually check anything and will fail any =head1 NAME
# user no matter what they type. It is strictly a proof of concept for
# the Qpsmtpd::Auth module. Don't run this in production!!! 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 { sub hook_auth {
my ( $self, $transaction, $method, $user, $passClear, $passHash, $ticket ) = my ( $self, $transaction, $method, $user, $passClear, $passHash, $ticket ) =

View File

@ -1,4 +1,4 @@
# -*- perl -*- #!perl -Tw
=head1 NAME =head1 NAME

View File

@ -1,7 +1,5 @@
#!perl -Tw #!perl -Tw
=pod
=head1 SYNOPSIS =head1 SYNOPSIS
This plugin checks the badmailfrom_patterns config. This allows This plugin checks the badmailfrom_patterns config. This allows

View File

@ -1,3 +1,5 @@
#!perl -Tw
# this plugin checks the badrcptto config (like badmailfrom, but for rcpt address # this plugin checks the badrcptto config (like badmailfrom, but for rcpt address
# rather than sender address) # rather than sender address)
use Qpsmtpd::DSN; use Qpsmtpd::DSN;

View File

@ -56,10 +56,11 @@ The default is I<check-at CONNECT> only.
=cut =cut
use IO::Select;
use warnings;
use strict; use strict;
use warnings;
use IO::Select;
use Qpsmtpd::Constants;
sub register { sub register {
my ($self, $qp, @args) = @_; my ($self, $qp, @args) = @_;
@ -209,6 +210,5 @@ sub mail_handler {
return DECLINED; return DECLINED;
} }
1; 1;

View File

@ -1,3 +1,5 @@
#!perl -Tw
# this plugin checks the relayclients config file and # this plugin checks the relayclients config file and
# $ENV{RELAYCLIENT} to see if relaying is allowed. # $ENV{RELAYCLIENT} to see if relaying is allowed.
# #

View File

@ -1,5 +1,5 @@
# -*- perl -*- #!perl -Tw
#
# A simple example of a plugin that logs all incoming mail to a file. # 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. # Useful for debugging other plugins or keeping an archive of things.

View File

@ -1,4 +1,5 @@
# -*- perl -*- #!perl -Tw
=head1 NAME =head1 NAME
count_unrecognized_commands - Count unrecognized commands and disconnect when we have too many count_unrecognized_commands - Count unrecognized commands and disconnect when we have too many

View File

@ -195,7 +195,6 @@ sub hook_rcpt {
} }
} }
return DECLINED; return DECLINED;
} }
sub hook_disconnect { sub hook_disconnect {
@ -206,7 +205,6 @@ sub hook_disconnect {
return DECLINED; return DECLINED;
} }
1;
=head1 Usage =head1 Usage

View File

@ -89,7 +89,6 @@ sub hook_data_post {
} }
} }
=cut
=head1 NAME =head1 NAME
@ -115,3 +114,5 @@ Copyright (C) 2005-2006 John Peacock.
Portions Copyright (C) 2004 Anthony D. Urso. All rights reserved. This Portions Copyright (C) 2004 Anthony D. Urso. All rights reserved. This
program is free software; you can redistribute it and/or modify it under program is free software; you can redistribute it and/or modify it under
the same terms as Perl itself. the same terms as Perl itself.
=cut

View File

@ -1,7 +1,15 @@
# #!perl -Tw
# dont_require_anglebrackets - accept addresses in MAIL FROM:/RCPT TO:
# commands without surrounding <> =head1 NAME
#
dont_require_anglebrackets
=head1 SYNOPSIS
accept addresses in MAIL FROM:/RCPT TO: commands without surrounding <>
=cut
sub hook_mail_pre { sub hook_mail_pre {
my ($self,$transaction, $addr) = @_; my ($self,$transaction, $addr) = @_;
unless ($addr =~ /^<.*>$/) { unless ($addr =~ /^<.*>$/) {

View File

@ -105,8 +105,6 @@ Flag to indicate whether to use per-recipient greylisting
databases (default is to use a shared database). Per-recipient configuration databases (default is to use a shared database). Per-recipient configuration
directories, if determined, supercede I<db_dir>. directories, if determined, supercede I<db_dir>.
=back
=item p0f =item p0f
Enable greylisting only when certain p0f criteria is met. The single Enable greylisting only when certain p0f criteria is met. The single
@ -124,6 +122,8 @@ away:
p0f genre,windows,link,dsl,distance,3 p0f genre,windows,link,dsl,distance,3
=back
=head1 BUGS =head1 BUGS
Database locking is implemented using flock, which may not work on 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 AnyDBM_File;
use Fcntl qw(:DEFAULT :flock); use Fcntl qw(:DEFAULT :flock);
use strict; use strict;
use Qpsmtpd::Constants;
my $VERSION = '0.08'; my $VERSION = '0.08';
@ -340,4 +341,3 @@ sub p0f_match {
} }
# arch-tag: 6ef5919e-404b-4c87-bcfe-7e9f383f3901 # arch-tag: 6ef5919e-404b-4c87-bcfe-7e9f383f3901

View File

@ -1,6 +1,4 @@
# #!perl -Tw
#
#
=head1 NAME =head1 NAME
@ -142,4 +140,3 @@ sub read_helpfile {
return $help; return $help;
} }
# vim: ts=4 sw=4 expandtab syn=perl

View File

@ -77,5 +77,3 @@ sub hook_pre_connection {
return (DECLINED); return (DECLINED);
} }
# vim: sw=4 ts=4 expandtab syn=perl

View File

@ -1,6 +1,6 @@
# -*- perl -*- #!perl -Tw
=pod =head1 SYNOPSIS
This plugin uses MaxMind's GeoIP service and the Geo::IP perl module to 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. do a lookup on incoming connections and record the country of origin.

View File

@ -1,4 +1,4 @@
# -*- perl -*- #!perl -Tw
=head1 NAME =head1 NAME

View File

@ -94,9 +94,6 @@ sub hook_reset_transaction { # slog
return DECLINED; return DECLINED;
} }
=cut
=head1 NAME =head1 NAME
adaptive - An adaptive logging plugin for qpsmtpd adaptive - An adaptive logging plugin for qpsmtpd

View File

@ -73,8 +73,6 @@ sub hook_logging {
return DECLINED; return DECLINED;
} }
=cut
=head1 DESCRIPTION =head1 DESCRIPTION
The logging/apache plugin uses the apache logging mechanism to write its 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 =cut
# vim: ts=4 sw=4 expandtab syn=perl

View File

@ -42,8 +42,6 @@ sub hook_logging {
return DECLINED; return DECLINED;
} }
=cut
=head1 NAME =head1 NAME
connection_id - plugin to demo use of the connection id connection_id - plugin to demo use of the connection id

View File

@ -121,6 +121,7 @@ use warnings;
use IO::File; use IO::File;
use Sys::Hostname; use Sys::Hostname;
use POSIX qw(strftime); use POSIX qw(strftime);
use Qpsmtpd::Constants;
sub register { sub register {
my ($self, $qp, @args) = @_; my ($self, $qp, @args) = @_;
@ -279,4 +280,3 @@ sub hook_logging {
return DECLINED; return DECLINED;
} }
# vi: tabstop=4 shiftwidth=4 expandtab:

View File

@ -107,6 +107,7 @@ Please see the LICENSE file included with qpsmtpd for details.
use strict; use strict;
use warnings; use warnings;
use Qpsmtpd::Constants;
use Sys::Syslog qw(:DEFAULT setlogsock); use Sys::Syslog qw(:DEFAULT setlogsock);
sub register { sub register {
@ -183,4 +184,3 @@ sub hook_logging {
return DECLINED; return DECLINED;
} }
# vi: tabstop=4 shiftwidth=4 expandtab

View File

@ -41,8 +41,6 @@ sub hook_logging {
return DECLINED; return DECLINED;
} }
=cut
=head1 NAME =head1 NAME
transaction_id - plugin to demo use of the transaction id transaction_id - plugin to demo use of the transaction id

View File

@ -40,8 +40,6 @@ sub hook_logging {
return DECLINED; return DECLINED;
} }
=cut
=head1 NAME =head1 NAME
warn - Default logging plugin for qpsmtpd warn - Default logging plugin for qpsmtpd

View File

@ -27,6 +27,7 @@ This plugin has so far only been tested with Brightmail's milter module.
=cut =cut
use Net::Milter; use Net::Milter;
use Qpsmtpd::Constants;
no warnings; no warnings;
sub register { sub register {
@ -233,4 +234,3 @@ sub hook_data_post {
return DECLINED; return DECLINED;
} }

View File

@ -1,6 +1,4 @@
# #!perl -Tw
#
#
=head1 NAME =head1 NAME
@ -62,4 +60,3 @@ sub reset_noop_counter {
*hook_help = # HELP *hook_help = # HELP
\&reset_noop_counter; \&reset_noop_counter;
# vim: ts=4 sw=4 expandtab syn=perl

View File

@ -1,13 +1,21 @@
# parse_addr_withhelo #!perl -Tw
#
# strict RFC 821 forbids parameters after the =head1 NAME
# MAIL FROM:<user@example.net>
# and parse_addr_withhelo
# RCPT TO:<someone@example.com>
# =head1 SYNOPSIS
# load this plugin to enforce, else the default EHLO parsing with
# parameters is done. strict RFC 821 forbids parameters after the
#
MAIL FROM:<user@example.net>
and
RCPT TO:<someone@example.com>
load this plugin to enforce, else the default EHLO parsing with
parameters is done.
=cut
sub hook_mail_parse { sub hook_mail_parse {
my $self = shift; my $self = shift;

View File

@ -31,8 +31,6 @@ actually redundant with rsmtp, but harmless).
=back =back
=cut
=head1 LICENSE =head1 LICENSE
Copyright (c) 2004 by Devin Carraway <qpsmtpd@devin.com> Copyright (c) 2004 by Devin Carraway <qpsmtpd@devin.com>
@ -63,6 +61,7 @@ use warnings;
use IO::File; use IO::File;
use Sys::Hostname qw(hostname); use Sys::Hostname qw(hostname);
use File::Temp qw(tempfile); use File::Temp qw(tempfile);
use Qpsmtpd::Constants;
sub register { sub register {
my ($self, $qp, %args) = @_; my ($self, $qp, %args) = @_;
@ -144,7 +143,3 @@ sub hook_queue {
return (OK, "Queued!"); return (OK, "Queued!");
} }
1;
# vi: ts=4 sw=4 expandtab syn=perl:

View File

@ -196,4 +196,3 @@ sub hook_queue {
return (OK, "Queued! $msg_id (Queue-Id: $qid)"); return (OK, "Queued! $msg_id (Queue-Id: $qid)");
} }
# vim: sw=2 ts=8 syn=perl

View File

@ -1,4 +1,5 @@
# -*- perl -*- #!perl -Tw
=head1 NAME =head1 NAME
qmail-queue qmail-queue

View File

@ -33,7 +33,7 @@ sub NEXT() { DECLINED }
sub random_fail { sub random_fail {
my $fpct = $_[0]->qp->connection->notes('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 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 provide random failure for each one, with the combined probability being out
@ -83,4 +83,3 @@ sub hook_data_post {
goto &random_fail goto &random_fail
} }

View File

@ -187,5 +187,3 @@ sub hook_rcpt {
return @{$map{$rcpt}}; return @{$map{$rcpt}};
} }
# vim: ts=4 sw=4 expandtab syn=perl

View File

@ -1,7 +1,17 @@
# this plugin checks the standard rcpthosts config #!perl -Tw
#
# It should be configured to be run _LAST_! =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; use Qpsmtpd::DSN;
sub hook_rcpt { sub hook_rcpt {

View File

@ -96,5 +96,3 @@ sub hook_rcpt {
} }
return (DECLINED); return (DECLINED);
} }
# vim: ts=4 sw=4 expandtab syn=perl

View File

@ -148,5 +148,3 @@ sub mx_valid {
} }
return 0; return 0;
} }
# vim: ts=2 sw=2 expandtab syn=perl

View File

@ -133,7 +133,6 @@ sub hook_disconnect {
return DECLINED; return DECLINED;
} }
1;
=head1 NAME =head1 NAME

View File

@ -37,6 +37,7 @@ whomever wrote the original SPF plugin, upon which I based this.
use strict; use strict;
use Mail::SPF 2.000; use Mail::SPF 2.000;
use Data::Dumper; use Data::Dumper;
use Qpsmtpd::Constants;
sub register { sub register {
my ($self, $qp, @args) = @_; my ($self, $qp, @args) = @_;

View File

@ -257,7 +257,7 @@ sub get_spam_score {
my $status = $transaction->header->get('X-Spam-Status') or return; my $status = $transaction->header->get('X-Spam-Status') or return;
my ($score) = ($status =~ m/hits=(-?\d+\.\d+)/)[0]; my ($score) = ($status =~ m/hits=(-?\d+\.\d+)/)[0];
return $score; return $score;
}
sub _cleanup_spam_header { sub _cleanup_spam_header {
my ($self, $transaction, $header_name) = @_; 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->add($old_header_name, $header) if $action eq 'rename';
$transaction->header->delete($header_name); $transaction->header->delete($header_name);
} }
}
} }

View File

@ -10,7 +10,7 @@ tls - plugin to support STARTTLS
tls [B<cert_path priv_key_path ca_path>] tls [B<cert_path priv_key_path ca_path>]
=over indentlevel =over 4
=item B<cert_path> =item B<cert_path>
@ -325,5 +325,3 @@ sub event_read {
$qp->disconnect(); $qp->disconnect();
} }
} }
1;

2
plugins/tls_cert Executable file → Normal file
View File

@ -1,4 +1,6 @@
#!perl -Tw #!perl -Tw
use warnings;
# Very basic script to create TLS certificates for qpsmtpd # Very basic script to create TLS certificates for qpsmtpd
use File::Temp qw/ tempfile tempdir /; use File::Temp qw/ tempfile tempdir /;
use Getopt::Long; use Getopt::Long;

View File

@ -510,6 +510,3 @@ sub init_resolver {
$self->{resolver}->udp_timeout($self->{timeout}); $self->{resolver}->udp_timeout($self->{timeout});
} }
1;
# vi: ts=4 sw=4 expandtab syn=perl

View File

@ -60,11 +60,12 @@ Please see the LICENSE file included with qpsmtpd for details.
=cut =cut
use File::Path;
use strict; use strict;
use warnings; use warnings;
use File::Path;
use Qpsmtpd::Constants;
sub register { sub register {
my ( $self, $qp, @args ) = @_; my ( $self, $qp, @args ) = @_;
@ -129,5 +130,3 @@ sub hook_data_post {
return (DECLINED); return (DECLINED);
} }
1;

View File

@ -109,6 +109,8 @@ Please see the LICENSE file included with qpsmtpd for details.
use strict; use strict;
use warnings; use warnings;
use Qpsmtpd::Constants;
sub register { sub register {
my ($self, $qp, @args) = @_; my ($self, $qp, @args) = @_;
my %args; my %args;
@ -227,5 +229,3 @@ sub hook_data_post {
return (DECLINED); return (DECLINED);
} }
1;

View File

@ -102,11 +102,12 @@ Please see the LICENSE file included with qpsmtpd for details.
=cut =cut
use ClamAV::Client;
use strict; use strict;
use warnings; use warnings;
use ClamAV::Client;
use Qpsmtpd::Constants;
sub register { sub register {
my ( $self, $qp, @args ) = @_; my ( $self, $qp, @args ) = @_;
@ -231,4 +232,3 @@ sub hook_data_post {
return (DECLINED); return (DECLINED);
} }
# vi: set ts=4 sw=4 et:

View File

@ -1,6 +1,5 @@
#!perl -Tw #!perl -Tw
# H+B EDV-AV plugin. # H+B EDV-AV plugin.
#
=head1 NAME =head1 NAME

View File

@ -174,4 +174,3 @@ sub hook_data_post {
return (DECLINED); return (DECLINED);
} }
# vim: ts=2 sw=2 expandtab

42
t/01-syntax.t Normal file
View File

@ -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");
};

8
t/02-pod.t Normal file
View File

@ -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 ) );