--- mimedefang.pl.orig	2003-08-02 15:02:43.000000000 +0200
+++ mimedefang.pl	2003-08-02 17:14:14.000000000 +0200
@@ -2860,6 +2860,91 @@
 }
 
 #***********************************************************************
+# %PROCEDURE: entity_contains_virus_bdc
+# %ARGUMENTS:
+#  entity -- a MIME entity
+# %RETURNS:
+#  1 if entity contains a virus as reported by Bitdefender; 0 otherwise.
+# %DESCRIPTION:
+#  Runs the Bitdefender program on the entity. (http://www.bitdefender.com)
+#***********************************************************************
+sub entity_contains_virus_bdc ($) {
+
+    unless($Features{'Virus:BDC'}) {
+	md_syslog('err', "$MsgID: Bitdefender not installed on this system");
+	return (wantarray ? (1, 'not-installed', 'tempfail') : 1);
+    }
+
+    my($entity) = @_;
+    my($body) = $entity->bodyhandle;
+    if (!defined($body)) {
+	return (wantarray ? (0, 'ok', 'ok') : 0);
+    }
+
+    # Get filename
+    my($path) = $body->path;
+    if (!defined($path)) {
+	return (wantarray ? (999, 'swerr', 'tempfail') : 1);
+    }
+
+    if (! ($path =~ m+^/+)) {
+        $path = $CWD . "/" . $path;
+    }
+ 
+    # Run bdc
+    my($code, $category, $action) =
+	run_virus_scanner($Features{'Virus:BDC'} . " $path --all --mail 2>&1");
+    if ($action ne 'proceed') {
+	return (wantarray ? ($code, $category, $action) : $code);
+    }
+    return (wantarray ? interpret_bdc_code($code) : $code);
+}
+
+#***********************************************************************
+# %PROCEDURE: message_contains_virus_bdc
+# %ARGUMENTS:
+#  Nothing
+# %RETURNS:
+#  1 if any file in the working directory contains a virus
+# %DESCRIPTION:
+#  Runs the Bitdefender program on the working directory
+#***********************************************************************
+sub message_contains_virus_bdc () {
+
+    unless($Features{'Virus:BDC'}) {
+	md_syslog('err', "$MsgID: Bitdefender not installed on this system");
+	return (wantarray ? (1, 'not-installed', 'tempfail') : 1);
+    }
+
+    # Run bdc
+    my($code, $category, $action) =
+	run_virus_scanner($Features{'Virus:BDC'} . " $CWD/Work --all --mail 2>&1");
+    return (wantarray ? interpret_bdc_code($code) : $code);
+}
+
+sub interpret_bdc_code ($) {
+    my($code) = @_;
+
+    md_syslog('err', "$CurrentVirusScannerMessage");
+
+    # OK
+#    return ($code, 'ok', 'ok') if ($code == 0);
+
+    if ($CurrentVirusScannerMessage =~ qr/^Infected files *:0(?!\d)/ or
+        $CurrentVirusScannerMessage =~ qr/^(?:Infected files|Identified viruses|Suspect files) *:0*[1-9]/ or
+        $CurrentVirusScannerMessage =~ m/(?:suspected|infected)\: (.*)/) {
+	$VirusName = $1
+	    if ($CurrentVirusScannerMessage =~ m/(?:suspected|infected)\: (\S+)\033/);
+	return ($code, 'virus', 'quarantine');
+    } else {
+    	return (0, 'ok', 'ok');
+    }
+
+    # All other codes should not happen
+    return ($code, 'swerr', 'tempfail');
+}
+
+#***********************************************************************
 # %PROCEDURE: entity_contains_virus_vexira
 # %ARGUMENTS:
 #  entity -- a MIME entity
