From: pcanterino <> Date: Thu, 22 Jul 2004 10:50:16 +0000 (+0000) Subject: Do not allow removing or renaming the root directory X-Git-Tag: version_2_0~8 X-Git-Url: https://git.p6c8.net/devedit.git/commitdiff_plain/7ccfda558e4118708d93bde4098fc1552b03a545?hp=d15b21ba0206652d4076dd94d3f68fcf4832fd7a Do not allow removing or renaming the root directory --- diff --git a/errors.dat b/errors.dat index 4a703a5..f867df8 100644 --- a/errors.dat +++ b/errors.dat @@ -24,5 +24,7 @@ lock_failed = Locking of '{USELIST}' failed. Try it again in a moment. If the not_exist = File/directory does not exist. dir_not_exist = The directory where you want to create this file or directory doesn't exist. file_too_large = The file you want to view or edit is too large (max. {SIZE} Bytes). +remove_root = You are not allowed to remove the root directory. +rename_root = You are not allowed to move/rename the root directory. # End of configuration file \ No newline at end of file diff --git a/modules/Command.pm b/modules/Command.pm index 0ae3416..d0070c4 100644 --- a/modules/Command.pm +++ b/modules/Command.pm @@ -6,7 +6,7 @@ package Command; # Execute Dev-Editor's commands # # Author: Patrick Canterino -# Last modified: 2004-07-20 +# Last modified: 2004-07-22 # use strict; @@ -590,6 +590,7 @@ sub exec_rename($$) my $virtual = $data->{'virtual'}; my $new_physical = $data->{'new_physical'}; + return error($config->{'errors'}->{'rename_root'},"/") if($virtual eq "/"); return error($config->{'errors'}->{'in_use'},upper_path($virtual),{FILE => $virtual}) if($data->{'uselist'}->in_use($virtual)); if($new_physical) @@ -663,6 +664,8 @@ sub exec_remove($$) my $physical = $data->{'physical'}; my $virtual = $data->{'virtual'}; + return error($config->{'errors'}->{'remove_root'},"/") if($virtual eq "/"); + if(-d $physical) { # Remove a directory