Return-Path: X-Original-To: apmail-spamassassin-commits-archive@www.apache.org Delivered-To: apmail-spamassassin-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 992A6D440 for ; Tue, 27 Nov 2012 23:21:57 +0000 (UTC) Received: (qmail 91927 invoked by uid 500); 27 Nov 2012 23:21:57 -0000 Delivered-To: apmail-spamassassin-commits-archive@spamassassin.apache.org Received: (qmail 91867 invoked by uid 500); 27 Nov 2012 23:21:57 -0000 Mailing-List: contact commits-help@spamassassin.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "SpamAssassin Dev" List-Id: Delivered-To: mailing list commits@spamassassin.apache.org Received: (qmail 91858 invoked by uid 99); 27 Nov 2012 23:21:57 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Nov 2012 23:21:57 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Nov 2012 23:21:55 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 92B452388A39; Tue, 27 Nov 2012 23:21:35 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1414465 - in /spamassassin/trunk/lib/Mail/SpamAssassin: Logger.pm Plugin/DCC.pm Date: Tue, 27 Nov 2012 23:21:35 -0000 To: commits@spamassassin.apache.org From: mmartinec@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20121127232135.92B452388A39@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mmartinec Date: Tue Nov 27 23:21:34 2012 New Revision: 1414465 URL: http://svn.apache.org/viewvc?rev=1414465&view=rev Log: DCC plugin: fix calls to dbg() - log facility must be a constant string before a sprintf expansion; hardened Logger.pm against a missing or broken log facility Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Logger.pm spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/DCC.pm Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Logger.pm URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Logger.pm?rev=1414465&r1=1414464&r2=1414465&view=diff ============================================================================== --- spamassassin/trunk/lib/Mail/SpamAssassin/Logger.pm (original) +++ spamassassin/trunk/lib/Mail/SpamAssassin/Logger.pm Tue Nov 27 23:21:34 2012 @@ -221,7 +221,7 @@ sub _log { # it's faster to access this as the $_[1] alias, and not to perform # string mods until we're sure we actually want to log anything - if ($_[1] =~ /^([^:]+?):/) { + if ($_[1] =~ /^([a-z0-9_-]*):/i) { $facility = $1; } else { $facility = "generic"; @@ -236,9 +236,9 @@ sub _log { } my ($level, $message, @args) = @_; - $message =~ s/^([^:]+?):\s*//; + $message =~ s/^([a-z0-9_-]*):\s*//i; - if (@args && index($message,'%') >= 0) { $message = sprintf($message,@args) } + $message = sprintf($message,@args) if @args; $message =~ s/\n+$//s; $message =~ s/^/${facility}: /mg; Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/DCC.pm URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/DCC.pm?rev=1414465&r1=1414464&r2=1414465&view=diff ============================================================================== --- spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/DCC.pm (original) +++ spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/DCC.pm Tue Nov 27 23:21:34 2012 @@ -589,7 +589,7 @@ sub dccifd_connect { if (defined $sockpath) { $sock = IO::Socket::UNIX->new(Type => SOCK_STREAM, Peer => $sockpath); if ($sock) { - dbg("%s connected to local socket %s", $tag, $sockpath); + dbg("$tag connected to local socket $sockpath"); return $sock; } $self->{dccifd_available} = 0; @@ -603,13 +603,13 @@ sub dccifd_connect { if ($conf->{dcc_dccifd_IPv6}) { # try IPv6 if we can with a host name or non-IPv4 address - dbg("%s connecting to inet6 socket [%s]:%s", $tag,$host,$port); + dbg("$tag connecting to inet6 socket [$host]:$port"); $sock = IO::Socket::INET6->new( Proto => 'tcp', PeerAddr => $host, PeerPort => $port); # fall back to IPv4 if that failed } if (!$sock) { - dbg("%s connecting to inet4 socket [%s]:%s", $tag,$host,$port); + dbg("$tag connecting to inet4 socket [$host]:$port"); $sock = IO::Socket::INET->new( Proto => 'tcp', PeerAddr => $host, PeerPort => $port); } @@ -868,7 +868,7 @@ sub ask_dcc { } defined $path or die "no dcc_path found\n"; - dbg("%s opening pipe to %s", $tag, + dbg("$tag opening pipe to " . join(' ', $path, "-C", "-x", "0", @opts, "<$tmpf")); $pid = Mail::SpamAssassin::Util::helper_app_pipe_open(*DCC, @@ -919,10 +919,10 @@ sub ask_dcc { my ($raw_x_dcc, $cksums) = $self->parse_dcc_response(\@resp); if (!defined $raw_x_dcc || $raw_x_dcc !~ /^X-DCC/) { - info("$tag instead of X-DCC header, $pgm returned '%s'", $raw_x_dcc); + info("$tag instead of X-DCC header, $pgm returned '$raw_x_dcc'"); return (undef, undef); } - dbg("%s %s responded with '%s'", $tag, $pgm, $raw_x_dcc); + dbg("$tag $pgm responded with '$raw_x_dcc'"); return ($raw_x_dcc, $cksums); }