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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Tue, 10 Apr 2007 20:32:13 -0000


raeburn		Tue Apr 10 16:32:13 2007 EDT

  Modified files:              
    /loncom	lchtmldir 
  Log:
  Allow users with usernames including . and - to have public_html directories, when given an author role.  
  
  
Index: loncom/lchtmldir
diff -u loncom/lchtmldir:1.17 loncom/lchtmldir:1.18
--- loncom/lchtmldir:1.17	Tue Jun 21 07:00:21 2005
+++ loncom/lchtmldir	Tue Apr 10 16:32:13 2007
@@ -70,6 +70,8 @@
 use Fcntl qw(:mode);
 use DirHandle;
 use POSIX;
+use lib '/home/httpd/lib/perl/';
+use LONCAPA qw(:match);
 
 $ENV{'PATH'} = '/bin:/usr/bin:/usr/local/sbin:/home/httpd/perl';
 delete @ENV{qw{IFS CDPATH ENV BASH_ENV}};
@@ -132,7 +134,7 @@
 
 # Untaint the username.
 
-my $match = $username =~ /^(\w+)$/;
+my $match = $username =~ /^($match_username)$/;
 my $patt  = $1;
  
 if($DEBUG) {
@@ -144,7 +146,7 @@
 if($DEBUG) {
     print("Save username = $safeuser \n");
 }
-if(($username ne $safeuser) or ($safeuser!~/^[A-z]/)) {
+if($username ne $safeuser) {
     if($DEBUG) {
 	print("User name $username had illegal characters\n");
     }
@@ -154,7 +156,7 @@
 #untaint the base directory require that the dir contain only 
 # alphas, / numbers or underscores, and end in /$safeuser
 
-$dir =~ /(^([\w\/]+))/;
+$dir =~ /(^([\w\/\.\-]+))/;
 
 my $dirtry1 = $1;