[LON-CAPA-cvs] cvs: loncom /auth lonuploadedacc.pm /lonnet/perl lonnet.pm

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 12 Nov 2002 22:23:37 -0000


albertel		Tue Nov 12 17:23:37 2002 EDT

  Modified files:              
    /loncom/auth	lonuploadedacc.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - fix for uploaded files, validating against wrong server
  - added new table to translate from IP to internal host id
  
  
Index: loncom/auth/lonuploadedacc.pm
diff -u loncom/auth/lonuploadedacc.pm:1.3 loncom/auth/lonuploadedacc.pm:1.4
--- loncom/auth/lonuploadedacc.pm:1.3	Mon Sep 30 17:01:41 2002
+++ loncom/auth/lonuploadedacc.pm	Tue Nov 12 17:23:37 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Access Handler for User Files
 #
-# $Id: lonuploadedacc.pm,v 1.3 2002/09/30 21:01:41 albertel Exp $
+# $Id: lonuploadedacc.pm,v 1.4 2002/11/12 22:23:37 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -38,11 +38,14 @@
     &Apache::loncommon::get_unprocessed_cgi($args,['token']); 
     my (undef,undef,$udom,$uname,$ufile)=split(/\//,$r->uri);
     $ufile=~s/^[\~\.]+//;
-    my ($server)=($ENV{'form.token'}=~/\_([a-zA-Z0-9]+)$/);
+    my ($homeserver)=($ENV{'form.token'}=~/\_([a-zA-Z0-9]+)$/);
+    my $remoteip=$ENV{'REMOTE_ADDR'};
+    &Apache::lonnet::logthis("remote server $remoteserver");
+    my $remoteserver=$Apache::lonnet::iphost{$remoteip};
 
     my $reply=&Apache::lonnet::reply('tokenauthuserfile:'.
                  $udom.'/'.$uname.'/'.$ufile.':'.$ENV{'form.token'},
-				     $server);
+				     $remoteserver);
     if ($reply eq 'ok') {
        return OK;
    } else {
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.299 loncom/lonnet/perl/lonnet.pm:1.300
--- loncom/lonnet/perl/lonnet.pm:1.299	Tue Oct 22 17:49:10 2002
+++ loncom/lonnet/perl/lonnet.pm	Tue Nov 12 17:23:37 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.299 2002/10/22 21:49:10 matthew Exp $
+# $Id: lonnet.pm,v 1.300 2002/11/12 22:23:37 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -77,7 +77,7 @@
 use LWP::UserAgent();
 use HTTP::Headers;
 use vars 
-qw(%perlvar %hostname %homecache %badServerCache %hostip %spareid %hostdom 
+qw(%perlvar %hostname %homecache %badServerCache %hostip %iphost %spareid %hostdom 
    %libserv %pr %prp %metacache %packagetab 
    %courselogs %accesshash $processmarker $dumpcount 
    %coursedombuf %coursehombuf %courseresdatacache %domaindescription);
@@ -3448,6 +3448,7 @@
 	 $hostname{$id}=$name;
 	 $hostdom{$id}=$domain;
 	 $hostip{$id}=$ip;
+	 $iphost{$ip}=$id;
 	 if ($domdescr) { $domaindescription{$domain}=$domdescr; }
 	 if ($role eq 'library') { $libserv{$id}=$name; }
        } else {