Diff for /loncom/auth/lonacc.pm between versions 1.130.4.1 and 1.137

version 1.130.4.1, 2010/03/19 22:22:34 version 1.137, 2011/08/09 01:35:31
Line 156  sub get_posted_cgi { Line 156  sub get_posted_cgi {
  for ($i=0;$i<=$#lines;$i++) {   for ($i=0;$i<=$#lines;$i++) {
     if ($lines[$i]=~/^--\Q$contentsep\E/) {      if ($lines[$i]=~/^--\Q$contentsep\E/) {
  if ($name) {   if ($name) {
     chomp($value);      $value=~s/[\r\n]+$//;
                     if (ref($fields) eq 'ARRAY') {                      if (ref($fields) eq 'ARRAY') {
                         next if (!grep(/^\Q$name\E$/,@{$fields}));                          next if (!grep(/^\Q$name\E$/,@{$fields}));
                     }                      }
Line 290  sub sso_login { Line 290  sub sso_login {
         }          }
     }      }
   
     my $domain = $r->dir_config('lonDefDomain');      my $domain = $r->dir_config('lonSSOUserDomain');
       if ($domain eq '') {
           $domain = $r->dir_config('lonDefDomain');
       }
     my $home=&Apache::lonnet::homeserver($user,$domain);      my $home=&Apache::lonnet::homeserver($user,$domain);
     if ($home !~ /(con_lost|no_host|no_such_host)/) {      if ($home !~ /(con_lost|no_host|no_such_host)/) {
  &Apache::lonnet::logthis(" SSO authorized user $user ");   &Apache::lonnet::logthis(" SSO authorized user $user ");
  if ($r->dir_config("lonBalancer") eq 'yes') {          my ($is_balancer,$otherserver) =
     # login but immeaditly go to switch server to find us a new               &Apache::lonnet::check_loadbalancing($user,$domain);
    if ($is_balancer) {
       # 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');
             $env{'request.sso.login'} = 1;              $env{'request.sso.login'} = 1;
Line 303  sub sso_login { Line 308  sub sso_login {
                 $env{'request.sso.reloginserver'} =                  $env{'request.sso.reloginserver'} =
                     $r->dir_config('lonSSOReloginServer');                      $r->dir_config('lonSSOReloginServer');
             }              }
     $r->internal_redirect('/adm/switchserver');              my $redirecturl = '/adm/switchserver';
               if ($otherserver ne '') {
                   $redirecturl .= '?otherserver='.$otherserver;
               }
       $r->internal_redirect($redirecturl);
     $r->set_handlers('PerlHandler'=> undef);      $r->set_handlers('PerlHandler'=> undef);
  } else {   } else {
     # need to login them in, so generate the need data that      # need to login them in, so generate the need data that
Line 380  sub handler { Line 389  sub handler {
  return $result;   return $result;
     }      }
   
       my ($is_balancer,$otherserver);
     if ($r->dir_config("lonBalancer") eq 'yes') {  
  $r->set_handlers('PerlResponseHandler'=>  
  [\&Apache::switchserver::handler]);  
     }  
           
     if ($handle eq '') {      if ($handle eq '') {
  $r->log_reason("Cookie $handle not valid", $r->filename);    $r->log_reason("Cookie $handle not valid", $r->filename); 
Line 417  sub handler { Line 422  sub handler {
                 my $preserved;                  my $preserved;
                 foreach my $pair (split(/&/,$query)) {                  foreach my $pair (split(/&/,$query)) {
                     my ($name, $value) = split(/=/,$pair);                      my ($name, $value) = split(/=/,$pair);
                     unless (($name eq 'symb') || ($name eq 'wrapperdisplay')) {                      unless ($name eq 'symb') {
                         $preserved .= $pair.'&';                          $preserved .= $pair.'&';
                     }                      }
                 }                  }
Line 431  sub handler { Line 436  sub handler {
   
  &Apache::lonacc::get_posted_cgi($r);   &Apache::lonacc::get_posted_cgi($r);
   
   # ------------------------------------------------------ Check if load balancer 
   
           ($is_balancer,$otherserver) =
               &Apache::lonnet::check_loadbalancing($env{'user.name'},
                                                    $env{'user.domain'});
           if ($is_balancer) {
               $r->set_handlers('PerlResponseHandler'=>
                                [\&Apache::switchserver::handler]);
               if ($otherserver ne '') {
                   $env{'form.otherserver'} = $otherserver;
               }
           }
   
 # ---------------------------------------------------------------- Check access  # ---------------------------------------------------------------- Check access
  my $now = time;   my $now = time;
  if ($requrl !~ m{^/(?:adm|public|prtspool)/}   if ($requrl !~ m{^/(?:adm|public|prtspool)/}
Line 501  sub handler { Line 519  sub handler {
     $requrl=~/\.(\w+)$/;      $requrl=~/\.(\w+)$/;
             my $query=$r->args;              my $query=$r->args;
     if ((&Apache::loncommon::fileembstyle($1) eq 'ssi') ||      if ((&Apache::loncommon::fileembstyle($1) eq 'ssi') ||
  ($requrl=~/^\/adm\/.*\/(aboutme|navmaps|smppg|bulletinboard)(\?|$ )/x) ||   ($requrl=~/^\/adm\/.*\/(aboutme|smppg|bulletinboard)(\?|$ )/x) ||
  ($requrl=~/^\/adm\/wrapper\//) ||   ($requrl=~/^\/adm\/wrapper\//) ||
  ($requrl=~m|^/adm/coursedocs/showdoc/|) ||   ($requrl=~m|^/adm/coursedocs/showdoc/|) ||
  ($requrl=~m|\.problem/smpedit$|) ||   ($requrl=~m|\.problem/smpedit$|) ||
  ($requrl=~/^\/public\/.*\/syllabus$/)) {   ($requrl=~/^\/public\/.*\/syllabus$/) ||
                   ($requrl=~/^\/adm\/(viewclasslist|navmaps)$/) ||
                   ($requrl=~/^\/adm\/.*\/aboutme\/portfolio(\?|$)/)) {
 # ------------------------------------- This is serious stuff, get symb and log  # ------------------------------------- This is serious stuff, get symb and log
  my $symb;   my $symb;
  if ($query) {   if ($query) {
Line 520  sub handler { Line 540  sub handler {
   'last_known' =>[$murl,$mid]);    'last_known' =>[$murl,$mid]);
     } elsif ((&Apache::lonnet::symbverify($symb,$requrl)) ||      } elsif ((&Apache::lonnet::symbverify($symb,$requrl)) ||
      (($requrl=~m|(.*)/smpedit$|) &&       (($requrl=~m|(.*)/smpedit$|) &&
       &Apache::lonnet::symbverify($symb,$1))) {        &Apache::lonnet::symbverify($symb,$1)) ||
                                (($requrl=~m|(.*/aboutme)/portfolio$|) &&
                                 &Apache::lonnet::symbverify($symb,$1))) {
  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],
   'last_known' =>[$murl,$mid]);    'last_known' =>[$murl,$mid]);
Line 532  sub handler { Line 554  sub handler {
  return HTTP_NOT_ACCEPTABLE;    return HTTP_NOT_ACCEPTABLE; 
     }      }
  } else {   } else {
                       if ($requrl=~m{^(/adm/.*/aboutme)/portfolio$}) {
                           $requrl = $1;
                       }
     $symb=&Apache::lonnet::symbread($requrl);      $symb=&Apache::lonnet::symbread($requrl);
     if (&Apache::lonnet::is_on_map($requrl) && $symb &&      if (&Apache::lonnet::is_on_map($requrl) && $symb &&
  !&Apache::lonnet::symbverify($symb,$requrl)) {   !&Apache::lonnet::symbverify($symb,$requrl)) {
Line 567  sub handler { Line 592  sub handler {
             }              }
  }   }
  return OK;   return OK;
       } else {
           my $defdom=$r->dir_config('lonDefDomain');
           ($is_balancer,$otherserver) =
               &Apache::lonnet::check_loadbalancing(undef,$defdom);
           if ($is_balancer) {
               $r->set_handlers('PerlResponseHandler'=>
                                [\&Apache::switchserver::handler]);
               if ($otherserver ne '') {
                   $env{'form.otherserver'} = $otherserver;
               }
           }
     }      }
 # -------------------------------------------- See if this is a public resource  # -------------------------------------------- See if this is a public resource
     if ($requrl=~m|^/+adm/+help/+|) {      if ($requrl=~m|^/+adm/+help/+|) {

Removed from v.1.130.4.1  
changed lines
  Added in v.1.137


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