Allow plugin tests to be in subdir (as with plugins).
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@737 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
parent
60b74decd9
commit
ef7d885929
2
config.sample/flat_auth_pw
Normal file
2
config.sample/flat_auth_pw
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
good@example.com:good_pass
|
||||||
|
bad@example.com:bad_pass
|
@ -35,6 +35,10 @@ check_spamhelo
|
|||||||
|
|
||||||
# sender_permitted_from
|
# sender_permitted_from
|
||||||
|
|
||||||
|
auth/auth_flat_file
|
||||||
|
auth/authnull
|
||||||
|
auth/authdeny
|
||||||
|
|
||||||
# this plugin needs to run after all other "rcpt" plugins
|
# this plugin needs to run after all other "rcpt" plugins
|
||||||
rcpt_ok
|
rcpt_ok
|
||||||
|
|
||||||
|
@ -314,7 +314,7 @@ sub _load_plugin {
|
|||||||
PLUGIN_DIR: for my $dir (@plugin_dirs) {
|
PLUGIN_DIR: for my $dir (@plugin_dirs) {
|
||||||
if (-e "$dir/$plugin") {
|
if (-e "$dir/$plugin") {
|
||||||
Qpsmtpd::Plugin->compile($plugin_name, $package,
|
Qpsmtpd::Plugin->compile($plugin_name, $package,
|
||||||
"$dir/$plugin", $self->{_test_mode});
|
"$dir/$plugin", $self->{_test_mode}, $plugin);
|
||||||
$self->log(LOGDEBUG, "Loading $plugin_line from $dir/$plugin")
|
$self->log(LOGDEBUG, "Loading $plugin_line from $dir/$plugin")
|
||||||
unless $plugin_line =~ /logging/;
|
unless $plugin_line =~ /logging/;
|
||||||
last PLUGIN_DIR;
|
last PLUGIN_DIR;
|
||||||
|
@ -127,7 +127,7 @@ sub isa_plugin {
|
|||||||
|
|
||||||
# why isn't compile private? it's only called from Plugin and Qpsmtpd.
|
# why isn't compile private? it's only called from Plugin and Qpsmtpd.
|
||||||
sub compile {
|
sub compile {
|
||||||
my ($class, $plugin, $package, $file, $test_mode) = @_;
|
my ($class, $plugin, $package, $file, $test_mode, $orig_name) = @_;
|
||||||
|
|
||||||
my $sub;
|
my $sub;
|
||||||
open F, $file or die "could not open $file: $!";
|
open F, $file or die "could not open $file: $!";
|
||||||
@ -140,9 +140,9 @@ sub compile {
|
|||||||
my $line = "\n#line 0 $file\n";
|
my $line = "\n#line 0 $file\n";
|
||||||
|
|
||||||
if ($test_mode) {
|
if ($test_mode) {
|
||||||
if (open(F, "t/plugin_tests/$plugin")) {
|
if (open(F, "t/plugin_tests/$orig_name")) {
|
||||||
local $/ = undef;
|
local $/ = undef;
|
||||||
$sub .= "#line 1 t/plugin_tests/$plugin\n";
|
$sub .= "#line 1 t/plugin_tests/$orig_name\n";
|
||||||
$sub .= <F>;
|
$sub .= <F>;
|
||||||
close F;
|
close F;
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ sub plugin_dirs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub log {
|
sub log {
|
||||||
my ($self, $trace, @log) = @_;
|
my ($self, $trace, $hook, $plugin, @log) = @_;
|
||||||
my $level = Qpsmtpd::TRACE_LEVEL();
|
my $level = Qpsmtpd::TRACE_LEVEL();
|
||||||
$level = $self->init_logger unless defined $level;
|
$level = $self->init_logger unless defined $level;
|
||||||
print("# " . join(" ", $$, @log) . "\n") if $trace <= $level;
|
print("# " . join(" ", $$, @log) . "\n") if $trace <= $level;
|
||||||
|
Loading…
Reference in New Issue
Block a user