function _clamav_scan_via_daemon in ClamAV 7
Same name and namespace in other branches
- 6 clamav.inc \_clamav_scan_via_daemon()
Scan a single file using a daemon.
Parameters
String $filepath: Full filepath to the file which is to be scanned. This must be a file which is readable by the web server.
String $filename: Filename of the uploaded file (used for logging).
Return value
int one of:
1 call to _clamav_scan_via_daemon()
- clamav_scan_file in ./
clamav.inc - Scan a single file
File
- ./
clamav.inc, line 85 - clamav.inc API and helper functions for the ClamAV module.
Code
function _clamav_scan_via_daemon($filepath, $filename) {
$host = variable_get('clamav_daemon_host', CLAMAV_DEFAULT_HOST);
$port = variable_get('clamav_daemon_port', CLAMAV_DEFAULT_PORT);
// try to open a socket to clamav
$handler = $host && $port ? @fsockopen($host, $port) : FALSE;
if (!$handler) {
watchdog('clamav', 'The clamav module can not connect to the clamav daemon over TCP/IP. The uploaded file %filename could not be scanned.', array(
'%filename' => $filename,
), WATCHDOG_WARNING);
return CLAMAV_SCANRESULT_UNCHECKED;
}
return _clamav_scan_via_daemon_handler($handler, $filepath, $filename);
}