From 360999ca4a16078f39c4cd68037409810fabb5b3 Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Sun, 17 Jun 2007 18:24:29 +0100 Subject: [PATCH] - Add bugspam.cgi with confirm string (closes: #348225) --- debian/changelog | 1 + examples/debian/misc/bugspam.cgi | 51 ++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100755 examples/debian/misc/bugspam.cgi diff --git a/debian/changelog b/debian/changelog index 8a02f903..be253864 100644 --- a/debian/changelog +++ b/debian/changelog @@ -192,6 +192,7 @@ debbugs (2.4.2) UNRELEASED; urgency=low - Add notfixed/notfound commands (closes: #389634) - Fix soapy insanity (closes: #422062) - Add script to split index.db by severities (closes: #422062) + - Add bugspam.cgi with confirm string (closes: #348225) -- Colin Watson Fri, 20 Jun 2003 18:57:25 +0100 diff --git a/examples/debian/misc/bugspam.cgi b/examples/debian/misc/bugspam.cgi new file mode 100755 index 00000000..2a8c4bb8 --- /dev/null +++ b/examples/debian/misc/bugspam.cgi @@ -0,0 +1,51 @@ +#!/usr/bin/perl -wT + +use strict; +use CGI qw(param remote_host); + +sub quitcgi($) { + my $msg = shift; + print "Content-Type: text/html\n\n"; + print "Error\n"; + print "An error occurred. Dammit.\n"; + print "Error was: $msg.\n"; + print "\n"; + exit 0; +} + +my $bug = param('bug') or quitcgi('No bug specfied'); +quitcgi('No valid bug number') unless $bug =~ /^\d{3,6}$/; +my $remote_host = remote_host or quitcgi("No remote host"); +my $ok = param('ok'); +if (not defined $ok) { + print "Content-Type: text/html\n\n"; + print "Verify submission\n"; + print "

Verify report for bug $bug

\n"; + print qq(Yes, report bug $bug as spam\n); + print "\n"; + exit 0; +} +my $time = time(); + +if ($remote_host =~ /^(?:222\.145\.167\.130|222\.148\.27\.140|61\.192\.213\.69|59\.124\.205\.94|221\.191\.105\.116|87\.69\.80\.58|201\.215\.217\.26|201\.215\.217\.32|66\.63\.250\.28|124\.29\.15\.132|61\.192\.200\.111|58\.81\.190\.204|220\.150\.239\.110|59\.106\.128\.138|216\.170\.223\.41|87\.165\.200\.176|62\.4\.19\.137|122\.16\.111\.96|121\.94\.6\.159|190\.42\.8\.125|61\.192\.200\.130|82\.135\.92\.154|221\.115\.95\.197|222\.239\.79\.10(?:7|8)|210\.91\.8\.51|61\.192\.206\.109|61\.192\.203\.55|140\.123\.100\.(?:15|13))$/) { + print "Content-Type: text/html\n\n"; + print "Go Away\n"; + print "

Report rejeted

\n"; + print "You have been abusing the BTS. Please go away. Contact owner\@bugs.debian.org if you can explain why you should be allowed to use the BTS.\n"; + print "\n"; + exit 0; +} + +open SPAMEDBUGS, '>>', '/org/bugs.debian.org/spammed/spammedbugs' + or quitcgi("opening spammedbugs: $!"); +print SPAMEDBUGS "$bug\t$remote_host\t$time\n" + or quitcgi("writing spammedbugs: $!"); +close SPAMEDBUGS; + +print "Content-Type: text/html\n\n"; +print "Thanks\n"; +print "

Report accepted

\n"; +print "Thank you for reporting that this bug log contains spam. These reports\n"; +print "are reviewed regularly and used to clean the bug logs and train the spam filters.\n"; +print "\n"; +exit 0; -- 2.39.5