summaryrefslogtreecommitdiff
path: root/Echolot
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2002-07-13 20:35:50 +0000
committerPeter Palfrader <peter@palfrader.org>2002-07-13 20:35:50 +0000
commit10fa6d047c7bbe2a78659a45a338093b0748276d (patch)
treee055898c3c89359ebf2a25e5f710499bf007e762 /Echolot
parentccdb1185e1c5bbf7dc54e08c8af9a9866a05d24d (diff)
Support �not a remailer� reply to remailer-xxx
Diffstat (limited to 'Echolot')
-rw-r--r--Echolot/Conf.pm34
-rw-r--r--Echolot/Config.pm17
-rw-r--r--Echolot/Storage/File.pm13
3 files changed, 60 insertions, 4 deletions
diff --git a/Echolot/Conf.pm b/Echolot/Conf.pm
index 0e669eb..7686614 100644
--- a/Echolot/Conf.pm
+++ b/Echolot/Conf.pm
@@ -1,7 +1,7 @@
package Echolot::Conf;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: Conf.pm,v 1.15 2002/07/10 16:22:49 weasel Exp $
+# $Id: Conf.pm,v 1.16 2002/07/13 20:35:50 weasel Exp $
#
=pod
@@ -24,6 +24,15 @@ use GnuPG::Interface;
use IO::Handle;
+sub is_not_a_remailer($) {
+ my ($reply) = @_;
+ if ($reply =~ /^\s* not \s+ a \s+ remailer\b/xi) {
+ return 1;
+ } else {
+ return 0;
+ };
+};
+
sub send_requests() {
Echolot::Globals::get()->{'storage'}->delay_commit();
for my $remailer (Echolot::Globals::get()->{'storage'}->get_addresses()) {
@@ -31,11 +40,22 @@ sub send_requests() {
next unless ($remailer->{'fetch'});
print "Sending requests to ".$remailer->{'address'}."\n"
if Echolot::Config::get()->{'verbose'};
+
+ my $source_text = Echolot::Config::get()->{'remailerxxxtext'};
+ my $template = HTML::Template->new(
+ scalarref => \$source_text,
+ strict => 0,
+ global_vars => 1 );
+ $template->param ( address => $remailer->{'address'} );
+ $template->param ( operator_address => Echolot::Config::get()->{'operator_address'} );
+ my $body = $template->output();
+
for my $type (qw{conf key help stats adminkey}) {
Echolot::Tools::send_message(
'To' => $remailer->{'address'},
'Subject' => 'remailer-'.$type,
- 'Token' => $type.'.'.$remailer->{'id'})
+ 'Token' => $type.'.'.$remailer->{'id'},
+ 'Body' => $body)
};
Echolot::Globals::get()->{'storage'}->decrease_ttl($remailer->{'address'});
};
@@ -149,6 +169,8 @@ sub remailer_conf($$$) {
cluck ("Returned token '$token' has no id at all"),
return 0;
+ Echolot::Globals::get()->{'storage'}->not_a_remailer($id), return 1
+ if (is_not_a_remailer($reply));
Echolot::Thesaurus::save_thesaurus('conf', $id, $reply);
remailer_caps($reply, $token, $time);
@@ -366,6 +388,8 @@ sub remailer_key($$$) {
cluck ("Returned token '$token' has no id at all"),
return 0;
+ Echolot::Globals::get()->{'storage'}->not_a_remailer($id), return 1
+ if (is_not_a_remailer($reply));
Echolot::Thesaurus::save_thesaurus('key', $id, $reply);
my $remailer = Echolot::Globals::get()->{'storage'}->get_address_by_id($id);
@@ -385,6 +409,8 @@ sub remailer_stats($$$) {
cluck ("Returned token '$token' has no id at all"),
return 0;
+ Echolot::Globals::get()->{'storage'}->not_a_remailer($id), return 1
+ if (is_not_a_remailer($reply));
Echolot::Thesaurus::save_thesaurus('stats', $id, $reply);
};
@@ -396,6 +422,8 @@ sub remailer_help($$$) {
cluck ("Returned token '$token' has no id at all"),
return 0;
+ Echolot::Globals::get()->{'storage'}->not_a_remailer($id), return 1
+ if (is_not_a_remailer($reply));
Echolot::Thesaurus::save_thesaurus('help', $id, $reply);
};
@@ -407,6 +435,8 @@ sub remailer_adminkey($$$) {
cluck ("Returned token '$token' has no id at all"),
return 0;
+ Echolot::Globals::get()->{'storage'}->not_a_remailer($id), return 1
+ if (is_not_a_remailer($reply));
Echolot::Thesaurus::save_thesaurus('adminkey', $id, $reply);
};
diff --git a/Echolot/Config.pm b/Echolot/Config.pm
index 604a9ba..06460f5 100644
--- a/Echolot/Config.pm
+++ b/Echolot/Config.pm
@@ -1,7 +1,7 @@
package Echolot::Config;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: Config.pm,v 1.23 2002/07/11 17:45:59 weasel Exp $
+# $Id: Config.pm,v 1.24 2002/07/13 20:35:50 weasel Exp $
#
=pod
@@ -126,10 +126,25 @@ sub init($) {
'rlist2-clear' => 'templates/rlist2-clear.html',
'clist' => 'templates/clist.html',
},
+
+ remailerxxxtext => "Hello,\n".
+ "\n".
+ "This message requests remailer configation data. The pinging software thinks\n".
+ "<TMPL_VAR NAME=\"address\"> is a remailer. Either it has been told so by the\n".
+ "maintainer of the pinger or it found the address in a remailer-conf or\n".
+ "remailer-key reply of some other remailer.\n".
+ "\n".
+ "If this is _not_ a remailer, you can tell this pinger that and it will stop\n".
+ "sending you those requests immediatly (otherwise it will try a few more times).\n".
+ "Just reply and make sure the following is the first line of your message:\n".
+ " not a remailer\n".
+ "\n".
+ "If you want to talk to a human please mail <TMPL_VAR NAME=\"operator_address\">.\n",
homedir => undef,
my_localpart => undef,
my_domain => undef,
+ operator_address => undef,
sitename => undef,
verbose => 0
};
diff --git a/Echolot/Storage/File.pm b/Echolot/Storage/File.pm
index c65d306..3c78ae5 100644
--- a/Echolot/Storage/File.pm
+++ b/Echolot/Storage/File.pm
@@ -1,7 +1,7 @@
package Echolot::Storage::File;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: File.pm,v 1.34 2002/07/11 23:39:13 weasel Exp $
+# $Id: File.pm,v 1.35 2002/07/13 20:35:50 weasel Exp $
#
=pod
@@ -661,6 +661,17 @@ sub restore_ttl($$) {
return 1;
};
+sub not_a_remailer($$) {
+ my ($self, $id) = @_;
+
+ my $address = $self->get_address_by_id($id);
+ cluck("No remailer found for id '$id'"), return 0 unless defined $address;
+
+ delete $self->{'METADATA'}->{'addresses'}->{$address}->{'disabled by user reply: is not a remailer'};
+ $self->commit();
+ return 1;
+};
+
sub set_caps($$$$$$;$) {
my ($self, $type, $caps, $nick, $address, $timestamp, $dont_expire) = @_;
if (! defined $self->{'METADATA'}->{'remailers'}->{$address}) {