#
# Symantec CarrierScan via Symantec CommandLineScanner
# TODO: avoid using CommandLineScanner by writing an own perl client
#

if ($cscmdline) {
    do_log(2, "Using $cscmdline");
    chop($output = `$cscmdline -a scan -i 1 -v -s $scs_host:$scs_port $TEMPDIR/parts`);
    do_log(2,$output);
    if ($output =~ /\nInfected: /) {		# no errors, virus discovered
        $scanner_errors = 0;
        @virusname = ($output =~ /Info:\s+(.+)/g);
	return 1;  # 'true' indicates virus found and stops further checking
    } elsif ($output =~ /Files Infected: 0/) {	     # no errors, no viruses found
	$scanner_errors = 0;
    } elsif ($output =~ /\n\*+ ERROR!/) {
        my @error_reason = ($output =~ /\n\*+ ERROR!\s+ (.+)/g);
	@error_reason = (undef) if !@error_reason;  # just in case: make list nonnil
	do_log(0, "Virus scanner failure: Symantec Carrier Scan - " . shift @error_reason);
    }
}
