Diff for /loncom/auth/lontokacc.pm between versions 1.3 and 1.19

version 1.3, 2002/07/31 15:23:55 version 1.19, 2007/05/16 09:45:58
Line 1 Line 1
 # The LearningOnline Network  # The LearningOnline Network
 # Low security Access Handler for Token-based access   # Access Handler for User File Transfers
 # (clearance given by other loncapa host)  
 #  #
 # $Id$  # $Id$
 #  #
Line 30 Line 29
 package Apache::lontokacc;  package Apache::lontokacc;
   
 use strict;  use strict;
 use Apache::Constants qw(:common);  use Apache::Constants qw(:common :remotehost);
 use Apache::lonnet();  use Apache::lonnet();
 use Apache::loncommon();  use Apache::File();
   use IO::Socket;
   
 sub handler {  sub handler {
     my $r = shift;      my $r = shift;
     my $query=$r->args;      my $reqhost = $r->get_remote_host(REMOTE_NOLOOKUP);
     &Apache::loncommon::get_unprocessed_cgi($query,['token','server']);      my @hostids= &Apache::lonnet::get_hosts_from_ip($reqhost);
     my $tmpinfo='no_token';      if (!@hostids && $reqhost ne '127.0.0.1' ) {
     if (($ENV{'form.token'}) || ($ENV{'form.server'})) {   $r->log_reason("Unable to find a host for ".
         $tmpinfo=&Apache::lonnet::unescape(         $r->get_remote_host(REMOTE_NOLOOKUP));
                    &Apache::lonnet::reply('tmpget:'.$ENV{'form.token'},   return FORBIDDEN;
                                                     $ENV{'form.server'}));  
         chomp($tmpinfo);  
         my $uri=$r->uri;  
         if ($tmpinfo=~/$uri$/) {  
    return OK;  
         }  
     }      }
     $r->log_reason("Invalid token-based access:".$r->uri.' for '.$tmpinfo.'.',      if ($reqhost eq '127.0.0.1') {
         $r->filename);          return OK;
     return FORBIDDEN;      }
       return OK;
 }  }
   
   sub removefile {
       my $r=shift;
       if ($r->status==200) {
           unlink($r->filename);
    #&Apache::lonnet::logthis('Unlinking '.$r->filename);
       } else {
           &Apache::lonnet::logthis('Failed to transfer '.$r->filename);
       }
       return OK;
   }
 1;  1;
 __END__  __END__
   
   
   
   
   
   
   

Removed from v.1.3  
changed lines
  Added in v.1.19


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