diff -urP qmail-scanner-1.13.orig/configure qmail-scanner-1.13/configure
--- qmail-scanner-1.13.orig/configure	Sun Jun 30 23:57:21 2002
+++ qmail-scanner-1.13/configure	Tue Jul 30 18:58:57 2002
@@ -28,7 +28,7 @@
 VERSION=`grep '^# Version: ' qmail-scanner-queue.template`
 VERSION=`echo $VERSION|awk '{print $NF}'`
 
-SUPPORTED_SCANNERS="sweep,sophie,vscan,trophie,uvscan,csav,antivir,kavscanner,AvpLinux,kavdaemon,AvpDaemonClient,fsav,fprot,inocucmd,ravlin,clamscan,verbose_spamassassin,fast_spamassassin"
+SUPPORTED_SCANNERS="bdc,sweep,sophie,vscan,trophie,uvscan,csav,antivir,kavscanner,AvpLinux,kavdaemon,AvpDaemonClient,fsav,fprot,inocucmd,ravlin,clamscan,verbose_spamassassin,fast_spamassassin"
 
 SILENT_VIRUSES="klez"
 
@@ -101,6 +101,7 @@
         --fix-mime) FIX_MIME=1 ; if [ "$2" != "" -a "`echo $2|grep '\-'`" = "" ] ; then  shift ; if [ "`echo $1|egrep -i '^1|^yes'`" = "" ]; then FIX_MIME="1" ; fi ;  if [ "`echo $1|egrep -i '^0|^no'`" != "" ]; then FIX_MIME="0" ; fi ; fi ;;
 	--no-QQ-check) MANUAL_INSTALL="1";;
 	--qmail-queue-binary) if [ "$2" != "" ] ; then  shift ; fi ; QMAILQUEUE_BIN="$1" ;;
+        --mime-unpacker) if [ "$2" != "" ] ; then  shift ; fi ; MIME_UNPACKER="$1" ;;
 	--install) INSTALLIT="1" ; if [ "$2" != "" -a "`echo $2|grep '\-'`" = "" ] ; then  shift ; fi ;;
         *) cat <<EOF >&2
  invalid option: $1
@@ -180,6 +181,7 @@
                           by default to help perlscanner.
   --install               Create directory paths, install perl script,
                           and change ownerships to match.
+  --mime-unpacker "reformime|ripmime"        Defaults to reformime. Allow ripmime.
 
        ****************
          Rarely Used
@@ -285,6 +287,28 @@
 
 PATH="$PATH:$QMAILDIR/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/etc/iscan:/usr/local/uvscan:/usr/lib/AntiVir:/usr/lib/uvscan:/usr/local/av:/opt/AV:/opt/AVP:/usr/local/f-prot:/usr/local/rav8/bin" export PATH
 
+if [ "$MIME_UNPACKER" != "" ]; then
+	if [ "`echo $MIME_UNPACKER |egrep -v '^(reformime|ripmime)$'`" != "" ]; then
+	    cat<<EOF
+
+
+                *************************
+
+Sorry, but your "--mime-unpacker" definition contains invalid options. 
+
+The only valid options are:
+
+reformime
+ripmime
+
+               **************************
+EOF
+	    exit
+	fi
+else
+	MIME_UNPACKER="reformime"
+fi
+
 NOTIFY_ADDRESSES="`echo $NOTIFY_ADDRESSES|sed -e 's/\"//g'  -e 's/ //g'`"
 
 if [ "$NOTIFY_ADDRESSES" = "all" ]; then
@@ -399,14 +423,15 @@
 	STRINGS="${STRINGS:-$dir/strings}"
     fi
 
+if [ "$MIME_UNPACKER" = "reformime" ]; then
     if test -x $dir/reformime
     then
-	REFORMIME_BINARY="${REFORMIME_BINARY:-$dir/reformime}"
+	UNMIME_BINARY="${UNMIME_BINARY:-$dir/reformime}"
         DD=`reformime -s1.2 -xTEST- < ./contrib/reformime-test.eml`
 	if [ "`grep hello TEST-hello.txt`" = "" ]; then
 	   echo "** FATAL ERROR ***"
 	   echo ""
