spamassassin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmarti...@apache.org
Subject svn commit: r1414465 - in /spamassassin/trunk/lib/Mail/SpamAssassin: Logger.pm Plugin/DCC.pm
Date Tue, 27 Nov 2012 23:21:35 GMT
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);
 }
 



Mime
View raw message