From: ijackson Date: Tue, 22 Jun 1999 16:15:22 +0000 (+0000) Subject: Bugfixes, discard generation stuff. X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=4d170c9a49c8b490b8dd80cb415cef8218a21247;p=bcp5-registry.git Bugfixes, discard generation stuff. --- diff --git a/bcp5-registry.pl b/bcp5-registry.pl index d5276a5..4861b28 100755 --- a/bcp5-registry.pl +++ b/bcp5-registry.pl @@ -69,6 +69,7 @@ $intro= 0; $error= 0; $registernew= 0; $pick= 0; +$deleted= 0; $pickvarsubnet= 8; $pickvarprefix= 24; $pick28check= ''; @@ -104,11 +105,10 @@ if (length $in{'register'}) { read_database(); $id= randnybs(16); - $generation= 0; $db{$id}= $ent= { }; $ent->{'created'}= $now; $ent->{'changed'}= 0; - $email= $in{'email'}; + $alwaysemail= $email= $in{'email'}; set_entry(); $justcreated= 1; @@ -144,7 +144,6 @@ if (length $in{'register'}) { read_database(); get_entry(); check_password(); - check_generation(); $ent->{'changed'}= $now; $email= length($in{'email'}) ? $in{'email'} : $db{$id}->{'email'}; @@ -160,12 +159,13 @@ if (length $in{'register'}) { read_database(); get_entry(); check_password(); - check_generation(); - + + $deleted= 1; + show_entry(); + delete $db{$id}; write_database(); - $deleted= 1; finish(); } elsif (length $in{'pick'}) { @@ -246,7 +246,8 @@ sub show_entry () { $$dk= gmtime($$k)." GMT"; } $alwaysemail= $email; - if ($ent->{'hiddenemail'} && !$justcreated && !$fulldetails && !$justupdated) { + if ($ent->{'hiddenemail'} && !$justcreated && \ + !$fulldetails && !$justupdated && !$deleted) { $displayemail= 0; $email= ''; } else { @@ -256,10 +257,6 @@ sub show_entry () { $emailhidechecked= $ent->{'hiddenemail'} ? 'checked' : ''; } -sub check_generation () { - $ent->{'generation'} eq $ent->{'generation'} or finish_error('generation'); -} - sub set_entry () { my ($v, $b, @b, $val, $mask); $net= $in{'net'}; @@ -270,7 +267,7 @@ print DEBUG "set_entry parsed netrange $network $prefix\n"; print DEBUG "$current_areai\n"; $current_areai>=0 or finish_error("wrongnet"); print DEBUG "ok\n"; - + foreach $v (qw(name contact email)) { $$v= $in{$v} unless $v eq 'email'; length $$v or finish_error("no$v"); @@ -278,7 +275,7 @@ print DEBUG "ok\n"; } $hiddenemail= !!length $in{'hiddenemail'}; - foreach $k (qw(generation network prefix name contact email hiddenemail)) { + foreach $k (qw(network prefix name contact email hiddenemail)) { $ent->{$k}= $$k; } @@ -343,7 +340,7 @@ sub finish_error ($) { my ($type) = @_; my ($t, $esel, $f); foreach $t (qw(noemail nonet noname nocontact badsize wrongsize badnet wrongnet - nopassword badpassword notfound generation badchar)) { + nopassword badpassword notfound badchar)) { $esel= "error_$t"; $$esel= 0; $f=1 if $type eq $t; diff --git a/config.pl b/config.pl index 8c60597..a9bb4c9 100644 --- a/config.pl +++ b/config.pl @@ -5,6 +5,6 @@ $nameboxlen= 55; $contactboxlen= 55; $emailboxlen= 55; $nullemail= 'discard-all@chiark.greenend.org.uk'; -$cgi= 'http://www.chiark.greenend.org.uk/ucgi/~ijackson/cam-g-rin'; +$cgi= 'http://www.chiark.greenend.org.uk/ucgi/~ijackson/cam-grin'; $ENV{'PATH'}= '/usr/local/bin:/bin:/usr/bin'; diff --git a/database.pl b/database.pl index 720a6c3..8bbd8fd 100644 --- a/database.pl +++ b/database.pl @@ -1,6 +1,6 @@ # -@db_fields= qw(generation network prefix name contact email hiddenemail created changed); +@db_fields= qw(network prefix name contact email hiddenemail created changed); sub read_database () { print DEBUG "reading\n"; diff --git a/passwords.pl b/passwords.pl index 1ebb210..f153d0d 100644 --- a/passwords.pl +++ b/passwords.pl @@ -42,7 +42,9 @@ sub make_password ($) { sub send_password ($) { $password= make_password($id); process_file('notice.txt'); - print DEBUG "---\n$out---\n"; + open SM, "| /usr/sbin/sendmail -odb -oi -oee -f $nullemail -t" or die $!; + print SM $out or die $!; + close SM; $? and die $?; } 1; diff --git a/template.html b/template.html index d9eb460..664ae83 100644 --- a/template.html +++ b/template.html @@ -26,6 +26,10 @@ registered @@@name@@@ updated @@@name@@@ @@@endif:@@@ +@@@if:deleted@@@ +deleted @@@name@@@ +@@@endif:@@@ + @@@if:listingall@@@ entire database @@@endif:@@@ @@ -85,6 +89,10 @@ Database entry updated: @@@name@@@ Password sent @@@endif:@@@ +@@@if:deleted@@@ +Database entry deleted +@@@endif:@@@ + @@@if:listingall@@@ Entire database listing @@@endif:@@@ @@ -169,12 +177,6 @@ If you believe that this has happened to you in error, contact the registry administrator, @@@adminemail@@@, quoting identifier @@@id@@@. @@@endif:@@@ -@@@if:error_generation@@@ -Another modification has been made to the record. Please use the -`view' option to see the new values, before making any further -changes. -@@@endif:@@@ - @@@if:error_noemail@@@ You must provide an email address. @@@endif:@@@ @@ -291,6 +293,12 @@ hide it; apart from that we will only use it to contact you about your database entry. @@@endif:@@@ +@@@if:deleted@@@ +

Deleted entry

+The following entry has been deleted. If this was a mistake, you may +re-register it now. +@@@endif:@@@ + @@@if:details|fulldetails@@@

Entry details

@@@endif:@@@ @@ -310,7 +318,6 @@ time unless you confirm it. You have beeen sent an email with your password, requesting confirmation. When you have received the email you may use `confirm/update', below, to confirm your database entry. If you do not confirm it it will expire in a few days. - @@@endif:@@@ @@@if:justupdated@@@ @@ -318,8 +325,7 @@ If you do not confirm it it will expire in a few days. The database entry below has been updated/confirmed/renewed. @@@endif:@@@ - -@@@if:registernew|details|fulldetails|justcreated|justupdated|picked|passwordsent@@@ +@@@if:registernew|details|fulldetails|justcreated|justupdated|picked|passwordsent|deleted@@@

@@ -354,6 +360,10 @@ Hide email address from public database. @@@endif:@@@ +@@@if:deleted@@@ + +@@@endif:@@@ + @@@if:details|fulldetails|justcreated|justupdated|passwordsent@@@

@@ -364,7 +374,6 @@ Last update/confirm: @@@datechanged@@@
@@@ifnot:changed@@@ Not yet confirmed. @@@endif:@@@ - @@@endif:@@@ @@@if:details@@@ @@ -395,6 +404,11 @@ You can also view the full details, including the hidden email address.

@@@endif:@@@ +@@@if:details|justcreated|passwordsent@@@ +Password: +
+@@@endif:@@@ + @@@ifnot:displayemail@@@ @@@endif:@@@ @@ -402,14 +416,10 @@ You can also view the full details, including the hidden email address. @@@if:details|fulldetails|justcreated|justupdated|passwordsent@@@ -
-@@@endif:@@@ - -@@@if:details|justcreated|passwordsent@@@ -Password: @@@endif:@@@ @@@if:fulldetails|justupdated@@@ +
Password: supplied. @@@endif:@@@