diff -uar qmail-scanner-1.16.old/configure qmail-scanner-1.16/configure
--- qmail-scanner-1.16.old/configure	Mon Feb 10 21:03:37 2003
+++ qmail-scanner-1.16/configure	Thu Feb 27 12:50:30 2003
@@ -84,6 +84,7 @@
 USERNAME="$USER"
 MANUAL_INSTALL="0"
 INSTALLIT="0"
+SA_QUARANTINE="0"
 
 while [ -n "$1" ]
 do
@@ -108,6 +109,7 @@
 	--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" ;;
+	--sa-quarantine) if [ "$2" != "" ] ; then  shift ; fi ; SA_QUARANTINE="$1" ;;
 	--install) INSTALLIT="1" ; if [ "$2" != "" -a "`echo $2|grep '\-'`" = "" ] ; then  shift ; fi ;;
         *) cat <<EOF >&2
  invalid option: $1
@@ -192,6 +194,9 @@
                           and change ownerships to match.
   --mime-unpacker "reformime"        Defaults to reformime.
 
+  --sa-quarantine ?       Spam messages over this score should be quarantined.
+                          Only relevant if SpamAssassin is used. Score of 0 
+			  means deliver all messages. Defaults to 0.
        ****************
          Rarely Used
        ****************
@@ -818,7 +823,7 @@
 
 MAILDOMAIN=${MAILDOMAIN:-$FQDN}
 LOCAL_DOMAINS_ARRAY=${LOCAL_DOMAINS_ARRAY:-$MAILDOMAIN}
-CMDLINE="$0 --spooldir $AS_QQ --qmaildir $QMAILDIR --bindir $BINDIR --qmail-queue-binary $QMAILQUEUE_BIN  --admin $USERNAME --domain $MAILDOMAIN --notify $NOTIFY_ADDRESSES --local-domains $LOCAL_DOMAINS_ARRAY --silent-viruses $SILENT_VIRUSES --lang $QSLANG --debug $DEBUG_LEVEL --unzip $FORCE_UNZIP --add-dscr-hdrs $DESCRIPTIVE_HEADERS --archive $ARCHIVEIT --redundant $REDUNDANT --log-details $LOG_DETAILS --fix-mime $FIX_MIME  --scanners \"$SCANNERS\""
+CMDLINE="$0 --spooldir $AS_QQ --qmaildir $QMAILDIR --bindir $BINDIR --qmail-queue-binary $QMAILQUEUE_BIN  --admin $USERNAME --domain $MAILDOMAIN --notify $NOTIFY_ADDRESSES --local-domains $LOCAL_DOMAINS_ARRAY --silent-viruses $SILENT_VIRUSES --lang $QSLANG --debug $DEBUG_LEVEL --unzip $FORCE_UNZIP --add-dscr-hdrs $DESCRIPTIVE_HEADERS --archive $ARCHIVEIT --redundant $REDUNDANT --log-details $LOG_DETAILS --fix-mime $FIX_MIME --sa-quarantine $SA_QUARANTINE  --scanners \"$SCANNERS\""
 
 
 
@@ -1186,6 +1191,12 @@
 
 SCANNER_ARRAY=`echo $SCANNER_ARRAY|sed 's/^,//g'`
 
+# If spamassassin is not found set SA_QUARANTINE back to 0
+if [ "`echo $SCANNER_ARRAY|grep -v 'spamassassin'`" != "" ]; then
+    SA_QUARANTINE="0"
+fi
+
+
 echo ""
 echo "Qmail-Scanner details."
 echo ""
@@ -1256,6 +1267,10 @@
 echo "silent-viruses=$FIND_SILENT_VIRUSES_ARRAY"
 echo "scanners=$SCANNER_ARRAY"
 
+if [ "$SA_QUARANTINE" != "0" ]; then
+    echo "sa-quarantine=$SA_QUARANTINE"
+fi
+
 SCANNER_ARRAY="`echo $SCANNER_ARRAY|sed -e 's/fast_spamassassin/spamassassin/g' -e 's/verbose_spamassassin/spamassassin/g'`"
 cat<<EOF
 
@@ -1375,6 +1390,7 @@
 s?REDUNDANT?$REDUNDANT?g;
 s?LOG_DETAILS?$LOG_DETAILS?g;
 s?FIX_MIME?$FIX_MIME?g;
+s?SA_QUARANTINE?$SA_QUARANTINE?g;
 s?LOCALE_sender_subject?$LOCALE_sender_subject?g;
 s?LOCALE_recips_subject?$LOCALE_recips_subject?g;
 s?LOCALE_attention?$LOCALE_attention?g;
diff -uar qmail-scanner-1.16.old/qmail-scanner-queue.template qmail-scanner-1.16/qmail-scanner-queue.template
--- qmail-scanner-1.16.old/qmail-scanner-queue.template	Thu Feb 27 13:00:19 2003
+++ qmail-scanner-1.16/qmail-scanner-queue.template	Thu Feb 27 11:51:56 2003
@@ -148,6 +148,11 @@
 my $log_details="LOG_DETAILS";
 
 
+#Spam messages over this score should be quarantined.
+#Only relevant if SpamAssassin is used. Score of 0
+#means deliver all messages. Defaults to 0.
+my $sa_quarantine="SA_QUARANTINE";
+
 #Full path to file in which virus-scanner versioning info is kept
 my $versionfile="$scandir/qmail-scanner-queue-version.txt";
 
diff -uar qmail-scanner-1.16.old/sub-spamassassin.pl qmail-scanner-1.16/sub-spamassassin.pl
--- qmail-scanner-1.16.old/sub-spamassassin.pl	Thu Dec  5 00:33:48 2002
+++ qmail-scanner-1.16/sub-spamassassin.pl	Thu Feb 27 14:24:26 2003
@@ -41,10 +41,20 @@
     $tag_score .= "SA:0($sa_score/$sa_max):";
     $sa_comment = "No, hits=$sa_score required=$sa_max" if ($spamc_options =~ /\-c/);
   } else {
-    $tag_score .= "SA:1($sa_score/$sa_max):";
-    $sa_comment = "Yes, hits=$sa_score required=$sa_max" if ($spamc_options =~ /\-c/);
-    &debug("SA: yup, this smells like SPAM");
-  }	
+    # If sa_quarantine is set and is greater than the spam threshold (sa_max),
+    # then compare sa_quarantine to the current score and quarantine if necessary,
+    # otherwise tag the message as normal.
+    if ( $sa_quarantine && ($sa_quarantine>$sa_max) && ($sa_quarantine<$sa_score) ) {
+	$destring="problem";
+	$quarantine_description="SPAM exceeds quarantine threshold" if (!$quarantine_description);
+	$quarantine_event="Policy:SPAM";
+	$description .= "\n---perlscanner results ---\n$destring '$quarantine_description'\n found in message $scandir/$file_id";
+    } else {
+	$tag_score .= "SA:1($sa_score/$sa_max):";
+	$sa_comment = "Yes, hits=$sa_score required=$sa_max" if ($spamc_options =~ /\-c/);
+	&debug("SA: yup, this smells like SPAM");
+    }
+  }
   $stop_spamassassin_time=[gettimeofday];
   $spamassassin_time = tv_interval ($start_spamassassin_time, $stop_spamassassin_time);
   &debug("spamassassin: finished scan of dir \"$scandir/$file_id\" in $spamassassin_time secs");
