From 2da43c3148d7ae67554de9cdf51fd2d0d03884a4 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Wed, 3 Jul 2002 12:09:03 +0000 Subject: reworked the no expire stuff for manual caps --- Echolot/Conf.pm | 10 +++++----- Echolot/Storage/File.pm | 14 ++++++++++---- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Echolot/Conf.pm b/Echolot/Conf.pm index bc14f84..68f1030 100644 --- a/Echolot/Conf.pm +++ b/Echolot/Conf.pm @@ -1,7 +1,7 @@ package Echolot::Conf; # (c) 2002 Peter Palfrader -# $Id: Conf.pm,v 1.10 2002/07/03 11:08:21 weasel Exp $ +# $Id: Conf.pm,v 1.11 2002/07/03 12:09:03 weasel Exp $ # =pod @@ -42,8 +42,8 @@ sub send_requests() { Echolot::Globals::get()->{'storage'}->enable_commit(); }; -sub remailer_conf($$$) { - my ($conf, $token, $time) = @_; +sub remailer_conf($$$;$) { + my ($conf, $token, $time, $dontexpire) = @_; my ($id) = $token =~ /^conf\.(\d+)$/; (defined $id) or @@ -68,7 +68,7 @@ sub remailer_conf($$$) { Echolot::Globals::get()->{'storage'}->add_prospective_address($remailer_address, 'self-capsstring-conf', $remailer_address); } else { Echolot::Globals::get()->{'storage'}->restore_ttl( $remailer->{'address'} ); - Echolot::Globals::get()->{'storage'}->set_caps($remailer_type, $remailer_caps, $remailer_nick, $remailer_address, $time); + Echolot::Globals::get()->{'storage'}->set_caps($remailer_type, $remailer_caps, $remailer_nick, $remailer_address, $time, $dontexpire); # if remailer is cpunk and not pgponly if (($remailer_caps =~ /\bcpunk\b/) && !($remailer_caps =~ /\bpgponly\b/)) { @@ -145,7 +145,7 @@ sub set_caps_manually($$) { my $token = 'conf.'.$id; my $conf = "Remailer-Type: set-manually\n$caps"; - remailer_conf($conf, $token, time + 10 * 365 * 24 * 60 * 60); # FIXME: Y2036 + remailer_conf($conf, $token, time, 1); return 1; }; diff --git a/Echolot/Storage/File.pm b/Echolot/Storage/File.pm index a075e93..cf01092 100644 --- a/Echolot/Storage/File.pm +++ b/Echolot/Storage/File.pm @@ -1,7 +1,7 @@ package Echolot::Storage::File; # (c) 2002 Peter Palfrader -# $Id: File.pm,v 1.25 2002/07/03 11:08:21 weasel Exp $ +# $Id: File.pm,v 1.26 2002/07/03 12:09:03 weasel Exp $ # =pod @@ -647,8 +647,8 @@ sub restore_ttl($$) { return 1; }; -sub set_caps($$$$$$) { - my ($self, $type, $caps, $nick, $address, $timestamp) = @_; +sub set_caps($$$$$$;$) { + my ($self, $type, $caps, $nick, $address, $timestamp, $dont_expire) = @_; if (! defined $self->{'METADATA'}->{'remailers'}->{$address}) { $self->{'METADATA'}->{'remailers'}->{$address} = { @@ -687,6 +687,11 @@ sub set_caps($$$$$$) { $conf->{'type'} = $type; }; }; + + if (defined $dont_expire) { + $self->{'METADATA'}->{'remailers'}->{$address}->{'conf'}->{'dont_expire'} = $dont_expire; + }; + $self->commit(); return 1; @@ -878,7 +883,8 @@ sub expire($) { delete $self->{'METADATA'}->{'remailers'}->{$remailer_addr}->{'conf'} if (defined $self->{'METADATA'}->{'remailers'}->{$remailer_addr}->{'conf'} && - ($self->{'METADATA'}->{'remailers'}->{$remailer_addr}->{'conf'}->{'last_update'} < $expire_conf)); + ($self->{'METADATA'}->{'remailers'}->{$remailer_addr}->{'conf'}->{'last_update'} < $expire_conf) && + ! ($self->{'METADATA'}->{'remailers'}->{$remailer_addr}->{'conf'}->{'dont_expire'})); $self->{'METADATA'}->{'remailers'}->{$remailer_addr}->{'status'} = 'expired' unless ( defined ($self->{'METADATA'}->{'remailers'}->{$remailer_addr}->{'conf'}) || -- cgit v1.2.3