--- loncom/lond 2003/12/22 11:03:37 1.166 +++ loncom/lond 2003/12/22 11:29:58 1.167 @@ -2,7 +2,7 @@ # The LearningOnline Network # lond "LON Daemon" Server (port "LOND" 5663) # -# $Id: lond,v 1.166 2003/12/22 11:03:37 foxr Exp $ +# $Id: lond,v 1.167 2003/12/22 11:29:58 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -10,7 +10,7 @@ # # LON-CAPA is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # LON-CAPA is distributed in the hope that it will be useful, @@ -52,7 +52,7 @@ my $DEBUG = 0; # Non zero to ena my $status=''; my $lastlog=''; -my $VERSION='$Revision: 1.166 $'; #' stupid emacs +my $VERSION='$Revision: 1.167 $'; #' stupid emacs my $remoteVERSION; my $currenthostid; my $currentdomainid; @@ -476,7 +476,36 @@ sub ReinitProcess { } return 'ok'; } +# +# Called to edit a file +# Parameters: +# request - The entire command/request sent by lonc or lonManage +# Return: +# The reply to send to the client. +sub EditFile { + my $request = shift; + + # Split the command into it's pieces: edit:filetype:script + + my ($request, $filetype, $script) = split(":", $request); + + # Check the pre-coditions for success: + + if($request != "edit") { # Something is amiss afoot alack. + return "error:edit request detected, but request != 'edit'\n"; + } + if( ($filetype ne "hosts") && + ($filetype ne "domain")) { + return "error:edit requested with invalid file specifier: $filetype \n"; + } + + # Split the edit script and check it's validity. + # Execute the edit operation. + + + return "ok\n"; +} # # Convert an error return code from lcpasswd to a string value. # @@ -1237,7 +1266,7 @@ sub make_new_child { my($command, $filetype, $script) = split(/:/, $userinput); if (($filetype eq "hosts") || ($filetype eq "domain")) { if($script ne "") { - Reply($client,"ok\n",$userinput); # DEBUG: Call EditFile here. + Reply($client, EditFile($userinput)); } else { Reply($client,"refused\n",$userinput); }