--- loncom/lond 2004/08/27 18:34:31 1.243 +++ loncom/lond 2004/08/29 04:12:18 1.245 @@ -2,7 +2,7 @@ # The LearningOnline Network # lond "LON Daemon" Server (port "LOND" 5663) # -# $Id: lond,v 1.243 2004/08/27 18:34:31 banghart Exp $ +# $Id: lond,v 1.245 2004/08/29 04:12:18 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -57,7 +57,7 @@ my $DEBUG = 0; # Non zero to ena my $status=''; my $lastlog=''; -my $VERSION='$Revision: 1.243 $'; #' stupid emacs +my $VERSION='$Revision: 1.245 $'; #' stupid emacs my $remoteVERSION; my $currenthostid="default"; my $currentdomainid; @@ -1299,20 +1299,21 @@ sub push_file_handler { # Side Effects: # The reply is written to $client. # + sub du_handler { my ($cmd, $ududir, $client) = @_; - my $userinput = "$cmd:$ududir"; - my $obs; - my $rights; - my $uduout=''; - my $udufn; - print $client "from lond not yet\n"; + if ($ududir=~/\.\./ || $ududir!~m|^/home/httpd/|) { + &Failure($client,"refused\n","$cmd:$ududir"); + return 1; + } + my $duout = `du -ks $ududir 2>/dev/null`; + $duout=~s/[^\d]//g; #preserve only the numbers + &Reply($client,"$duout\n","$cmd:$ududir"); return 1; } ®ister_handler("du", \&du_handler, 0, 1, 0); - # # ls - list the contents of a directory. For each file in the # selected directory the filename followed by the full output of