From 70ac732dbf0595f3df5e967db594dbc35a357dcc Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Fri, 21 Feb 2003 06:37:52 +0000 Subject: Add sendchainpings command --- Echolot/Commands.pm | 4 +++- NEWS | 2 ++ debian/echolot.init | 2 +- pingd | 37 ++++++++++++++++++++++++++++++++++--- tools/pingctl | 2 +- 5 files changed, 41 insertions(+), 6 deletions(-) diff --git a/Echolot/Commands.pm b/Echolot/Commands.pm index 0ae4bf9..df475b0 100644 --- a/Echolot/Commands.pm +++ b/Echolot/Commands.pm @@ -1,7 +1,7 @@ package Echolot::Commands; # (c) 2002 Peter Palfrader -# $Id: Commands.pm,v 1.14 2003/02/20 19:39:03 weasel Exp $ +# $Id: Commands.pm,v 1.15 2003/02/21 06:37:52 weasel Exp $ # =pod @@ -71,6 +71,8 @@ sub processCommands($) { Echolot::Globals::get()->{'scheduler'}->schedule('getkeyconf', 0, time(), \@args ); } elsif ($command eq 'sendpings') { Echolot::Globals::get()->{'scheduler'}->schedule('ping', 0, time(), \@args ); + } elsif ($command eq 'sendchainpings') { + Echolot::Globals::get()->{'scheduler'}->schedule('chainping', 0, time(), \@args ); } elsif ($command eq 'buildstats') { Echolot::Globals::get()->{'scheduler'}->schedule('buildstats', 0, time() ); } elsif ($command eq 'buildkeys') { diff --git a/NEWS b/NEWS index c65c6a7..03513a7 100644 --- a/NEWS +++ b/NEWS @@ -21,12 +21,14 @@ Changes in version Several other settings control the details of chain pinging. You probably don't want or need to tweak them. See the pingd.conf(5) manual page for details. + - Also adds the new "sendchainpings" command. * Create an index.txt file in the thesaurus directory which holds id, nick, and address for each remailer in the thesaurus. This helps additional tools to utilize Echolot's data. * Compile a list of default From: lines as well as a list of remailers which allow user supplied From headers. * Print status summary to log daily. + - Also adds the new "summary" command. * Reliable and CRLF - a neverending (sad) story. Changes in version 2.0.10 - 2003-02-03 diff --git a/debian/echolot.init b/debian/echolot.init index 29c89c9..3916ddc 100755 --- a/debian/echolot.init +++ b/debian/echolot.init @@ -134,7 +134,7 @@ reload|force-reload|restart) wait_for_deaddaemon $PID $0 start ;; -process|add|delete|set|setremailercaps|deleteremailercaps|getkeyconf|sendpings|buildstats|buildkeys|buildthesaurus|buildfromlines|dumpconf|summary) +process|add|delete|set|setremailercaps|deleteremailercaps|getkeyconf|sendpings|sendchainpings|buildstats|buildkeys|buildthesaurus|buildfromlines|dumpconf|summary) # Check for right User SU="" if [ "$CHECKUID" -gt "0" ]; then diff --git a/pingd b/pingd index 2d6977c..a31fc69 100755 --- a/pingd +++ b/pingd @@ -3,7 +3,7 @@ $| = 1; # (c) 2002, 2003 Peter Palfrader -# $Id: pingd,v 1.100 2003/02/20 19:39:03 weasel Exp $ +# $Id: pingd,v 1.101 2003/02/21 06:37:52 weasel Exp $ # =pod @@ -36,6 +36,8 @@ pingd - echolot ping daemon =item B B [I
[I
...]] +=item B B I
B<:>I
[I
B<:>I
...] + =item B B =item B B @@ -44,6 +46,8 @@ pingd - echolot ping daemon =item B B +=item B B + =item B B =back @@ -140,6 +144,11 @@ If no addresses are given requests will be sent to all remailers. Send a command to immediatly send pings to the given remailers. If no addresses are given requests will be sent to all remailers. +=item B I
B<:>I
[I
B<:>I
...] + +Send a command to immediatly send chain pings to the given chains. +A chain is two remailer addresses seperated by a colon. + =item B Send a command to immediatly rebuild stats. @@ -194,8 +203,9 @@ Print version number and exit sucessfully. =item B<--nohup> Usefull only with the B, B, B, -B, B, B, B, -B, B, B or B command. +B, B, B, B, +B, B, B, B, +or B command. Don't send a HUP signal to the daemon which instructs it to process the commands after adding the command to the task list. @@ -456,6 +466,23 @@ sub command_sendpings(@) { }; }; +sub command_sendchainpings(@) { + my @argv = @_; + + my @args; + for my $arg (@argv) { + my ($addr1, $addr2) = split /:/, $arg; + die ("Argument $arg is not in the form address1:address2") unless defined $addr1 && defined $addr2; + die ("Address 1 in $arg ('$addr1') is not a valid email address\n") unless ($addr1 =~ /^[a-zA-Z0-9+._-]+\@[a-zA-Z0-9+.-]+$/ ); + die ("Address 2 in $arg ('$addr2') is not a valid email address\n") unless ($addr2 =~ /^[a-zA-Z0-9+._-]+\@[a-zA-Z0-9+.-]+$/ ); + push @args, [ $addr1, $addr2 ]; + }; + + for my $arg (@args) { + Echolot::Commands::addCommand("sendchainpings $arg->[0] $arg->[1]"); + }; +}; + sub pid_exists($) { my ($remove_stale) = @_; @@ -651,6 +678,7 @@ if ($params->{'help'}) { print (" deleteremailercaps ... delete remailer capabilities manually\n"); print (" getkeyconf ... request remailer-xxx data immediatly\n"); print (" sendpings ... request immediate sending of pings\n"); + print (" sendchainpings ... request immediate sending of chainpings\n"); print (" buildstats ... build remailer stats immediatly\n"); print (" buildkeys ... buid keyrings immediatly\n"); print (" buildthesaurus ... build thesaurus immediatly\n"); @@ -694,6 +722,9 @@ if ($COMMAND eq 'add' || $COMMAND eq 'delete') { } elsif ($COMMAND eq 'sendpings') { command_sendpings(@ARGV); hup_if_wanted($params->{'nohup'}); +} elsif ($COMMAND eq 'sendchainpings') { + command_sendchainpings(@ARGV); + hup_if_wanted($params->{'nohup'}); } elsif ($COMMAND eq 'buildstats') { Echolot::Commands::addCommand("buildstats"); hup_if_wanted($params->{'nohup'}); diff --git a/tools/pingctl b/tools/pingctl index 3a3ede6..9304734 100755 --- a/tools/pingctl +++ b/tools/pingctl @@ -94,7 +94,7 @@ reload|force-reload|restart) sleep 10 $0 start ;; -process|add|delete|set|setremailercaps|deleteremailercaps|getkeyconf|sendpings|buildstats|buildkeys|buildthesaurus|buildfromlines|dumpconf|summary) +process|add|delete|set|setremailercaps|deleteremailercaps|getkeyconf|sendpings|sendchainpings|buildstats|buildkeys|buildthesaurus|buildfromlines|dumpconf|summary) echo "Running pingd $1..." if [ ! -z "$SU" ]; then $SU "$PINGD \"$@\"" -- cgit v1.2.3