Hi,

there is a small bug in qmail-scanner 1.20 that occurs if you install it
with "--archive no". 

While "configure --help" says:

  --archive [yes|no|regex] Defaults to "no". Whether to archive mail after
                           it as been processed. If "yes", all copies of 
                           processed mail will be moved into the maildir 
                           "/var/spool/qmailscan/archives/". Any other string besides
                           "yes" and "no" will be treated as a REGEX. Only mail
                            ^^^^^^^^^^^^^

this is wrong. "--archive no" archives mails that match /no/. In other
words, "no" is treated as a regex. The error is within the configure
script. I reproduced the code for readability:

---snip---
#!/bin/sh

a=no

ARCHIVEIT="1"

if [ "$a" != "" -a "`echo $a|grep '\-'`" = "" ] ; then  
  #shift 
  if [ "`echo $a|egrep -i '^0|^no'`" != "" ]; then     ## "no" is matched
    ARCHIVEIT="0"
  fi
  if [ "`echo $a|egrep -i '^1|^yes'`" != "" ]; then    
    ARCHIVEIT="1" 
  else 
    ARCHIVEIT="$a"                                     ## "no" is regex
  fi 
fi 

echo $ARCHIVEIT     ## prints "no" not "0"
---snip----

It should be:

---snip---
#!/bin/sh

a=no

ARCHIVEIT="1"

if [ "$a" != "" -a "`echo $a|grep '\-'`" = "" ] ; then  
  #shift 
  if [ "`echo $a|egrep -i '^0|^no'`" != "" ]; then    ## "no" is matched 
    ARCHIVEIT="0"
  else
    if [ "`echo $a|egrep -i '^1|^yes'`" != "" ]; then 
      ARCHIVEIT="1" 
    else 
      ARCHIVEIT="$a"                                  ## never happens
    fi 
  fi
fi 

echo $ARCHIVEIT
---snip---

The attached patch fixes the bug (you also may remove "--archive no"
from your configure call, as this is the default).

Alex

-- 
Alex Pleiner
zeitform Internet Dienste         Fraunhoferstrasse 5
                                  64283 Darmstadt, Germany
http://www.zeitform.de            Tel.: +49 (0)6151 155-635
mailto:[EMAIL PROTECTED]        Fax:  +49 (0)6151 155-634
GnuPG/PGP Key-ID: 0x613C21EA
--- configure.orig      2003-11-20 17:36:17.000000000 +0100
+++ configure   2003-11-20 17:37:29.000000000 +0100
@@ -110,7 +110,7 @@
        --add-dscr-hdrs) if [ "$2" != "" ] ; then  shift ; fi ; 
DESCRIPTIVE_HEADERS="$1" ;;
        --scanners) if [ "$2" != "" -a "`echo $2|grep '\-'`" = "" ] ; then shift ; fi 
; FIND_SCANNERS="$1" ;;
        --skip-text-msgs) if [ "$2" != "" ] ; then  shift ; fi ; SKIP_TEXT_MSGS="$1" ;;
-        --archive) ARCHIVEIT="1" ; if [ "$2" != "" -a "`echo $2|grep '\-'`" = "" ] ; 
then  shift ; if [ "`echo $1|egrep -i '^0|^no'`" != "" ]; then ARCHIVEIT="0" ; fi ; if 
[ "`echo $1|egrep -i '^1|^yes'`" != "" ]; then ARCHIVEIT="1" ; else ARCHIVEIT="$1" ; 
fi ;  fi ;;
+        --archive) ARCHIVEIT="1" ; if [ "$2" != "" -a "`echo $2|grep '\-'`" = "" ] ; 
then  shift ; if [ "`echo $1|egrep -i '^0|^no'`" != "" ]; then ARCHIVEIT="0" ; else if 
[ "`echo $1|egrep -i '^1|^yes'`" != "" ]; then ARCHIVEIT="1" ; else ARCHIVEIT="$1" ; 
fi ;  fi ; fi ;;
        --redundant) REDUNDANT="no" ; if [ "$2" != "" -a "`echo $2|grep '\-'`" = "" ] 
; then  shift ; REDUNDANT="$1" ;  fi ;;
         --log-details) if [ "$2" != "" -a "`echo $2|grep '\-'`" = "" ] ; then  shift 
; LOG_DETAILS="$1" ;  fi ;;
        --log-crypto) if [ "$2" != "" -a "`echo $2|grep '\-'`" = "" ] ; then  shift ; 
LOG_CRYPTO="$1" ;  fi ;;

Reply via email to