Check SERVER_PORT when validating referers

Bug #284372 r=timeless


git-svn-id: svn://10.0.0.236/trunk@196646 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
cls%seawood.org
2006-05-16 05:23:22 +00:00
parent 7a92358866
commit cc3c5932e6

View File

@@ -1063,12 +1063,12 @@ sub validateReferer {
my (@scripts) = @_;
my $script;
my $found = 0;
my $script_path = dirname("$ENV{'SERVER_NAME'}$ENV{'SCRIPT_NAME'}");
my $script_path = dirname($ENV{'SCRIPT_NAME'});
my $referer = $ENV{'HTTP_REFERER'} || "";
foreach $script (@scripts) {
$found++ if
($referer =~ m@^http(s)?://(\w+(:\w+)?\@)?$script_path/$script(\?|$)@i);
($referer =~ m@^http(s)?://(\w+(:\w+)?\@)?$ENV{'SERVER_NAME'}(:$ENV{'SERVER_PORT'})?$script_path/$script(\?|$)@i);
}
die "This script cannot be called directly.\n" if (!$found);
}