Diff for /loncom/auth/lonauth.pm between versions 1.142 and 1.143

version 1.142, 2017/02/17 14:34:21 version 1.143, 2017/02/25 20:00:36
Line 42  use Fcntl qw(:flock); Line 42  use Fcntl qw(:flock);
 use Apache::lonlocal;  use Apache::lonlocal;
 use Apache::File();  use Apache::File();
 use HTML::Entities;  use HTML::Entities;
   use Digest::MD5;
     
 # ------------------------------------------------------------ Successful login  # ------------------------------------------------------------ Successful login
 sub success {  sub success {
Line 72  sub success { Line 73  sub success {
         }          }
     }      }
   
 # ------------------------------------------------------------ Get cookie ready  # ----------------------------------------------------------- Get cookies ready
     $cookie="lonID=$cookie; path=/; HttpOnly";      my ($securecookie,$defaultcookie);
       if ($ENV{'SERVER_PORT'} == 443) {
           $securecookie="lonID=$cookie; path=/; HttpOnly; secure";
           my $lonidsdir=$r->dir_config('lonIDsDir');
           if (($lonidsdir) && (-e "$lonidsdir/$cookie.id")) {
               my $linkname=substr(Digest::MD5::md5_hex(Digest::MD5::md5_hex(time(). {}. rand(). $$)), 0, 32).'_linked';
               if (-e "$lonidsdir/$linkname.id") {
                   unlink("$lonidsdir/$linkname.id");
               }
               my $made_symlink = eval { symlink("$lonidsdir/$cookie.id",
                                                 "$lonidsdir/$linkname.id"); 1 };
               if ($made_symlink) {
                   $defaultcookie = "lonLinkID=$linkname; path=/; HttpOnly;";
                   &Apache::lonnet::appenv({'user.linkedenv' => "$lonidsdir/$linkname.id"});
               }
           }
       } else {
           $defaultcookie = "lonID=$cookie; path=/; HttpOnly;";
       }
 # -------------------------------------------------------- Menu script and info  # -------------------------------------------------------- Menu script and info
     my $destination = $lowerurl;      my $destination = $lowerurl;
   
Line 152  sub success { Line 171  sub success {
 # ------------------------------------------------- Output for successful login  # ------------------------------------------------- Output for successful login
   
     &Apache::loncommon::content_type($r,'text/html');      &Apache::loncommon::content_type($r,'text/html');
     $r->header_out('Set-cookie' => $cookie);      if ($securecookie) {
           $r->headers_out->add('Set-cookie' => $securecookie);
       }
       if ($defaultcookie) {
           $r->headers_out->add('Set-cookie' => $defaultcookie);
       }
     $r->send_http_header;      $r->send_http_header;
   
     my %lt=&Apache::lonlocal::texthash(      my %lt=&Apache::lonlocal::texthash(

Removed from v.1.142  
changed lines
  Added in v.1.143


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