From 4a745d6baf05151774458358b9064322d42e1bd7 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Tue, 20 Nov 2012 01:40:57 -0500 Subject: [PATCH 1/3] updated more split '' syntax to split // --- lib/Qpsmtpd.pm | 2 +- lib/Qpsmtpd/Postfix/pf2qp.pl | 2 +- log/summarize | 4 ++-- plugins/auth/auth_flat_file | 2 +- plugins/auth/auth_vpopmail | 2 +- plugins/auth/auth_vpopmail_sql | 2 +- plugins/dspam | 18 ++++++++++-------- plugins/hosts_allow | 2 +- plugins/rcpt_map | 2 +- 9 files changed, 19 insertions(+), 17 deletions(-) diff --git a/lib/Qpsmtpd.pm b/lib/Qpsmtpd.pm index b7a9932..133a6a8 100644 --- a/lib/Qpsmtpd.pm +++ b/lib/Qpsmtpd.pm @@ -354,7 +354,7 @@ sub _load_plugin { my $self = shift; my ($plugin_line, @plugin_dirs) = @_; - my ($plugin, @args) = split ' ', $plugin_line; + my ($plugin, @args) = split / /, $plugin_line; my $package; diff --git a/lib/Qpsmtpd/Postfix/pf2qp.pl b/lib/Qpsmtpd/Postfix/pf2qp.pl index 0cd7894..3f8f55d 100755 --- a/lib/Qpsmtpd/Postfix/pf2qp.pl +++ b/lib/Qpsmtpd/Postfix/pf2qp.pl @@ -67,7 +67,7 @@ while () { next if /^_/; s#(/\*.*\*/)##; my $comment = $1 || ""; - my @words = split ' ', $_; + my @words = split / /, $_; my $const = shift @words; if ($const eq "CLEANUP_STAT_OK") { push @out, ""; diff --git a/log/summarize b/log/summarize index b203cca..b14dd3f 100755 --- a/log/summarize +++ b/log/summarize @@ -195,7 +195,7 @@ sub parse_line_plugin { my ($tai, $pid, $hook, $plugin, $message ) = split /\s/, $line, 5; $plugin =~ s/:$//; if ( $plugin =~ /_3a/ ) { - ($plugin) = split '_3a', $plugin; # trim :N off the plugin log entry + ($plugin) = split /_3a/, $plugin; # trim :N off the plugin log entry }; $plugin =~ s/_2d/-/g; @@ -320,7 +320,7 @@ sub populate_plugins_from_registry { next if ! $aliases; $aliases =~ s/\s+//g; $plugins{$name}{aliases} = $aliases; - foreach my $a ( split ',', $aliases ) { + foreach my $a ( split /,/, $aliases ) { $plugin_aliases{$a} = $name; }; }; diff --git a/plugins/auth/auth_flat_file b/plugins/auth/auth_flat_file index a17d051..2045009 100644 --- a/plugins/auth/auth_flat_file +++ b/plugins/auth/auth_flat_file @@ -53,7 +53,7 @@ sub auth_flat_file { return ( DENY, "authflat - missing password" ); } - my ( $pw_name, $pw_domain ) = split '@', lc($user); + my ( $pw_name, $pw_domain ) = split /@/, lc($user); unless ( defined $pw_domain ) { $self->log(LOGINFO, "fail: missing domain"); diff --git a/plugins/auth/auth_vpopmail b/plugins/auth/auth_vpopmail index 91a5ac6..e1dc423 100644 --- a/plugins/auth/auth_vpopmail +++ b/plugins/auth/auth_vpopmail @@ -61,7 +61,7 @@ sub auth_vpopmail { my ($self, $transaction, $method, $user, $passClear, $passHash, $ticket) = @_; - my $pw = vauth_getpw( split '@', lc($user) ); + my $pw = vauth_getpw( split /@/, lc($user) ); my $pw_clear_passwd = $pw->{pw_clear_passwd}; my $pw_passwd = $pw->{pw_passwd}; diff --git a/plugins/auth/auth_vpopmail_sql b/plugins/auth/auth_vpopmail_sql index dd9b3cb..90f08e8 100644 --- a/plugins/auth/auth_vpopmail_sql +++ b/plugins/auth/auth_vpopmail_sql @@ -104,7 +104,7 @@ sub get_db_handle { sub get_vpopmail_user { my ( $self, $dbh, $user ) = @_; - my ( $pw_name, $pw_domain ) = split '@', lc($user); + my ( $pw_name, $pw_domain ) = split /@/, lc($user); if ( ! defined $pw_domain ) { $self->log(LOGINFO, "skip: missing domain: " . lc $user ); diff --git a/plugins/dspam b/plugins/dspam index 9f36032..6812451 100644 --- a/plugins/dspam +++ b/plugins/dspam @@ -260,7 +260,7 @@ sub select_username { $self->log(LOGDEBUG, "Message has $recipient_count recipients"); if ( $recipient_count > 1 ) { - $self->log(LOGINFO, "skipping user prefs, $recipient_count recipients detected."); + $self->log(LOGINFO, "multiple recipients ($recipient_count), ignoring user prefs"); return getpwuid($>); }; @@ -296,13 +296,13 @@ sub parse_response { #return $self->parse_response_regexp( $response ); # probably slower - my ($user, $result, $class, $prob, $conf, $sig) = split '; ', $response; + my ($user, $result, $class, $prob, $conf, $sig) = split /; /, $response; - (undef, $result) = split '=', $result; - (undef, $class ) = split '=', $class; - (undef, $prob ) = split '=', $prob; - (undef, $conf ) = split '=', $conf; - (undef, $sig ) = split '=', $sig; + (undef, $result) = split /=/, $result; + (undef, $class ) = split /=/, $class; + (undef, $prob ) = split /=/, $prob; + (undef, $conf ) = split /=/, $conf; + (undef, $sig ) = split /=/, $sig; $result = substr($result, 1, -1); # strip off quotes $class = substr($class, 1, -1); @@ -656,7 +656,9 @@ sub autolearn_spamassassin { my $sa = $transaction->notes('spamassassin' ); if ( ! $sa || ! $sa->{is_spam} ) { - $self->log(LOGERROR, "SA results missing"); + if ( ! $self->connection->notes('naughty') ) { + $self->log(LOGERROR, "SA results missing"); # SA skips naughty + }; return; }; diff --git a/plugins/hosts_allow b/plugins/hosts_allow index 550504c..6661ec1 100644 --- a/plugins/hosts_allow +++ b/plugins/hosts_allow @@ -98,7 +98,7 @@ sub in_hosts_allow { my ($ipmask, $const, $message) = split /\s+/, $_, 3; next unless defined $const; - my ($net,$mask) = split '/', $ipmask, 2; + my ($net,$mask) = split /\//, $ipmask, 2; $mask = 32 if ! defined $mask; $mask = pack "B32", "1"x($mask)."0"x(32-$mask); if (join('.', unpack('C4', inet_aton($remote) & $mask)) eq $net) { diff --git a/plugins/rcpt_map b/plugins/rcpt_map index 32c0a3b..e18d168 100644 --- a/plugins/rcpt_map +++ b/plugins/rcpt_map @@ -153,7 +153,7 @@ sub read_map { s/^\s*//; next if /^#/; next unless $_; - my ($addr, $code, $msg) = split ' ', $_, 3; + my ($addr, $code, $msg) = split / /, $_, 3; next unless $addr; unless ($code) { From aaaf69de5c78e0de94595fbb70fc19b8108054d6 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Tue, 20 Nov 2012 03:31:25 -0500 Subject: [PATCH 2/3] log/summarize: improve formatting so vertical columns are consistent, regardless of when the connection is ended. --- log/summarize | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/log/summarize b/log/summarize index b14dd3f..acf3c94 100755 --- a/log/summarize +++ b/log/summarize @@ -80,6 +80,7 @@ while ( defined (my $line = $fh->read) ) { next if $type ne 'connect'; # ignore unless connect my ($host, $ip) = split /\s/, $message; $ip = substr $ip, 1, -1; + foreach ( keys %seen_plugins, qw/ helo_host from to / ) { $pids{$pid}{$_} = ''; }; $pids{$pid}{ip} = $ip; $pids{$pid}{hostname} = $host if $host ne 'Unknown'; }; @@ -231,11 +232,11 @@ sub print_auto_format { $seen_plugins{$plugin}++; }; - next if ! $seen_plugins{$plugin}; # hide plugins not used + next if ! $seen_plugins{$plugin}; # hide unused plugins if ( $hide_plugins{$plugin} ) { # user doesn't want to see delete $pids{$pid}{$plugin}; next; - }; + }; if ( defined $pids{$pid}{helo_host} && $plugin =~ /helo/ ) { $format .= " %-18.18s"; From 5758412c530eb9f08f4cd8455e70ea9982b767fc Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Tue, 20 Nov 2012 03:33:08 -0500 Subject: [PATCH 3/3] v0.91 bump for release --- Changes | 70 +++++++++++++++++++++++++++++++++++++++++++++++--- MANIFEST | 1 + lib/Qpsmtpd.pm | 2 +- 3 files changed, 69 insertions(+), 4 deletions(-) diff --git a/Changes b/Changes index be8d88f..d77e22f 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,70 @@ -Next Version +0.91 Nov 20, 2012 + a handful of minor changes to log messages, similar to v0.90 + + replace all instances of split '' with split // (required for 5.1?+) + + clamdscan: skip processing of naughty messages + + TcpServer: improved IPv6 support (Michael Holzt) + + SPF: improved support for IPv6, removed is_in_relayclient in favor + of checking if relayclient() note is set. + + spamassassin: added 'headers none' option + + qmail_deliverable: added vpopmail extension support, reject null + senders to ezmlm mailing lists. + + dnsbl rejections handled by naughty plugin + + changed default loglevel from 9 to 6 + + allow messages with no body: (Robin's patch) + + ordered config.sample/plugins roughly in SMTP phase order + + added Plugins::adjust_karma, reduces code requirements in other plugins + + added whitelist plugin + + helo: added is_plain_ip to lenient checks + + dspam improvements + + added log2sql, log/watch.pl, log/summarize.pl, and plugins/registry.txt + + new dkim plugin added (deprecates domainkeys plugin). + +0.90 Jun 27, 2012 + + Many logging adjustments for plugins, to achieve the goal of emitting + a single message per plugin that provides a summary of that plugins + action(s) and/or outcome(s). + + qmail_deliverable plugin added (depends on Qmail::Deliverable). + + karma plugin added. + + naughty plugin added. + + count_unrecognized_commands: corrected variable assignment error + + connection_time: added tcpserver deployment compatibility + + loop: max_hops was sometimes unset + + dnsbl,rhsbl: process DNS queries syncronously to improve overall efficiency + + insert headers at top of message (consistent SMTP behavior) in uribl + domainkeys, spamassassin plugins. + + spamassassin: consolidated two data_post methods (more linear, simpler) + + rewrote check_basicheaders -> headers + + renamed check_loop -> loop renamed check_badrcptto -> badrcptto renamed check_badmailfromto -> badmailfromto renamed check_badmailfrom -> badmailfrom @@ -27,7 +91,7 @@ Next Version new plugin check_bogus_bounce (Steve Kemp) - clamav: added ClamAV version to the X-Virus-Checked header, + clamav: added ClamAV version to the X-Virus-Checked header, as well as noting "no virus found". (Matt Simerson) assorted documentation cleanups (Steve Kemp, Robert Spier) @@ -49,7 +113,7 @@ Next Version Note Net::IP dependency (Larry Nedry) - Various minor spelling cleanups and such (Steve Kemp, Devin Carraway) + Various minor spelling cleanups and such (Steve Kemp, Devin Carraway) rpm: create .rpm files from the packaging/rpm directory (Peter J. Holzer, Robin Bowes, Filippo Carletti, Richard Siddell) diff --git a/MANIFEST b/MANIFEST index 7c46ef1..8c60bdf 100644 --- a/MANIFEST +++ b/MANIFEST @@ -185,6 +185,7 @@ t/plugin_tests/badrcptto t/plugin_tests/count_unrecognized_commands t/plugin_tests/dnsbl t/plugin_tests/dspam +t/plugin_tests/earlytalker t/plugin_tests/greylisting t/plugin_tests/headers t/plugin_tests/helo diff --git a/lib/Qpsmtpd.pm b/lib/Qpsmtpd.pm index 133a6a8..6d7bc12 100644 --- a/lib/Qpsmtpd.pm +++ b/lib/Qpsmtpd.pm @@ -7,7 +7,7 @@ use Qpsmtpd::Constants; #use DashProfiler; -$VERSION = "0.90"; +$VERSION = "0.91"; my $git;