-	   echo "$REFORMIME_BINARY contains bugs. Please upgrade to a release"
+	   echo "$UNMIME_BINARY contains bugs. Please upgrade to a release"
 	   echo "that post-dates Mar 22 2002 (e.g. 1.3.8)"
 	   echo ""
 	   rm -f TEST-hello.txt
@@ -414,23 +439,12 @@
 	fi
 	rm -f TEST-hello.txt
     fi    
+
     if test -x $dir/maildrop
     then
 	MAILDROP_BINARY="${MAILDROP_BINARY:-$dir/maildrop}"
-    fi    
-    if test -x $dir/unzip
-    then
-	UNZIP_BINARY="${UNZIP_BINARY:-$dir/unzip}"
-	#Now check for password support
-	touch file.zip
-	DD=`unzip -Pxxx file.zip 2>&1|grep '^Archive:'`
-	if [ "$DD" != "" ]; then
-	 UNZIP_OPTIONS="-Pxxxxx"
-	else
-	 UNZIP_OPTIONS=""
-	fi
-	rm -f file.zip
-    fi    
+    fi
+
     if test -x $dir/tnef
     then
 	TNEF_BINARY="${TNEF_BINARY:-$dir/tnef}"
@@ -450,7 +464,38 @@
 	    exit 1
 	fi
 	LANG=$OLD_LANG export LANG
+    fi
+fi
+if [ "$MIME_UNPACKER" = "ripmime" ]; then
+    if test -x $dir/ripmime
+    then
+	UNMIME_BINARY="${UNMIME_BINARY:-$dir/ripmime}"
+        DD=`ripmime -i - < ./contrib/reformime-test.eml`
+	if [ "`grep hello hello.txt`" = "" ]; then
+	   echo "** FATAL ERROR ***"
+	   echo ""
+	   echo "$UNMIME_BINARY contains bugs. Please upgrade to a newer release."
+	   echo ""
+	   rm -f hello.txt textfile*
+	   exit 1
+	fi
+	rm -f hello.txt textfile*
+    fi
+fi
+    if test -x $dir/unzip
+    then
+	UNZIP_BINARY="${UNZIP_BINARY:-$dir/unzip}"
+	#Now check for password support
+	touch file.zip
+	DD=`unzip -Pxxx file.zip 2>&1|grep '^Archive:'`
+	if [ "$DD" != "" ]; then
+	 UNZIP_OPTIONS="-Pxxxxx"
+	else
+	 UNZIP_OPTIONS=""
+	fi
+	rm -f file.zip
     fi    
+    
     if test -x $dir/uvscan 
     then
 	if [ "`echo $FIND_SCANNERS|grep ' uvscan '`" != "" ]; then
@@ -656,6 +701,16 @@
 	   fi
 	fi
     fi
+    if test -x $dir/bdc
+    then
+	if [ "`echo $FIND_SCANNERS|grep ' bdc '`" != "" ]; then
+	   if [ "`$dir/bdc  --tempdir=$PWD --arc --mail --nowarn $TMP_DIR 2>&1|grep -i test`" != "" ]; then
+	      BDC_BINARY="${BDC:-$dir/bdc}"
+	      INSTALLED_SCANNERS="$INSTALLED_SCANNERS
+bdc"
+	   fi
+	fi
+    fi
     if [ "`echo $FIND_SCANNERS|grep spamassassin`" != "" ]; then
     if test -x $dir/spamassassin
     then
@@ -836,7 +891,7 @@
     exit
 fi
 
-
+if [ "$MIME_UNPACKER" = "reformime" ]; then
 #Check version of maildrop to ensure it's not the buggy version
 
 DD="`$MAILDROP_BINARY -v 2>&1|grep '^maildrop'|grep '1\.0'`"
@@ -857,6 +912,7 @@
 EOF
     exit
 fi
+fi
 
 #Find out if their uudecoder is supported
 if [ "$UUDECODE_BINARY" != "" ]; then
@@ -942,7 +998,8 @@
      LOCAL_DOMAINS_ARRAY="`echo $LDA|sed 's/^,//g'`"
 fi
 
