Remove some relics of the CVS based ports system that doesn't exist.
Approved by: gjb
This commit is contained in:
parent
081fea100a
commit
c570f1067c
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/head/; revision=45331
3 changed files with 0 additions and 275 deletions
|
@ -1,123 +0,0 @@
|
|||
#!/usr/bin/perl -T
|
||||
# Copyright (c) 1997-2011 Wolfram Schneider <wosch@FreeBSD.ORG>, Berlin.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
# pds.cgi - FreeBSD Ports download sources cgi script
|
||||
# print a list of source files for a port
|
||||
#
|
||||
# $FreeBSD$
|
||||
|
||||
sub escape($) { $_ = $_[0]; s/&/&/g; s/</</g; s/>/>/g; $_; }
|
||||
|
||||
$hsty_email = 'ports@FreeBSD.org';
|
||||
|
||||
require "./cgi-lib.pl";
|
||||
require "./cgi-style.pl";
|
||||
|
||||
$ENV{'QUERY_STRING'} =~ /([\w\-\.\/+_@]+)/;
|
||||
$file = escape($1);
|
||||
$file_rcs = "$file/Makefile,v";
|
||||
|
||||
$cvsroot = "/usr/local/www/cvsroot/FreeBSD";
|
||||
$co = '/usr/bin/co';
|
||||
$make = '/usr/bin/make';
|
||||
$pds = '/usr/local/www/bin/pds';
|
||||
|
||||
# security
|
||||
$ENV{'PATH'} = '/bin:/usr/bin';
|
||||
|
||||
# set DISTDIR to a dummy directory.
|
||||
$ENV{'DISTDIR'} = "/tmp/___pds.cgi___" . $<;
|
||||
|
||||
# security
|
||||
$ENV{'PATH'} = '/bin:/usr/bin';
|
||||
|
||||
|
||||
sub footer {
|
||||
return qq{<P>\n<A HREF="} .
|
||||
($ENV{'PATH_INFO'} ? 'http://www.FreeBSD.org/ports/' : '../ports/') .
|
||||
qq{">Help</a>\n} . &html_footer;
|
||||
}
|
||||
|
||||
print &short_html_header("FreeBSD Ports download script");
|
||||
print "<p>\n";
|
||||
if ($file ne escape($ENV{'QUERY_STRING'})) {
|
||||
print qq{Invalid query string\n} . &footer;
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($file !~ m%^ports/[^/]+/[^/]+$%) {
|
||||
print qq{Invalid module name: "$file"\n} . &footer;
|
||||
exit;
|
||||
}
|
||||
|
||||
if (! -f "$cvsroot/$file_rcs" || $file_rcs =~ /\.\./) {
|
||||
print qq{Port "$file" does not exist.\n} . &footer;
|
||||
exit;
|
||||
}
|
||||
|
||||
print "<h2>Sources for $file</h2>\n\n";
|
||||
|
||||
open(MAKE, "-|") || exec($pds, "$cvsroot/$file_rcs") || do {
|
||||
print "Sorry, cannot run make\n" . &footer;
|
||||
exit;
|
||||
};
|
||||
|
||||
local(@sources);
|
||||
while(<MAKE>) {
|
||||
push(@sources, $_);
|
||||
}
|
||||
close MAKE;
|
||||
|
||||
if ($#sources < 0) {
|
||||
print "Sorry, did not find the sources for $file\n" . &footer;
|
||||
exit;
|
||||
}
|
||||
|
||||
foreach (@sources) {
|
||||
print qq{<a href="$1">$1</a><br>\n} if m%((http|ftp)://\S+)%;
|
||||
}
|
||||
|
||||
local($md5file) = "$cvsroot/$file/distinfo,v";
|
||||
if (-f $md5file) {
|
||||
open(CO, "-|") || exec ($co, '-q', '-p', $md5file) || do {
|
||||
print "Cannot read MD5 checksum file for $file\n" . &footer;
|
||||
exit;
|
||||
};
|
||||
local(@checksums);
|
||||
while(<CO>) {
|
||||
push(@checksums, $_) if $_;
|
||||
}
|
||||
close CO;
|
||||
if ($#checksums >= 0) {
|
||||
print "<h3>MD5 Checksum for $file</h3>\n\n";
|
||||
print "<PRE>\n";
|
||||
print @checksums;
|
||||
print "</PRE>\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print &footer;
|
||||
exit;
|
|
@ -138,12 +138,6 @@ sub init_variables {
|
|||
# security
|
||||
$ENV{'PATH'} = '/bin:/usr/bin';
|
||||
|
||||
# ports download sources script
|
||||
$pds = 'pds.cgi';
|
||||
|
||||
# make plain text URLs clickable cgi script
|
||||
$url = 'url.cgi';
|
||||
|
||||
# extension type for packages
|
||||
$packageExt = 'tbz';
|
||||
|
||||
|
|
|
@ -1,146 +0,0 @@
|
|||
#!/usr/bin/perl -T
|
||||
#
|
||||
# Copyright (c) Oct 1997-2011 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
# url.cgi - make plain text URLs clickable
|
||||
#
|
||||
# $FreeBSD$
|
||||
|
||||
use strict;
|
||||
|
||||
$ENV{"PATH"} = "/bin:/usr/bin";
|
||||
|
||||
$main::hsty_email = 'ports@FreeBSD.org';
|
||||
|
||||
# shutup perl -w
|
||||
my $dummy = $main::hsty_base . $main::hsty_email; undef $dummy;
|
||||
|
||||
require "./cgi-lib.pl";
|
||||
require "./cgi-style.pl";
|
||||
|
||||
my $file = $ENV{'QUERY_STRING'};
|
||||
my $uri = "$file";
|
||||
my $portcategory;
|
||||
|
||||
|
||||
# security checks
|
||||
if ($file !~ m%^(http|ftp)://[a-z_\-0-9]+\.freebsd\.(com|org)%i &&
|
||||
$file !~ m%^ports/%) {
|
||||
&CgiError(("Invalid URL", "Only http://*.freebsd.* is allowed.\n"));
|
||||
exit(0);
|
||||
}
|
||||
|
||||
# backward compatible with old ports layout
|
||||
$file =~ s%/pkg/DESCR$%/pkg-descr%;
|
||||
|
||||
# catch '..', multiple times
|
||||
# ports/japanese/ppxp/../../net/ppxp/pkg-descr
|
||||
# -> ports/net/ppxp/pkg-descr
|
||||
1 while $file =~ s%/[^/]+/\.\./%/%;
|
||||
|
||||
# print HTML header
|
||||
$file =~ s%(http|ftp)://ftp.FreeBSD.org/pub/FreeBSD/(branches/|FreeBSD)-current/%%i;
|
||||
if ($file =~ m%^ports/([\w\-]+)/(\w[\w\-+.]+)/pkg-descr%) {
|
||||
print &html_header(
|
||||
"Port description for $1/$2");
|
||||
$portcategory = $1;
|
||||
|
||||
# XXX: shut up perl -T warnings
|
||||
$file = qq{ports/$1/$2/pkg-descr};
|
||||
} else {
|
||||
print &short_html_header($file);
|
||||
}
|
||||
|
||||
my $isvalidfilename = ($file =~ m%^ports/[\w\-]+/\w[\w\-+.]*/pkg-descr%);
|
||||
my $atticfile = $file;
|
||||
$atticfile =~ s%^(.*)/([^/]+)$%$1/Attic/$2%;
|
||||
|
||||
my($cvsroot) = '/usr/local/www/cvsroot/FreeBSD';
|
||||
my $realfile;
|
||||
|
||||
# since CVS moves deleted files into the Attic subdirectory we also
|
||||
# want to look there, so we can find CVS deleted files (which might
|
||||
# still be referenced from other places).
|
||||
if ($isvalidfilename && -f "$cvsroot/$file,v") {
|
||||
$realfile = $file;
|
||||
} elsif ($isvalidfilename && -f "$cvsroot/$atticfile,v") {
|
||||
$realfile = $atticfile;
|
||||
} else {
|
||||
$isvalidfilename = 0;
|
||||
}
|
||||
|
||||
# do cvs checkout
|
||||
if($isvalidfilename) {
|
||||
open(CO, "-|") ||
|
||||
exec ('/usr/bin/co', '-p', '-q', "$cvsroot/$realfile,v") ||
|
||||
die "exec co -pq $cvsroot/$realfile,v: $!\n";
|
||||
} else {
|
||||
print "<p>The port specified does not exist, or has an invalid name: <p>",
|
||||
"<blockquote>$file</blockquote>\n";
|
||||
|
||||
# Server environment variables
|
||||
my $http_referer = $ENV{'HTTP_REFERER'};
|
||||
|
||||
# rfc1738 says that ";"|"/"|"?"|":"|"@"|"&"|"=" may be reserved.
|
||||
$http_referer =~ s/([^a-zA-Z0-9;\/?:&=])/sprintf("%%%02x",ord($1))/eg;
|
||||
|
||||
if ($http_referer) {
|
||||
print qq{<p>You are coming from
|
||||
<blockquote>
|
||||
<a href="$http_referer">$http_referer</a>.
|
||||
</blockquote>
|
||||
<p>\n};
|
||||
}
|
||||
print "<p>Please contact www\@FreeBSD.org\n";
|
||||
warn "$0: invalid port name: `$file', $http_referer\n";
|
||||
}
|
||||
print "\n<HR>\n<pre>\n";
|
||||
|
||||
# read the pkg-descr file and make URLs clickable
|
||||
my($content);
|
||||
$content .= $_ while(<CO>);
|
||||
$content =~ s/</</g;
|
||||
$content =~ s%((http|ftp)://\S+[^.;,"\s>])%<A HREF="$1">$1</A>%gi;
|
||||
|
||||
print $content;
|
||||
print "</pre>\n";
|
||||
|
||||
# Add 'source' link for freebsd ports
|
||||
if ($file =~ m%^(ports/[\w\-]+/\w[\w\-+.]+)/pkg-descr%) {
|
||||
print qq{<HR><a href=\"pds.cgi?$1">Sources</a> |\n};
|
||||
print qq{<a href=\"../ports/$portcategory.html">};
|
||||
print qq{Category $portcategory</a>\n};
|
||||
print qq{| <a href="../ports/">Help</a>\n};
|
||||
print qq{<BR>\n};
|
||||
}
|
||||
|
||||
# print standard footer line
|
||||
print &html_footer;
|
||||
|
||||
# Sleep 0.35 seconds to avoid DoS attacks from broken robots
|
||||
select undef, undef, undef, 0.35;
|
||||
|
||||
exit;
|
||||
|
Loading…
Reference in a new issue