chiark / gitweb /
probe: set nullglob, so it works when disabled
[modbot-ulm.git] / probes / modrelays-probe
index 79e8ab7f5f4b0d10f13795ec888bb0ec11e0b3c9..4ce164856cdaee895cab95243735835a2c7beaea 100755 (executable)
@@ -6,6 +6,8 @@ MODRELAYS=moderators.isc.org
 PROBE_TIMEOUT=$(( 20 * 60 ))
 PROBE_EXPIRE=$(( 32 * 86400 ))
 
+shopt -s nullglob
+
 case "$1" in
 received)
        mode="$1"
@@ -31,9 +33,9 @@ compute-td () {
        # caller must "local td", which will be set
        local probeid=$1
 
-       probeid="$domain,${probeid//[^-=.,_0-9A-Za-z]/%/},$id"
+       probeid="$domain,${probeid//[^-=:.,_0-9A-Za-z]/%},$id"
        case $probeid in
-       .*|*/*) fail "yikes, sanitisation bug!" ;;
+       .*|*/*) fail "yikes, sanitisation bug ($probeid) !" ;;
        esac
 
        td="$statedir/$probeid"
@@ -358,6 +360,9 @@ mode_received () {
        while read hn group id domain mx addr; do
                if [ x"$hn" != x"X-WebSTUMP-Relay-Probe:" ]; then continue; fi
                if [ x"$group" != x"$GROUP" ]; then continue; fi
+               case " $id $domain $mx $addr" in
+               */*|' '.*)      fail "bad syntax" ;;
+               esac
                local td
                compute-td "mx=$mx,addr=$addr"
                >"$td/ok" ||: