Annotation of loncom/auth/lonracc.pm, revision 1.1
1.1 ! albertel 1: # The LearningOnline Network
! 2: # Access Handler for File Transfers
! 3: # (lonacc: Cookie Based Access Handler
! 4: # 5/21/99,5/22,5/29,5/31,6/15 Gerd Kortemeyer)
! 5: # 6/16,6/18,7/3 Gerd Kortemeyer
! 6:
! 7: package Apache::lonracc;
! 8:
! 9: use strict;
! 10: use Apache::Constants qw(:common :remotehost);
! 11: use Apache::File();
! 12:
! 13: sub handler {
! 14: my $r = shift;
! 15: my $reqhost;
! 16: unless ($reqhost=$r->get_remote_host(REMOTE_DOUBLE_REV)) {
! 17: $r->log_reason("Spoof request");
! 18: return FORBIDDEN;
! 19: }
! 20: my $readline;
! 21: my $lontabdir=$r->dir_config('lonTabDir');
! 22: {
! 23: my $fh;
! 24: unless ($fh=Apache::File->new("$lontabdir/hosts.tab")) {
! 25: $r->log_reason("Could not find host tab file");
! 26: return FORBIDDEN;
! 27: }
! 28: while ($readline=<$fh>) {
! 29: my ($id,$domain,$role,$name,$ip)=split(/:/,$readline);
! 30: if ($name =~ /$reqhost/i) {
! 31: my $filename=$r->filename;
! 32: if (-e "$filename.$id") {
! 33: return OK;
! 34: } else {
! 35: $r->log_reason("$id not subscribed", $r->filename);
! 36: return FORBIDDEN;
! 37: }
! 38: }
! 39: }
! 40:
! 41: }
! 42: $r->log_reason("Invalid request for file transfer from $reqhost",
! 43: $r->filename);
! 44: return FORBIDDEN;
! 45: }
! 46:
! 47: 1;
! 48: __END__
! 49:
! 50:
! 51:
! 52:
! 53:
! 54:
! 55:
! 56:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>