--- loncom/auth/loncacc.pm 2005/04/07 06:56:21 1.38 +++ loncom/auth/loncacc.pm 2006/11/23 01:49:41 1.42 @@ -2,7 +2,7 @@ # Cookie Based Access Handler for Construction Area # (lonacc: 5/21/99,5/22,5/29,5/31 Gerd Kortemeyer) # -# $Id: loncacc.pm,v 1.38 2005/04/07 06:56:21 albertel Exp $ +# $Id: loncacc.pm,v 1.42 2006/11/23 01:49:41 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -31,12 +31,11 @@ package Apache::loncacc; use strict; use Apache::Constants qw(:common :http :methods REDIRECT); -use Apache::File; use CGI::Cookie(); use Fcntl qw(:flock); use Apache::lonlocal; use Apache::lonnet; - +use Apache::lonacc; sub constructaccess { my ($url,$ownerdomain)=@_; @@ -54,11 +53,9 @@ sub constructaccess { } foreach my $domain (@possibledomains) { - my $capriv='user.priv.ca./'.$domain.'/'.$ownername.'./'; - foreach (keys %env) { - if ($_ eq $capriv) { - return ($ownername,$domain); - } + if (exists($env{'user.priv.ca./'.$domain.'/'.$ownername.'./'}) || + exists($env{'user.priv.aa./'.$domain.'/'.$ownername.'./'}) ) { + return ($ownername,$domain); } } return ''; @@ -72,8 +69,7 @@ sub handler { my $lonid=$cookies{'lonID'}; my $cookie; if ($lonid) { - my $handle=$lonid->value; - $handle=~s/\W//g; + my $handle=&LONCAPA::clean_handle($lonid->value); my $lonidsdir=$r->dir_config('lonIDsDir'); if ((-e "$lonidsdir/$handle.id") && ($handle ne '')) { @@ -97,7 +93,7 @@ sub handler { # -------------------------------------------------------- Load POST parameters - &Apache::loncommon::get_posted_cgi($r); + &Apache::lonacc::get_posted_cgi($r); return OK; } else {