--- /root/unstable/mailscanner/mailscanner/bin/MailScanner/Message.pm	Wed Oct 30 14:35:40 2002
+++ Message.pm	Wed Oct 30 21:10:43 2002
@@ -1245,21 +1245,36 @@
 # Passed in the name of the config variable that points to the filename.
 # This is also used to read the inline signature added to the bottom of
 # clean messages.
+# Substitutions allowed in the message are
+#     $viruswarningfilename -- by default VirusWarning.txt
+# and $filename -- comma-separated list of infected attachments
 sub ReadVirusWarning {
   my $this = shift;
   my($option) = @_;
 
-  my $filename = MailScanner::Config::Value($option, $this);
+  my $file = MailScanner::Config::Value($option, $this);
   my $viruswarningname = MailScanner::Config::Value('attachmentwarningfilename',
                                                     $this);
   my($line);
 
   #print STDERR "Reading virus warning message from $filename\n";
   my $fh = new FileHandle;
-  $fh->open($filename)
+  $fh->open($file)
     or (MailScanner::Log::WarnLog("Could not open inline file %s, %s",
-                                  $filename, $!),
+                                  $file, $!),
         return undef);
+
+  # Work out the list of all the infected attachments, including
+  # reports applying to the whole message
+  my($attach, $text, %infected, $filename);
+  while (($attach, $text) = each %{$this->{allreports}}) {
+    if ($attach eq "") {
+      $infected{"the entire message"} = 1;
+    } else {
+      $infected{"$attach"} = 1;
+    }
+  }
+  $filename = join(', ', keys %infected);
 
   my $result = "";
   while (<$fh>) {