Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Patch for Mail::ClamAV (modern clamav versions)

by cavac (Curate)
on Jan 30, 2019 at 13:44 UTC ( #1229166=perlquestion: print w/replies, xml ) Need Help??

cavac has asked for the wisdom of the Perl Monks concerning the following question:

This isn't so much a question as to provide others with an answer/solution. RT didn't work for me today for Mail::ClamAV and "Meditations" didn't feel like the right place to post this.

Mail::ClamAV has a long standing bug with checking the version of the installed clamav binary. The bug is in how the version strings are compared.

I wrote a patch to fix this (needs another pair of eyes, though), here it is:

diff -ur Mail-ClamAV-0.29-0/ClamAV.pm Mail-ClamAV-0.30-0/ClamAV.pm --- Mail-ClamAV-0.29-0/ClamAV.pm 2019-01-30 14:10:41.676672369 +010 +0 +++ Mail-ClamAV-0.30-0/ClamAV.pm 2019-01-30 14:12:55.505658002 +010 +0 @@ -7,7 +7,7 @@ our $VERSION; BEGIN { - $VERSION = '0.29'; + $VERSION = '0.30'; } # guard against memory errors not being reported Only in Mail-ClamAV-0.30-0: config.pl diff -ur Mail-ClamAV-0.29-0/Makefile.PL Mail-ClamAV-0.30-0/Makefile.PL --- Mail-ClamAV-0.29-0/Makefile.PL 2019-01-30 14:10:41.680672399 +0 +100 +++ Mail-ClamAV-0.30-0/Makefile.PL 2019-01-30 14:25:22.283191107 +0 +100 @@ -51,7 +51,12 @@ } my $clver = get_cl_version(); - return warn_cl_version_bad() if $clver lt $minclversion; + + my ($thismajor, $thisminor, $thispatch) = split/\./, $clver; + my ($minmajor, $minminor, $minpatch) = split/\./, $minclversion; + if($thismajor < $minmajor || ($thismajor == $minmajor && $thismin +or < $minmajor) || (thismajor == $minmajor && $thisminor == $minminor + && $thispatch < $minpatch)) { + return warn_cl_version_bad($clver); + } my $inc = get_cl_inc_paths(); my $libs = get_cl_libs(); @@ -87,7 +92,8 @@ } sub warn_cl_version_bad { - warn "The clamav version you are using is too old. Please upgrade + to at least $minclversion\n"; + my $clver = shift; + warn "The clamav version ($clver) you are using is too old. Pleas +e upgrade to at least $minclversion\n"; return 0; } diff -ur Mail-ClamAV-0.29-0/META.yml Mail-ClamAV-0.30-0/META.yml --- Mail-ClamAV-0.29-0/META.yml 2019-01-30 14:10:41.680672399 +0100 +++ Mail-ClamAV-0.30-0/META.yml 2019-01-30 14:12:42.761564062 +0100 @@ -1,6 +1,6 @@ --- #YAML:1.0 name: Mail-ClamAV -version: 0.29 +version: 0.30 abstract: Perl extension for the clamav virus scanner license: ~ author: @@ -11,7 +11,7 @@ provides: Mail::ClamAV: file: ClamAV.pm - version: 0.29 + version: 0.30 no_index: directory: - Inline

Note: I contacted the maintainer of the package. But i'm not too hopeful, last update of Mail::ClamAV was 2009.

perl -e 'use MIME::Base64; print decode_base64("4pmsIE5ldmVyIGdvbm5hIGdpdmUgeW91IHVwCiAgTmV2ZXIgZ29ubmEgbGV0IHlvdSBkb3duLi4uIOKZqwo=");'

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1229166]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2020-05-31 17:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (175 votes). Check out past polls.

    Notices?