chiark / gitweb /
probes: receive
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 10 Oct 2017 15:22:44 +0000 (16:22 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 10 Oct 2017 15:22:44 +0000 (16:22 +0100)
forward-slimy.part.INO
probes/modrelays-probe

index 059e4622387bfaa42fc5ae6b5c3099d7bbf661ef..6cafafa1d726789a3fe13a45c51746c59862ac4c 100644 (file)
@@ -2,6 +2,10 @@ if $local_part_suffix is +%ABBREV%+%KEYSUBMIT%
 or $local_part_suffix is +%ABBREV%+test-submission
 then
        unseen pipe "mail -s submission %LOGGROUPEMAILPREFIX%+%ABBREV%+log+submissions"
+       if $header_X-WebSTUMP-Relay-Probe: contains %GROUP% then
+               pipe "%BASEDIR/probes/modrelays-probe received %BASEDIR%"
+               finish
+       endif
        unseen pipe "%BASEDIR%/xlog/bin/record submission %GROUP%"
        pipe "%BASEDIR%/stump/etc/modenv stump.pl submission.pl"
        finish
index ef7c639bb2b90365b9e532078924438cf7bd2b8b..a817a85b8c2c8655303007ea9b93f7412cf0a9e9 100755 (executable)
@@ -6,6 +6,14 @@ MODRELAYS=moderators.isc.org
 PROBE_TIMEOUT=$(( 20 * 60 ))
 PROBE_EXPIRE=$(( 32 * 86400 ))
 
+case "$1" in
+received)
+       mode="$1"
+       cd "$2"
+       shift; shift; set "$mode" "$@"
+       ;;
+esac
+
 . ../global-settings
 . ./settings
 
@@ -18,8 +26,8 @@ fail () {
        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
 
@@ -29,6 +37,10 @@ record-probing () {
        esac
 
        td="$statedir/$probeid"
+}
+
+record-probing () {
+       compute-td "$@"
        mkdir -p $td
 }
 
@@ -197,7 +209,7 @@ probe-domain () {
 }
 
 no_args () {
-       case $1 in
+       case $# in
        0) return ;;
        *) fail "no arguments to $mode allowed" ;;
        esac
@@ -339,6 +351,20 @@ mode_report () {
        done
 }
 
+mode_received () {
+       no_args
+
+       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
+               local td
+               compute-td "mx=$mx,addr=$addr"
+               >"$td/ok" ||:
+               return
+       done
+}
+
 mode_all () {
        no_args $#
        for domain in $MODRELAYS; do