[LON-CAPA-cvs] cvs: loncom / lonhttpd

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Wed, 11 Apr 2007 19:52:45 -0000


raeburn		Wed Apr 11 15:52:45 2007 EDT

  Modified files:              
    /loncom	lonhttpd 
  Log:
  Check the domainconfig user is in a recognized domain.
  Not exactly lightweight since it pulls in the entirety of Apache::lonnet.
  
  
Index: loncom/lonhttpd
diff -u loncom/lonhttpd:1.11 loncom/lonhttpd:1.12
--- loncom/lonhttpd:1.11	Tue Apr 10 16:08:01 2007
+++ loncom/lonhttpd	Wed Apr 11 15:52:44 2007
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-# $Id: lonhttpd,v 1.11 2007/04/10 20:08:01 raeburn Exp $
+# $Id: lonhttpd,v 1.12 2007/04/11 19:52:44 raeburn Exp $
 
 $VERSION = "1.3.2 (Demonic/Linux/LON-CAPA Derivative $Revison$)";
 
@@ -12,6 +12,7 @@
 
 use lib '/home/httpd/lib/perl/';
 use LONCAPA::Configuration();
+use Apache::lonnet;
 %loncapavar=%{&LONCAPA::Configuration::read_conf('loncapa.conf')};
 $port_to_use=$loncapavar{'lonhttpdPort'};
 if (!defined($port_to_use)) {
@@ -356,13 +357,10 @@
 	$address=~s/\/+/\//g;
         if ($address=~/^\/(status|adm\/|res\/adm\/)/) {
             $fail = 0;
-        } elsif ($address =~ /^\/res\/([^\/]+)\/([^\/]+)\-domainconfig\/(logo|domlogo|img)\/[^\/]+$/) {
-#            FIXME - should check $1 is a real domain here - need a lightweight
-#                    domain checker.
-#            @alldomains = &Apache::lonnet::get_domains();
-#            if (grep(/^\Q$1\E$/,@alldomains)) {
+        } elsif ($address =~ /^\/res\/([^\/]+)\/\1\-domainconfig\/(logo|domlogo|img)\/[^\/]+$/) {
+            if (&Apache::lonnet::domain($1) ne '') {
                 $fail = 0;
-#            }
+            }
         }
 
 #