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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 16 Mar 2004 20:57:50 -0000


albertel		Tue Mar 16 15:57:50 2004 EDT

  Modified files:              
    /loncom	lond 
  Log:
  - The style police say "Death to leaning toothpicks!"
  - Also protect $fname in the regexp in case it has anything odd in it
  
  
Index: loncom/lond
diff -u loncom/lond:1.184 loncom/lond:1.185
--- loncom/lond:1.184	Tue Mar 16 15:48:49 2004
+++ loncom/lond	Tue Mar 16 15:57:49 2004
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # lond "LON Daemon" Server (port "LOND" 5663)
 #
-# $Id: lond,v 1.184 2004/03/16 20:48:49 raeburn Exp $
+# $Id: lond,v 1.185 2004/03/16 20:57:49 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -53,7 +53,7 @@
 my $status='';
 my $lastlog='';
 
-my $VERSION='$Revision: 1.184 $'; #' stupid emacs
+my $VERSION='$Revision: 1.185 $'; #' stupid emacs
 my $remoteVERSION;
 my $currenthostid;
 my $currentdomainid;
@@ -1828,14 +1828,14 @@
 		} elsif ($userinput =~ /^fetchuserfile/) { # Client clear or enc.
 		    if(isClient) {
 			my ($cmd,$fname)=split(/:/,$userinput);
-			my ($udom,$uname,$ufile) = ($fname =~ /^([^\/]+)\/([^\/]+)\/(.+)$/);
+			my ($udom,$uname,$ufile) = ($fname =~ m|^([^/]+)/([^/]+)/(.+)$|);
 			my $udir=propath($udom,$uname).'/userfiles';
 			unless (-e $udir) { mkdir($udir,0770); }
 			if (-e $udir) {
                             $ufile=~s/^[\.\~]+//;
                             my $path = $udir;
-                            if ($ufile =~/(.+)\/([^\/]+)$/) {
-                                my @parts=split(/\//,$1);
+                            if ($ufile =~m|(.+)/([^/]+)$|) {
+                                my @parts=split('/',$1);
                                 foreach my $part (@parts) {
                                     $path .= '/'.$part;
                                     if ((-e $path)!=1) {
@@ -1881,7 +1881,7 @@
 			if (open(ENVIN,$perlvar{'lonIDsDir'}.'/'.
 				 $session.'.id')) {
 			    while (my $line=<ENVIN>) {
-				if ($line=~ m|userfile\.$fname\=|) { $reply='ok'; }
+				if ($line=~ m|userfile\.\Q$fname\E\=|) { $reply='ok'; }
 			    }
 			    close(ENVIN);
 			    print $client $reply."\n";