version 1.14, 2005/02/05 22:20:56
|
version 1.16, 2005/02/10 22:30:56
|
Line 52 sub subscribed {
|
Line 52 sub subscribed {
|
|
|
sub handler { |
sub handler { |
my $r = shift; |
my $r = shift; |
my $reqhost = $r->get_remote_host(REMOTE_HOST); |
my $reqhost = $r->get_remote_host(REMOTE_NOLOOKUP); |
if (!$reqhost) { |
my %iphost=&Apache::lonnet::get_iphost(); |
$r->log_reason("Unable to do hostname lookup for ".$ENV{'REMOTE_ADDR'}); |
my $hostids=$iphost{$reqhost}; |
|
if (!$hostids && $reqhost ne '127.0.0.1' ) { |
|
$r->log_reason("Unable to find a host for ". |
|
$r->get_remote_host(REMOTE_NOLOOKUP)); |
|
return FORBIDDEN; |
} |
} |
if ($reqhost eq 'localhost.localdomain') { |
if ($reqhost eq '127.0.0.1') { |
return OK; |
return OK; |
} |
} |
my $return; |
my $return; |
my @ids=(); |
my @ids=(); |
my $id; |
my $id; |
foreach $id (keys %Apache::lonnet::hostname) { |
|
if ($Apache::lonnet::hostname{$id} =~ /\Q$reqhost\E/i) { |
foreach $id (@{$hostids}) { |
my $filename=$r->filename; |
my $filename=$r->filename; |
my $uri =$r->uri; |
my $uri =$r->uri; |
if ((-e "$filename.$id") || |
if ((-e "$filename.$id") || |
&subscribed($filename,$id) || |
&subscribed($filename,$id) || |
($filename=~/\.meta$/) || |
($filename=~/\.meta$/) || |
($uri=~m|^/raw/uploaded|)) { |
($uri=~m|^/raw/uploaded|)) { |
return OK; |
return OK; |
} else { |
} else { |
$return=FORBIDDEN; |
$return=FORBIDDEN; |
push(@ids,$id); |
push(@ids,$id); |
} |
|
} |
} |
} |
} |
if ($return == FORBIDDEN) { |
if ($return == FORBIDDEN) { |