[LON-CAPA-cvs] cvs: loncom / lond /lonnet/perl lonnet.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Thu, 29 Apr 2004 07:18:10 -0000
albertel Thu Apr 29 03:18:10 2004 EDT
Modified files:
/loncom lond
/loncom/lonnet/perl lonnet.pm
Log:
- add command in lond/lonnet.pm to remove '/uploaded/' files
Index: loncom/lond
diff -u loncom/lond:1.186 loncom/lond:1.187
--- loncom/lond:1.186 Wed Apr 7 06:02:11 2004
+++ loncom/lond Thu Apr 29 03:18:10 2004
@@ -2,7 +2,7 @@
# The LearningOnline Network
# lond "LON Daemon" Server (port "LOND" 5663)
#
-# $Id: lond,v 1.186 2004/04/07 10:02:11 foxr Exp $
+# $Id: lond,v 1.187 2004/04/29 07:18:10 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -53,7 +53,7 @@
my $status='';
my $lastlog='';
-my $VERSION='$Revision: 1.186 $'; #' stupid emacs
+my $VERSION='$Revision: 1.187 $'; #' stupid emacs
my $remoteVERSION;
my $currenthostid;
my $currentdomainid;
@@ -1868,6 +1868,37 @@
}
} else {
print $client "not_home\n";
+ }
+ } else {
+ Reply($client, "refused\n", $userinput);
+ }
+# --------------------------------------------------------- remove a user file
+ } elsif ($userinput =~ /^removeuserfile/) { # Client clear or enc.
+ if(isClient) {
+ my ($cmd,$fname)=split(/:/,$userinput);
+ my ($udom,$uname,$ufile) = ($fname =~ m|^([^/]+)/([^/]+)/(.+)$|);
+ &logthis("$udom - $uname - $ufile");
+ if ($ufile =~m|/\.\./|) {
+ # any files paths with /../ in them refuse
+ # to deal with
+ print $client "refused\n";
+ } else {
+ my $udir=propath($udom,$uname);
+ if (-e $udir) {
+ my $file=$udir.'/userfiles/'.$ufile;
+ if (-e $file) {
+ unlink($file);
+ if (-e $file) {
+ print $client "failed\n";
+ } else {
+ print $client "ok\n";
+ }
+ } else {
+ print $client "not_found\n";
+ }
+ } else {
+ print $client "not_home\n";
+ }
}
} else {
Reply($client, "refused\n", $userinput);
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.489 loncom/lonnet/perl/lonnet.pm:1.490
--- loncom/lonnet/perl/lonnet.pm:1.489 Fri Apr 23 19:01:36 2004
+++ loncom/lonnet/perl/lonnet.pm Thu Apr 29 03:18:10 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.489 2004/04/23 23:01:36 albertel Exp $
+# $Id: lonnet.pm,v 1.490 2004/04/29 07:18:10 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1336,6 +1336,12 @@
' to host '.$docuhome.': '.$fetchresult);
return '/adm/notfound.html';
}
+}
+
+sub removeuserfile {
+ my ($docuname,$docudom,$fname)=@_;
+ my $home=&homeserver($docuname,$docudom);
+ return &reply("removeuserfile:$docudom/$docuname/$fname",$home);
}
# ------------------------------------------------------------------------- Log