--- loncom/auth/lontokacc.pm 2002/08/01 22:36:11 1.4 +++ loncom/auth/lontokacc.pm 2002/08/08 13:45:21 1.6 @@ -1,7 +1,7 @@ # The LearningOnline Network # Access Handler for User File Transfers # -# $Id: lontokacc.pm,v 1.4 2002/08/01 22:36:11 www Exp $ +# $Id: lontokacc.pm,v 1.6 2002/08/08 13:45:21 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -37,9 +37,13 @@ sub handler { my $r = shift; my $reqhost; unless ($reqhost=$r->get_remote_host(REMOTE_DOUBLE_REV)) { - $r->log_reason("Spoof request"); + $r->log_reason("Spoof request ".$reqhost); return FORBIDDEN; } + if ($reqhost eq 'localhost.localdomain') { + $r->register_cleanup(\&removefile); + return OK; + } my $readline; my $lontabdir=$r->dir_config('lonTabDir'); { @@ -50,7 +54,10 @@ sub handler { } while ($readline=<$fh>) { my ($id,$domain,$role,$name,$ip)=split(/:/,$readline); - if ($name =~ /$reqhost/i) { return OK; } + if ($name =~ /$reqhost/i) { + $r->register_cleanup(\&removefile); + return OK; + } } } @@ -59,6 +66,15 @@ sub handler { return FORBIDDEN; } +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); + } +} 1; __END__