Option to clamdscan to scan all messages, even if there are no attachments

git-svn-id: https://svn.perl.org/qpsmtpd/trunk@815 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
Robert Spier 2007-11-17 07:55:32 +00:00
parent c5dd26b6af
commit 53a5fd60d9

View File

@ -67,6 +67,10 @@ a header to the message with the virus results.
The maximum size, in kilobytes, of messages to scan; defaults to 128k. The maximum size, in kilobytes, of messages to scan; defaults to 128k.
=item B<scan_all>
Scan all messages, even if there are no attachments
=back =back
=head1 REQUIREMENTS =head1 REQUIREMENTS
@ -101,6 +105,7 @@ sub register {
$self->{"_clamd"}->{"clamd_socket"} ||= "/tmp/clamd"; $self->{"_clamd"}->{"clamd_socket"} ||= "/tmp/clamd";
$self->{"_clamd"}->{"deny_viruses"} ||= "yes"; $self->{"_clamd"}->{"deny_viruses"} ||= "yes";
$self->{"_clamd"}->{"max_size"} ||= 128; $self->{"_clamd"}->{"max_size"} ||= 128;
$self->{"_clamd"}->{"scan_all"} ||= 0;
} }
sub hook_data_post { sub hook_data_post {
@ -115,7 +120,8 @@ sub hook_data_post {
# Ignore non-multipart emails # Ignore non-multipart emails
my $content_type = $transaction->header->get('Content-Type'); my $content_type = $transaction->header->get('Content-Type');
$content_type =~ s/\s/ /g if defined $content_type; $content_type =~ s/\s/ /g if defined $content_type;
unless ( $content_type unless ( $self->{"_clamd"}-{"scan_all"}
|| $content_type
&& $content_type =~ m!\bmultipart/.*\bboundary="?([^"]+)!i ) && $content_type =~ m!\bmultipart/.*\bboundary="?([^"]+)!i )
{ {
$self->log( LOGNOTICE, "non-multipart mail - skipping" ); $self->log( LOGNOTICE, "non-multipart mail - skipping" );