Comment 2 for bug 1813962

Revision history for this message
Mathew Yanovsky (mathew-yanovsky) wrote :

I found a thread about the same issue on Freebsd Bugzilla forum:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=235002
They provided a patch for cyrusimap/cyrus-imapd that I borrowed (see below) and it worked for me, I was able to build ecap_clamav_adapter after modifying ClamAv.cc
cyrusimap/cyrus-imapd patch that I used a reference:
https://github.com/cyrusimap/cyrus-imapd/commit/09b5bf11e12185727d53a6ae06d71a767952a537#diff-e162ed934ed89d2014e496fc1961be01

This will only work with clamav-0.101.0 and above.

Patch itself:

--- ClamAv.cc.orig 2019-02-09 22:44:27.770356182 -0500
+++ ClamAv.cc.patched 2019-02-09 23:41:41.963098901 -0500
@@ -44,7 +44,12 @@
     // We assume that cl_*() functions used here are threadsafe.

     const char *virname = 0;
- const int eScanResult = cl_scanfile(answer.fileName.c_str(), &virname, 0, engine, CL_SCAN_STDOPT);
+ static struct cl_scan_options options;
+
+ memset(&options, 0, sizeof(struct cl_scan_options));
+ options.parse |= ~0; /* enable all parsers */
+
+ const int eScanResult = cl_scanfile(answer.fileName.c_str(), &virname, 0, engine, &options);

     switch (eScanResult) {
     case CL_CLEAN: