[LON-CAPA-cvs] cvs: loncom / lonhttpd /auth checkauthen.pm lonacc.pm publiccheck.pm /lonnet/perl lonnet.pm

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Wed, 11 Apr 2007 21:37:25 -0000


raeburn		Wed Apr 11 17:37:25 2007 EDT

  Modified files:              
    /loncom/auth	lonacc.pm publiccheck.pm checkauthen.pm 
    /loncom/lonnet/perl	lonnet.pm 
    /loncom	lonhttpd 
  Log:
  Put reg exp check for domain logo in lonnet  - &is_domainimage()
  checkauthen, publiccheck and lonacc all need this to serve images for log-in page if port 8080 is not in use.
  Other possibilities - (1) call once in checkauthen and pass along to publiccheck and lonacc in Apache notes, or (2) modify loncapa_apach.conf.
  lonhttpd to use a call to the same routine.
  
  
Index: loncom/auth/lonacc.pm
diff -u loncom/auth/lonacc.pm:1.107 loncom/auth/lonacc.pm:1.108
--- loncom/auth/lonacc.pm:1.107	Wed Jan 31 11:48:54 2007
+++ loncom/auth/lonacc.pm	Wed Apr 11 17:36:58 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Cookie Based Access Handler
 #
-# $Id: lonacc.pm,v 1.107 2007/01/31 16:48:54 albertel Exp $
+# $Id: lonacc.pm,v 1.108 2007/04/11 21:36:58 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -207,6 +207,9 @@
 sub handler {
     my $r = shift;
     my $requrl=$r->uri;
+    if (&Apache::lonnet::is_domainimage($requrl)) {
+        return OK;
+    }
     my %cookies=CGI::Cookie->parse($r->header_in('Cookie'));
     my $lonid=$cookies{'lonID'};
     my $cookie;
Index: loncom/auth/publiccheck.pm
diff -u loncom/auth/publiccheck.pm:1.13 loncom/auth/publiccheck.pm:1.14
--- loncom/auth/publiccheck.pm:1.13	Wed Jan 24 14:39:22 2007
+++ loncom/auth/publiccheck.pm	Wed Apr 11 17:36:58 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Cookie Based Access Handler
 #
-# $Id: publiccheck.pm,v 1.13 2007/01/24 19:39:22 albertel Exp $
+# $Id: publiccheck.pm,v 1.14 2007/04/11 21:36:58 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -43,6 +43,9 @@
     my $r = shift;
 
     my $requrl=$r->uri;
+    if (&Apache::lonnet::is_domainimage($requrl)) {
+        return OK;
+    }
     my %cookies=CGI::Cookie->parse($r->header_in('Cookie'));
     my $lonid=$cookies{'lonID'};
     if ($lonid) {
Index: loncom/auth/checkauthen.pm
diff -u loncom/auth/checkauthen.pm:1.10 loncom/auth/checkauthen.pm:1.11
--- loncom/auth/checkauthen.pm:1.10	Wed Nov 22 20:49:41 2006
+++ loncom/auth/checkauthen.pm	Wed Apr 11 17:36:58 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # checks for a cokkie to authenticate a user
 #
-# $Id: checkauthen.pm,v 1.10 2006/11/23 01:49:41 albertel Exp $
+# $Id: checkauthen.pm,v 1.11 2007/04/11 21:36:58 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -36,6 +36,10 @@
 sub handler {
     my ($r) = @_;
 
+    if (&Apache::lonnet::is_domainimage($r->uri)) {
+        return OK;
+    }
+
     if ($r->auth_type() ne 'LONCAPA') {
 	return DECLINED;
     }
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.867 loncom/lonnet/perl/lonnet.pm:1.868
--- loncom/lonnet/perl/lonnet.pm:1.867	Tue Apr 10 16:29:53 2007
+++ loncom/lonnet/perl/lonnet.pm	Wed Apr 11 17:37:20 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.867 2007/04/10 20:29:53 raeburn Exp $
+# $Id: lonnet.pm,v 1.868 2007/04/11 21:37:20 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -830,6 +830,16 @@
     return (\%returnhash,\@order);
 }
 
+sub is_domainimage {
+    my ($url) = @_;
+    if ($url=~m-^/+res/+($match_domain)/+\1\-domainconfig/+(img|logo|domlogo)/+-) {
+        if (&domain($1) ne '') {
+            return '1';
+        }
+    }
+    return;
+}
+
 # --------------------------------------------------- Assign a key to a student
 
 sub assign_access_key {
Index: loncom/lonhttpd
diff -u loncom/lonhttpd:1.12 loncom/lonhttpd:1.13
--- loncom/lonhttpd:1.12	Wed Apr 11 15:52:44 2007
+++ loncom/lonhttpd	Wed Apr 11 17:37:24 2007
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-# $Id: lonhttpd,v 1.12 2007/04/11 19:52:44 raeburn Exp $
+# $Id: lonhttpd,v 1.13 2007/04/11 21:37:24 raeburn Exp $
 
 $VERSION = "1.3.2 (Demonic/Linux/LON-CAPA Derivative $Revison$)";
 
@@ -357,12 +357,9 @@
 	$address=~s/\/+/\//g;
         if ($address=~/^\/(status|adm\/|res\/adm\/)/) {
             $fail = 0;
-        } elsif ($address =~ /^\/res\/([^\/]+)\/\1\-domainconfig\/(logo|domlogo|img)\/[^\/]+$/) {
-            if (&Apache::lonnet::domain($1) ne '') {
-                $fail = 0;
-            }
+        } elsif (&Apache::lonnet::is_domainimage($address)) {
+            $fail = 0;
         }
-
 #
 # because existing restriction matrix would not do precedence across rules
 #