-if [ "$REFORMIME_BINARY" = "" ]
+if [ "$MIME_UNPACKER" = "reformime" ]; then
+if [ "$UNMIME_BINARY" = "" ]
 then
     cat<<EOF
 
@@ -959,7 +1016,7 @@
 EOF
     exit
 fi
-
+fi
 if [ "$UNZIP_BINARY" = "" ]; then
     cat<<EOF
 
@@ -990,10 +1047,10 @@
 echo "
 The following binaries and scanners were found on your system:
 "
-if [ "$REFORMIME_BINARY" != "" ]
+if [ "$UNMIME_BINARY" != "" ]
 then 
-    echo "reformime=$REFORMIME_BINARY"
-    MIMEUNPACKER="$REFORMIME_BINARY "
+    echo "mimeunpacker=$UNMIME_BINARY"
+    MIMEUNPACKER="$UNMIME_BINARY "
 fi
 if [ "$UUDECODE_BINARY" != "" ] 
 then
@@ -1077,6 +1134,11 @@
     SCANNER_ARRAY="$SCANNER_ARRAY,\"clamscan_scanner\""
 fi
 
+if [ "$BDC_BINARY" != "" ]; then
+    echo "bdc=$BDC_BINARY";
+    SCANNER_ARRAY="$SCANNER_ARRAY,\"bdc_scanner\""
+fi
+
 
 if [ "$SPAMC_BINARY" != "" ]; then
     if [ "$SPAMASSASSIN_VERSION" = "fast_spamassassin" ]; then
@@ -1215,7 +1277,7 @@
  
 . ./.locale_vars
 
-perl -p -e "s?REFORMIME_BINARY?$REFORMIME_BINARY?g;
+perl -p -e "s?UNMIME_BINARY?$UNMIME_BINARY?g;
 s?PERLRELEASE_DETAILS?$PERLRELEASE_DETAILS?g;
 s?HOST_OS?$HOST_OS?g;
 s?HOST_RELEASE?$HOST_RELEASE?g;
@@ -1251,6 +1313,7 @@
 s?INOCUCMD?$INOCUCMD?g;
 s?RAVLIN?$RAVLIN?g;
 s?CLAMSCAN?$CLAMSCAN?g;
+s?BDC_BINARY?$BDC_BINARY?g;
 s?SPAMASSASSIN_BINARY?$SPAMASSASSIN_BINARY?g;
 s?SPAMC_BINARY?$SPAMC_BINARY?g;
 s?SPAMC_OPTIONS?$SPAMC_OPTIONS?g;
diff -urP qmail-scanner-1.13.orig/qmail-scanner-queue.template qmail-scanner-1.13/qmail-scanner-queue.template
--- qmail-scanner-1.13.orig/qmail-scanner-queue.template	Mon Jul 22 00:34:22 2002
+++ qmail-scanner-1.13/qmail-scanner-queue.template	Tue Jul 30 18:58:58 2002
@@ -187,6 +187,7 @@
 my $inocucmd_binary='INOCUCMD';
 my $ravlin_binary='RAVLIN';
 my $clamscan_binary='CLAMSCAN';
+my $bdc_binary='BDC_BINARY';
 my $spamc_binary='SPAMC_BINARY';
 my $spamc_options='SPAMC_OPTIONS';
 my $spamc_subject='SPAMC_SUBJECT';
@@ -289,6 +290,8 @@
 
 if ($mimeunpacker_binary =~ /reformime/) {
   $mimeunpacker_binary .= " -x$scandir/$file_id/";
+} elsif ($mimeunpacker_binary =~ /ripmime/) {
+   $mimeunpacker_binary .= " -i - -d $scandir/$file_id/";
 }
 
   
