--- loncom/lonnet/perl/lonnet.pm 2017/08/07 20:22:54 1.1347 +++ loncom/lonnet/perl/lonnet.pm 2017/08/23 22:38:43 1.1350 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.1347 2017/08/07 20:22:54 raeburn Exp $ +# $Id: lonnet.pm,v 1.1350 2017/08/23 22:38:43 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1598,65 +1598,19 @@ sub internet_dom_servers { return %uniqservers; } -sub notcallable { - my ($cmdtype,$calldom) = @_; - if (&domain($calldom) eq '') { - return 1; - } - unless ($cmdtype =~ /^(content|shared|enroll|coaurem|domroles|catalog|reqcrs|msg)$/) { - return 1; - } - my @machinedoms = ¤t_machine_domains(); - if (grep(/^\Q$calldom\E$/,@machinedoms)) { - return; - } - my $reject; - my $intdom = &internet_dom($perlvar{'lonHostID'}); - if ($intdom eq '') { - return 1; - } - my $callprimary = &domain($calldom,'primary'); - my $intcalldom = &Apache::lonnet::internet_dom($callprimary); - unless ($intdom eq $intcalldom) { - my ($trustconfig,$cached)=&Apache::lonnet::is_cached_new('trust',$calldom); - unless (defined($cached)) { - my %domconfig = &Apache::lonnet::get_dom('configuration',['trust'],$calldom); - &Apache::lonnet::do_cache_new('trust',$calldom,$domconfig{'trust'},3600); - $trustconfig = $domconfig{'trust'}; - } - if (ref($trustconfig)) { - if (ref($trustconfig->{$cmdtype}) eq 'HASH') { - if (ref($trustconfig->{$cmdtype}->{'exc'}) eq 'ARRAY') { - if (grep(/^\Q$intdom\E$/,@{$trustconfig->{$cmdtype}->{'exc'}})) { - $reject = 1; - } - } - if (ref($trustconfig->{$cmdtype}->{'inc'}) eq 'ARRAY') { - if (grep(/^\Q$intdom\E$/,@{$trustconfig->{$cmdtype}->{'inc'}})) { - $reject = 0; - } else { - $reject = 1; - } - } - } - } - } - return $reject; -} - sub trusted_domains { my ($cmdtype,$calldom) = @_; - my (%trusted,%untrusted); + my ($trusted,$untrusted); if (&domain($calldom) eq '') { - return (\%trusted,\%untrusted); + return ($trusted,$untrusted); } unless ($cmdtype =~ /^(content|shared|enroll|coaurem|domroles|catalog|reqcrs|msg)$/) { - return (\%trusted,\%untrusted); + return ($trusted,$untrusted); } my $callprimary = &domain($calldom,'primary'); my $intcalldom = &Apache::lonnet::internet_dom($callprimary); if ($intcalldom eq '') { - return (\%trusted,\%untrusted); + return ($trusted,$untrusted); } my ($trustconfig,$cached)=&Apache::lonnet::is_cached_new('trust',$calldom); @@ -1706,17 +1660,17 @@ sub trusted_domains { } foreach my $exc (@allexc) { if (ref($doms_by_intdom{$exc}) eq 'ARRAY') { - map { $untrusted{$_}; } @{$doms_by_intdom{$exc}}; + $untrusted = $doms_by_intdom{$exc}; } } foreach my $inc (@allinc) { 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 { @@ -3740,12 +3694,12 @@ sub userfileupload { '_'.$env{'user.domain'}.'/pending'; } elsif (($context eq 'existingfile') || ($context eq 'canceloverwrite')) { my ($docuname,$docudom); - if ($destudom) { + if ($destudom =~ /^$match_domain$/) { $docudom = $destudom; } else { $docudom = $env{'user.domain'}; } - if ($destuname) { + if ($destuname =~ /^$match_username$/) { $docuname = $destuname; } else { $docuname = $env{'user.name'};