diff --git a/config.sample/flat_auth_pw b/config.sample/flat_auth_pw new file mode 100644 index 0000000..292d9f5 --- /dev/null +++ b/config.sample/flat_auth_pw @@ -0,0 +1,2 @@ +good@example.com:good_pass +bad@example.com:bad_pass diff --git a/config.sample/plugins b/config.sample/plugins index 1d6b180..92a7a66 100644 --- a/config.sample/plugins +++ b/config.sample/plugins @@ -35,6 +35,10 @@ check_spamhelo # sender_permitted_from +auth/auth_flat_file +auth/authnull +auth/authdeny + # this plugin needs to run after all other "rcpt" plugins rcpt_ok diff --git a/lib/Qpsmtpd.pm b/lib/Qpsmtpd.pm index aa778a2..54220e9 100644 --- a/lib/Qpsmtpd.pm +++ b/lib/Qpsmtpd.pm @@ -314,7 +314,7 @@ sub _load_plugin { PLUGIN_DIR: for my $dir (@plugin_dirs) { if (-e "$dir/$plugin") { 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") unless $plugin_line =~ /logging/; last PLUGIN_DIR; diff --git a/lib/Qpsmtpd/Plugin.pm b/lib/Qpsmtpd/Plugin.pm index fcc85a6..9e18326 100644 --- a/lib/Qpsmtpd/Plugin.pm +++ b/lib/Qpsmtpd/Plugin.pm @@ -127,7 +127,7 @@ sub isa_plugin { # why isn't compile private? it's only called from Plugin and Qpsmtpd. sub compile { - my ($class, $plugin, $package, $file, $test_mode) = @_; + my ($class, $plugin, $package, $file, $test_mode, $orig_name) = @_; my $sub; open F, $file or die "could not open $file: $!"; @@ -140,9 +140,9 @@ sub compile { my $line = "\n#line 0 $file\n"; if ($test_mode) { - if (open(F, "t/plugin_tests/$plugin")) { + if (open(F, "t/plugin_tests/$orig_name")) { local $/ = undef; - $sub .= "#line 1 t/plugin_tests/$plugin\n"; + $sub .= "#line 1 t/plugin_tests/$orig_name\n"; $sub .= ; close F; } diff --git a/t/Test/Qpsmtpd.pm b/t/Test/Qpsmtpd.pm index 80ab6ce..7bfa85a 100644 --- a/t/Test/Qpsmtpd.pm +++ b/t/Test/Qpsmtpd.pm @@ -75,7 +75,7 @@ sub plugin_dirs { } sub log { - my ($self, $trace, @log) = @_; + my ($self, $trace, $hook, $plugin, @log) = @_; my $level = Qpsmtpd::TRACE_LEVEL(); $level = $self->init_logger unless defined $level; print("# " . join(" ", $$, @log) . "\n") if $trace <= $level; diff --git a/t/plugin_tests/auth::auth_flat_file b/t/plugin_tests/auth/auth_flat_file similarity index 100% rename from t/plugin_tests/auth::auth_flat_file rename to t/plugin_tests/auth/auth_flat_file diff --git a/t/plugin_tests/auth::authdeny b/t/plugin_tests/auth/authdeny similarity index 100% rename from t/plugin_tests/auth::authdeny rename to t/plugin_tests/auth/authdeny diff --git a/t/plugin_tests/auth::authnull b/t/plugin_tests/auth/authnull similarity index 100% rename from t/plugin_tests/auth::authnull rename to t/plugin_tests/auth/authnull