Diff for /loncom/lond between versions 1.234 and 1.236

version 1.234, 2004/08/23 11:24:45 version 1.236, 2004/08/24 06:43:21
Line 1860  sub remove_user_file_handler { Line 1860  sub remove_user_file_handler {
 }  }
 &register_handler("removeuserfile", \&remove_user_file_handler, 0,1,0);  &register_handler("removeuserfile", \&remove_user_file_handler, 0,1,0);
   
   #
   #   make a directory in a user's home directory userfiles subdirectory.
   # Parameters:
   #    cmd   - the Lond request keyword that got us here.
   #    tail  - the part of the command past the keyword.
   #    client- File descriptor connected with the client.
   #
   # Returns:
   #    1    - Continue processing.
   
   sub mkdir_user_file_handler {
       my ($cmd, $tail, $client) = @_;
   
       my ($dir) = split(/:/, $tail); # Get rid of any tailing :'s lonc may have sent.
       $dir=&unescape($dir);
       my ($udom,$uname,$ufile) = ($dir =~ m|^([^/]+)/([^/]+)/(.+)$|);
       if ($ufile =~m|/\.\./|) {
    # any files paths with /../ in them refuse 
    # to deal with
    &Failure($client, "refused\n", "$cmd:$tail");
       } else {
    my $udir = &propath($udom,$uname);
    if (-e $udir) {
       my $newdir=$udir.'/userfiles/'.$ufile;
       if (!-e $newdir) {
    mkdir($newdir);
    if (!-e $newdir) {
       &Failure($client, "failed\n", "$cmd:$tail");
    } else {
       &Reply($client, "ok\n", "$cmd:$tail");
    }
       } else {
    &Failure($client, "not_found\n", "$cmd:$tail");
       }
    } else {
       &Failure($client, "not_home\n", "$cmd:$tail");
    }
       }
       return 1;
   }
   &register_handler("mkdiruserfile", \&mkdir_user_file_handler, 0,1,0);
   
   
 #  #
 #  Authenticate access to a user file by checking the user's   #  Authenticate access to a user file by checking the user's 
Line 3225  sub process_request { Line 3267  sub process_request {
     Reply($client, "refused\n", $userinput);      Reply($client, "refused\n", $userinput);
           
  }   }
 # ----------------------------------------- portfolio directory list (portls)  
     } elsif ($userinput =~ /^portls/) {  
  if(isClient) {  
     my ($cmd,$uname,$udom)=split(/:/,$userinput);  
     my $udir=propath($udom,$uname).'/userfiles/portfolio';  
     my $dirLine='';  
     my $dirContents='';  
     if (opendir(LSDIR,$udir.'/')){  
  while ($dirLine = readdir(LSDIR)){  
     $dirContents = $dirContents.$dirLine.'<br />';  
  }  
     } else {  
  $dirContents = "No directory found\n";  
     }  
     print $client $dirContents."\n";  
  } else {  
     Reply($client, "refused\n", $userinput);  
  }  
 # -------------------------------------------------------------------------- ls  # -------------------------------------------------------------------------- ls
     } elsif ($userinput =~ /^ls/) {      } elsif ($userinput =~ /^ls/) {
  if(isClient) {   if(isClient) {

Removed from v.1.234  
changed lines
  Added in v.1.236


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>