[LON-CAPA-cvs] cvs: loncom /cgi createpending.pl enrollqueued.pl listcodes.pl listdomconfig.pl ping.pl takeoffline.pl

raeburn raeburn at source.lon-capa.org
Fri Jul 3 20:54:43 EDT 2026


raeburn		Sat Jul  4 00:54:43 2026 EDT

  Modified files:              
    /loncom/cgi	createpending.pl enrollqueued.pl listcodes.pl 
               	listdomconfig.pl takeoffline.pl ping.pl 
  Log:
  - Requestor's IP address retrieval centralized in lonnet::get_requestor_ip()
    to support operation of domain's LON-CAPA nodes behind WAF/Reverse Proxy.
  
  
Index: loncom/cgi/createpending.pl
diff -u loncom/cgi/createpending.pl:1.2 loncom/cgi/createpending.pl:1.3
--- loncom/cgi/createpending.pl:1.2	Wed Aug 17 14:35:57 2016
+++ loncom/cgi/createpending.pl	Sat Jul  4 00:54:42 2026
@@ -4,7 +4,7 @@
 # for unofficial courses, textbook courses, communities and 
 # placement tests queued pending validation, once validated.
 #  
-# $Id: createpending.pl,v 1.2 2016/08/17 14:35:57 raeburn Exp $
+# $Id: createpending.pl,v 1.3 2026/07/04 00:54:42 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -144,7 +144,7 @@
     }
 
     my %domconfig = &Apache::lonnet::get_dom('configuration',['requestcourses'],$cdom);
-    my $remote_ip = $ENV{'REMOTE_ADDR'};
+    my $remote_ip =&Apache::lonnet::get_requestor_ip();
     my $allowed;
 
     if (ref($domconfig{'requestcourses'}) eq 'HASH') {
Index: loncom/cgi/enrollqueued.pl
diff -u loncom/cgi/enrollqueued.pl:1.4 loncom/cgi/enrollqueued.pl:1.5
--- loncom/cgi/enrollqueued.pl:1.4	Fri May 19 19:29:33 2017
+++ loncom/cgi/enrollqueued.pl	Sat Jul  4 00:54:42 2026
@@ -3,7 +3,7 @@
 # Script to complete processing of self-enrollment requests
 # queued pending validation, when validated.
 #  
-# $Id: enrollqueued.pl,v 1.4 2017/05/19 19:29:33 raeburn Exp $
+# $Id: enrollqueued.pl,v 1.5 2026/07/04 00:54:42 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -160,7 +160,7 @@
     }
 
     my %domconfig = &Apache::lonnet::get_dom('configuration',['selfenrollment'],$dom);
-    my $remote_ip = $ENV{'REMOTE_ADDR'};
+    my $remote_ip =&Apache::lonnet::get_requestor_ip();
     my $allowed;
 
     if (ref($domconfig{'selfenrollment'}) eq 'HASH') {
Index: loncom/cgi/listcodes.pl
diff -u loncom/cgi/listcodes.pl:1.2 loncom/cgi/listcodes.pl:1.3
--- loncom/cgi/listcodes.pl:1.2	Wed Jan  1 19:07:44 2014
+++ loncom/cgi/listcodes.pl	Sat Jul  4 00:54:42 2026
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 $|=1;
 # Listing of domain's courses with unique six character codes
-# $Id: listcodes.pl,v 1.2 2014/01/01 19:07:44 raeburn Exp $
+# $Id: listcodes.pl,v 1.3 2026/07/04 00:54:42 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -119,7 +119,7 @@
               &mt('You will need to access this information from: [_1].',$confhome);
         return;
     }
-    my $remote_ip = $ENV{'REMOTE_ADDR'};
+    my $remote_ip =&Apache::lonnet::get_requestor_ip();
     my $allowed;
     if (&LONCAPA::lonauthcgi::check_ipbased_access('uniquecodes',$remote_ip)) {
         $allowed = 1;
Index: loncom/cgi/listdomconfig.pl
diff -u loncom/cgi/listdomconfig.pl:1.2 loncom/cgi/listdomconfig.pl:1.3
--- loncom/cgi/listdomconfig.pl:1.2	Mon Aug  1 15:19:05 2016
+++ loncom/cgi/listdomconfig.pl	Sat Jul  4 00:54:42 2026
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 $|=1;
 # Domain Configuration Dump
-# $Id: listdomconfig.pl,v 1.2 2016/08/01 15:19:05 raeburn Exp $
+# $Id: listdomconfig.pl,v 1.3 2026/07/04 00:54:42 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -86,7 +86,7 @@
 #############################################
 
 sub main {
-    my $remote_ip = $ENV{'REMOTE_ADDR'};
+    my $remote_ip =&Apache::lonnet::get_requestor_ip();
     my $allowed;
     if (&LONCAPA::lonauthcgi::check_ipbased_access('domconf',$remote_ip)) {
         $allowed = 1;
Index: loncom/cgi/takeoffline.pl
diff -u loncom/cgi/takeoffline.pl:1.8 loncom/cgi/takeoffline.pl:1.9
--- loncom/cgi/takeoffline.pl:1.8	Wed Jan 21 15:12:03 2015
+++ loncom/cgi/takeoffline.pl	Sat Jul  4 00:54:42 2026
@@ -2,7 +2,7 @@
 $|=1;
 # Take machine offline, reroute traffic
 #
-# $Id: takeoffline.pl,v 1.8 2015/01/21 15:12:03 raeburn Exp $
+# $Id: takeoffline.pl,v 1.9 2026/07/04 00:54:42 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -98,7 +98,7 @@
         }
         %{$servers{$dom}} = &Apache::lonnet::get_servers($dom);
     }
-    my $ip = $ENV{'REMOTE_ADDR'};
+    my $remote_ip =&Apache::lonnet::get_requestor_ip();
     my $lonhost = $Apache::lonnet::perlvar{'lonHostID'};
     print '<p>'.&mt("When a LON-CAPA server is 'taken offline' using this utility, the standard log-in page will be replaced with one of the following:").'</p>'.
           '<ul><li>'.&mt('A page which automatically performs a redirect to another server in your domain - the server must be specified below.').'</li>'.
Index: loncom/cgi/ping.pl
diff -u loncom/cgi/ping.pl:1.9 loncom/cgi/ping.pl:1.10
--- loncom/cgi/ping.pl:1.9	Mon Oct 17 17:23:25 2011
+++ loncom/cgi/ping.pl	Sat Jul  4 00:54:42 2026
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 # ping cgi-script
-# $Id: ping.pl,v 1.9 2011/10/17 17:23:25 raeburn Exp $
+# $Id: ping.pl,v 1.10 2026/07/04 00:54:42 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -38,7 +38,7 @@
 &main();
 
 sub main {
-    my $remote_ip = $ENV{'REMOTE_ADDR'};
+    my $remote_ip =&Apache::lonnet::get_requestor_ip();
     my $allowed;
     my @hosts = &Apache::lonnet::get_hosts_from_ip($remote_ip);
     if (@hosts > 0) {




More information about the LON-CAPA-cvs mailing list