Diff for /loncom/lond between versions 1.144 and 1.146

version 1.144, 2003/09/16 09:47:01 version 1.146, 2003/09/16 10:28:14
Line 60 Line 60
 # 09/08/2003 Ron Fox:  Told lond to take care of change logging so we  # 09/08/2003 Ron Fox:  Told lond to take care of change logging so we
 #      don't have to remember it:  #      don't have to remember it:
 # $Log$  # $Log$
   # Revision 1.146  2003/09/16 10:28:14  foxr
   # ReinitProcess - decode the process selector and produce the associated pid
   # filename.  Note: While it is possible to test that valid process selectors are
   # handled properly I am not able to test that invalid process selectors produce
   # the appropriate error as lonManage also blocks the use of invalid process selectors.
   #
   # Revision 1.145  2003/09/16 10:13:20  foxr
   # Added ReinitProcess function to oversee the parsing and processing of the
   # reinit:<process> client request.
   #
 # Revision 1.144  2003/09/16 09:47:01  foxr  # Revision 1.144  2003/09/16 09:47:01  foxr
 # Added skeletal support for SIGUSR2 (update hosts.tab)  # Added skeletal support for SIGUSR2 (update hosts.tab)
 #  #
Line 338  sub PushFile { Line 348  sub PushFile {
   
     if(!InstallFile($tablefile, $contents)) {      if(!InstallFile($tablefile, $contents)) {
  &logthis('<font color="red"> Pushfile: unable to install '   &logthis('<font color="red"> Pushfile: unable to install '
  .$tablefile." $! </font>");   .$tablefile." $! </font>");
  return "error:$!";   return "error:$!";
     }      }
     else {      else {
Line 353  sub PushFile { Line 363  sub PushFile {
     return "ok";      return "ok";
   
 }  }
   
   #
   #  Called to re-init either lonc or lond.
   #
   #  Parameters:
   #    request   - The full request by the client.  This is of the form
   #                reinit:<process>  
   #                where <process> is allowed to be either of 
   #                lonc or lond
   #
   #  Returns:
   #     The string to be sent back to the client either:
   #   ok         - Everything worked just fine.
   #   error:why  - There was a failure and why describes the reason.
   #
   #
   sub ReinitProcess {
       my $request = shift;
   
   
       # separate the request (reinit) from the process identifier and
       # validate it producing the name of the .pid file for the process.
       #
       #
       my ($junk, $process) = split(":", $request);
       my $processpidfile = $perlvar{'lonDaemons'}.'/';
       if($process eq 'lonc') {
    $processpidfile = $processpidfile."lonc.pid";
       } elsif ($process eq 'lond') {
    $processpidfile = $processpidfile."lond.pid";
       } else {
    &logthis('<font color="yellow" Invalid reinit request for '.$process
    ."</font>");
    return "error:Invalid process identifier $process";
       }
       &logthis('<font color="red"> Reinitializing '.$process." </font>");
       return 'ok';
   }
   
 #  #
 #  Convert an error return code from lcpasswd to a string value.  #  Convert an error return code from lcpasswd to a string value.
 #  #
Line 952  sub make_new_child { Line 1001  sub make_new_child {
        if ($wasenc == 1) {         if ($wasenc == 1) {
    my $cert = GetCertificate($userinput);     my $cert = GetCertificate($userinput);
    if(ValidManager($cert)) {     if(ValidManager($cert)) {
        print $client "ok\n";         chomp($userinput);
          my $reply = ReinitProcess($userinput);
          print $client  "$reply\n";
    } else {     } else {
        print $client "refused\n";         print $client "refused\n";
    }     }

Removed from v.1.144  
changed lines
  Added in v.1.146


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>