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