aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunStroke74 <andrey.b.nikitin@gmail.com>2014-12-27 21:45:14 +0500
committerSunStroke74 <andrey.b.nikitin@gmail.com>2014-12-27 21:45:14 +0500
commit676e6e803ffd82670c5d25e8803bca8ce5da590a (patch)
treed5163d2e3161195c733aa78950370416296e8665
parentbfab6f2300dccf54e696bb2e98c2794c58c4a046 (diff)
downloadpfsense-packages-676e6e803ffd82670c5d25e8803bca8ce5da590a.tar.gz
pfsense-packages-676e6e803ffd82670c5d25e8803bca8ce5da590a.tar.bz2
pfsense-packages-676e6e803ffd82670c5d25e8803bca8ce5da590a.zip
Added ability to change ClamAV mode from GUI
Solves situation when "save" needs to be pressed twice.
-rw-r--r--config/havp/havp.inc14
1 files changed, 8 insertions, 6 deletions
diff --git a/config/havp/havp.inc b/config/havp/havp.inc
index 6c26a0d4..8118f695 100644
--- a/config/havp/havp.inc
+++ b/config/havp/havp.inc
@@ -48,8 +48,7 @@ if(!function_exists("filter_configure"))
define('HV_DEBUG', 'false');
# use Clamd daemon (another - use libclam)
-$use_clamd_mode = $config['installedpackages']['havp']['config'][0]['use_clamd'];
-define('HV_USE_CLAMD', $use_clamd_mode);
+# define('HV_USE_CLAMD', 'true');
define('HV_CLAMD_TCPSOCKET', 'true');
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -152,6 +151,7 @@ define('HV_SCANTEMPFILE', 'hv_scan_tempfile');
# XML fields
# ------------------------------------------------------------------------------
define('F_ENABLE', 'enable');
+define('F_USECLAMD', 'useclamd');
define('F_PROXYMODE', 'proxymode');
define('F_PROXYINTERFACE', 'proxyinterface');
define('F_PROXYBINDIFACE', 'proxybindiface'); # internal var
@@ -516,6 +516,8 @@ function havp_convert_pfxml_xml()
# === GUI Fields ===
$havp_config[F_ENABLE] = ( $pfconf[F_ENABLE] === 'on' ? 'true' : 'false' );
+ # ClamAV mode
+ $havp_config[F_USECLAMD] = $pfconf[F_USECLAMD];
# proxy
$havp_config[F_PROXYMODE] = ( !empty($pfconf[F_PROXYMODE]) ? $pfconf[F_PROXYMODE] : 'standard' );
# ToDo: add check squid transparent
@@ -711,9 +713,9 @@ function havp_config_havp()
$conf[] = "MAXDOWNLOADSIZE {$havp_config[F_MAXDOWNLOADSIZE]}";
#
$conf[] = "\n# ClamAV Library Scanner (libclamav) ";
- $conf[] = "ENABLECLAMLIB " . (HV_USE_CLAMD !== 'true' ? "true" : "false");
+ $conf[] = "ENABLECLAMLIB " . ($havp_config[F_USECLAMD] !== 'true' ? "true" : "false");
# use clamd, if configured
- if (HV_USE_CLAMD === 'true') {
+ if ($havp_config[F_USECLAMD] === 'true') {
$conf[] = "\n# Clamd scanner (Clam daemon)";
$conf[] = "ENABLECLAMD true";
# clamd socket
@@ -1343,7 +1345,7 @@ function havp_startup_script()
$s[] = "\t# start";
$s[] = "\tif [ -z \"`{$havpchk}`\" ];then";
- if (HV_USE_CLAMD === 'true') {
+ if ($havp_config[F_USECLAMD] === 'true') {
$clampid_dir = HVDEF_CLAM_RUNDIR;
$s[] = "\t\t# start clamd before (to be sure)";
$s[] = "\t\t" . HVDEF_CLAM_STARTUP_SCRIPT . " start";
@@ -1564,7 +1566,7 @@ function start_antivirus_scanner($filename)
$param[] = "--max-dir-recursion=255"; # Maximum directory recursion level
$param = implode(" ", $param);
- if (HV_USE_CLAMD === 'true')
+ if ($havp_config[F_USECLAMD] === 'true')
$param = "clamdscan $param $filename"; # use clamd daemon (more quickly)
else $param = "clamscan $param $filename";