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

version 1.30, 2003/09/16 18:15:43 version 1.35, 2004/08/23 18:57:16
Line 43  use Apache::File; Line 43  use Apache::File;
 use CGI::Cookie();  use CGI::Cookie();
 use Fcntl qw(:flock);  use Fcntl qw(:flock);
 use Apache::lonlocal;  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.'./';
     foreach (keys %ENV) {   foreach (keys %ENV) {
         if ($_ eq $capriv) {      if ($_ eq $capriv) {
            return ($ownername,$ownerdomain);   return ($ownername,$domain);
         }      }
    }
     }      }
     return '';      return '';
 }  }
Line 72  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 84  sub handler { Line 93  sub handler {
   
 # --------------------------------------------------------- Initialize Language  # --------------------------------------------------------- Initialize Language
     
      &Apache::lonlocal::get_language_handle();       &Apache::lonlocal::get_language_handle($r);
   
 # -------------------------------------------------------------- Resource State  # -------------------------------------------------------------- Resource State
   
Line 111  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.30  
changed lines
  Added in v.1.35


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