Fix: Call of antivirus
This commit is contained in:
parent
bb58b80ce8
commit
e6a3225ae7
@ -1078,7 +1078,7 @@ NoSessionFound=الخاص بي ويبدو أن عدم السماح لقائمة
|
||||
FormToTestFileUploadForm=نموذج لاختبار تحميل الملف (وفقا لبرنامج الإعداد)
|
||||
PreviewNotAvailable=المعاينة غير متاحة
|
||||
AntiVirusCommand=المسار الكامل لقيادة مكافحة الفيروسات
|
||||
AntiVirusCommandExample=c:\Program Files (x86)\ClamWin\bin\clamscan.exe
|
||||
AntiVirusCommandExample=c:\Progra~1\ClamWin\bin\clamscan.exe
|
||||
AntiVirusParam=مزيد من المعلمات على سطر الأوامر
|
||||
AntiVirusParamExample=--database="C:\Program Files (x86)\ClamWin\lib"
|
||||
YouCanDownloadBackupFile=يمكن أن الملفات التي تم إنشاؤها الآن يمكن تحميلها
|
||||
|
||||
@ -67,7 +67,7 @@ MaxSizeForUploadedFiles=Maximum size for uploaded files (0 to disallow any uploa
|
||||
UseCaptchaCode=Use graphical code (CAPTCHA) on login page
|
||||
UseAvToScanUploadedFiles=Use anti-virus to scan uploaded files
|
||||
AntiVirusCommand= Full path to antivirus command
|
||||
AntiVirusCommandExample= Example for ClamWin: c:\Program Files (x86)\ClamWin\bin\clamscan.exe<br>Example for ClamAv: /usr/bin/clamscan
|
||||
AntiVirusCommandExample= Example for ClamWin: c:\Progra~1\ClamWin\bin\clamscan.exe<br>Example for ClamAv: /usr/bin/clamscan
|
||||
AntiVirusParam= More parameters on command line
|
||||
AntiVirusParamExample= Example for ClamWin: --database="C:\Program Files (x86)\ClamWin\lib"
|
||||
ComptaSetup=Accounting module setup
|
||||
|
||||
@ -67,7 +67,7 @@ MaxSizeForUploadedFiles= Taille maximum des documents uploadés (0 pour interdir
|
||||
UseCaptchaCode= Utilisation du code graphique (CAPTCHA) sur la page de login
|
||||
UseAvToScanUploadedFiles= Utilisation d'un anti-virus pour scanner les fichiers uploadés
|
||||
AntiVirusCommand= Chemin complet vers la commande antivirus
|
||||
AntiVirusCommandExample= Exemple pour ClamWin: c:\Program Files (x86)\ClamWin\bin\clamscan.exe<br>Exemple pour ClamAv: /usr/bin/clamscan
|
||||
AntiVirusCommandExample= Exemple pour ClamWin: c:\Progra~1\ClamWin\bin\clamscan.exe<br>Exemple pour ClamAv: /usr/bin/clamscan
|
||||
AntiVirusParam= Paramètres supplémentaire sur la ligne de commande
|
||||
AntiVirusParamExample= Exemple pour ClamWin: --database="C:\Program Files (x86)\ClamWin\lib"
|
||||
ComptaSetup= Configuration du module Comptabilité
|
||||
|
||||
@ -60,19 +60,22 @@ class AntiVir
|
||||
|
||||
$return = 0;
|
||||
|
||||
$outputfile=$conf->admin->dir_temp.'/dol_avscan_file.out.'.session_id();
|
||||
|
||||
$fullcommand=$this->getCliCommand($file);
|
||||
//$fullcommand='"c:\Program Files (x86)\ClamWin\bin\clamscan.exe" --database="C:\Program Files (x86)\ClamWin\lib" "c:\temp\aaa.txt"';
|
||||
$fullcommand.=' 2>&1'; // This is to get error output
|
||||
|
||||
$output=array();
|
||||
$return_var=0;
|
||||
$safemode=ini_get("safe_mode");
|
||||
// Create a clean fullcommand
|
||||
dol_syslog("AntiVir::dol_avscan_file Run command=".$fullcommand);
|
||||
exec($fullcommand, $output, $return_var);
|
||||
dol_syslog("AntiVir::dol_avscan_file Run command=".$fullcommand." with safe_mode ".($safe_mode?"on":"off"));
|
||||
// Run CLI command. If run of Windows, you can get return with echo %ERRORLEVEL%
|
||||
$lastline=exec($fullcommand, $output, $return_var);
|
||||
|
||||
//print "x".$lastline." - ".join(',',$output)." - ".$return_var."y";exit;
|
||||
|
||||
/*
|
||||
$outputfile=$conf->admin->dir_temp.'/dol_avscan_file.out.'.session_id();
|
||||
$handle = fopen($outputfile, 'w');
|
||||
if ($handle)
|
||||
{
|
||||
@ -150,10 +153,11 @@ class AntiVir
|
||||
if (! preg_match('/%file/',$conf->global->MAIN_ANTIVIRUS_PARAM))
|
||||
$param=$param." ".escapeshellarg(trim($file));
|
||||
|
||||
if (preg_match("/\s/",$command)) $command=escapeshellarg($command); // Use quotes on command
|
||||
if (preg_match("/\s/",$command)) $command=escapeshellarg($command); // Use quotes on command. Using escapeshellcmd fails.
|
||||
|
||||
$ret=$command.' '.$param;
|
||||
//$ret=$command.' '.$param.' 2>&1';
|
||||
//print "xx".$ret."xx";exit;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
@ -443,7 +443,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
|
||||
if ($result < 0) // If virus or error, we stop here
|
||||
{
|
||||
$reterrors=$antivir->errors;
|
||||
dol_syslog("Functions.lib::dol_move_uploaded_file File ".$file_name." KO with antivir", LOG_WARNING);
|
||||
dol_syslog('Functions.lib::dol_move_uploaded_file File "'.$src_file.'" (target name "'.$file_name.'") KO with antivirus: result='.$result.' errors='.join(',',$antivir->errors), LOG_WARNING);
|
||||
return 'ErrorFileIsInfectedWithAVirus: '.join(',',$reterrors);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user