Diff for /loncom/auth/lonauth.pm between versions 1.141 and 1.144

version 1.141, 2016/12/05 00:51:43 version 1.144, 2017/08/08 16:43:54
Line 32  use strict; Line 32  use strict;
 use LONCAPA qw(:DEFAULT :match);  use LONCAPA qw(:DEFAULT :match);
 use Apache::Constants qw(:common);  use Apache::Constants qw(:common);
 use CGI qw(:standard);  use CGI qw(:standard);
 use DynaLoader; # for Crypt::DES version  
 use Crypt::DES;  
 use Apache::loncommon();  use Apache::loncommon();
 use Apache::lonnet;  use Apache::lonnet;
 use Apache::lonmenu();  use Apache::lonmenu();
Line 42  use Fcntl qw(:flock); Line 40  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 71  sub success {
         }          }
     }      }
   
 # ------------------------------------------------------------ Get cookie ready  # ----------------------------------------------------------- Get cookies ready
     $cookie="lonID=$cookie; path=/";      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 169  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.141  
changed lines
  Added in v.1.144


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