version 1.3, 2009/06/13 20:28:51
|
version 1.7, 2011/10/14 20:50:54
|
Line 55 package LONCAPA::lonauthcgi;
|
Line 55 package LONCAPA::lonauthcgi;
|
|
|
use strict; |
use strict; |
use lib '/home/httpd/lib/perl'; |
use lib '/home/httpd/lib/perl'; |
|
use Socket; |
use Apache::lonnet; |
use Apache::lonnet; |
use Apache::lonlocal; |
use Apache::lonlocal; |
use LONCAPA; |
use LONCAPA; |
|
use LONCAPA::Configuration(); |
|
|
############################################# |
############################################# |
############################################# |
############################################# |
Line 94 sub check_ipbased_access {
|
Line 96 sub check_ipbased_access {
|
return $allowed; |
return $allowed; |
} |
} |
} |
} |
|
if (&is_manager_ip($ip)) { |
|
$allowed = 1; |
|
return $allowed; |
|
} |
if ($page ne 'ping') { |
if ($page ne 'ping') { |
my @poss_domains = &Apache::lonnet::current_machine_domains(); |
my @poss_domains = &Apache::lonnet::current_machine_domains(); |
foreach my $dom (@poss_domains) { |
foreach my $dom (@poss_domains) { |
Line 117 sub check_ipbased_access {
|
Line 123 sub check_ipbased_access {
|
############################################# |
############################################# |
############################################# |
############################################# |
|
|
|
sub is_manager_ip { |
|
my ($remote_ip) = @_; |
|
return if ($remote_ip eq ''); |
|
my ($directory,$is_manager); |
|
my $config=LONCAPA::Configuration::read_conf(); |
|
if (ref($config) eq 'HASH') { |
|
$directory = $config->{'lonTabDir'}; |
|
} |
|
if (defined($directory)) { |
|
if (open(MANAGERS, "$directory/managers.tab")) { |
|
while(my $host = <MANAGERS>) { |
|
chomp($host); |
|
next if ($host =~ /^\#/); |
|
my $ip = &Apache::lonnet::get_host_ip($host); |
|
if (defined($ip)) { |
|
if ($remote_ip eq $ip) { |
|
$is_manager = 1; |
|
last; |
|
} |
|
} else { |
|
my ($cluname,$dnsname) = split(/:/, $host); |
|
$ip = gethostbyname($dnsname); |
|
if (defined($ip)) { |
|
my $hostip = inet_ntoa($ip); |
|
if ($hostip = $remote_ip) { |
|
$is_manager = 1; |
|
} |
|
} |
|
} |
|
} |
|
close(MANAGERS); |
|
} |
|
} |
|
return $is_manager; |
|
} |
|
|
|
############################################# |
|
############################################# |
|
|
=pod |
=pod |
|
|
=item can_view() |
=item can_view() |
Line 194 sub can_view {
|
Line 239 sub can_view {
|
} |
} |
} |
} |
} |
} |
|
last if $allowed; |
} |
} |
last if $allowed; |
|
} |
} |
} |
} |
return $allowed; |
return $allowed; |
Line 270 sub serverstatus_titles {
|
Line 315 sub serverstatus_titles {
|
'metadata_harvest' => 'Harvest Metadata Searches', |
'metadata_harvest' => 'Harvest Metadata Searches', |
'takeoffline' => 'Offline - replace Log-in page', |
'takeoffline' => 'Offline - replace Log-in page', |
'takeonline' => 'Online - restore Log-in page', |
'takeonline' => 'Online - restore Log-in page', |
'showenv' => "Show user environment", |
'showenv' => 'Show user environment', |
|
'toggledebug' => 'Toggle debug messages', |
); |
); |
return \%titles; |
return \%titles; |
} |
} |