--- loncom/lond 2004/04/29 10:35:07 1.178.2.21 +++ loncom/lond 2004/05/04 10:09:38 1.178.2.22 @@ -2,7 +2,7 @@ # The LearningOnline Network # lond "LON Daemon" Server (port "LOND" 5663) # -# $Id: lond,v 1.178.2.21 2004/04/29 10:35:07 foxr Exp $ +# $Id: lond,v 1.178.2.22 2004/05/04 10:09:38 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -53,7 +53,7 @@ my $DEBUG = 1; # Non zero to ena my $status=''; my $lastlog=''; -my $VERSION='$Revision: 1.178.2.21 $'; #' stupid emacs +my $VERSION='$Revision: 1.178.2.22 $'; #' stupid emacs my $remoteVERSION; my $currenthostid; my $currentdomainid; @@ -242,7 +242,9 @@ sub TieUserHash { # make the history log entry: - unless ($namespace =~/^nohist\_/ && (scalar @_ > 0)) { + if (($namespace =~/^nohist\_/) && (scalar @_ > 0)) { + my $args = scalar @_; + Debug(" Opening history: $namespace $args"); my $hfh = IO::File->new(">>$proname/$namespace.hist"); if($hfh) { my $now = time; @@ -788,7 +790,7 @@ sub ChangePasswordHandler { # npass - New password. my ($udom,$uname,$upass,$npass)=split(/:/,$tail); - chomp($npass); + $upass=&unescape($upass); $npass=&unescape($npass); &Debug("Trying to change password for $uname"); @@ -1028,8 +1030,8 @@ sub UpdateResourceHandler { my $userinput = "$cmd:$tail"; - my $fname=split(/:/,$tail); # This allows interactive testing - chomp($fname); # with telnet. + my $fname= $tail; # This allows interactive testing + my $ownership=ishome($fname); if ($ownership eq 'not_owner') { @@ -1190,10 +1192,8 @@ sub UnsubscribeHandler { my $client = shift; my $userinput= "$cmd:$tail"; - my ($fname) = split(/:/,$tail); # This allows for interactive testing - # e.g. manual telnet and unsub:res: - # Otherwise the \r gets in the way. - chomp($fname); + my ($fname) = $tail; + Debug("Unsubscribing $fname"); if (-e $fname) { Debug("Exists"); @@ -1852,8 +1852,7 @@ sub DumpWithRegexp { } RegisterHandler("dump", \&DumpWithRegexp, 0, 1, 0); -# Store an aitem in any resource meta data(?) or database with -# versioning? +# Store a set of key=value pairs associated with a versioned name. # # Parameters: # $cmd - Request command keyword. @@ -1919,7 +1918,9 @@ sub StoreHandler { } RegisterHandler("store", \&StoreHandler, 0, 1, 0); # -# Restore a prior version of a resource. +# Dump out all versions of a resource that has key=value pairs associated +# with it for each version. These resources are built up via the store +# command. # # Parameters: # $cmd - Command keyword. @@ -1933,6 +1934,13 @@ RegisterHandler("store", \&StoreHandler, # 1 indicating the caller should not yet exit. # Side-effects: # Writes a reply to the client. +# The reply is a string of the following shape: +# version=current&version:keys=k1:k2...&1:k1=v1&1:k2=v2... +# Where the 1 above represents version 1. +# this continues for all pairs of keys in all versions. +# +# +# # sub RestoreHandler { my $cmd = shift; @@ -2429,7 +2437,7 @@ sub TmpGetHandler { my $client = shift; my $userinput = "$cmd:$id"; - chomp($id); + $id=~s/\W/\_/g; my $store; my $execdir=$perlvar{'lonDaemons'}; @@ -2697,6 +2705,7 @@ sub ProcessRequest { my ($command, $tail) = split(/:/, $userinput, 2); chomp($command); chomp($tail); + $tail =~ s/(\r)//; # This helps people debugging with e.g. telnet. Debug("Command received: $command, encoded = $wasenc");