whitespace, copyright bump, simplify logic

This commit is contained in:
Matt Simerson 2012-04-08 02:01:24 -04:00 committed by Ask Bjørn Hansen
parent 7c2e37ff20
commit 3afcc92150
2 changed files with 12 additions and 14 deletions

View File

@ -57,7 +57,7 @@ sub TRACE_LEVEL { $TraceLevel }; # leave for plugin compatibility
sub hooks { $hooks; } sub hooks { $hooks; }
sub load_logging { sub load_logging {
# need to do this differently that other plugins so as to # need to do this differently than other plugins so as to
# not trigger logging activity # not trigger logging activity
return if $LOGGING_LOADED; return if $LOGGING_LOADED;
my $self = shift; my $self = shift;
@ -123,7 +123,7 @@ sub varlog {
($hook, $plugin, @log) = @_; ($hook, $plugin, @log) = @_;
} }
$self->load_logging; # in case we already don't have this loaded yet $self->load_logging; # in case we don't have this loaded yet
my ($rc) = $self->run_hooks_no_respond("logging", $trace, $hook, $plugin, @log); my ($rc) = $self->run_hooks_no_respond("logging", $trace, $hook, $plugin, @log);
@ -184,7 +184,6 @@ sub config {
return wantarray ? @{$_config_cache->{$c}} : $_config_cache->{$c}->[0]; return wantarray ? @{$_config_cache->{$c}} : $_config_cache->{$c}->[0];
} }
return; return;
} }
sub config_dir { sub config_dir {
@ -412,9 +411,7 @@ sub _load_plugin {
return $plug; return $plug;
} }
sub transaction { sub transaction { return {}; } # base class implements empty transaction
return {}; # base class implements empty transaction
}
sub run_hooks { sub run_hooks {
my ($self, $hook) = (shift, shift); my ($self, $hook) = (shift, shift);
@ -554,14 +551,14 @@ sub spool_dir {
$Spool_dir = $1; # cleanse the taint $Spool_dir = $1; # cleanse the taint
my $Spool_perms = $self->config('spool_perms') || '0700'; my $Spool_perms = $self->config('spool_perms') || '0700';
if (-d $Spool_dir) { # Make sure the spool dir has appropriate rights if (! -d $Spool_dir) { # create it if it doesn't exist
$self->log(LOGWARN,
"Permissions on spool_dir $Spool_dir are not $Spool_perms")
unless ((stat $Spool_dir)[2] & 07777) == oct($Spool_perms);
} else { # Or create it if it doesn't already exist
mkdir($Spool_dir,oct($Spool_perms)) mkdir($Spool_dir,oct($Spool_perms))
or die "Could not create spool_dir $Spool_dir: $!"; or die "Could not create spool_dir $Spool_dir: $!";
} };
# Make sure the spool dir has appropriate rights
$self->log(LOGWARN,
"Permissions on spool_dir $Spool_dir are not $Spool_perms")
unless ((stat $Spool_dir)[2] & 07777) == oct($Spool_perms);
} }
return $Spool_dir; return $Spool_dir;
@ -626,8 +623,8 @@ L<http://smtpd.develooper.com/> and the I<README> file for more information.
=head1 COPYRIGHT =head1 COPYRIGHT
Copyright 2001-2010 Ask Bjørn Hansen, Develooper LLC. See the Copyright 2001-2012 Ask Bjørn Hansen, Develooper LLC. See the
LICENSE file for more information. LICENSE file for more information.
=cut

View File

@ -1,5 +1,6 @@
package Test::Qpsmtpd; package Test::Qpsmtpd;
use strict; use strict;
use lib 't';
use Carp qw(croak); use Carp qw(croak);
use base qw(Qpsmtpd::SMTP); use base qw(Qpsmtpd::SMTP);
use Test::More; use Test::More;