version 1.154, 2003/10/08 20:29:46
|
version 1.156, 2003/10/13 08:49:54
|
Line 99 my $thisserver;
|
Line 99 my $thisserver;
|
my %hostid; |
my %hostid; |
my %hostdom; |
my %hostdom; |
my %hostip; |
my %hostip; |
|
my %managers; # If defined $managers{hostname} is a manager |
my %perlvar; # Will have the apache conf defined perl vars. |
my %perlvar; # Will have the apache conf defined perl vars. |
|
|
# |
# |
Line 155 sub GetCertificate {
|
Line 156 sub GetCertificate {
|
|
|
return $clientip; |
return $clientip; |
} |
} |
|
# |
|
# ReadManagerTable: Reads in the current manager table. For now this is |
|
# done on each manager authentication because: |
|
# - These authentications are not frequent |
|
# - This allows dynamic changes to the manager table |
|
# without the need to signal to the lond. |
|
# |
|
|
|
sub ReadManagerTable { |
|
|
|
# Clean out the old table first.. |
|
|
|
foreach my $key (keys %managers) { |
|
delete $managers{$key}; |
|
} |
|
|
|
my $tablename = $perlvar{'lonTabDir'}."/managers.tab"; |
|
if (!open (MANAGERS, $tablename)) { |
|
logthis('<font color="red">No manager table. Nobody can manage!!</font>'); |
|
return; |
|
} |
|
while(my $host = <MANAGERS>) { |
|
chomp($host); |
|
if (!defined $hostip{$host}) { |
|
logthis('<font color="red"> manager '.$host. |
|
" not in hosts.tab, rejected as manager</font>"); |
|
} else { |
|
$managers{$host} = $hostip{$host}; # Whatever for now. |
|
} |
|
} |
|
} |
|
|
# |
# |
# ValidManager: Determines if a given certificate represents a valid manager. |
# ValidManager: Determines if a given certificate represents a valid manager. |
Line 167 sub GetCertificate {
|
Line 198 sub GetCertificate {
|
sub ValidManager { |
sub ValidManager { |
my $certificate = shift; |
my $certificate = shift; |
|
|
my $hostentry = $hostid{$certificate}; |
ReadManagerTable; |
if ($hostentry ne undef) { |
|
&logthis('<font color="yellow">Authenticating manager'. |
my $hostname = $hostid{$certificate}; |
" $hostentry</font>"); |
|
return 1; |
|
|
if ($hostname ne undef) { |
|
if($managers{$hostname} ne undef) { |
|
&logthis('<font color="yellow">Authenticating manager'. |
|
" $hostname</font>"); |
|
return 1; |
|
} else { |
|
&logthis('<font color="red" failed manager authentication '. |
|
$hostname." is not a valid manager host</font>"); |
|
return 0; |
|
} |
} else { |
} else { |
&logthis('<font color="red"> Failed manager authentication '. |
&logthis('<font color="red"> Failed manager authentication '. |
"$certificate </font>"); |
"$certificate </font>"); |
|
return 0; |
} |
} |
} |
} |
# |
# |
Line 626 sub checkchildren {
|
Line 668 sub checkchildren {
|
} |
} |
} |
} |
$SIG{ALRM} = 'DEFAULT'; |
$SIG{ALRM} = 'DEFAULT'; |
$SIG{__DIE__} = \&catchcexception; |
$SIG{__DIE__} = \&catchexception; |
} |
} |
|
|
# --------------------------------------------------------------------- Logging |
# --------------------------------------------------------------------- Logging |