Diff for /loncom/auth/lonlogin.pm between versions 1.187 and 1.188

version 1.187, 2021/09/28 21:16:07 version 1.188, 2021/10/06 19:28:55
Line 38  use Apache::lonlocal; Line 38  use Apache::lonlocal;
 use Apache::migrateuser();  use Apache::migrateuser();
 use lib '/home/httpd/lib/perl/';  use lib '/home/httpd/lib/perl/';
 use LONCAPA qw(:DEFAULT :match);  use LONCAPA qw(:DEFAULT :match);
   use URI::Escape;
   use HTML::Entities();
 use CGI::Cookie();  use CGI::Cookie();
     
 sub handler {  sub handler {
Line 111  sub handler { Line 113  sub handler {
     }      }
   
     my $lonhost = $r->dir_config('lonHostID');      my $lonhost = $r->dir_config('lonHostID');
     $env{'form.firsturl'} =~ s/(`)/'/g;  
   
 # Check if browser sent a LON-CAPA load balancer cookie (and this is a balancer)  # Check if browser sent a LON-CAPA load balancer cookie (and this is a balancer)
   
Line 123  sub handler { Line 124  sub handler {
             $protocol = 'http' if ($protocol ne 'https');              $protocol = 'http' if ($protocol ne 'https');
             my $dest = '/adm/roles';              my $dest = '/adm/roles';
             if ($env{'form.firsturl'} ne '') {              if ($env{'form.firsturl'} ne '') {
                 $dest = &HTML::Entities::encode($env{'form.firsturl'},'\'"<>&');                  if ($env{'form.firsturl'} =~ /[^\x00-\xFF]/) {
                       $dest = &uri_escape_utf8($env{'form.firsturl'});
                   } else {
                       $dest = &uri_escape($env{'form.firsturl'});
                   }
                   $dest = &HTML::Entities::encode($dest,"'");
             }              }
             my %info = (              my %info = (
                          balcookie => $lonhost.':'.$balancer_cookie,                           balcookie => $lonhost.':'.$balancer_cookie,
Line 203  sub handler { Line 209  sub handler {
     &Apache::loncommon::end_page();      &Apache::loncommon::end_page();
         my $dest = '/adm/roles';          my $dest = '/adm/roles';
         if ($env{'form.firsturl'} ne '') {          if ($env{'form.firsturl'} ne '') {
             $dest = &HTML::Entities::encode($env{'form.firsturl'},'\'"<>&');              if ($env{'form.firsturl'} =~ /[^\x00-\xFF]/) {
                   $dest = &uri_escape_utf8($env{'form.firsturl'});
               } else {
                   $dest = &uri_escape($env{'form.firsturl'});
               }
               $dest = &HTML::Entities::encode($dest,"'");
         }          }
         if (($env{'form.ltoken'}) || ($linkprot)) {          if (($env{'form.ltoken'}) || ($linkprot)) {
             unless ($linkprot) {              unless ($linkprot) {
Line 796  HEADER Line 807  HEADER
             $ssologin = $samlssourl;              $ssologin = $samlssourl;
         }          }
         if ($env{'form.firsturl'} ne '') {          if ($env{'form.firsturl'} ne '') {
             $ssologin .= (($ssologin=~/\?/)?'&amp;':'?') .              my $querystring;
                          'origurl='.&HTML::Entities::encode($env{'form.firsturl'},'\'<>&"');              if ($env{'form.firsturl'} =~ /[^\x00-\xFF]/) {
                   $querystring = &uri_escape_utf8($env{'form.firsturl'});
               } else {
                   $querystring = &uri_escape($env{'form.firsturl'});
               }
               $querystring = &HTML::Entities::encode($querystring,"'");
               $ssologin .= (($ssologin=~/\?/)?'&amp;':'?') . $querystring;
         }          }
         my $ssohref;          my $ssohref;
         if ($samlssoimg ne '') {          if ($samlssoimg ne '') {
Line 1022  sub redirect_page { Line 1039  sub redirect_page {
     }      }
     my $url = $protocol.'://'.$hostname.$path;      my $url = $protocol.'://'.$hostname.$path;
     if ($env{'form.firsturl'} ne '') {      if ($env{'form.firsturl'} ne '') {
         $url .='?firsturl='.&HTML::Entities::encode($env{'form.firsturl'},'\'"<>&');;          my $querystring;
           if ($env{'form.firsturl'} =~ /[^\x00-\xFF]/) {
               $querystring = &uri_escape_utf8($env{'form.firsturl'});
           } else {
               $querystring = &uri_escape($env{'form.firsturl'});
           }
           $querystring = &HTML::Entities::encode($querystring,"'");
           $url .='?firsturl='.$querystring
     }      }
     if ($linkprot) {      if ($linkprot) {
         my $ltoken = &Apache::lonnet::tmpput({linkprot => $linkprot},$desthost);          my $ltoken = &Apache::lonnet::tmpput({linkprot => $linkprot},$desthost);

Removed from v.1.187  
changed lines
  Added in v.1.188


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