To reproduce, set tail on ssl error log and login to the GUI.
Code: Select all
tail -F /var/log/httpd/ssl_error_log
[Wed Jan 16 17:27:24 2019] [warn] [client your.client.ip.address] PHP Warning: preg_match(): Empty regular expression in /var/www/html/mailscanner/functions.php on line 4780
[Wed Jan 16 17:27:24 2019] [warn] [client your.client.ip.address] PHP Warning: preg_match(): Empty regular expression in /var/www/html/mailscanner/functions.php on line 4780
[Wed Jan 16 17:27:24 2019] [warn] [client your.client.ip.address] PHP Warning: preg_match(): Empty regular expression in /var/www/html/mailscanner/functions.php on line 4780
[Wed Jan 16 17:27:24 2019] [warn] [client your.client.ip.address] PHP Warning: preg_match(): Empty regular expression in /var/www/html/mailscanner/functions.php on line 4780
...
...
Cause: The getVirus function loops thru the defined virusscanners, in my case clamd and sophos.
By default the VIRUS_REGEX is empty, aka not defined, since i don't use SophosSAVI, only clamd and Sophos.
line 4779 was inserted by me
4767 /**
4768 * @param string $report virus report message
4769 * @return string|null
4770 */
4771 function getVirus($report)
4772 {
4773 $match = null;
4774 if (defined('VIRUS_REGEX')) {
4775 preg_match(VIRUS_REGEX, $report, $match);
4776 } else {
4777 $scanners = explode(' ', get_conf_var('VirusScanners'));
4778 foreach ($scanners as $scanner) {
4779 #echo "$scanner)";
4780 if (preg_match(getVirusRegex($scanner), $report, $match) === 1) {
4781 break;
4782 }
4783 }
4784 }
4785 if (count($match) > 2) {
4786 return $match[2];
4787 }
4788 return $report;
4789 }
4790 /**
As I don't understand why function getVirusRegex($scanner = null) ( on line 149) didn't return the correct, scanner dependant, regex.
Can someone can explain this? With my solution there is only 1 regex for all scanners used .....
Temp solution: uncomment the Override VIRUS_REGEX
Code: Select all
vi /var/www/html/mailscanner/conf.php
// define('VIRUS_REGEX', '/(\S+) was infected by (\S+)/'); // SophosSAVI
Change to
Code: Select all
// Display Virus on message listing
define('DISPLAY_VIRUS_REPORT', true);
// Override VIRUS_REGEX??
define('VIRUS_REGEX', '/(\S+) was infected by (\S+)/'); // SophosSAVI
//define('VIRUS_REGEX', '/(.+) was infected: (\S+)/'; // Clamd