Diff for /loncom/lonnet/perl/lonnet.pm between versions 1.1425 and 1.1426

version 1.1425, 2020/09/28 13:08:57 version 1.1426, 2020/10/01 10:16:34
Line 8290  sub allowed { Line 8290  sub allowed {
                         } elsif ($noblockcheck) {                          } elsif ($noblockcheck) {
                             $thisallowed='F';                              $thisallowed='F';
                         } else {                          } else {
                             my @blockers = &has_comm_blocking($priv,$symb,$refuri,$ignorecache);                              my @blockers = &has_comm_blocking($priv,'',$refuri,'',1);
                             if (@blockers > 0) {                              if (@blockers > 0) {
                                 $thisallowed = 'B';                                  $thisallowed = 'B';
                             } else {                              } else {
Line 8408  sub allowed { Line 8408  sub allowed {
                       } elsif ($noblockcheck) {                        } elsif ($noblockcheck) {
                           $thisallowed.=$value;                            $thisallowed.=$value;
                       } else {                        } else {
                           my @blockers = &has_comm_blocking($priv,'',$refuri,$ignorecache);                            my @blockers = &has_comm_blocking($priv,'',$refuri,'',1);
                           if (@blockers > 0) {                            if (@blockers > 0) {
                               $thisallowed = 'B';                                $thisallowed = 'B';
                           } else {                            } else {
Line 8829  sub get_commblock_resources { Line 8829  sub get_commblock_resources {
 }  }
   
 sub has_comm_blocking {  sub has_comm_blocking {
     my ($priv,$symb,$uri,$nosymbcache,$blocked,$blocks) = @_;      my ($priv,$symb,$uri,$nosymbcache,$noenccheck,$blocked,$blocks) = @_;
     my @blockers;      my @blockers;
     return unless ($env{'request.course.id'});      return unless ($env{'request.course.id'});
     return unless ($priv eq 'bre');      return unless ($priv eq 'bre');
Line 8839  sub has_comm_blocking { Line 8839  sub has_comm_blocking {
     return unless (keys(%cachedblockers) > 0);      return unless (keys(%cachedblockers) > 0);
     my (%possibles,@symbs);      my (%possibles,@symbs);
     if (!$symb) {      if (!$symb) {
         $symb = &symbread($uri,1,1,'',\%possibles,$nosymbcache);          $symb = &symbread($uri,1,1,1,\%possibles,$nosymbcache,$noenccheck);
     }      }
     if ($symb) {      if ($symb) {
         @symbs = ($symb);          @symbs = ($symb);
Line 13310  sub deversion { Line 13310  sub deversion {
   
 sub symbread {  sub symbread {
     my ($thisfn,$donotrecurse,$ignorecachednull,$checkforblock,$possibles,      my ($thisfn,$donotrecurse,$ignorecachednull,$checkforblock,$possibles,
         $nocache)=@_;          $nocache,$noenccheck)=@_;
     my $cache_str='request.symbread.cached.'.$thisfn;      my $cache_str='request.symbread.cached.'.$thisfn;
     if (defined($env{$cache_str}) && !$nocache) {      if (defined($env{$cache_str}) && !$nocache) {
         unless (ref($possibles) eq 'HASH') {          unless (ref($possibles) eq 'HASH') {
Line 13362  sub symbread { Line 13362  sub symbread {
                 untie(%hash);                  untie(%hash);
             }              }
             if ($syval) {              if ($syval) {
                 my @blockers = &has_comm_blocking('bre',$syval,$thisfn,$nocache);                  my @blockers = &has_comm_blocking('bre',$syval,$thisfn,$nocache,$noenccheck);
                 if (@blockers) {                  if (@blockers) {
                     $syval='';                      $syval='';
                 }                  }
Line 13405  sub symbread { Line 13405  sub symbread {
                      }                       }
                      if ($checkforblock) {                       if ($checkforblock) {
                          unless ($bighash{'randomout_'.$ids} || $env{'request.role.adv'}) {                           unless ($bighash{'randomout_'.$ids} || $env{'request.role.adv'}) {
                              my @blockers = &has_comm_blocking('bre',$syval,$bighash{'src_'.$ids});                               my @blockers = &has_comm_blocking('bre',$syval,$bighash{'src_'.$ids},'',$noenccheck);
                              if (@blockers) {                               if (@blockers) {
                                  $syval = '';                                   $syval = '';
                                  untie(%bighash);                                   untie(%bighash);
Line 13431  sub symbread { Line 13431  sub symbread {
                                  my $poss_syval=&encode_symb($bighash{'map_id_'.$mapid},                                   my $poss_syval=&encode_symb($bighash{'map_id_'.$mapid},
              $resid,$thisfn);               $resid,$thisfn);
                                  next if ($bighash{'randomout_'.$id} && !$env{'request.role.adv'});                                   next if ($bighash{'randomout_'.$id} && !$env{'request.role.adv'});
                                  next unless ($bighash{'encrypted_'.$id} eq $env{'request.enc'});                                   next unless (($noenccheck) || ($bighash{'encrypted_'.$id} eq $env{'request.enc'}));
                                  if ($checkforblock) {                                   if ($checkforblock) {
                                      my @blockers = &has_comm_blocking('bre',$poss_syval,$file);                                       my @blockers = &has_comm_blocking('bre',$poss_syval,$file,'',$noenccheck);
                                      if (@blockers > 0) {                                       if (@blockers > 0) {
                                          $syval = '';                                           $syval = '';
                                      } else {                                       } else {

Removed from v.1.1425  
changed lines
  Added in v.1.1426


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