Diff for /loncom/cgi/ping.pl between versions 1.7 and 1.9

version 1.7, 2008/11/28 20:50:25 version 1.9, 2011/10/17 17:23:25
Line 31  $|=1; Line 31  $|=1;
 use lib '/home/httpd/lib/perl/';  use lib '/home/httpd/lib/perl/';
 use Apache::lonnet;  use Apache::lonnet;
 use LONCAPA::loncgi;  use LONCAPA::loncgi;
   use LONCAPA::lonauthcgi;
   
 print("Content-type: text/plain\n\n");  print("Content-type: text/plain\n\n");
   
 &main();  &main();
   
 sub main {  sub main {
     if (!&LONCAPA::loncgi::check_ipbased_access('ping')) {      my $remote_ip = $ENV{'REMOTE_ADDR'};
         if (!&LONCAPA::loncgi::check_cookie_and_load_env()) {      my $allowed;
             return;      my @hosts = &Apache::lonnet::get_hosts_from_ip($remote_ip);
       if (@hosts > 0) {
           $allowed = 1;
       } elsif (&LONCAPA::lonauthcgi::check_ipbased_access('ping',$remote_ip)) {
           $allowed = 1;
       } elsif (&LONCAPA::loncgi::check_cookie_and_load_env()) {
           if (&LONCAPA::lonauthcgi::can_view('ping')) {
               $allowed = 1;
         }          }
       }
         if (!&LONCAPA::loncgi::can_view('ping')) {      if ($allowed) {
             return;          my $testhost=$ENV{'QUERY_STRING'};
           $testhost=~s/\W//g;
           if (&Apache::lonnet::hostname($testhost) ne '') {
               print &Apache::lonnet::reply('ping',$testhost)."\n";
           } else {
               print 'unknown_host';
         }          }
       } else {
           print 'forbidden';
     }      }
   
     my $testhost=$ENV{'QUERY_STRING'};  
     $testhost=~s/\W//g;  
   
     print &Apache::lonnet::reply('ping',$testhost)."\n";  
     return;      return;
 }  }

Removed from v.1.7  
changed lines
  Added in v.1.9


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>