--- loncom/auth/lonacc.pm 2003/09/20 17:44:22 1.48 +++ loncom/auth/lonacc.pm 2005/02/21 18:22:04 1.60.2.1 @@ -1,7 +1,7 @@ # The LearningOnline Network # Cookie Based Access Handler # -# $Id: lonacc.pm,v 1.48 2003/09/20 17:44:22 www Exp $ +# $Id: lonacc.pm,v 1.60.2.1 2005/02/21 18:22:04 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -52,6 +52,9 @@ sub handler { my $r = shift; my $requrl=$r->uri; my %cookies=CGI::Cookie->parse($r->header_in('Cookie')); + if ($r->header_in('User-Agent')=~/NSDL\_Search\_Bot/) { + return OK; + } my $lonid=$cookies{'lonID'}; my $cookie; if ($lonid) { @@ -70,13 +73,13 @@ sub handler { # -------------------------------------------------------------- Resource State - if ($requrl=~/^\/res\//) { + if ($requrl=~/^\/+(res|uploaded)\//) { $ENV{'request.state'} = "published"; } else { $ENV{'request.state'} = 'unknown'; } $ENV{'request.filename'} = $r->filename; - + $ENV{'request.noversionuri'} = &Apache::lonnet::deversion($requrl); # -------------------------------------------------------- Load POST parameters &Apache::loncommon::get_posted_cgi($r); @@ -109,6 +112,7 @@ sub handler { if ((&Apache::loncommon::fileembstyle($1) eq 'ssi') || ($requrl=~/^\/adm\/.*\/(aboutme|navmaps|smppg|bulletinboard)(\?|$)/) || ($requrl=~/^\/adm\/wrapper\//) || + ($requrl=~m|\.problem/smpedit$|) || ($requrl=~/^\/public\/.*\/syllabus$/)) { # ------------------------------------- This is serious stuff, get symb and log my $query=$r->args; @@ -118,8 +122,14 @@ sub handler { } if ($ENV{'form.symb'}) { $symb=&Apache::lonnet::symbclean($ENV{'form.symb'}); - if (&Apache::lonnet::symbverify($symb,$requrl)) { - my ($map,$mid,$murl)=split(/\_\_\_/,$symb); + if ($requrl =~ m|^/adm/wrapper/|) { + my ($map,$mid,$murl)=&Apache::lonnet::decode_symb($symb); + &Apache::lonnet::symblist($map,$murl => $mid, + 'last_known' => $murl); + } elsif ((&Apache::lonnet::symbverify($symb,$requrl)) || + (($requrl=~m|(.*)/smpedit$|) && + &Apache::lonnet::symbverify($symb,$1))) { + my ($map,$mid,$murl)=&Apache::lonnet::decode_symb($symb); &Apache::lonnet::symblist($map,$murl => $mid, 'last_known' => $murl); } else { @@ -131,6 +141,13 @@ sub handler { } } else { $symb=&Apache::lonnet::symbread($requrl); + if (&Apache::lonnet::is_on_map($requrl) && $symb && + !&Apache::lonnet::symbverify($symb,$requrl)) { + $r->log_reason('Invalid symb for '.$requrl.': '.$symb); + $ENV{'user.error.msg'}= + "$requrl:bre:1:1:Invalid Access"; + return HTTP_NOT_ACCEPTABLE; + } my ($map,$mid,$murl)=split(/\_\_\_/,$symb); &Apache::lonnet::symblist($map,$murl => $mid, 'last_known' => $murl); @@ -152,29 +169,36 @@ sub handler { if ($requrl=~m|^/public/| || (&Apache::lonnet::metadata($requrl,'copyright') eq 'public')) { &Apache::lonnet::logthis('Granting public access: '.$requrl); - my $buffer; - $r->read($buffer,$r->header_in('Content-length'),0); - &Apache::loncommon::get_unprocessed_cgi($buffer); + &Apache::loncommon::get_posted_cgi($r); $ENV{'user.name'}='public'; $ENV{'user.domain'}='public'; $ENV{'request.state'} = "published"; $ENV{'request.publicaccess'} = 1; $ENV{'request.filename'} = $r->filename; + my ($httpbrowser, $clientbrowser, $clientversion, + $clientmathml, $clientunicode, $clientos) = + &Apache::loncommon::decode_user_agent($r); + $ENV{'browser.type'}=$clientbrowser; + $ENV{'browser.version'}=$clientversion; + $ENV{'browser.mathml'}=$clientmathml; + $ENV{'browser.unicode'}=$clientunicode; + $ENV{'browser.os'}=$clientos; + return OK; } # -------------------------------------------------------------- Not authorized $requrl=~/\.(\w+)$/; - if ((&Apache::loncommon::fileembstyle($1) eq 'ssi') || - ($requrl=~/^\/adm\/(roles|logout|email|menu|remote)/) || - ($requrl=~m|^/prtspool/|)) { +# if ((&Apache::loncommon::fileembstyle($1) eq 'ssi') || +# ($requrl=~/^\/adm\/(roles|logout|email|menu|remote)/) || +# ($requrl=~m|^/prtspool/|)) { # -------------------------- Store where they wanted to go and get login screen $ENV{'request.querystring'}=$r->args; $ENV{'request.firsturl'}=$requrl; return FORBIDDEN; - } else { +# } else { # --------------------------------------------------------------------- Goodbye - return HTTP_BAD_REQUEST; - } +# return HTTP_BAD_REQUEST; +# } } 1; 500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at root@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.