--- loncom/auth/lonracc.pm 2007/02/01 06:20:34 1.18 +++ loncom/auth/lonracc.pm 2007/03/02 23:43:29 1.22 @@ -1,7 +1,7 @@ # The LearningOnline Network # Access Handler for File Transfers # -# $Id: lonracc.pm,v 1.18 2007/02/01 06:20:34 albertel Exp $ +# $Id: lonracc.pm,v 1.22 2007/03/02 23:43:29 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -37,9 +37,9 @@ use IO::Socket; sub subscribed { my ($filename,$id) = @_; - return 0 if (-e "$filename.subscription"); + return 0 if (!-e "$filename.subscription"); - my $hostname=$Apache::lonnet::hostname{$id}; + my $hostname=&Apache::lonnet::hostname($id); my (undef,undef,undef,undef,$ip) = gethostbyname($hostname); return 0 if (length($ip) != 4); @@ -58,10 +58,15 @@ sub subscribed { sub handler { my $r = shift; + + my $filename=$r->filename; + if (!-e $filename) { + return NOT_FOUND; + } + my $reqhost = $r->get_remote_host(REMOTE_NOLOOKUP); - my %iphost=&Apache::lonnet::get_iphost(); - my $hostids=$iphost{$reqhost}; - if (!$hostids && $reqhost ne '127.0.0.1' ) { + my @hostids= &Apache::lonnet::get_hosts_from_ip($reqhost); + if (!@hostids && $reqhost ne '127.0.0.1' ) { $r->log_reason("Unable to find a host for ". $r->get_remote_host(REMOTE_NOLOOKUP)); return FORBIDDEN; @@ -72,8 +77,7 @@ sub handler { my $return; my @ids; - foreach my $id (@{$hostids}) { - my $filename=$r->filename; + foreach my $id (@hostids) { my $uri =$r->uri; if (($filename=~/\.meta$/) || ($uri=~m|^/raw/uploaded|) ||