PROBE_TIMEOUT=$(( 20 * 60 ))
PROBE_EXPIRE=$(( 32 * 86400 ))
+shopt -s nullglob
+
+case "$1" in
+received)
+ mode="$1"
+ cd "$2"
+ shift; shift; set "$mode" "$@"
+ ;;
+esac
+
. ../global-settings
. ./settings
exit 16
}
-record-probing () {
- # implicitly uses newsgroup, id, domain
+compute-td () {
+ # implicitly uses GROUP, id, domain
# 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"
+}
+
+record-probing () {
+ compute-td "$@"
mkdir -p $td
}
+record-probing-start () {
+ record-probing "$@"
+ if ! [ -e "$td/started" ]; then
+ date -R >"$td/started"
+ fi
+}
+
record-outcome () {
local probeid=$1
local outcome=$2
local addr=$2
local td
- record-probing "mx=$mx,addr=$addr"
+ record-probing-start "mx=$mx,addr=$addr"
set +e
swaks --to "${GROUP//./-}@$domain" \
probe-domain () {
local domain=$1
local td
- record-probing dns
+ record-probing-start dns
set +e
adnshost -Fi -Tn +Do +Dt -t mx $domain >$td/dns
if ! [ -e "$attempt/$outcome" ]; then return; fi
found_to_report=true
- read <"$attempt/$outcome" message
+ message=$(cat "$attempt/$outcome")
local reported
if [ -e "$attempt/reported" ]; then
The moderation relay probe
$info
+END
+
+ if [ -e "$attempt/started" ]; then
+ local started
+ read started <"$attempt/started"
+ cat >>"$email" <<END
+started at
+ $started
+END
+ fi
+
+ cat >>"$email" <<END
resulted in the outcome
$outcome
END
--$delim
Content-Type: text/plain; charset="utf-8"
Content-Disposition: inline; filename="${log##*/}"
+Content-Description: "${log##*/}"
Content-Transfer-Encoding: 8bit
END
done
}
-mode_all () {
+mode_received () {
no_args $#
- for domain in $MODRELAYS; do
- probe-domain $domain
+
+ local hn group id domain mx addr
+ 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" ||:
+ return
done
}
-mode_auto () {
+mode_all () {
no_args $#
- xxx do something to cause sleeping
- mode_all
+ for domain in $MODRELAYS; do
+ probe-domain $domain
+ done
}
mode_domain () {