From 55fd180cf4450ab5142069169eefc14056798d88 Mon Sep 17 00:00:00 2001 From: Regis Houssin <regis@dolibarr.fr> Date: Sun, 21 Oct 2007 20:40:44 +0000 Subject: [PATCH] Test d'utilisation de php5-clamavlib --- htdocs/admin/security_other.php | 2 +- htdocs/docsoc.php | 1 + htdocs/langs/en_US/admin.lang | 1 + htdocs/langs/en_US/other.lang | 1 + htdocs/langs/fr_FR/admin.lang | 1 + htdocs/langs/fr_FR/other.lang | 1 + htdocs/lib/functions.inc.php | 21 +++++++++++++-------- 7 files changed, 19 insertions(+), 9 deletions(-) diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php index 87522846cc8..b949790ab22 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -188,7 +188,7 @@ print "<tr ".$bc[$var].">"; print '<td colspan="3">'.$langs->trans("UseAvToScanUploadedFiles"); if($conf->global->MAIN_USE_AVSCAN == 1) { - print '<br>'; + print ' : '; // Clamav if (function_exists("cl_scanfile")) { diff --git a/htdocs/docsoc.php b/htdocs/docsoc.php index 903cacefeeb..7225978356b 100644 --- a/htdocs/docsoc.php +++ b/htdocs/docsoc.php @@ -68,6 +68,7 @@ if ( $_POST["sendit"] && $conf->upload != 0) } else { + // Fichier infect� par un virus $mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWith",$result).'</div>'; } } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 43928d9e62e..36bdcf4cb94 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -35,6 +35,7 @@ MustBeLowerThanPHPLimit=Note: your PHP limits upload size to <b>%s</b> %s, whate NoMaxSizeByPHPLimit=Note: No limit are built in your PHP MaxSizeForUploadedFiles=Maximum size for uploaded files (0 to disallow any upload) UseCaptchaCode=Use graphical code on logon page +UseAvToScanUploadedFiles=Use anti-virus to scan uploaded files ComptaSetup=Accounting module setup UserSetup=Users' management setup MenuSetup=Menus management setup diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index 6c51ca148fc..e18df43f4f2 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -81,6 +81,7 @@ SendNewPasswordDesc=This form allows you to request a new passord. It will be se BackToLoginPage=Back to login page AuthenticationDoesNotAllowSendNewPassword=Authentication mode is <b>%s</b>.<br>In this mode, Dolibarr can't know nor change your password.<br>Contact your system administrator if you want to change your password. EnableGDLibraryDesc=Install or enable GD library with your PHP for use this option. +EnablePhpAVModuleDesc=You need to install a module compatible with your anti-virus. (Clamav : php4-clamavlib ou php5-clamavlib) ##### Webcal ##### LoginWebcal=Login for Webcalendar AddCalendarEntry=Add entry in calendar diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 0d7ce61cb85..4212d783403 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -35,6 +35,7 @@ MustBeLowerThanPHPLimit=Remarque: Votre PHP limite naturellement la taille NoMaxSizeByPHPLimit=Aucune limite interne � votre serveur PHP MaxSizeForUploadedFiles=Taille maximum des documents upload�s (0 pour interdire l'upload) UseCaptchaCode=Utilisation du code graphique sur la page de login +UseAvToScanUploadedFiles=Utilisation d'un anti-virus pour scanner les fichiers upload�s ComptaSetup=Configuration du module Comptabilit� UserSetup=Configuration gestion des utilisateurs MenuSetup=Administration des menus par base de donn�es diff --git a/htdocs/langs/fr_FR/other.lang b/htdocs/langs/fr_FR/other.lang index 6d5b852452b..cfd45c0ce62 100644 --- a/htdocs/langs/fr_FR/other.lang +++ b/htdocs/langs/fr_FR/other.lang @@ -81,6 +81,7 @@ SendNewPasswordDesc=Ce formulaire permet d'envoyer un nouveau mot de passe. Il s BackToLoginPage=Retour page de connexion AuthenticationDoesNotAllowSendNewPassword=Le mode d'authentification de Dolibarr est configur� � "<b>%s</b>".<br>Dans ce mode, Dolibarr n'a pas la possibilit� de connaitre ni modifier votre mot de passe.<br>Contacter votre administrateur pour connaitre les modalit�s de changement. EnableGDLibraryDesc=Vous devez activer ou installer la librairie GD avec votre PHP pour pouvoir activer cette option. +EnablePhpAVModuleDesc=Vous devez installer un module PHP compatible avec votre anti-virus. (Clamav : php4-clamavlib ou php5-clamavlib) ##### Webcal ##### LoginWebcal=Login Webcalendar AddCalendarEntry=Ajouter entr�e dans le calendrier diff --git a/htdocs/lib/functions.inc.php b/htdocs/lib/functions.inc.php index 108624e8a22..776c5b120b3 100644 --- a/htdocs/lib/functions.inc.php +++ b/htdocs/lib/functions.inc.php @@ -2079,21 +2079,26 @@ function dol_delete_dir_recursive($dir,$count=0) } /** - \brief Scan les fichiers avec Clamav + \brief Scan les fichiers avec un anti-virus \param file Fichier a scanner \return malware Nom du virus si infect� sinon retourne "null" */ function dol_avscan_file($file) { $malware = ''; - $maxreclevel = 5 ; // maximal recursion level - $maxfiles = 1000; // maximal number of files to be scanned within archive - $maxratio = 200; // maximal compression ratio - $archivememlim = 0; // limit memory usage for bzip2 (0/1) - $maxfilesize = 10485760; // archived files larger than this value (in bytes) will not be scanned + + // Clamav + if (function_exists("cl_scanfile")) + { + $maxreclevel = 5 ; // maximal recursion level + $maxfiles = 1000; // maximal number of files to be scanned within archive + $maxratio = 200; // maximal compression ratio + $archivememlim = 0; // limit memory usage for bzip2 (0/1) + $maxfilesize = 10485760; // archived files larger than this value (in bytes) will not be scanned - cl_setlimits($maxreclevel, $maxfiles, $maxratio, $archivememlim, $maxfilesize); - $malware = cl_scanfile($file); + cl_setlimits($maxreclevel, $maxfiles, $maxratio, $archivememlim, $maxfilesize); + $malware = cl_scanfile($file); + } return $malware; } -- GitLab