===================================================================
RCS file: /cvs/cvsweb/cvsweb.cgi,v
retrieving revision 4.20
retrieving revision 4.22
diff -u -p -r4.20 -r4.22
--- cvsweb/cvsweb.cgi 2019/11/11 15:46:39 4.20
+++ cvsweb/cvsweb.cgi 2019/11/13 09:12:47 4.22
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-# $Id: cvsweb.cgi,v 4.20 2019/11/11 15:46:39 schwarze Exp $
+# $Id: cvsweb.cgi,v 4.22 2019/11/13 09:12:47 schwarze Exp $
# $knu: cvsweb.cgi,v 1.299 2010/11/13 16:37:18 simon
#
# cvsweb - a CGI interface to CVS trees.
@@ -144,7 +144,6 @@ sub spacedHtmlText($;$);
sub link($$);
sub revcmp($$);
sub fatal($$@);
-sub config_error($$);
sub redirect($;$);
sub safeglob($);
sub search_path($);
@@ -263,7 +262,7 @@ $scriptname = '' unless defined($scriptname);
$where = $pathinfo;
$doCheckout = $where =~ s|^/$CheckoutMagic/|/|o;
$where =~ s|^/||;
-$scriptname =~ s|^/*|/|;
+$scriptname =~ s|^/+||;
# Let's workaround thttpd's stupidity..
if ($scriptname =~ m|/$|) {
@@ -271,6 +270,7 @@ if ($scriptname =~ m|/$|) {
my $re = quotemeta $pathinfo;
$scriptname =~ s/$re$//;
}
+$scriptname = "/$scriptname" if $scriptname;
# $scriptname : the URI escaped path to this script
# $where : the path in the CVS repository (without leading /, or only /)
@@ -315,14 +315,18 @@ $maycompress = (
qw(cvsroot hideattic ignorecase sortby logsort f only_with_tag ln
hidecvsroot hidenonreadable);
-#
# Load configuration.
-#
-if (-f $config) {
- do "$config" or config_error($config, $@);
-} else {
- fatal("500 Internal Error",
- 'Configuration not found. Set the parameter $config
in cvsweb.cgi to your cvsweb.conf configuration file first.');
+{
+ $config =~ m|^/| or fatal '500 Internal Error',
+ 'Configuration file name "%s
" is not an absolute path.',
+ $config;
+ defined do $config and last;
+ $@ and fatal '500 Internal Error',
+ 'Error loading configuration file "%s
":
%s', + $config, $@; + fatal '500 Internal Error', + 'Cannot read configuration file "
%s
": %s',
+ $config, $! || 'unknown error';
}
# Try to find a readable dir where we can cd into. Some abs_path()
@@ -1541,17 +1545,6 @@ sub fatal($$@)
sprintf($format, map(htmlquote($_), @args)), "\n";
html_footer();
exit(1);
-}
-
-
-#
-# Signal a (fatal) configuration error.
-#
-sub config_error($$)
-{
- fatal('500 Internal Error',
- 'Error loading configuration file "%s
":