This file is indexed.

/usr/share/perl5/ClamAV/Config.pm is in libclamav-client-perl 0.11-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#
# ClamAV::Config class
#
# (C) 2004-2005 Julian Mehnle <julian@mehnle.net>
# $Id: Config.pm,v 1.3 2005/01/21 22:50:14 julian Exp $
#
##############################################################################

=head1 NAME

ClamAV::Config - A Perl class providing configuration information for Perl
modules related to ClamAV

=cut

package ClamAV::Config;

=head1 VERSION

0.11

=cut

our $VERSION = 0.11;

=head1 SYNOPSIS

    use ClamAV::Config;
    
    # ClamAV base configuration:
    ClamAV::Config->config_dir;
    ClamAV::Config->clamd_config_file;
    
    # clamd run-time configuration:
    ClamAV::Config->clamd_config;
    ClamAV::Config->clamd_option($option);

=cut

use warnings;
use strict;

use Error qw(:try);

use IO::File;

# Private declarations:
##############################################################################

use constant TRUE   => (0 == 0);
use constant FALSE  => not TRUE;

my $clamd_config;

# Interface:
##############################################################################

=head1 DESCRIPTION

This class provides configuration information for Perl modules related to the
ClamAV virus scanner, e.g. installation specific file system paths and run-time
configuration options.

=cut

sub clamd_option;

# Implementation:
##############################################################################

=head2 ClamAV base configuration

The following ClamAV base configuration information is provided as class
methods:

=over

=item B<config_dir>

The base configuration directory of ClamAV.

=cut

use constant config_dir             => '/etc/clamav';

=item B<clamd_config_file>

The absolute file name of the I<clamd> configuration file.

=cut

use constant clamd_config_file      => config_dir . '/clamd.conf';

=back

=head2 clamd run-time configuration

The following clamd run-time configuration information is provided as class
methods:

=over

=item B<clamd_config>

Returns all clamd run-time configuration options as a hash reference.

=cut

sub clamd_config {
    my ($self) = @_;
    
    return $clamd_config
        if $clamd_config;
    
    my $file = IO::File->new($self->clamd_config_file);
    if (not $file) {
        $clamd_config = {};
        throw ClamAV::Config::Error(
            'Could not open clamd config file "' . $self->clamd_config_file . '" for reading'
        );
    }
    
    while (my $line = $file->getline) {
        chomp($line);
        next if $line =~ /^\s*#/;
        if (not $line =~ /^\s*(\w+)(?:\s+(\S+))?\s*$/) {
            $clamd_config = {};
            throw ClamAV::Config::Error('Malformed line in clamd configuration file encountered');
        }
        $clamd_config->{$1} = (defined($2) ? $2 : TRUE);
    }
    
    return $clamd_config;
}

=item B<clamd_option($option)>

Returns the value of the specified clamd run-time configuration option.

=cut

sub clamd_option {
    my ($self, $option) = @_;
    return $self->clamd_config->{$option};
}

=back

=head1 SEE ALSO

For AVAILABILITY, SUPPORT, and LICENSE information, see
L<ClamAV::Client>.

=head1 AUTHOR

Julian Mehnle <julian@mehnle.net>

=cut

package ClamAV::Config::Error;
use base qw(Error::Simple);

package ClamAV::Config;

TRUE;

# vim:tw=79