Skip Menu |

This queue is for tickets about the File-Scan-ClamAV CPAN distribution.

Report information
The Basics
Id: 35847
Status: resolved
Priority: 0/
Queue: File-Scan-ClamAV

People
Owner: JAMTUR [...] cpan.org
Requestors: jonas [...] frukt.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: 1.93



Subject: Stream scanning using remote host
Quoting POD: Show quoted text
> Note: there is no way to connect to a clamd on another machine. > The reason for this is that clamd can only scan local files,
Actually, clamd can scan streams that are not from local files, and File::Scan::ClamAV *almost* supports this using streamscan. Show quoted text
> Plus if you are using TCP/IP clamd appears to bind to all adaptors, > so it is probably insecure. -ms
If the machine is reachable by anyone yes, but since there are firewalls (and clamd can be told not to bind to all addresses) I don't think this applies. Attached is a small diff that simply adds the option 'host' to the module. If that option is defined, _get_tcp_connection will use its value instead of localhost. This works fine here for scanning with another machine. The change is very small, but then it doesn't include the necessary POD-changes... Regards /Jonas
Subject: ClamAV.diff
--- ClamAV.pm Sat Sep 18 00:07:51 2004 +++ /usr/local/lib/perl5/site_perl/5.8.2/File/Scan/ClamAV.pm Tue May 13 18:58:53 2008 @@ -235,6 +235,7 @@ $c->close; chomp(my $r = $conn->getline); + if($r =~ /stream: (.+) FOUND/i){ @return = ('FOUND', $1); } else { @@ -410,14 +411,15 @@ sub _get_tcp_connection { my ($self, $port) = @_; $port ||= $self->{port}; + my $host = defined($self->{host}) ? $self->{host} : 'localhost'; return IO::Socket::INET->new( - PeerAddr => 'localhost', + PeerAddr => $host, PeerPort => $port, Proto => 'tcp', Type => SOCK_STREAM, Timeout => 10 - ) || $self->_seterrstr("Cannot connect to 'localhost:$port': $@"); + ) || $self->_seterrstr("Cannot connect to '$host:$port': $@"); } sub _get_unix_connection {
This is a good idea. Committed to 1.93, but have not tested it extensively. Thanks,