From 95357bcc18daf291bbae476ef9b83815f4a0cec9 Mon Sep 17 00:00:00 2001 From: Andrew Dunstan Date: Sat, 18 Dec 2010 18:19:49 -0500 Subject: [PATCH] housekeeping --- cgi-bin/register.pl | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/cgi-bin/register.pl b/cgi-bin/register.pl index 5b1ce0a..5d83e79 100755 --- a/cgi-bin/register.pl +++ b/cgi-bin/register.pl @@ -15,7 +15,8 @@ use CGI; use Template; use Captcha::reCAPTCHA; -use vars qw($dbhost $dbname $dbuser $dbpass $dbport $notifyapp $captcha_pubkey $captcha_privkey $template_dir $default_host); +use vars qw($dbhost $dbname $dbuser $dbpass $dbport $notifyapp + $captcha_pubkey $captcha_privkey $template_dir $default_host); require "$ENV{BFConfDir}/BuildFarmWeb.pl"; @@ -29,8 +30,10 @@ my $query = new CGI; my $params = $query->Vars; -my ($os, $osv, $comp, $compv, $arch, $email, $owner, $challenge, $response ) = @{$params}{ - qw(os osv comp compv arch email owner recaptcha_challenge_field recaptcha_response_field)}; +my ($os, $osv, $comp, $compv, $arch, $email, $owner, $challenge, $response ) = + @{$params}{ + qw(os osv comp compv arch email owner recaptcha_challenge_field + recaptcha_response_field)}; my $captcha = Captcha::reCAPTCHA->new; my $captcha_ok = $captcha->check_answer @@ -41,17 +44,20 @@ my $captcha_ok = $captcha->check_answer ); -unless ($os && $osv && $comp && $compv && $arch && $email && $owner && $captcha_ok->{is_valid}) +unless ($os && $osv && $comp && $compv && $arch && $email && $owner && + $captcha_ok->{is_valid}) { print "Content-Type: text/html\n\n"; $template->process('register-incomplete.tt'); exit; } -# some idiot has a script that tries to talk to me -# this should catch and dispose of him -if ((grep {/rgergerger|\@pgbuildfarm\.org|Content-Type:|http:|mailto:|href=|None|Unknown/} $os,$osv,$comp,$compv,$arch,$email,$owner) - || ($email =~ /john.*\@aol.com/) ) +# these filters should catch and dispose of idiots, +# although I hope they are redundant now we're using captchas. + +if ((grep + {/\@pgbuildfarm\.org|Content-Type:|http:|mailto:|href=|None|Unknown/} + $os,$osv,$comp,$compv,$arch,$email,$owner)) { print "Status: 403 Forbidden - go away idiot\n", -- 2.30.2