--- loncom/lonnet/perl/lonnet.pm 2002/05/07 19:16:15 1.213 +++ loncom/lonnet/perl/lonnet.pm 2002/05/11 20:42:00 1.217 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.213 2002/05/07 19:16:15 www Exp $ +# $Id: lonnet.pm,v 1.217 2002/05/11 20:42:00 harris41 Exp $ # # Copyright Michigan State University Board of Trustees # @@ -627,6 +627,7 @@ sub subscribe { sub repcopy { my $filename=shift; $filename=~s/\/+/\//g; + if ($filename=~/^\/home\/httpd\/html\/adm\//) { return OK; } my $transname="$filename.in.transfer"; if ((-e $filename) || (-e $transname)) { return OK; } my $remoteurl=subscribe($filename); @@ -716,7 +717,6 @@ sub flushcourselogs { &logthis('Flushing course log buffers'); foreach (keys %courselogs) { my $crsid=$_; - &logthis(":$crsid:$coursehombuf{$crsid}"); if (&reply('log:'.$coursedombuf{$crsid}.':'. &escape($courselogs{$crsid}), $coursehombuf{$crsid}) eq 'ok') { @@ -2524,19 +2524,33 @@ sub symblist { sub symbverify { my ($symb,$thisfn)=@_; $thisfn=&declutter($thisfn); - -# &logthis("Symb verify: $symb $thisfn"); - +# direct jump to resource in page or to a sequence - will construct own symbs + if ($thisfn=~/\.(page|sequence)$/) { return 1; } +# check URL part my ($map,$resid,$url)=split(/\_\_\_/,$symb); unless (&symbclean($url) eq &symbclean($thisfn)) { return 0; } - return 1; + $symb=&symbclean($symb); my %bighash; my $okay=0; if (tie(%bighash,'GDBM_File',$ENV{'request.course.fn'}.'.db', &GDBM_READER,0640)) { - + my $ids=$bighash{'ids_/res/'.$thisfn}; + unless ($ids) { + $ids=$bighash{'ids_/'.$thisfn}; + } + if ($ids) { +# ------------------------------------------------------------------- Has ID(s) + foreach (split(/\,/,$ids)) { + my ($mapid,$resid)=split(/\./,$_); + if ( + &symbclean(&declutter($bighash{'map_id_'.$mapid}).'___'.$resid.'___'.$thisfn) + eq $symb) { + $okay=1; + } + } + } untie(%bighash); } return $okay; @@ -2547,15 +2561,12 @@ sub symbverify { sub symbclean { my $symb=shift; -# &logthis("Symb in: $symb"); - # remove version from map $symb=~s/\.(\d+)\.(\w+)\_\_\_/\.$2\_\_\_/; + # remove version from URL $symb=~s/\.(\d+)\.(\w+)$/\.$2/; -# &logthis("Symb out: $symb"); - return $symb; } @@ -2768,13 +2779,26 @@ sub goodbye { } BEGIN { -# ------------------------------------------------------------ Read access.conf +# ------------------------------------------- Read access.conf and loncapa.conf +# (eventually access.conf will become deprecated) unless ($readit) { + { my $config=Apache::File->new("/etc/httpd/conf/access.conf"); while (my $configline=<$config>) { - if ($configline =~ /PerlSetVar/) { + if ($configline =~ /^[^\#]*PerlSetVar/) { + my ($dummy,$varname,$varvalue)=split(/\s+/,$configline); + chomp($varvalue); + $perlvar{$varname}=$varvalue; + } + } +} +{ + my $config=Apache::File->new("/etc/httpd/conf/loncapa.conf"); + + while (my $configline=<$config>) { + if ($configline =~ /^[^\#]*PerlSetVar/) { my ($dummy,$varname,$varvalue)=split(/\s+/,$configline); chomp($varvalue); $perlvar{$varname}=$varvalue;