Diff for /loncom/lond between versions 1.177 and 1.178.2.2

version 1.177, 2004/02/18 10:35:56 version 1.178.2.2, 2004/02/23 10:25:52
Line 48  use localauth; Line 48  use localauth;
 use File::Copy;  use File::Copy;
 use LONCAPA::ConfigFileEdit;  use LONCAPA::ConfigFileEdit;
   
 my $DEBUG = 0;       # Non zero to enable debug log entries.  my $DEBUG = 1;       # Non zero to enable debug log entries.
   
 my $status='';  my $status='';
 my $lastlog='';  my $lastlog='';
Line 626  sub AuthenticateHandler { Line 626  sub AuthenticateHandler {
    #  upass   - User's password.     #  upass   - User's password.
         
    my ($udom,$uname,$upass)=split(/:/,$tail);     my ($udom,$uname,$upass)=split(/:/,$tail);
      Debug(" Authenticate domain = $udom, user = $uname, password = $upass");
    chomp($upass);     chomp($upass);
    $upass=unescape($upass);     $upass=unescape($upass);
    my $proname=propath($udom,$uname);     my $proname=propath($udom,$uname);
Line 634  sub AuthenticateHandler { Line 635  sub AuthenticateHandler {
    #   The user's 'personal' loncapa passworrd file describes how to authenticate:     #   The user's 'personal' loncapa passworrd file describes how to authenticate:
         
    if (-e $passfilename) {     if (-e $passfilename) {
        Debug("Located password file: $passfilename");
   
       my $pf = IO::File->new($passfilename);        my $pf = IO::File->new($passfilename);
       my $realpasswd=<$pf>;        my $realpasswd=<$pf>;
       chomp($realpasswd);        chomp($realpasswd);
Line 642  sub AuthenticateHandler { Line 645  sub AuthenticateHandler {
       #        #
       #   Authenticate against password stored in the internal file.        #   Authenticate against password stored in the internal file.
       #        #
        Debug("Authenticating via $howpwd");
       if ($howpwd eq 'internal') {        if ($howpwd eq 'internal') {
          &Debug("Internal auth");           &Debug("Internal auth");
          $pwdcorrect= (crypt($upass,$contentpwd) eq $contentpwd);           $pwdcorrect= (crypt($upass,$contentpwd) eq $contentpwd);
Line 2453  sub ProcessRequest { Line 2457  sub ProcessRequest {
    # Split off the request keyword from the rest of the stuff.     # Split off the request keyword from the rest of the stuff.
         
    my ($command, $tail) = split(/:/, $userinput, 2);     my ($command, $tail) = split(/:/, $userinput, 2);
      
      Debug("Command received: $command, encoded = $wasenc");
   
         
 # ------------------------------------------------------------- Normal commands  # ------------------------------------------------------------- Normal commands
   
Line 2466  sub ProcessRequest { Line 2472  sub ProcessRequest {
       my $Handler      = $$DispatchInfo[0];        my $Handler      = $$DispatchInfo[0];
       my $NeedEncode   = $$DispatchInfo[1];        my $NeedEncode   = $$DispatchInfo[1];
       my $ClientTypes  = $$DispatchInfo[2];        my $ClientTypes  = $$DispatchInfo[2];
         Debug("Matched dispatch hash: mustencode: $NeedEncode ClientType $ClientTypes");
               
       #  Validate the request:        #  Validate the request:
               
       my $ok = 1;        my $ok = 1;
       if($NeedEncode && (!$wasenc)) {        my $requesterprivs = 0;
          Reply($client, "refused\n", $userinput);        if(isClient()) {
          $ok = 0;   $requesterprivs |= $CLIENT_OK;
       }        }
       if(isClient && (($ClientTypes & $CLIENT_OK) == 0)) {        if(isManager()) {
          Reply($client, "refused\n", $userinput);   $requesterprivs |= $MANAGER_OK;
          $ok = 0;  
       }        }
       if(isManager && (($ClientTypes & $MANAGER_OK) == 0)) {        if($NeedEncode && (!$wasenc)) {
          Reply($client, "refused\n", $userinput);   Debug("Must encode but wasn't: $NeedEncode $wasenc");
          $ok = 0;           $ok = 0;
       }        }
         if(($ClientTypes & $requesterprivs) == 0) {
    Debug("Client not privileged to do this operation");
    $ok = 0;
         }
   
       if($ok) {        if($ok) {
    Debug("Dispatching to handler $command $tail");
          $KeepGoing = &$Handler($command, $tail, $client);           $KeepGoing = &$Handler($command, $tail, $client);
         } else {
    Debug("Refusing to dispatch because ok is false");
    Failure($client, "refused", $userinput);
       }        }
   
   

Removed from v.1.177  
changed lines
  Added in v.1.178.2.2


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