version 1.188, 2004/04/29 10:24:40
|
version 1.192, 2004/06/01 09:58:30
|
Line 225 sub ValidManager {
|
Line 225 sub ValidManager {
|
# 1 - Success. |
# 1 - Success. |
# |
# |
sub CopyFile { |
sub CopyFile { |
my $oldfile = shift; |
|
my $newfile = shift; |
my ($oldfile, $newfile) = @_; |
|
|
# The file must exist: |
# The file must exist: |
|
|
Line 326 sub AdjustHostContents {
|
Line 326 sub AdjustHostContents {
|
# 0 - failure and $! has an errno. |
# 0 - failure and $! has an errno. |
# |
# |
sub InstallFile { |
sub InstallFile { |
my $Filename = shift; |
|
my $Contents = shift; |
my ($Filename, $Contents) = @_; |
my $TempFile = $Filename.".tmp"; |
my $TempFile = $Filename.".tmp"; |
|
|
# Open the file for write: |
# Open the file for write: |
Line 564 sub isValidEditCommand {
|
Line 564 sub isValidEditCommand {
|
# file being edited. |
# file being edited. |
# |
# |
sub ApplyEdit { |
sub ApplyEdit { |
my $directive = shift; |
|
my $editor = shift; |
my ($directive, $editor) = @_; |
|
|
# Break the directive down into its command and its parameters |
# Break the directive down into its command and its parameters |
# (at most two at this point. The meaning of the parameters, if in fact |
# (at most two at this point. The meaning of the parameters, if in fact |
Line 649 sub AdjustOurHost {
|
Line 649 sub AdjustOurHost {
|
# editor - Editor containing the file. |
# editor - Editor containing the file. |
# |
# |
sub ReplaceConfigFile { |
sub ReplaceConfigFile { |
my $filename = shift; |
|
my $editor = shift; |
my ($filename, $editor) = @_; |
|
|
CopyFile ($filename, $filename.".old"); |
CopyFile ($filename, $filename.".old"); |
|
|
Line 749 sub catchexception {
|
Line 749 sub catchexception {
|
$SIG{'QUIT'}='DEFAULT'; |
$SIG{'QUIT'}='DEFAULT'; |
$SIG{__DIE__}='DEFAULT'; |
$SIG{__DIE__}='DEFAULT'; |
&status("Catching exception"); |
&status("Catching exception"); |
&logthis("<font color=red>CRITICAL: " |
&logthis("<font color='red'>CRITICAL: " |
."ABNORMAL EXIT. Child $$ for server $thisserver died through " |
."ABNORMAL EXIT. Child $$ for server $thisserver died through " |
."a crash with this error msg->[$error]</font>"); |
."a crash with this error msg->[$error]</font>"); |
&logthis('Famous last words: '.$status.' - '.$lastlog); |
&logthis('Famous last words: '.$status.' - '.$lastlog); |
Line 760 sub catchexception {
|
Line 760 sub catchexception {
|
|
|
sub timeout { |
sub timeout { |
&status("Handling Timeout"); |
&status("Handling Timeout"); |
&logthis("<font color=ref>CRITICAL: TIME OUT ".$$."</font>"); |
&logthis("<font color='red'>CRITICAL: TIME OUT ".$$."</font>"); |
&catchexception('Timeout'); |
&catchexception('Timeout'); |
} |
} |
# -------------------------------- Set signal handlers to record abnormal exits |
# -------------------------------- Set signal handlers to record abnormal exits |
Line 843 sub HUNTSMAN { # si
|
Line 843 sub HUNTSMAN { # si
|
&logthis("Free socket: ".shutdown($server,2)); # free up socket |
&logthis("Free socket: ".shutdown($server,2)); # free up socket |
my $execdir=$perlvar{'lonDaemons'}; |
my $execdir=$perlvar{'lonDaemons'}; |
unlink("$execdir/logs/lond.pid"); |
unlink("$execdir/logs/lond.pid"); |
&logthis("<font color=red>CRITICAL: Shutting down</font>"); |
&logthis("<font color='red'>CRITICAL: Shutting down</font>"); |
&status("Done killing children"); |
&status("Done killing children"); |
exit; # clean up with dignity |
exit; # clean up with dignity |
} |
} |
Line 853 sub HUPSMAN { # sig
|
Line 853 sub HUPSMAN { # sig
|
&status("Killing children for restart (HUP)"); |
&status("Killing children for restart (HUP)"); |
kill 'INT' => keys %children; |
kill 'INT' => keys %children; |
&logthis("Free socket: ".shutdown($server,2)); # free up socket |
&logthis("Free socket: ".shutdown($server,2)); # free up socket |
&logthis("<font color=red>CRITICAL: Restarting</font>"); |
&logthis("<font color='red'>CRITICAL: Restarting</font>"); |
my $execdir=$perlvar{'lonDaemons'}; |
my $execdir=$perlvar{'lonDaemons'}; |
unlink("$execdir/logs/lond.pid"); |
unlink("$execdir/logs/lond.pid"); |
&status("Restarting self (HUP)"); |
&status("Restarting self (HUP)"); |
Line 1015 sub Debug {
|
Line 1015 sub Debug {
|
# request - Original request from client. |
# request - Original request from client. |
# |
# |
sub Reply { |
sub Reply { |
my $fd = shift; |
|
my $reply = shift; |
my ($fd, $reply, $request) = @_; |
my $request = shift; |
|
|
|
print $fd $reply; |
print $fd $reply; |
Debug("Request was $request Reply was $reply"); |
Debug("Request was $request Reply was $reply"); |
Line 1095 sub reconlonc {
|
Line 1094 sub reconlonc {
|
kill USR1 => $loncpid; |
kill USR1 => $loncpid; |
} else { |
} else { |
&logthis( |
&logthis( |
"<font color=red>CRITICAL: " |
"<font color='red'>CRITICAL: " |
."lonc at pid $loncpid not responding, giving up</font>"); |
."lonc at pid $loncpid not responding, giving up</font>"); |
} |
} |
} else { |
} else { |
&logthis('<font color=red>CRITICAL: lonc not running, giving up</font>'); |
&logthis('<font color="red">CRITICAL: lonc not running, giving up</font>'); |
} |
} |
} |
} |
|
|
Line 1203 my $execdir=$perlvar{'lonDaemons'};
|
Line 1202 my $execdir=$perlvar{'lonDaemons'};
|
open (PIDSAVE,">$execdir/logs/lond.pid"); |
open (PIDSAVE,">$execdir/logs/lond.pid"); |
print PIDSAVE "$$\n"; |
print PIDSAVE "$$\n"; |
close(PIDSAVE); |
close(PIDSAVE); |
&logthis("<font color=red>CRITICAL: ---------- Starting ----------</font>"); |
&logthis("<font color='red'>CRITICAL: ---------- Starting ----------</font>"); |
&status('Starting'); |
&status('Starting'); |
|
|
|
|
Line 1340 sub make_new_child {
|
Line 1339 sub make_new_child {
|
print $client "ok\n"; |
print $client "ok\n"; |
} else { |
} else { |
&logthis( |
&logthis( |
"<font color=blue>WARNING: $clientip did not reply challenge</font>"); |
"<font color='blue'>WARNING: $clientip did not reply challenge</font>"); |
&status('No challenge reply '.$clientip); |
&status('No challenge reply '.$clientip); |
} |
} |
} else { |
} else { |
&logthis( |
&logthis( |
"<font color=blue>WARNING: " |
"<font color='blue'>WARNING: " |
."$clientip failed to initialize: >$remotereq< </font>"); |
."$clientip failed to initialize: >$remotereq< </font>"); |
&status('No init '.$clientip); |
&status('No init '.$clientip); |
} |
} |
} else { |
} else { |
&logthis( |
&logthis( |
"<font color=blue>WARNING: Unknown client $clientip</font>"); |
"<font color='blue'>WARNING: Unknown client $clientip</font>"); |
&status('Hung up on '.$clientip); |
&status('Hung up on '.$clientip); |
} |
} |
if ($clientok) { |
if ($clientok) { |
Line 1365 sub make_new_child {
|
Line 1364 sub make_new_child {
|
} |
} |
&reconlonc("$perlvar{'lonSockDir'}/$id"); |
&reconlonc("$perlvar{'lonSockDir'}/$id"); |
} |
} |
&logthis("<font color=green>Established connection: $clientname</font>"); |
&logthis("<font color='green'>Established connection: $clientname</font>"); |
&status('Will listen to '.$clientname); |
&status('Will listen to '.$clientname); |
# ------------------------------------------------------------ Process requests |
# ------------------------------------------------------------ Process requests |
while (my $userinput=<$client>) { |
while (my $userinput=<$client>) { |
Line 1562 sub make_new_child {
|
Line 1561 sub make_new_child {
|
$pwdcorrect=0; |
$pwdcorrect=0; |
# log error if it is not a bad password |
# log error if it is not a bad password |
if ($krb4_error != 62) { |
if ($krb4_error != 62) { |
&logthis('krb4:'.$uname.','.$contentpwd.','. |
&logthis('krb4:'.$uname.','. |
&Authen::Krb4::get_err_txt($Authen::Krb4::error)); |
&Authen::Krb4::get_err_txt($Authen::Krb4::error)); |
} |
} |
} |
} |
Line 2623 sub make_new_child {
|
Line 2622 sub make_new_child {
|
$qresult.=$key.'='.$descr.'&'; |
$qresult.=$key.'='.$descr.'&'; |
} else { |
} else { |
my $unescapeVal = &unescape($descr); |
my $unescapeVal = &unescape($descr); |
if (eval('$unescapeVal=~/$description/i')) { |
if (eval('$unescapeVal=~/\Q$description\E/i')) { |
$qresult.="$key=$descr&"; |
$qresult.="$key=$descr&"; |
} |
} |
} |
} |
Line 2878 sub make_new_child {
|
Line 2877 sub make_new_child {
|
} else { |
} else { |
print $client "refused\n"; |
print $client "refused\n"; |
$client->close(); |
$client->close(); |
&logthis("<font color=blue>WARNING: " |
&logthis("<font color='blue'>WARNING: " |
."Rejected client $clientip, closing connection</font>"); |
."Rejected client $clientip, closing connection</font>"); |
} |
} |
} |
} |
|
|
# ============================================================================= |
# ============================================================================= |
|
|
&logthis("<font color=red>CRITICAL: " |
&logthis("<font color='red'>CRITICAL: " |
."Disconnect from $clientip ($clientname)</font>"); |
."Disconnect from $clientip ($clientname)</font>"); |
|
|
|
|
Line 2910 sub make_new_child {
|
Line 2909 sub make_new_child {
|
# |
# |
sub ManagePermissions |
sub ManagePermissions |
{ |
{ |
my $request = shift; |
|
my $domain = shift; |
my ($request, $domain, $user, $authtype) = @_; |
my $user = shift; |
|
my $authtype= shift; |
|
|
|
# See if the request is of the form /$domain/_au |
# See if the request is of the form /$domain/_au |
if($request =~ /^(\/$domain\/_au)$/) { # It's an author rolesput... |
if($request =~ /^(\/$domain\/_au)$/) { # It's an author rolesput... |
Line 2930 sub ManagePermissions
|
Line 2927 sub ManagePermissions
|
# |
# |
sub GetAuthType |
sub GetAuthType |
{ |
{ |
my $domain = shift; |
|
my $user = shift; |
my ($domain, $user) = @_; |
|
|
Debug("GetAuthType( $domain, $user ) \n"); |
Debug("GetAuthType( $domain, $user ) \n"); |
my $proname = &propath($domain, $user); |
my $proname = &propath($domain, $user); |