Disclaimer problem
Plant, Dean
dean.plant at ROKE.CO.UK
Tue Jun 3 10:54:30 IST 2003
Julian,
I still find that mail goes through unsigned with version 4.21-9 when there is no body text and an attachment. The only exception is if the attachment is a text file. Is there anything I may have setup incorrectly.
Thanks
Dean Plant.
-----Original Message-----
From: Julian Field [mailto:mailscanner at ECS.SOTON.AC.UK]
Sent: 30 May 2003 09:32
To: MAILSCANNER at JISCMAIL.AC.UK
Subject: Re: Disclaimer problem
At 08:39 30/05/2003, you wrote:
>Hello,
>
>I am currently evaluating MailScanner and have come across a small problem
>regarding signing of mail. I have added a disclaimer to all out going mail
>using a ruleset but have noticed that any mail that has an attachment but
>does not have any body text does not get signed. All other mail is signed
>correctly.
>
>I have upgraded to the latest version and started with an new
>MailScanner.conf but the problem persists.
>
>I am using Redhat8/Sendmail/F-prot.
>
>Does anyone have any idea's as to what I may be doing wrong.
>
>Thanks in advance.
>
>Dean Plant
Try applying this patch to /usr/lib/MailScanner/MailScanner/Message.pm.
Read the man page for the "patch" command if you don't know how to drive
it, saves you doing it by hand :)
It appears to work okay for me, and will be in the next stable release (due
this weekend).
--- Message.pm 2003-05-30 09:09:21.000000000 +0100
+++ Message.pm.new2 2003-05-30 09:24:43.000000000 +0100
@@ -1447,6 +1447,7 @@
# If multipart, try to sign our first part
if ($top->is_multipart) {
+ my $sigcounter = 0;
# JKF Signed and encrypted multiparts must not be touched.
# JKF Instead put the sig in the epilogue. Breaks the RFC
# JKF but in a harmless way.
@@ -1456,18 +1457,33 @@
@signature = map { "$_\n" } split(/\n/, $signature);
unshift @signature, "\n";
$top->epilogue(\@signature);
- return;
+ return 1;
}
- $this->SignCleanEntity($top->parts(0));
- $this->SignCleanEntity($top->parts(1))
+ $sigcounter += $this->SignCleanEntity($top->parts(0));
+ $sigcounter += $this->SignCleanEntity($top->parts(1))
if $top->head and $top->effective_type =~ /multipart\/alternative/i;
- return;
+
+ if ($sigcounter == 0) {
+ # If we haven't signed anything by now, it must be a multipart
+ # message containing only things we can't sign. So add a text/plain
+ # section on the front and sign that.
+ my $text = $this->ReadVirusWarning('inlinetextsig') . "\n\n";
+ my $newpart = build MIME::Entity
+ Type => 'text/plain',
+ Disposition => 'inline',
+ Data => $text,
+ Encoding => 'quoted-printable',
+ Top => 0;
+ $top->add_part($newpart, 0);
+ $sigcounter = 1;
+ }
+ return $sigcounter;
}
$MimeType = $top->head->mime_type if $top->head;
- return unless $MimeType =~ m{text/}i; # Won't sign non-text message.
+ return 0 unless $MimeType =~ m{text/}i; # Won't sign non-text message.
# Won't sign attachments.
- return if $top->head->mime_attr('content-disposition') =~ /attachment/i;
+ return 0 if $top->head->mime_attr('content-disposition') =~ /attachment/i;
# Get body data as array of newline-terminated lines
$top->bodyhandle or return undef;
@@ -1489,6 +1505,9 @@
$io->print("\n$signature\n");
}
$io->close;
+
+ # We signed something
+ return 1;
}
--
Julian Field
www.MailScanner.info
MailScanner thanks transtec Computers for their support
-------------- next part --------------
Registered Office: Roke Manor Research Ltd, Siemens House, Oldbury, Bracknell,
Berkshire. RG12 8FZ
The information contained in this e-mail and any attachments is confidential to Roke
Manor Research Ltd and must not be passed to any third party without permission. This
communication is for information only and shall not create or change any contractual
relationship.
More information about the MailScanner
mailing list