=================================================================== RCS file: /cvs/cvsweb/cvsweb.cgi,v retrieving revision 1.1.1.4 retrieving revision 3.12 diff -u -p -r1.1.1.4 -r3.12 --- cvsweb/cvsweb.cgi 2000/09/03 18:41:30 1.1.1.4 +++ cvsweb/cvsweb.cgi 2000/08/15 06:54:01 3.12 @@ -41,8 +41,8 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # -# $zId: cvsweb.cgi,v 1.94 2000/08/24 06:41:22 hnordstrom Exp $ -# $kId: cvsweb.cgi,v 1.17 2000/09/03 18:25:47 knu Exp $ +# $zId: cvsweb.cgi,v 1.93 2000/07/27 17:42:28 hzeller Exp $ +# $Id: cvsweb.cgi,v 3.12 2000/08/15 06:54:01 knu Exp $ # ### @@ -53,8 +53,8 @@ use vars qw ( %CVSROOT %CVSROOTdescr %MIRRORS %DEFAULTVALUE %ICONS %MTYPES %alltags @tabcolors %fileinfo %tags @branchnames %nameprinted %symrev %revsym @allrevisions %date %author @revdisplayorder - @revisions %state %difflines %log %branchpoint @revorder - $prcgi @prcategories $prcategories $mancgi + @revisions %state %difflines %log %branchpoint @revorder $prcgi + @prcategories $prcategories $checkoutMagic $doCheckout $scriptname $scriptwhere $where $pathinfo $Browser $nofilelinks $maycompress @stickyvars %funcline_regexp $is_mod_perl @@ -124,10 +124,7 @@ use Cwd; # User configuration is stored in $config = undef; -for ($ENV{CVSWEB_CONFIG}, -# '/home/knu/etc/cvsweb.conf', - '/usr/local/etc/cvsweb.conf', - getcwd . '/cvsweb.conf') { +for ($ENV{CVSWEB_CONFIG}, '/usr/local/etc/cvsweb.conf', getcwd . '/cvsweb.conf') { $config = $_ if defined($_) && -r $_; } @@ -347,7 +344,6 @@ foreach my $k (keys %ICONS) { do "$config-$cvstree" if (-f "$config-$cvstree"); $prcategories = '(?:' . join('|', @prcategories) . ')'; -$prcgi .= '%s' if defined($prcgi) && $prcgi !~ /%s/; $fullname = $cvsroot . '/' . $where; $mimetype = &getMimeTypeFromSuffix ($fullname); @@ -721,7 +717,7 @@ elsif (-d $fullname) { print "All tags / default branch\n"; foreach my $tag (reverse sort { lc $a cmp lc $b } keys %tags) { print "$tag\n"; } print "\n"; @@ -757,7 +753,7 @@ elsif (-d $fullname) { printDiffSelect(0); print ""; print "Show Attic files: "; - print "\n"; print ""; print "\n"; @@ -887,7 +883,7 @@ sub findLastModifiedSubdirs(@) { } sub htmlify($;$) { - my($string, $extra) = @_; + my($string, $pr) = @_; # Special Characters; RFC 1866 $string =~ s/&/&/g; @@ -896,21 +892,14 @@ sub htmlify($;$) { $string =~ s/>/>/g; # get URL's as link .. - $string =~ s`(http|ftp|https)(://[-a-zA-Z0-9%.~:_/]+)([?&]([-a-zA-Z0-9%.~:_]+)=([-a-zA-Z0-9%.~:_])+)*`$1$2$3`g; + $string =~ s`(http|ftp|https)(://[-a-zA-Z0-9%.~:_/]+)([?&]([-a-zA-Z0-9%.~:_]+)=([-a-zA-Z0-9%.~:_])+)*`$1$2$3`; # get e-mails as link - $string =~ s`([-a-zA-Z0-9_.]+@([-a-zA-Z0-9]+\.)+[A-Za-z]{2,4})`$1`g; + $string =~ s`([-a-zA-Z0-9_.]+@([-a-zA-Z0-9]+\.)+[A-Za-z]{2,4})`$1`; - if ($extra) { - # get PR #'s as link .. - if (defined($prcgi)) { - 1 while $string =~ s`\b(pr[:#]?\s*(?:#?\d+[,\s]\s*)*#?)(\d+)\b`sprintf('%s%s', $1, sprintf($prcgi, $2), $2)`ie; - $string =~ s`\b${prcategories}/(\d+)\b`sprintf('%s', sprintf($prcgi, $1), $&)`igeo; - } - - # get manpage specs as link .. - if (defined($mancgi)) { - $string =~ s`\b([a-zA-Z]\w+)\(([0-9n])\)\B`sprintf('%s', sprintf($mancgi, $2, $1), $&)`ge; - } + # get #PR as link .. + if ($pr && defined($prcgi)) { + 1 while $string =~ s`\b(pr[:#]?\s*(?:#?\d+[,\s]\s*)*#?)(\d+)\b`$1$2`i; + $string =~ s`\b${prcategories}/(\d+)\b`$&`igo; } return $string; @@ -920,7 +909,7 @@ sub spacedHtmlText($) { local $_ = $_[0]; # Cut trailing spaces - s/\s+\n$//; + s/\s+$//; # Expand tabs s/\t+/' ' x (length($&) * $tabstop - length($`) % $tabstop)/e @@ -957,10 +946,6 @@ sub link($$) { sub revcmp($$) { my($rev1, $rev2) = @_; - - # make no comparison for a tag or a branch - return 0 if $rev1 =~ /[^\d.]/ || $rev2 =~ /[^\d.]/; - my(@r1) = split(/\./, $rev1); my(@r2) = split(/\./, $rev2); my($a,$b); @@ -1075,7 +1060,7 @@ sub doAnnotate($$) { # make sure the revisions a wellformed, for security # reasons .. - if ($rev =~ /[^\w.]/) { + if (!($rev =~ /^[\d\.]+$/)) { &fatal("404 Not Found", "Malformed query \"$ENV{QUERY_STRING}\""); } @@ -1226,13 +1211,9 @@ sub doCheckout($$) { my ($mimetype,$revopt); my $fh = do {local(*FH);}; - if ($rev eq 'HEAD' || $rev eq '.') { - $rev = undef; - } - # make sure the revisions a wellformed, for security # reasons .. - if (defined($rev) && $rev =~ /[^\w.]/) { + if (defined($rev) && !($rev =~ /^[\d\.]+$/)) { &fatal("404 Not Found", "Malformed query \"$ENV{QUERY_STRING}\""); } @@ -1268,7 +1249,7 @@ sub doCheckout($$) { # Safely for a child process to read from. if (! open($fh, "-|")) { # child open(STDERR, ">&STDOUT"); # Redirect stderr to stdout - exec("cvs", "-Rld", $cvsroot, "co", "-p", $revopt, $where); + exec("cvs", "-d", $cvsroot, "co", "-p", $revopt, $where); } #=================================================================== #Checking out squid/src/ftp.c @@ -1385,10 +1366,9 @@ sub doDiff($$$$$$) { $rev2 = $tr2; $sym2 = ""; } - # make sure the revisions a wellformed, for security # reasons .. - if ($rev1 =~ /[^\w.]/ || $rev2 =~ /[^\w.]/) { + if (!($rev1 =~ /^[\d\.]+$/) || !($rev2 =~ /^[\d\.]+$/)) { &fatal("404 Not Found", "Malformed query \"$ENV{QUERY_STRING}\""); } @@ -1430,7 +1410,7 @@ sub doDiff($$$$$$) { # apply special options if ($showfunc) { - push @difftype, '-p' if $f =~ /^[cHhu]$/; + push @difftype, '-p'; my($re1, $re2); @@ -2142,7 +2122,7 @@ EOF print "\n"; $diffrev = $revdisplayorder[0]; $diffrev = $input{"r2"} if (defined($input{"r2"})); - print "\n"; + print "\n"; print "Type of Diff should be a "; printDiffSelect(0); print "\n"; @@ -2390,7 +2370,7 @@ sub navigateHeader($$$$$) { $swhere = urlencode($filename) if ($swhere eq ""); print "<\!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"; print "\n\n"; - print ''; + print ''; print "\n$path$filename - $title - $rev\n"; print "\n"; print ""; @@ -2742,7 +2722,7 @@ sub http_header(;$) { sub html_header($) { my ($title) = @_; - my $version = '$zRevision: 1.94 $ $kRevision: 1.17 $'; #' + my $version = '$zRevision: 1.93 $ $Revision: 3.12 $'; #' http_header(); print <