Diff for /loncom/auth/lonacc.pm between versions 1.159.2.12 and 1.180

version 1.159.2.12, 2020/09/30 19:33:59 version 1.180, 2020/09/30 19:25:16
Line 102  use Apache::loncommon(); Line 102  use Apache::loncommon();
 use Apache::lonlocal;  use Apache::lonlocal;
 use Apache::restrictedaccess();  use Apache::restrictedaccess();
 use Apache::blockedaccess();  use Apache::blockedaccess();
   use Apache::lonprotected();
 use Fcntl qw(:flock);  use Fcntl qw(:flock);
 use LONCAPA qw(:DEFAULT :match);  use LONCAPA qw(:DEFAULT :match);
   
Line 202  sub get_posted_cgi { Line 203  sub get_posted_cgi {
  $fname='';   $fname='';
  $fmime='';   $fmime='';
     }      }
                       if ($i<$#lines && $lines[$i+1]=~/^Content\-Type\:\s*([\w\-\/]+)/i) {
                           # TODO: something with $1 !
                           $i++;
                       }
                       if ($i<$#lines && $lines[$i+1]=~/^Content\-transfer\-encoding\:\s*([\w\-\/]+)/i) {
                           # TODO: something with $1 !
                           $i++;
                       }
     $i++;      $i++;
  }   }
     } else {      } else {
Line 355  sub sso_login { Line 364  sub sso_login {
     # login but immediately go to switch server to find us a new       # login but immediately go to switch server to find us a new 
     # machine      # machine
     &Apache::lonauth::success($r,$user,$domain,$home,'noredirect');      &Apache::lonauth::success($r,$user,$domain,$home,'noredirect');
               foreach my $item (keys(%form)) {
                   $env{'form.'.$item} = $form{$item};
               }
               unless ($form{'symb'}) {
                   unless (($r->uri eq '/adm/roles') || ($r->uri eq '/adm/sso')) {
                       $env{'form.origurl'} = $r->uri;
                   }
               }
             $env{'request.sso.login'} = 1;              $env{'request.sso.login'} = 1;
             if (defined($r->dir_config("lonSSOReloginServer"))) {              if (defined($r->dir_config("lonSSOReloginServer"))) {
                 $env{'request.sso.reloginserver'} =                  $env{'request.sso.reloginserver'} =
Line 369  sub sso_login { Line 386  sub sso_login {
  } else {   } else {
     # need to login them in, so generate the need data that      # need to login them in, so generate the need data that
     # migrate expects to do login      # migrate expects to do login
             my $ip = $r->get_remote_host();      my $ip = $r->get_remote_host();
     my %info=('ip'        => $ip,      my %info=('ip'        => $ip,
       'domain'    => $domain,        'domain'    => $domain,
       'username'  => $user,        'username'  => $user,
Line 520  sub handler { Line 537  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 =~ m{^/public/$cdom/$cnum/syllabus$}))) {                    ($requrl eq "/public/$cdom/$cnum/syllabus") ||
                     ($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 542  sub handler { Line 560  sub handler {
             my $lonhost = &Apache::lonnet::host_from_dns($hostname);              my $lonhost = &Apache::lonnet::host_from_dns($hostname);
             if ($lonhost) {              if ($lonhost) {
                 my $actual = &Apache::lonnet::absolute_url($hostname);                  my $actual = &Apache::lonnet::absolute_url($hostname);
                   my $exphostname = &Apache::lonnet::hostname($lonhost);
                 my $expected = $Apache::lonnet::protocol{$lonhost}.'://'.$hostname;                  my $expected = $Apache::lonnet::protocol{$lonhost}.'://'.$hostname;
                 unless ($actual eq $expected) {                  unless ($actual eq $expected) {
                     $env{'request.use_absolute'} = $expected;                      $env{'request.use_absolute'} = $expected;
Line 590  sub handler { Line 609  sub handler {
                 $env{'form.origurl'} = $r->uri;                  $env{'form.origurl'} = $r->uri;
             }              }
         }          }
           if ($requrl=~m{^/+tiny/+$match_domain/+\w+$}) {
               if ($env{'user.name'} eq 'public' &&
                   $env{'user.domain'} eq 'public') {
                   $env{'request.firsturl'}=$requrl;
                   return FORBIDDEN;
               } else {
                   return OK;
               }
           }
 # ---------------------------------------------------------------- Check access  # ---------------------------------------------------------------- Check access
  my $now = time;   my $now = time;
         my $check_symb;          my $check_symb;
Line 671  sub handler { Line 698  sub handler {
                 &Apache::blockedaccess::setup_handler($r);                  &Apache::blockedaccess::setup_handler($r);
                 return OK;                  return OK;
             }              }
               if ($access eq 'D') {
                   &Apache::lonprotected::setup_handler($r);
                   return OK;
               }
     if (($access ne '2') && ($access ne 'F')) {      if (($access ne '2') && ($access ne 'F')) {
                 if ($requrl =~ m{^/res/}) {                  if ($requrl =~ m{^/res/}) {
                     $access = &Apache::lonnet::allowed('bro',$requrl);                      $access = &Apache::lonnet::allowed('bro',$requrl);
Line 736  sub handler { Line 767  sub handler {
  }   }
  if ($env{'form.symb'}) {   if ($env{'form.symb'}) {
     $symb=&Apache::lonnet::symbclean($env{'form.symb'});      $symb=&Apache::lonnet::symbclean($env{'form.symb'});
                     if ($requrl eq '/adm/navmaps') {      if ($requrl eq '/adm/navmaps') {
                         my ($map,$mid,$murl)=&Apache::lonnet::decode_symb($symb);                          my ($map,$mid,$murl)=&Apache::lonnet::decode_symb($symb);
                         &Apache::lonnet::symblist($map,$murl => [$murl,$mid]);                          &Apache::lonnet::symblist($map,$murl => [$murl,$mid]);
                     } elsif ($requrl =~ m|^/adm/wrapper/|      } elsif ($requrl =~ m|^/adm/wrapper/|
  || $requrl =~ m|^/adm/coursedocs/showdoc/|) {   || $requrl =~ m|^/adm/coursedocs/showdoc/|) {
  my ($map,$mid,$murl)=&Apache::lonnet::decode_symb($symb);   my ($map,$mid,$murl)=&Apache::lonnet::decode_symb($symb);
                         if ($map =~ /\.page$/) {                          if ($map =~ /\.page$/) {
                             my $mapsymb = &Apache::lonnet::symbread($map);                              my $mapsymb = &Apache::lonnet::symbread($map);
                             ($map,$mid,$murl)=&Apache::lonnet::decode_symb($mapsymb);                              ($map,$mid,$murl)=&Apache::lonnet::decode_symb($mapsymb); 
                         }                          }
  &Apache::lonnet::symblist($map,$murl => [$murl,$mid],   &Apache::lonnet::symblist($map,$murl => [$murl,$mid],
   'last_known' =>[$murl,$mid]);    'last_known' =>[$murl,$mid]);
Line 814  sub handler { Line 845  sub handler {
                                 my $mapsymb = &Apache::lonnet::symbread($map);                                  my $mapsymb = &Apache::lonnet::symbread($map);
                                 ($map,$mid,$murl)=&Apache::lonnet::decode_symb($mapsymb);                                  ($map,$mid,$murl)=&Apache::lonnet::decode_symb($mapsymb);
                             }                              }
                             &Apache::lonnet::symblist($map,$murl =>[$murl,$mid],      &Apache::lonnet::symblist($map,$murl =>[$murl,$mid],
                                                       'last_known' =>[$murl,$mid]);        'last_known' =>[$murl,$mid]);
                         }                          }
     }      }
  }   }
Line 868  sub handler { Line 899  sub handler {
 # ------------------------------------ See if this is a viewable portfolio file  # ------------------------------------ See if this is a viewable portfolio file
     if (&Apache::lonnet::is_portfolio_url($requrl)) {      if (&Apache::lonnet::is_portfolio_url($requrl)) {
         my $clientip = $r->get_remote_host();          my $clientip = $r->get_remote_host();
  my $access=&Apache::lonnet::allowed('bre',$requrl,undef,undef,$clientip);          my $access=&Apache::lonnet::allowed('bre',$requrl,undef,undef,$clientip);
  if ($access eq 'A') {   if ($access eq 'A') {
     &Apache::restrictedaccess::setup_handler($r);      &Apache::restrictedaccess::setup_handler($r);
     return OK;      return OK;

Removed from v.1.159.2.12  
changed lines
  Added in v.1.180


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