Back out the highly unpopular email address blocking.

This commit is contained in:
Ceri Davies 2005-12-04 12:50:17 +00:00
parent 3daa0d7d5e
commit 5183913e78
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/www/; revision=26513
3 changed files with 5 additions and 167 deletions

View file

@ -1,24 +1,14 @@
#!/usr/bin/perl -T
# $FreeBSD: www/en/cgi/query-pr.cgi,v 1.50 2005/11/09 21:38:31 fenner Exp $
# $FreeBSD: www/en/cgi/query-pr.cgi,v 1.47 2005/11/06 22:13:05 ceri Exp $
$ENV{'PATH'} = "/bin:/usr/bin:/usr/sbin:/sbin:/usr/local/bin";
use DB_File;
use Fcntl qw(:DEFAULT :flock);
require "./cgi-lib.pl";
require "./cgi-style.pl";
require "getopts.pl";
require "./Gnats.pm"; import Gnats;
my $expiretime = 2700;
$dbpath = "/tmp/querypr-code.db";
&Getopts('cp:');
if ($opt_c) {
$codeentered = $opt_c;
}
&Getopts('p:');
if ($opt_p) {
@ -32,15 +22,8 @@ if ($opt_p) {
($scriptname = $ENV{'SCRIPT_NAME'}) =~ s|^/?|/|;
$scriptname =~ s|/$||;
($summary = $scriptname) =~ s/query-pr/query-pr-summary/;
print "<form method='post' action='$scriptname'>\n";
print "<form method='get' action='$scriptname'>\n";
print "<input type='text' name='pr' />\n";
print "<p>To view the PR with email addresses, copy the code ";
print " from the image below: <input type='text' ";
print " name='code-confirm' id='code-confirm' size='8' />\n";
print "</p><p><label for='code-confirm'>";
print "<img src='querypr-code.cgi?dummy=1' ";
print " alt='Random text; if you cannot see the image, please email ";
print " bugbusters\@FreeBSD.org' border='0' height='24' /></label></p>\n";
print "<input type='submit' value='Query' />\n</form>\n";
print "<p>See also the <a href='$summary'>PR summary</a></p>\n";
print &html_footer;
@ -53,46 +36,6 @@ if (!($pr = $input{'pr'}) && &MethGet) {
$pr = $ENV{'QUERY_STRING'};
}
# Get the confirmation code if it exists
# (and wasn't specified with -c).
$codeentered ||= $input{'code-confirm'};
# Verify the data ...
$db_obj = tie(%db_hash, 'DB_File', $dbpath, O_CREAT|O_RDWR, 0644)
or die "dbcreate $dbpath $!";
$fd = $db_obj->fd;
open(DB_FH, "+<&=$fd") or die "fdopen $!";
unless (flock (DB_FH, LOCK_EX | LOCK_NB)) {
unless (flock (DB_FH, LOCK_EX)) { die "flock: $!" }
}
# Sweep for and remove expired codes.
foreach $randomcode (keys %db_hash) {
if ( ($currenttime - $expiretime) >= $db_hash{$randomcode}) {
delete $db_hash{"$randomcode"};
}
}
$codeentered =~ s/.*/\U$&/; # Turn input uppercase
$currenttime = time();
if (defined($codeentered) && $codeentered && $db_hash{$codeentered} &&
(($currenttime - $expiretime) <= $db_hash{$codeentered})) {
# This code is good. Set the flag and remove the code.
$codeok++;
delete $db_hash{"$codeentered"};
} else {
# Fail silently.
;
}
$db_obj->sync(); # to flush
flock(DB_FH, LOCK_UN);
undef $db_obj; # removing the last reference to the DB
# closes it. Closing DB_FH is implicit.
untie %db_hash;
# be tolerant to <category>/<PR id> queries
$pr =~ s%^.+/%%; # remove <category>/ part
if ($pr =~ /(\d+)/) {
@ -199,10 +142,6 @@ while(<Q>) {
$origsyn = $syn;
$syn = &fixline($syn);
print &html_header("Problem Report $cat/$number : $syn");
if (! $codeok ) {
print "<p><a href='#SEEMAIL'>View PR with email
addresses</a></p>\n";
}
print "<p><strong>$syn</strong></p>\n<dl>\n";
} else {
next if $inhdr;
@ -215,7 +154,7 @@ while(<Q>) {
} else {
$trailer .= $2;
}
if ($1 eq "Originator" && $from ne "" && $codeok) { # add email address
if ($1 eq "Originator" && $from ne "") { # add email address
$trailer .= " &lt;<a href='mailto:$email'>" . &fixline($from) . "</a>&gt;";
}
$trailer .= '</dd>';
@ -243,22 +182,6 @@ $email =~ s/[^a-zA-Z+.@-]/"%" . sprintf("%02X", unpack("C", $&))/eg;
print qq`<a href="mailto:bug-followup\@FreeBSD.org,${email}?subject=Re:%20${cat}/${number}:%20$origsyn">Submit Followup</a> | <a href="./query-pr.cgi?pr=$pr&amp;f=raw">Raw PR</a> | <a href="./query-pr-summary.cgi?query">Find Another PR</a>\n`;
if (! $codeok ) {
print "<a name='SEEMAIL' id='SEEMAIL' />";
print "<p>To see this PR with email addresses ";
print " displayed, enter the code from the image and submit: </p>\n";
print "<form method='post' action='$scriptname'>\n";
print "<input type='hidden' name='pr' value='$number'/>\n";
print "<input type='text' name='code-confirm' ";
print " id='code-confirm' size='8' />\n";
print "<label for='code-confirm'>";
print "<img src='querypr-code.cgi?dummy=1' ";
print " alt='Random text; if you cannot see the image, please email ";
print " bugbusters\@FreeBSD.org' border='0' height='24' /></label>\n";
print "<input type='submit' value='Go' />\n";
print "</form>\n";
}
print &html_footer;
# Sleep 0.35 seconds to avoid DoS attacks from broken robots