@@ -709,12 +712,14 @@
   #append any ORIGINAL uuencoded filenames to this directory array
   #so that perlscanner can match on uuencoded filenames
   foreach $file (@allfiles,@uufile_list,@zipfile_list) {
-    #skip files that reformime generates.
+    #skip files that reformime/ripmime generates.
     #This will potentially allow baddies to smuggle files through
     #by using filenames like this... Nothing can be done about that:-(
     #Reformime generates filenames of the form:
     # 967067231.24320-X.host.name (where X is a number)
-    if ($file =~ /^[0-9]+\.[0-9]+\-[0-9]+\.|^$file_id/) {
+    #Ripmime generates filenames of the form:
+    # textfileX (where X is a number)
+    if ($file =~ /^[0-9]+\.[0-9]+\-[0-9]+\.|^$file_id|^textfile[0-9]+/) {
       &debug("p_s: skipping auto-generated file $file");
       $ps_skipfile=1;
     } else {
@@ -968,7 +973,7 @@
 sub scan_queue {
   my ($scanner,$SCANINFO,$files,$sweep_eng,$sweep_product,$dir);
   my $start_scan_time =time;
-  my ($inocucmd_eng,$inocucmd_product,$spamassassin_eng);
+  my ($inocucmd_eng,$inocucmd_product,$bdc_ver,$bdc_core,$spamassassin_eng);
   
   chdir($scandir);
   &debug("s_q: re-create the quarantine version file");
@@ -1122,6 +1127,18 @@
 	}
       }
       close(CLAMS);
+    } elsif ($scanner eq "bdc") {
+      open(BDCOP,"$bdc_binary --info|")||die "failed to call $bdc_binary --info - $!";
+      while (<BDCOP>) {
+	chomp;
+        if (/BDC(.*)v([0-9\.]+)/) {
+          $bdc_ver=$2;
+        } elsif (/CORE v([0-9\.]+)/) {
+          $bdc_core=$1;
+        }
+      }
+      $SCANINFO .= "bdc: $bdc_ver/$bdc_core. ";
+      close(BDCOP);
     } elsif ($scanner eq "spamassassin") {
       #X-Spam-Checker-Version: SpamAssassin 2.01
       open(SPAS,"$spamassassin_binary  -V |")||die "failed to call $spamassassin_binary -V - $!";
diff -urP qmail-scanner-1.13.orig/sub-bdc.pl qmail-scanner-1.13/sub-bdc.pl
--- qmail-scanner-1.13.orig/sub-bdc.pl	Thu Jan  1 01:00:00 1970
+++ qmail-scanner-1.13/sub-bdc.pl	Tue Jul 30 18:58:58 2002
@@ -0,0 +1,29 @@
+sub bdc_scanner {
+  #Bitdefender scanner
+    my($start_bdc_time)=[gettimeofday];
+    my ($DD,$bdc_status,$bdc_time,$stop_bdc_time);
+    my $OK_CHARS='-a-zA-Z0-9_.@\n\s\/\:';
+
+    &debug("bdc: starting scan of directory \"$scandir/$file_id\"...");
+    &debug("run  $bdc_binary --arc --mail --nowarn  $scandir/$file_id  2>&1");
+    $DD=`$bdc_binary  --arc --mail --nowarn  $scandir/$file_id   2>&1`;
+    $bdc_status=($? >> 8);
+    $DD =~ s/\[\d(\;\d+)+m//go;
+    $DD =~ s/[^$OK_CHARS]//go;
+    &debug("--output of Bitdefender bdc was:\n$DD--");
+    if ($DD =~ /infected: (.*)/s) {
+	$quarantine_description=$1;
+	my @quar_desc=split(/\n/, $quarantine_description);
+	$quarantine_description=$quar_desc[0];
+	&debug("bdc_scanner: There be a virus! ($quarantine_description)");
+	($quarantine_event=$quarantine_description)=~s/\s/_/g;
+	$quarantine_event="BDC:".substr($quarantine_event,0,$QE_LEN);
+	$description .= "\n---BDC results ---\n$DD";
+    } elsif ($bdc_status > 0) {
+	&debug("bdc_scanner: Whoops! Something went wrong - requeue");
+	&tempfail("corrupt or unknown Bdc scanner/resource problems - exit status $bdc_status");
+    }
+    $stop_bdc_time=[gettimeofday];
+    $bdc_time = tv_interval ($start_bdc_time, $stop_bdc_time);
+    &debug("bdc: finished scan of dir \"$scandir/$file_id\" in $bdc_time secs");
+}
