Diff for /loncom/auth/lonracc.pm between versions 1.15 and 1.17

version 1.15, 2005/02/06 07:23:40 version 1.17, 2005/04/07 06:56:21
Line 30  package Apache::lonracc; Line 30  package Apache::lonracc;
   
 use strict;  use strict;
 use Apache::Constants qw(:common :remotehost);  use Apache::Constants qw(:common :remotehost);
 use Apache::lonnet();  use Apache::lonnet;
 use Apache::File();  use Apache::File();
 use IO::Socket;  use IO::Socket;
   
Line 53  sub subscribed { Line 53  sub subscribed {
 sub handler {  sub handler {
     my $r = shift;      my $r = shift;
     my $reqhost = $r->get_remote_host(REMOTE_NOLOOKUP);      my $reqhost = $r->get_remote_host(REMOTE_NOLOOKUP);
     my $netaddr=inet_aton($reqhost);      my %iphost=&Apache::lonnet::get_iphost();
     ($reqhost) = gethostbyaddr($netaddr,AF_INET);      my $hostids=$iphost{$reqhost};
     if (!$reqhost) {      if (!$hostids && $reqhost ne '127.0.0.1' ) {
  $r->log_reason("Unable to do hostname $reqhost lookup for ".$r->get_remote_host(REMOTE_NOLOOKUP));   $r->log_reason("Unable to find a host for ".
          $r->get_remote_host(REMOTE_NOLOOKUP));
  return FORBIDDEN;   return FORBIDDEN;
     }      }
     if ($reqhost eq 'localhost.localdomain') {      if ($reqhost eq '127.0.0.1') {
  return OK;   return OK;
     }      }
     my $return;      my $return;
     my @ids=();      my @ids=();
     my $id;      my $id;
     foreach $id (keys %Apache::lonnet::hostname) {  
  if ($Apache::lonnet::hostname{$id} =~ /^\Q$reqhost\E$/i) {      foreach $id (@{$hostids}) {
     my $filename=$r->filename;   my $filename=$r->filename;
     my $uri =$r->uri;   my $uri =$r->uri;
     if ((-e "$filename.$id") ||   if ((-e "$filename.$id") ||
  &subscribed($filename,$id) ||      &subscribed($filename,$id) ||
  ($filename=~/\.meta$/) ||      ($filename=~/\.meta$/) ||
  ($uri=~m|^/raw/uploaded|)) {      ($uri=~m|^/raw/uploaded|)) {
  return OK;      return OK;
     } else {   } else {
  $return=FORBIDDEN;      $return=FORBIDDEN;
  push(@ids,$id);      push(@ids,$id);
     }  
  }   }
     }      }
     if ($return == FORBIDDEN) {      if ($return == FORBIDDEN) {

Removed from v.1.15  
changed lines
  Added in v.1.17


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