version 1.186, 2021/01/02 19:31:11
|
version 1.192, 2021/07/19 15:48:26
|
Line 305 sub sso_login {
|
Line 305 sub sso_login {
|
my $query = $r->args; |
my $query = $r->args; |
my %form; |
my %form; |
if ($query) { |
if ($query) { |
my @items = ('role','symb','iptoken'); |
my @items = ('role','symb','iptoken','origurl'); |
&Apache::loncommon::get_unprocessed_cgi($query,\@items); |
&Apache::loncommon::get_unprocessed_cgi($query,\@items); |
foreach my $item (@items) { |
foreach my $item (@items) { |
if (defined($env{'form.'.$item})) { |
if (defined($env{'form.'.$item})) { |
Line 349 sub sso_login {
|
Line 349 sub sso_login {
|
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($r,$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(); |
Line 367 sub sso_login {
|
Line 367 sub sso_login {
|
foreach my $item (keys(%form)) { |
foreach my $item (keys(%form)) { |
$env{'form.'.$item} = $form{$item}; |
$env{'form.'.$item} = $form{$item}; |
} |
} |
unless ($form{'symb'}) { |
unless (($form{'symb'}) || ($form{'origurl'})) { |
unless (($r->uri eq '/adm/roles') || ($r->uri eq '/adm/sso')) { |
unless (($r->uri eq '/adm/roles') || ($r->uri eq '/adm/sso')) { |
$env{'form.origurl'} = $r->uri; |
$env{'form.origurl'} = $r->uri; |
} |
} |
Line 393 sub sso_login {
|
Line 393 sub sso_login {
|
'server' => $r->dir_config('lonHostID'), |
'server' => $r->dir_config('lonHostID'), |
'sso.login' => 1 |
'sso.login' => 1 |
); |
); |
foreach my $item ('role','symb','iptoken') { |
foreach my $item ('role','symb','iptoken','origurl') { |
if (exists($form{$item})) { |
if (exists($form{$item})) { |
$info{$item} = $form{$item}; |
$info{$item} = $form{$item}; |
} |
} |
} |
} |
unless ($info{'symb'}) { |
unless (($info{'symb'}) || ($info{'origurl'})) { |
unless (($r->uri eq '/adm/roles') || ($r->uri eq '/adm/sso')) { |
unless (($r->uri eq '/adm/roles') || ($r->uri eq '/adm/sso')) { |
$info{'origurl'} = $r->uri; |
$info{'origurl'} = $r->uri; |
} |
} |
Line 559 sub handler {
|
Line 559 sub handler {
|
my $hostname = $r->hostname(); |
my $hostname = $r->hostname(); |
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,1,1); |
my $exphostname = &Apache::lonnet::hostname($lonhost); |
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) { |
Line 673 sub handler {
|
Line 673 sub handler {
|
if ((!$env{'request.role.adv'}) && ($env{'acc.randomout'}) && |
if ((!$env{'request.role.adv'}) && ($env{'acc.randomout'}) && |
($env{'acc.randomout'}=~/\&\Q$poss_symb\E\&/)) { |
($env{'acc.randomout'}=~/\&\Q$poss_symb\E\&/)) { |
undef($poss_symb); |
undef($poss_symb); |
|
} elsif ((!$env{'request.role.adv'}) && ($env{'acc.deeplinkout'}) && |
|
($env{'acc.deeplinkout'}=~/\&\Q$poss_symb\E\&/)) { |
|
undef($poss_symb); |
} |
} |
} |
} |
} |
} |
Line 682 sub handler {
|
Line 685 sub handler {
|
$access=&Apache::lonnet::allowed('bre',$requrl,'','','','',1); |
$access=&Apache::lonnet::allowed('bre',$requrl,'','','','',1); |
} |
} |
} else { |
} else { |
$access=&Apache::lonnet::allowed('bre',$requrl); |
my $nodeeplinkcheck; |
|
if (($check_access) && ($requrl =~ /\.(sequence|page)$/)) { |
|
unless ($env{'form.navmap'}) { |
|
if ($r->args ne '') { |
|
&Apache::loncommon::get_unprocessed_cgi($r->args,['navmap']); |
|
unless ($env{'form.navmap'}) { |
|
$nodeeplinkcheck = 1; |
|
} |
|
} |
|
} |
|
} |
|
$access=&Apache::lonnet::allowed('bre',$requrl,'','','','','',$nodeeplinkcheck) |
} |
} |
} |
} |
if ($check_block) { |
if ($check_block) { |
Line 789 sub handler {
|
Line 803 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); |
($requrl =~ m{^/adm/wrapper/}) || |
&Apache::lonnet::symblist($map,$murl => [$murl,$mid]); |
($requrl =~ m{^/adm/coursedocs/showdoc/})) { |
} elsif ($requrl =~ m|^/adm/wrapper/| |
unless (&Apache::lonnet::symbverify($symb,$requrl)) { |
|| $requrl =~ m|^/adm/coursedocs/showdoc/|) { |
if (&Apache::lonnet::is_on_map($requrl)) { |
my ($map,$mid,$murl)=&Apache::lonnet::decode_symb($symb); |
$symb = &Apache::lonnet::symbread($requrl); |
if ($map =~ /\.page$/) { |
unless (&Apache::lonnet::symbverify($symb,$requrl)) { |
my $mapsymb = &Apache::lonnet::symbread($map); |
undef($symb); |
($map,$mid,$murl)=&Apache::lonnet::decode_symb($mapsymb); |
} |
|
} |
|
} |
|
if ($symb) { |
|
if ($requrl eq '/adm/navmaps') { |
|
my ($map,$mid,$murl)=&Apache::lonnet::decode_symb($symb); |
|
&Apache::lonnet::symblist($map,$murl => [$murl,$mid]); |
|
} elsif (($requrl =~ m{^/adm/wrapper/}) || |
|
($requrl =~ m{^/adm/coursedocs/showdoc/})) { |
|
my ($map,$mid,$murl)=&Apache::lonnet::decode_symb($symb); |
|
if ($map =~ /\.page$/) { |
|
my $mapsymb = &Apache::lonnet::symbread($map); |
|
($map,$mid,$murl)=&Apache::lonnet::decode_symb($mapsymb); |
|
} |
|
&Apache::lonnet::symblist($map,$murl => [$murl,$mid], |
|
'last_known' =>[$murl,$mid]); |
|
} |
} |
} |
&Apache::lonnet::symblist($map,$murl => [$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)) || |
Line 860 sub handler {
|
Line 888 sub handler {
|
} |
} |
} |
} |
if ($invalidsymb) { |
if ($invalidsymb) { |
$r->log_reason('Invalid symb for '.$requrl.': '.$symb); |
if ($requrl eq '/adm/navmaps') { |
$env{'user.error.msg'}= |
undef($symb); |
"$requrl:bre:1:1:Invalid Access"; |
} else { |
return HTTP_NOT_ACCEPTABLE; |
$r->log_reason('Invalid symb for '.$requrl.': '.$symb); |
|
$env{'user.error.msg'}= |
|
"$requrl:bre:1:1:Invalid Access"; |
|
return HTTP_NOT_ACCEPTABLE; |
|
} |
} |
} |
} |
} |
} |
} |