version 1.1348, 2017/08/08 15:33:13
|
version 1.1352, 2017/08/27 02:36:58
|
Line 1600 sub internet_dom_servers {
|
Line 1600 sub internet_dom_servers {
|
|
|
sub trusted_domains { |
sub trusted_domains { |
my ($cmdtype,$calldom) = @_; |
my ($cmdtype,$calldom) = @_; |
my (%trusted,%untrusted); |
my ($trusted,$untrusted); |
if (&domain($calldom) eq '') { |
if (&domain($calldom) eq '') { |
return (\%trusted,\%untrusted); |
return ($trusted,$untrusted); |
} |
} |
unless ($cmdtype =~ /^(content|shared|enroll|coaurem|domroles|catalog|reqcrs|msg)$/) { |
unless ($cmdtype =~ /^(content|shared|enroll|coaurem|domroles|catalog|reqcrs|msg)$/) { |
return (\%trusted,\%untrusted); |
return ($trusted,$untrusted); |
} |
} |
my $callprimary = &domain($calldom,'primary'); |
my $callprimary = &domain($calldom,'primary'); |
my $intcalldom = &Apache::lonnet::internet_dom($callprimary); |
my $intcalldom = &Apache::lonnet::internet_dom($callprimary); |
if ($intcalldom eq '') { |
if ($intcalldom eq '') { |
return (\%trusted,\%untrusted); |
return ($trusted,$untrusted); |
} |
} |
|
|
my ($trustconfig,$cached)=&Apache::lonnet::is_cached_new('trust',$calldom); |
my ($trustconfig,$cached)=&Apache::lonnet::is_cached_new('trust',$calldom); |
Line 1660 sub trusted_domains {
|
Line 1660 sub trusted_domains {
|
} |
} |
foreach my $exc (@allexc) { |
foreach my $exc (@allexc) { |
if (ref($doms_by_intdom{$exc}) eq 'ARRAY') { |
if (ref($doms_by_intdom{$exc}) eq 'ARRAY') { |
map { $untrusted{$_}; } @{$doms_by_intdom{$exc}}; |
$untrusted = $doms_by_intdom{$exc}; |
} |
} |
} |
} |
foreach my $inc (@allinc) { |
foreach my $inc (@allinc) { |
if (ref($doms_by_intdom{$inc}) eq 'ARRAY') { |
if (ref($doms_by_intdom{$inc}) eq 'ARRAY') { |
map { $trusted{$_}; } @{$doms_by_intdom{$inc}}; |
$trusted = $doms_by_intdom{$inc}; |
} |
} |
} |
} |
} |
} |
} |
} |
return(\%trusted,\%untrusted); |
return ($trusted,$untrusted); |
} |
} |
|
|
sub will_trust { |
sub will_trust { |
Line 3171 sub externalssi {
|
Line 3171 sub externalssi {
|
} |
} |
} |
} |
|
|
|
sub remove_stale_resfile { |
|
my ($url) = @_; |
|
my $stale; |
|
if ($url=~m{^/res/($match_domain)/($match_username)/}) { |
|
my $audom = $1; |
|
my $auname = $2; |
|
unless (($url =~ /\.\d+\.\w+$/) || ($url !~ m{^/res/lib/templates/})) { |
|
my $homeserver = &homeserver($auname,$audom); |
|
unless (($homeserver eq 'no_host') || |
|
(grep { $_ eq $homeserver } ¤t_machine_ids())) { |
|
my $fname = &filelocation('',$url); |
|
if (-e $fname) { |
|
my $protocol = $protocol{$homeserver}; |
|
$protocol = 'http' if ($protocol ne 'https'); |
|
my $hostname = &hostname($homeserver); |
|
if ($hostname) { |
|
my $uri = &declutter($url); |
|
my $request=new HTTP::Request('HEAD',$protocol.'://'.$hostname.'/raw/'.$uri); |
|
my $response = &LONCAPA::LWPReq::makerequest($homeserver,$request,'',\%perlvar,5,0,1); |
|
if ($response->is_success()) { |
|
my $remmodtime = &HTTP::Date::str2time( $response->header('Last-modified') ); |
|
my $locmodtime = (stat($fname))[9]; |
|
if ($locmodtime < $remmodtime) { |
|
unlink($fname); |
|
if ($uri!~/\.meta$/) { |
|
unlink($fname.'.meta'); |
|
} |
|
&reply("unsub:$fname",$homeserver); |
|
$stale = 1; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
return $stale; |
|
} |
|
|
# -------------------------------- Allow a /uploaded/ URI to be vouched for |
# -------------------------------- Allow a /uploaded/ URI to be vouched for |
|
|
sub allowuploaded { |
sub allowuploaded { |
Line 3694 sub userfileupload {
|
Line 3733 sub userfileupload {
|
'_'.$env{'user.domain'}.'/pending'; |
'_'.$env{'user.domain'}.'/pending'; |
} elsif (($context eq 'existingfile') || ($context eq 'canceloverwrite')) { |
} elsif (($context eq 'existingfile') || ($context eq 'canceloverwrite')) { |
my ($docuname,$docudom); |
my ($docuname,$docudom); |
if ($destudom) { |
if ($destudom =~ /^$match_domain$/) { |
$docudom = $destudom; |
$docudom = $destudom; |
} else { |
} else { |
$docudom = $env{'user.domain'}; |
$docudom = $env{'user.domain'}; |
} |
} |
if ($destuname) { |
if ($destuname =~ /^$match_username$/) { |
$docuname = $destuname; |
$docuname = $destuname; |
} else { |
} else { |
$docuname = $env{'user.name'}; |
$docuname = $env{'user.name'}; |
Line 13363 sub fetch_dns_checksums {
|
Line 13402 sub fetch_dns_checksums {
|
my ($id,$domain,$role,$name,$protocol,$intdom)=split(/:/,$configline); |
my ($id,$domain,$role,$name,$protocol,$intdom)=split(/:/,$configline); |
$name=~s/\s//g; |
$name=~s/\s//g; |
if ($id && $domain && $role && $name) { |
if ($id && $domain && $role && $name) { |
|
if ((exists($hostname{$id})) && ($hostname{$id} ne '')) { |
|
my $curr = $hostname{$id}; |
|
my $skip; |
|
if (ref($name_to_host{$curr}) eq 'ARRAY') { |
|
if (($curr eq $name) && (@{$name_to_host{$curr}} == 1)) { |
|
$skip = 1; |
|
} else { |
|
@{$name_to_host{$curr}} = grep { $_ ne $id } @{$name_to_host{$curr}}; |
|
} |
|
} |
|
unless ($skip) { |
|
push(@{$name_to_host{$name}},$id); |
|
} |
|
} else { |
|
push(@{$name_to_host{$name}},$id); |
|
} |
$hostname{$id}=$name; |
$hostname{$id}=$name; |
push(@{$name_to_host{$name}}, $id); |
|
$hostdom{$id}=$domain; |
$hostdom{$id}=$domain; |
if ($role eq 'library') { $libserv{$id}=$name; } |
if ($role eq 'library') { $libserv{$id}=$name; } |
if (defined($protocol)) { |
if (defined($protocol)) { |