[LON-CAPA-cvs] cvs: loncom /auth checkauthen.pm lonacc.pm lonauth.pm loncacc.pm lonlogout.pm lonroles.pm publiccheck.pm switchserver.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Thu, 23 Nov 2006 01:49:43 -0000
This is a MIME encoded message
--albertel1164246583
Content-Type: text/plain
albertel Wed Nov 22 20:49:43 2006 EDT
Modified files:
/loncom/auth checkauthen.pm lonacc.pm lonauth.pm loncacc.pm
lonlogout.pm lonroles.pm publiccheck.pm
switchserver.pm
Log:
- swithc to using helper cleaing functions and helper matchi re
--albertel1164246583
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20061122204943.txt"
Index: loncom/auth/checkauthen.pm
diff -u loncom/auth/checkauthen.pm:1.9 loncom/auth/checkauthen.pm:1.10
--- loncom/auth/checkauthen.pm:1.9 Tue Sep 19 14:03:02 2006
+++ loncom/auth/checkauthen.pm Wed Nov 22 20:49:41 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# checks for a cokkie to authenticate a user
#
-# $Id: checkauthen.pm,v 1.9 2006/09/19 18:03:02 albertel Exp $
+# $Id: checkauthen.pm,v 1.10 2006/11/23 01:49:41 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -61,8 +61,7 @@
my $lonid=$cookies{'lonID'};
my $handle;
if ($lonid) {
- $handle = $lonid->value;
- $handle=~s/\W//g;
+ $handle=&LONCAPA::clean_handle($lonid->value);
$handle = $r->dir_config('lonIDsDir')."/$handle.id";
} else {
$handle = $env{'user.environment'};
Index: loncom/auth/lonacc.pm
diff -u loncom/auth/lonacc.pm:1.101 loncom/auth/lonacc.pm:1.102
--- loncom/auth/lonacc.pm:1.101 Tue Sep 19 16:36:27 2006
+++ loncom/auth/lonacc.pm Wed Nov 22 20:49:41 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Cookie Based Access Handler
#
-# $Id: lonacc.pm,v 1.101 2006/09/19 20:36:27 albertel Exp $
+# $Id: lonacc.pm,v 1.102 2006/11/23 01:49:41 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -200,8 +200,7 @@
my $handle;
if ($lonid) {
- $handle=$lonid->value;
- $handle=~s/\W//g;
+ $handle=&LONCAPA::clean_handle($lonid->value);
}
my $result = &sso_login($r,$lonid,$handle);
Index: loncom/auth/lonauth.pm
diff -u loncom/auth/lonauth.pm:1.86 loncom/auth/lonauth.pm:1.87
--- loncom/auth/lonauth.pm:1.86 Thu Oct 12 14:18:01 2006
+++ loncom/auth/lonauth.pm Wed Nov 22 20:49:41 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# User Authentication Module
#
-# $Id: lonauth.pm,v 1.86 2006/10/12 18:18:01 albertel Exp $
+# $Id: lonauth.pm,v 1.87 2006/11/23 01:49:41 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -173,8 +173,7 @@
my $lonid=$cookies{'lonID'};
my $cookie;
if ($lonid) {
- my $handle=$lonid->value;
- $handle=~s/\W//g;
+ my $handle=&LONCAPA::clean_handle($lonid->value);
my $lonidsdir=$r->dir_config('lonIDsDir');
if ((-e "$lonidsdir/$handle.id") && ($handle ne '')) {
# Indeed, a valid token is found
@@ -221,9 +220,9 @@
# split user logging in and "su"-user
($form{'uname'},$form{'suname'})=split(/\:/,$form{'uname'});
- $form{'uname'} =~ s/\W//g;
- $form{'suname'} =~ s/\W//g;
- $form{'udom'} =~ s/\W//g;
+ $form{'uname'} = &LONCAPA::clean_username($form{'uname'});
+ $form{'suname'}= &LONCAPA::clean_username($form{'suname'});
+ $form{'udom'} = &LONCAPA::clean_domain( $form{'udom'});
my $role = $r->dir_config('lonRole');
my $domain = $r->dir_config('lonDefDomain');
Index: loncom/auth/loncacc.pm
diff -u loncom/auth/loncacc.pm:1.41 loncom/auth/loncacc.pm:1.42
--- loncom/auth/loncacc.pm:1.41 Thu Apr 13 15:07:33 2006
+++ loncom/auth/loncacc.pm Wed Nov 22 20:49:41 2006
@@ -2,7 +2,7 @@
# Cookie Based Access Handler for Construction Area
# (lonacc: 5/21/99,5/22,5/29,5/31 Gerd Kortemeyer)
#
-# $Id: loncacc.pm,v 1.41 2006/04/13 19:07:33 albertel Exp $
+# $Id: loncacc.pm,v 1.42 2006/11/23 01:49:41 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -69,8 +69,7 @@
my $lonid=$cookies{'lonID'};
my $cookie;
if ($lonid) {
- my $handle=$lonid->value;
- $handle=~s/\W//g;
+ my $handle=&LONCAPA::clean_handle($lonid->value);
my $lonidsdir=$r->dir_config('lonIDsDir');
if ((-e "$lonidsdir/$handle.id") && ($handle ne '')) {
Index: loncom/auth/lonlogout.pm
diff -u loncom/auth/lonlogout.pm:1.21 loncom/auth/lonlogout.pm:1.22
--- loncom/auth/lonlogout.pm:1.21 Tue Sep 5 16:16:49 2006
+++ loncom/auth/lonlogout.pm Wed Nov 22 20:49:41 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Logout Handler
#
-# $Id: lonlogout.pm,v 1.21 2006/09/05 20:16:49 albertel Exp $
+# $Id: lonlogout.pm,v 1.22 2006/11/23 01:49:41 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -49,8 +49,7 @@
}
#check if cookie still valid
- my $handle=$lonid->value;
- $handle=~s/\W//g;
+ my $handle=&LONCAPA::clean_handle($lonid->value);
my $lonidsdir=$r->dir_config('lonIDsDir');
if ((!-e "$lonidsdir/$handle.id") || ($handle eq '')) {
$r->log_reason("Cookie $handle not valid", $r->filename);
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.169 loncom/auth/lonroles.pm:1.170
--- loncom/auth/lonroles.pm:1.169 Fri Oct 20 18:05:55 2006
+++ loncom/auth/lonroles.pm Wed Nov 22 20:49:41 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# User Roles Screen
#
-# $Id: lonroles.pm,v 1.169 2006/10/20 22:05:55 albertel Exp $
+# $Id: lonroles.pm,v 1.170 2006/11/23 01:49:41 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -42,7 +42,7 @@
use Apache::lonpageflip();
use Apache::lonnavdisplay();
use GDBM_File;
-use LONCAPA;
+use LONCAPA qw(:DEFAULT :match);
sub redirect_user {
@@ -126,7 +126,7 @@
if ($numdc > 0) {
foreach my $envkey (keys %env) {
if (my ($domain,$coursenum) =
- ($envkey =~ m-^form\.cc\./(\w+)/(\w+)$-)) {
+ ($envkey =~ m-^form\.cc\./($match_domain)/($match_username)$-)) {
if ($dcroles{$domain}) {
&check_privs($domain,$coursenum,$then,$now);
}
@@ -663,7 +663,8 @@
foreach (sort(keys(%recent_roles))) {
if (defined($roletext{'user.role.'.$_})) {
$output.=$roletext{'user.role.'.$_};
- if ($_ =~ m-dc\./(\w+)/- && $dcroles{$1}) {
+ if ($_ =~ m-dc\./($match_domain)/-
+ && $dcroles{$1}) {
$output .= &allcourses_row($1,'recent');
}
} elsif ($numdc > 0) {
@@ -690,7 +691,7 @@
foreach my $which (sort {uc($a) cmp uc($b)} (keys(%sortrole))) {
if ($roleclass{$sortrole{$which}} =~ /^\Q$type\E/) {
$output.=$roletext{$sortrole{$which}};
- if ($sortrole{$which} =~ m-dc\./(\w+)/-) {
+ if ($sortrole{$which} =~ m-dc\./($match_domain)/-) {
if ($dcroles{$1}) {
$output .= &allcourses_row($1,'');
}
@@ -890,7 +891,7 @@
my $numdc = 0;
if ($env{'user.adv'}) {
foreach my $envkey (sort keys %env) {
- if ($envkey=~/^user\.role\.dc\.\/(\w+)\/$/) {
+ if ($envkey=~/^user\.role\.dc\.\/($match_domain)\/$/) {
my $dcdom = $1;
my $livedc = 1;
my ($tstart,$tend)=split(/\./,$env{$envkey});
@@ -987,7 +988,7 @@
my $advanced = $env{'user.adv'};
my $tryagain = $env{'form.tryagain'};
unless ($rolekey =~/^error\:/) {
- if ($rolekey =~ m-^user\.role.cc\./(\w+)/(\w+)$-) {
+ if ($rolekey =~ m-^user\.role.cc\./($match_domain)/($match_username)$-) {
my $tcourseid = $1.'_'.$2;
my $trolecode = 'cc./'.$1.'/'.$2;
my $twhere;
Index: loncom/auth/publiccheck.pm
diff -u loncom/auth/publiccheck.pm:1.10 loncom/auth/publiccheck.pm:1.11
--- loncom/auth/publiccheck.pm:1.10 Fri Aug 4 17:31:53 2006
+++ loncom/auth/publiccheck.pm Wed Nov 22 20:49:41 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Cookie Based Access Handler
#
-# $Id: publiccheck.pm,v 1.10 2006/08/04 21:31:53 albertel Exp $
+# $Id: publiccheck.pm,v 1.11 2006/11/23 01:49:41 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -45,8 +45,7 @@
my %cookies=CGI::Cookie->parse($r->header_in('Cookie'));
my $lonid=$cookies{'lonID'};
if ($lonid) {
- my $handle=$lonid->value;
- $handle=~s/\W//g;
+ my $handle=&LONCAPA::clean_handle($lonid->value);
my $lonidsdir=$r->dir_config('lonIDsDir');
if ((-e "$lonidsdir/$handle.id") && ($handle ne '')) {
&Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle);
Index: loncom/auth/switchserver.pm
diff -u loncom/auth/switchserver.pm:1.9 loncom/auth/switchserver.pm:1.10
--- loncom/auth/switchserver.pm:1.9 Wed Aug 30 12:13:37 2006
+++ loncom/auth/switchserver.pm Wed Nov 22 20:49:41 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Switch Servers Handler
#
-# $Id: switchserver.pm,v 1.9 2006/08/30 16:13:37 albertel Exp $
+# $Id: switchserver.pm,v 1.10 2006/11/23 01:49:41 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -47,8 +47,7 @@
my $cookie;
if (!$lonid) { return undef; }
- my $handle=$lonid->value;
- $handle=~s/\W//g;
+ my $handle=&LONCAPA::clean_handle($lonid->value);
my $lonidsdir=$r->dir_config('lonIDsDir');
if ((!-e "$lonidsdir/$handle.id") || ($handle eq '')) {
$r->log_reason("Cookie $handle not valid", $r->filename);
--albertel1164246583--