Source: havp
Version: 0.92a-4
Severity: important
tags: patch

havp does not compile against new clamav. The patch attached does solve
the issue.

Sebastian
From: Sebastian Andrzej Siewior <sebast...@breakpoint.cc>
Date: Tue, 29 Jan 2019 23:21:02 +0100
Subject: [PATCH] havp: Update to clamav 0.101
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The API changed slightly: The cl_scanfile() expects now a struct which
options set. CL_SCAN_GENERAL_ALLMATCHES enables all-match mode.
The ~0 for parse enables all possible parses like PE/PDF/…
The heuristic part (which needs to be enabled) matches to the old
behaviour which blocked encrypted archives or doc files.

Signed-off-by: Sebastian Andrzej Siewior <sebast...@breakpoint.cc>
---
 havp/scanners/clamlibscanner.cpp | 22 +++++++++++++++++-----
 havp/scanners/clamlibscanner.h   |  2 +-
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/havp/scanners/clamlibscanner.cpp b/havp/scanners/clamlibscanner.cpp
index f851552..0abd5b0 100644
--- a/havp/scanners/clamlibscanner.cpp
+++ b/havp/scanners/clamlibscanner.cpp
@@ -204,7 +204,7 @@ int ClamLibScanner::ReloadDatabase()
 string ClamLibScanner::Scan( const char *FileName )
 {
 #ifdef CL_INIT_DEFAULT
-    int ret = cl_scanfile(FileName, &virname, NULL, engine, scanopts);
+    int ret = cl_scanfile(FileName, &virname, NULL, engine, &cl_options);
 #else
     int ret = cl_scanfile(FileName, &virname, NULL, engine, &limits, scanopts);
 #endif
@@ -280,20 +280,32 @@ ClamLibScanner::ClamLibScanner()
     }
 
     //Set scanning options
-    scanopts = CL_SCAN_STDOPT;
+    memset(&cl_options, 0, sizeof(struct cl_scan_options));
+
+    cl_options.general = CL_SCAN_GENERAL_ALLMATCHES;
+    cl_options.parse = ~0;
+
+    /* scanopts = CL_SCAN_STDOPT; */
 
     if ( Params::GetConfigBool("CLAMBLOCKMAX") )
     {
-        scanopts = scanopts | CL_SCAN_BLOCKMAX;
+        /* cl_options = cl_options | CL_SCAN_BLOCKMAX; */
+	cl_options.heuristic |= CL_SCAN_HEURISTIC_EXCEEDS_MAX;
     }
     if ( Params::GetConfigBool("CLAMBLOCKENCRYPTED") )
     {
-        scanopts = scanopts | CL_SCAN_BLOCKENCRYPTED;
+        /* scanopts = scanopts | CL_SCAN_BLOCKENCRYPTED; */
+	cl_options.heuristic |= CL_SCAN_HEURISTIC_ENCRYPTED_ARCHIVE;
+	cl_options.heuristic |= CL_SCAN_HEURISTIC_ENCRYPTED_DOC;
     }
     if ( Params::GetConfigBool("CLAMBLOCKBROKEN") )
     {
-        scanopts = scanopts | CL_SCAN_BLOCKBROKEN;
+        /* scanopts = scanopts | CL_SCAN_BLOCKBROKEN; */
+	cl_options.heuristic |= CL_SCAN_HEURISTIC_BROKEN;
+
     }
+    if (cl_options.heuristic != 0)
+	    cl_options.general |= CL_SCAN_GENERAL_HEURISTICS;
 
     //Set up archive limits
 #ifndef CL_INIT_DEFAULT
diff --git a/havp/scanners/clamlibscanner.h b/havp/scanners/clamlibscanner.h
index f9c63e6..8d2f952 100644
--- a/havp/scanners/clamlibscanner.h
+++ b/havp/scanners/clamlibscanner.h
@@ -42,7 +42,7 @@ struct cl_limits limits;
 struct cl_stat dbstat;
 char dbdir[255];
 
-int scanopts;
+struct cl_scan_options cl_options;
 
 public:
 
-- 
2.20.1

Reply via email to