Diff for /loncom/auth/lonacc.pm between versions 1.166 and 1.171

version 1.166, 2017/04/04 02:59:40 version 1.171, 2018/11/24 16:19:04
Line 159  sub get_posted_cgi { Line 159  sub get_posted_cgi {
                         if (length($value) == 1) {                          if (length($value) == 1) {
                             $value=~s/[\r\n]$//;                              $value=~s/[\r\n]$//;
                         }                          }
                     } elsif ($fname =~ /\.(xls|doc|ppt)x$/i) {                      } elsif ($fname =~ /\.(xls|doc|ppt)(x|m)$/i) {
                         $value=~s/[\r\n]$//;                          $value=~s/[\r\n]$//;
                     }                      }
                     if (ref($fields) eq 'ARRAY') {                      if (ref($fields) eq 'ARRAY') {
Line 289  sub upload_size_allowed { Line 289  sub upload_size_allowed {
 sub sso_login {  sub sso_login {
     my ($r,$handle,$username) = @_;      my ($r,$handle,$username) = @_;
   
     my $lonidsdir=$r->dir_config('lonIDsDir');  
     if (($r->user eq '') || ($username ne '') || ($r->user eq 'public:public') ||      if (($r->user eq '') || ($username ne '') || ($r->user eq 'public:public') ||
         (defined($env{'user.name'}) && (defined($env{'user.domain'}))          (defined($env{'user.name'}) && (defined($env{'user.domain'}))
   && ($handle ne ''))) {    && ($handle ne ''))) {
Line 341  sub sso_login { Line 340  sub sso_login {
             ($is_balancer,$otherserver) =              ($is_balancer,$otherserver) =
                 &Apache::lonnet::check_loadbalancing($user,$domain,'login');                  &Apache::lonnet::check_loadbalancing($user,$domain,'login');
             if ($is_balancer) {              if ($is_balancer) {
                 if ($otherserver eq '') {                  # Check if browser sent a LON-CAPA load balancer cookie (and this is a balancer)
                   my ($found_server,$balancer_cookie) = &Apache::lonnet::check_for_balancer_cookie($r);
                   if (($found_server) && ($balancer_cookie =~ /^\Q$domain\E_\Q$user\E_/)) {
                       $otherserver = $found_server;
                   } elsif ($otherserver eq '') {
                     my $lowest_load;                      my $lowest_load;
                     ($otherserver,undef,undef,undef,$lowest_load) = &Apache::lonnet::choose_server($domain);                      ($otherserver,undef,undef,undef,$lowest_load) = &Apache::lonnet::choose_server($domain);
                     if ($lowest_load > 100) {                      if ($lowest_load > 100) {
                         $otherserver = &Apache::lonnet::spareserver($lowest_load,$lowest_load,1,$domain);                          $otherserver = &Apache::lonnet::spareserver($lowest_load,$lowest_load,1,$domain);
                     }                      }
                 }                      if ($otherserver ne '') {
                 if ($otherserver ne '') {                          my @hosts = &Apache::lonnet::current_machine_ids();
                     my @hosts = &Apache::lonnet::current_machine_ids();                          if (grep(/^\Q$otherserver\E$/,@hosts)) {
                     if (grep(/^\Q$otherserver\E$/,@hosts)) {                              $hosthere = $otherserver;
                         $hosthere = $otherserver;                          }
                     }                      }
                 }                  }
             }              }
Line 526  sub handler { Line 529  sub handler {
         } elsif ($env{'request.course.id'} &&          } elsif ($env{'request.course.id'} &&
                  (($requrl =~ m{^/adm/$match_domain/$match_username/aboutme$}) ||                   (($requrl =~ m{^/adm/$match_domain/$match_username/aboutme$}) ||
                   ($requrl eq "/public/$cdom/$cnum/syllabus") ||                    ($requrl eq "/public/$cdom/$cnum/syllabus") ||
                   ($requrl =~ m{^/adm/$cdom/$cnum/\d+/exttools?$}))) {                    ($requrl =~ m{^/adm/$cdom/$cnum/\d+/ext\.tool$}))) {
             my $query = $r->args;              my $query = $r->args;
             if ($query) {              if ($query) {
                 foreach my $pair (split(/&/,$query)) {                  foreach my $pair (split(/&/,$query)) {
Line 562  sub handler { Line 565  sub handler {
         my $checkexempt;          my $checkexempt;
         if ($env{'user.loadbalexempt'} eq $r->dir_config('lonHostID')) {          if ($env{'user.loadbalexempt'} eq $r->dir_config('lonHostID')) {
             if ($env{'user.loadbalcheck.time'} + 600 > time) {              if ($env{'user.loadbalcheck.time'} + 600 > time) {
                 $checkexempt = 1;                      $checkexempt = 1;
             }              }
         }          }
         if ($env{'user.noloadbalance'} eq $r->dir_config('lonHostID')) {          if ($env{'user.noloadbalance'} eq $r->dir_config('lonHostID')) {
Line 572  sub handler { Line 575  sub handler {
             ($is_balancer,$otherserver) =              ($is_balancer,$otherserver) =
                 &Apache::lonnet::check_loadbalancing($env{'user.name'},                  &Apache::lonnet::check_loadbalancing($env{'user.name'},
                                                      $env{'user.domain'});                                                       $env{'user.domain'});
               if ($is_balancer) {
                   unless (($requrl eq '/adm/switchserver') && (!$r->is_initial_req())) {
                       # Check if browser sent a LON-CAPA load balancer cookie (and this is a balancer)
                       my ($found_server,$balancer_cookie) = &Apache::lonnet::check_for_balancer_cookie($r);
                       if (($found_server) && ($balancer_cookie =~ /^\Q$env{'user.domain'}\E_\Q$env{'user.name'}\E_/)) {
                           $otherserver = $found_server;
                       }
                   }
               }
         }          }
         if ($is_balancer) {          if ($is_balancer) {
             $r->set_handlers('PerlResponseHandler'=>              unless (($requrl eq '/adm/switchserver') && (!$r->is_initial_req())) {
                              [\&Apache::switchserver::handler]);                  $r->set_handlers('PerlResponseHandler'=>
             if ($otherserver ne '') {                                   [\&Apache::switchserver::handler]);
                 $env{'form.otherserver'} = $otherserver;                  if ($otherserver ne '') {
                       $env{'form.otherserver'} = $otherserver;
                   }
             }              }
             unless (($env{'form.origurl'}) || ($r->uri eq '/adm/roles') ||              unless (($env{'form.origurl'}) || ($r->uri eq '/adm/roles') ||
                     ($r->uri eq '/adm/switchserver') || ($r->uri eq '/adm/sso')) {                      ($r->uri eq '/adm/switchserver') || ($r->uri eq '/adm/sso')) {
                 $env{'form.origurl'} = $r->uri;                  $env{'form.origurl'} = $r->uri;
             }              }
         }          }
           if ($requrl=~m{^/+tiny/+$match_domain/+\w+$}) {
               return OK;
           }
 # ---------------------------------------------------------------- Check access  # ---------------------------------------------------------------- Check access
  my $now = time;   my $now = time;
  if ($requrl !~ m{^/(?:adm|public|prtspool)/}   if ($requrl !~ m{^/(?:adm|public|prtspool)/}
Line 675  sub handler { Line 691  sub handler {
  ($requrl=~/^\/public\/.*\/syllabus$/) ||   ($requrl=~/^\/public\/.*\/syllabus$/) ||
                 ($requrl=~/^\/adm\/(viewclasslist|navmaps)$/) ||                  ($requrl=~/^\/adm\/(viewclasslist|navmaps)$/) ||
                 ($requrl=~/^\/adm\/.*\/aboutme\/portfolio(\?|$)/) ||                  ($requrl=~/^\/adm\/.*\/aboutme\/portfolio(\?|$)/) ||
                 ($requrl=~m{^/adm/$cdom/$cnum/\d+/exttools?$})) {                  ($requrl=~m{^/adm/$cdom/$cnum/\d+/ext\.tool$})) {
 # ------------------------------------- This is serious stuff, get symb and log  # ------------------------------------- This is serious stuff, get symb and log
  my $symb;   my $symb;
  if ($query) {   if ($query) {

Removed from v.1.166  
changed lines
  Added in v.1.171


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