Fix clamdscan configuration handling

- Honor configured 'false' values
 - Treat 'scan_all' consistently with other options--permitting 0, 1, 'yes', or 'no' as values
This commit is contained in:
Jonathan Hall 2014-09-16 12:03:49 -05:00
parent 48bd0f3e0c
commit 9faa1e1903

View File

@ -136,10 +136,14 @@ sub register {
} }
# Set sensible defaults # Set sensible defaults
$self->{_args}{deny_viruses} ||= 'yes';
$self->{_args}{max_size} ||= 1024; $self->{_args}{max_size} ||= 1024;
$self->{_args}{scan_all} ||= 1; if ( ! defined $self->{_args}{deny_viruses} ) {
for my $setting ('deny_viruses', 'defer_on_error') { $self->{_args}{deny_viruses} = 'yes';
}
if ( ! defined $self->{_args}{scan_all} ) {
$self->{_args}{scan_all} = 1;
}
for my $setting (qw( deny_viruses defer_on_error scan_all )) {
next unless $self->{'_args'}{$setting}; next unless $self->{'_args'}{$setting};
if (lc $self->{'_args'}{$setting} eq 'no') { if (lc $self->{'_args'}{$setting} eq 'no') {
$self->{'_args'}{$setting} = 0; $self->{'_args'}{$setting} = 0;