Diff for /loncom/auth/lonracc.pm between versions 1.21 and 1.23

version 1.21, 2007/03/02 23:17:48 version 1.23, 2008/11/12 20:01:09
Line 26 Line 26
 # http://www.lon-capa.org/  # http://www.lon-capa.org/
 #  #
   
   =pod
   
   =head1 NAME
   
   Apache::lonracc - Access Handler for File Transfers
   
   =head1 SYNOPSIS
   
   Invoked by /etc/httpd/conf/loncapa.conf:
   
    <LocationMatch "^/raw.*">
    PerlAccessHandler Apache::lonracc
    </LocationMatch>
   
   =head1 INTRODUCTION
   
   This module enables authentication for file transfers and works
   against the /res tree.
   
   Only lond invokes the /raw namespace through its subscribe function.
   
   This is part of the LearningOnline Network with CAPA project
   described at http://www.lon-capa.org.
   
   =head1 HANDLER SUBROUTINE
   
   This routine is called by Apache and mod_perl.
   
   =over 4
   
   =item *
   
   Determine requesting host
   
   =item *
   
   See whether or not the requesting host is subscribed.
   
   =item *
   
   Respond with status of request and make log entry in case of unallowed
   access.
   
   =back
   
   =cut
   
 package Apache::lonracc;  package Apache::lonracc;
   
 use strict;  use strict;
Line 65  sub handler { Line 112  sub handler {
     }      }
   
     my $reqhost = $r->get_remote_host(REMOTE_NOLOOKUP);      my $reqhost = $r->get_remote_host(REMOTE_NOLOOKUP);
     my %iphost=&Apache::lonnet::get_iphost();      my @hostids= &Apache::lonnet::get_hosts_from_ip($reqhost);
     my $hostids=$iphost{$reqhost};      if (!@hostids && $reqhost ne '127.0.0.1' ) {
     if (!$hostids && $reqhost ne '127.0.0.1' ) {  
  $r->log_reason("Unable to find a host for ".   $r->log_reason("Unable to find a host for ".
        $r->get_remote_host(REMOTE_NOLOOKUP));         $r->get_remote_host(REMOTE_NOLOOKUP));
  return FORBIDDEN;   return FORBIDDEN;
Line 78  sub handler { Line 124  sub handler {
     my $return;      my $return;
     my @ids;      my @ids;
   
     foreach my $id (@{$hostids}) {      foreach my $id (@hostids) {
  my $uri =$r->uri;   my $uri =$r->uri;
  if (($filename=~/\.meta$/) ||   if (($filename=~/\.meta$/) ||
     ($uri=~m|^/raw/uploaded|) ||      ($uri=~m|^/raw/uploaded|) ||
Line 102  sub handler { Line 148  sub handler {
 1;  1;
 __END__  __END__
   
 =head1 NAME  
   
 Apache::lonracc - Access Handler for File Transfers  
   
 =head1 SYNOPSIS  
   
 Invoked by /etc/httpd/conf/loncapa.conf:  
   
  <LocationMatch "^/raw.*">  
  PerlAccessHandler Apache::lonracc  
  </LocationMatch>  
   
 =head1 INTRODUCTION  
   
 This module enables authentication for file transfers and works  
 against the /res tree.  
   
 Only lond invokes the /raw namespace through its subscribe function.  
   
 This is part of the LearningOnline Network with CAPA project  
 described at http://www.lon-capa.org.  
   
 =head1 HANDLER SUBROUTINE  
   
 This routine is called by Apache and mod_perl.  
   
 =over 4  
   
 =item *  
   
 Determine requesting host  
   
 =item *  
   
 See whether or not the requesting host is subscribed.  
   
 =item *  
   
 Respond with status of request and make log entry in case of unallowed  
 access.  
   
 =back  
   
 =cut  
   
   
   

Removed from v.1.21  
changed lines
  Added in v.1.23


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