Diff for /loncom/auth/lonauth.pm between versions 1.121.2.13 and 1.121.2.16

version 1.121.2.13, 2015/01/26 22:25:41 version 1.121.2.16, 2017/06/06 22:34:37
Line 73  sub success { Line 73  sub success {
     }      }
   
 # ------------------------------------------------------------ Get cookie ready  # ------------------------------------------------------------ Get cookie ready
     $cookie="lonID=$cookie; path=/";      $cookie="lonID=$cookie; path=/; HttpOnly";
 # -------------------------------------------------------- Menu script and info  # -------------------------------------------------------- Menu script and info
     my $destination = $lowerurl;      my $destination = $lowerurl;
   
Line 238  sub reroute { Line 238  sub reroute {
 sub handler {  sub handler {
     my $r = shift;      my $r = shift;
     my $londocroot = $r->dir_config('lonDocRoot');      my $londocroot = $r->dir_config('lonDocRoot');
     my $form;  
 # Are we re-routing?  # Are we re-routing?
     if (-e "$londocroot/lon-status/reroute.txt") {      if (-e "$londocroot/lon-status/reroute.txt") {
  &reroute($r);   &reroute($r);
Line 356  sub handler { Line 355  sub handler {
         (undef,$form{'iptoken'}) = split('=',$iptokenstr);          (undef,$form{'iptoken'}) = split('=',$iptokenstr);
     }      }
   
     my $keybin=pack("H16",$key);      my $upass = &Apache::loncommon::des_decrypt($key,$form{'upass0'});
   
     my $cipher;  
     if ($Crypt::DES::VERSION>=2.03) {  
  $cipher=new Crypt::DES $keybin;  
     }  
     else {  
  $cipher=new DES $keybin;  
     }  
     my $upass='';  
     for (my $i=0;$i<=2;$i++) {  
  my $chunk=  
     $cipher->decrypt(unpack("a8",pack("H16",substr($form{'upass'.$i},0,16))));  
   
  $chunk.=  
     $cipher->decrypt(unpack("a8",pack("H16",substr($form{'upass'.$i},16,16))));  
   
  $chunk=substr($chunk,1,ord(substr($chunk,0,1)));  
  $upass.=$chunk;  
     }  
   
 # ---------------------------------------------------------------- Authenticate  # ---------------------------------------------------------------- Authenticate
   
Line 474  sub handler { Line 454  sub handler {
   
     unless ($hosthere) {      unless ($hosthere) {
         ($is_balancer,$otherserver) =          ($is_balancer,$otherserver) =
             &Apache::lonnet::check_loadbalancing($form{'uname'},$form{'udom'});              &Apache::lonnet::check_loadbalancing($form{'uname'},$form{'udom'},'login');
           if ($is_balancer) {
               if ($otherserver eq '') {
                   my $lowest_load;
                   ($otherserver,undef,undef,undef,$lowest_load) = &Apache::lonnet::choose_server($form{'udom'});
                   if ($lowest_load > 100) {
                       $otherserver = &Apache::lonnet::spareserver($lowest_load,$lowest_load,1,$form{'udom'});
                   }
               }
               if ($otherserver ne '') {
                   my @hosts = &Apache::lonnet::current_machine_ids();
                   if (grep(/^\Q$otherserver\E$/,@hosts)) {
                       $hosthere = $otherserver;
                   }
               }
           }
     }      }
   
     if ($is_balancer) {      if (($is_balancer) && (!$hosthere)) {
         if (!$otherserver) {   
             ($otherserver) = &Apache::lonnet::choose_server($form{'udom'});  
         }  
         if ($otherserver) {          if ($otherserver) {
             &success($r,$form{'uname'},$form{'udom'},$authhost,'noredirect',undef,              &success($r,$form{'uname'},$form{'udom'},$authhost,'noredirect',undef,
                      \%form);                       \%form);
Line 548  sub handler { Line 540  sub handler {
                 return OK;                  return OK;
             }              }
         }          }
           if (($is_balancer) && ($hosthere)) {
               $form{'noloadbalance'} = $hosthere;
           }
         &success($r,$form{'uname'},$form{'udom'},$authhost,$firsturl,undef,          &success($r,$form{'uname'},$form{'udom'},$authhost,$firsturl,undef,
                  \%form);                   \%form);
         return OK;          return OK;

Removed from v.1.121.2.13  
changed lines
  Added in v.1.121.2.16


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