Diff for /loncom/auth/loncacc.pm between versions 1.28 and 1.35

version 1.28, 2003/05/13 00:52:46 version 1.35, 2004/08/23 18:57:16
Line 42  use Apache::Constants qw(:common :http : Line 42  use Apache::Constants qw(:common :http :
 use Apache::File;  use Apache::File;
 use CGI::Cookie();  use CGI::Cookie();
 use Fcntl qw(:flock);  use Fcntl qw(:flock);
   use Apache::lonlocal;
   use Apache::lonnet();
   
   
 sub constructaccess {  sub constructaccess {
     my ($url,$ownerdomain)=@_;      my ($url,$ownerdomain)=@_;
     my ($ownername)=($url=~/\/(?:\~|priv\/|home\/)(\w+)/);      my ($ownername)=($url=~/\/(?:\~|priv\/|home\/)(\w+)\//);
     unless (($ownername) && ($ownerdomain)) { return ''; }      unless (($ownername) && ($ownerdomain)) { return ''; }
     # We do not allow editing of previous versions of files.      # We do not allow editing of previous versions of files.
     if ($url=~/\.(\d+)\.(\w+)$/) { return ''; }      if ($url=~/\.(\d+)\.(\w+)$/) { return ''; }
     if (($ownername eq $ENV{'user.name'}) &&      my @possibledomains = &Apache::lonnet::current_machine_domains();
         ($ownerdomain eq $ENV{'user.domain'})) {      if ($ownername eq $ENV{'user.name'}) {
  return ($ownername,$ownerdomain);   foreach my $domain (@possibledomains) {
       if ($domain eq $ENV{'user.domain'}) {
    return ($ownername,$domain);
       }
    }
     }      }
       
     my $capriv='user.priv.ca./'.      foreach my $domain (@possibledomains) {
                $ownerdomain.'/'.$ownername.'./'.   my $capriv='user.priv.ca./'.$domain.'/'.$ownername.'./';
        $ownerdomain.'/'.$ownername;   foreach (keys %ENV) {
     foreach (keys %ENV) {      if ($_ eq $capriv) {
         if ($_ eq $capriv) {   return ($ownername,$domain);
            return ($ownername,$ownerdomain);      }
         }   }
     }      }
   
     return '';      return '';
 }  }
   
Line 73  sub handler { Line 79  sub handler {
     my %cookies=CGI::Cookie->parse($r->header_in('Cookie'));      my %cookies=CGI::Cookie->parse($r->header_in('Cookie'));
     my $lonid=$cookies{'lonID'};      my $lonid=$cookies{'lonID'};
     my $cookie;      my $cookie;
       &Apache::lonnet::logthis("Wha? cookie");
     if ($lonid) {      if ($lonid) {
    &Apache::lonnet::logthis("Valid cookie");
  my $handle=$lonid->value;   my $handle=$lonid->value;
         $handle=~s/\W//g;          $handle=~s/\W//g;
         my $lonidsdir=$r->dir_config('lonIDsDir');          my $lonidsdir=$r->dir_config('lonIDsDir');
Line 83  sub handler { Line 91  sub handler {
   
             &Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle);              &Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle);
   
   # --------------------------------------------------------- Initialize Language
    
        &Apache::lonlocal::get_language_handle($r);
   
 # -------------------------------------------------------------- Resource State  # -------------------------------------------------------------- Resource State
   
             $ENV{'request.state'}    = "construct";              $ENV{'request.state'}    = "construct";
Line 108  sub handler { Line 120  sub handler {
   
             return OK;               return OK; 
         } else {           } else { 
       &Apache::lonnet::logthis("Invalid cookie");
             $r->log_reason("Cookie $handle not valid", $r->filename)               $r->log_reason("Cookie $handle not valid", $r->filename) 
         };          };
     }      }

Removed from v.1.28  
changed lines
  Added in v.1.35


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