Package: tumgreyspf

Version: 1.35-7

Package tumgreyspf includes daily cron script to clean expired IPs
from database.
This script checks for GREYLISTEXPIREDAYS in
/etc/tumgreyspf/default.conf by using:

if [ -f /etc/tumgreyspf/default.conf ] ; then
        GREYLISTEXPIREDAYS=`grep GREYLISTEXPIREDAYS
/etc/tumgreyspf/default.conf | cut -d'=' -f2 | awk '{print $1}' | cut
-d'.' -f1`
fi

Usually, that returns GREYLISTEXPIREDAYS value.
Unfortunately, if user experiments with different values, leaving some
of them commented, like:

#GREYLISTEXPIREDAYS = 60.0
GREYLISTEXPIREDAYS = 20.0
#GREYLISTEXPIREDAYS = 30.0

or similar, greping/cutting/awking would return:

60.0
20.0
30.0

Solution is to change a little bit command for GREYLISTEXPIREDAYS
extracting to something like:

grep ^GREYLISTEXPIREDAYS /etc/tumgreyspf/default.conf | cut -d'=' -f2
| awk '{print $1}' | cut -d'.' -f1


or, if we want to allow white spaces in front of GREYLISTEXPIREDAYS,
but not "#" character at the begining of the line:

grep -v '^#' /etc/tumgreyspf/default.conf | grep GREYLISTEXPIREDAYS |
cut -d'=' -f2 | awk '{print $1}' | cut -d'.' -f1


or, if we also want to enable whitespaces in front of comment char:

grep -v '^ *#' /etc/tumgreyspf/default.conf | grep GREYLISTEXPIREDAYS
| cut -d'=' -f2 | awk '{print $1}' | cut -d'.' -f1


then again, we can avoid returning more then one not-commented value
(if user made misconfigured default.conf, leaving more then one
GREYLISTEXPIREDAYS line uncommented) by returning just the first
value:

grep -v '^ *#' /etc/tumgreyspf/default.conf | grep GREYLISTEXPIREDAYS
| cut -d'=' -f2 | awk '{print $1; exit}' | cut -d'.' -f1



Anyways, solution is quite trivial, but can help to avoid misbehaviour
caused by choosing the wrong line containing GREYLISTEXPIREDAYS.


Regards,
Nebojsa Trpkovic



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to