mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 06:03:28 +00:00
Disallow non-level-0 backups and /etc/dumpdates for non-filesystem roots
This commit is contained in:
@@ -34,3 +34,4 @@ Fixed remote tar backups via FTP on OSX.
|
||||
Files and directories to exclude can be specified for TAR format backups on Linux.
|
||||
---- Changes since 1.410 ----
|
||||
Added checkboxes to control if failure of the pre and post-backup commands cause the whole job to be regarded as a failure.
|
||||
Prevent non-level-0 backups and updating of the /etc/dumpdates file for backups of directories that are not filesystem mount points, as this isn't supported by the <tt>dump</tt> command.
|
||||
|
||||
@@ -68,8 +68,8 @@ unlink("$module_config_directory/$_[0]->{'id'}.dump");
|
||||
sub directory_filesystem
|
||||
{
|
||||
local $fs;
|
||||
foreach $m (sort { length($a->[0]) <=> length($b->[0]) }
|
||||
&foreign_call("mount", "list_mounted")) {
|
||||
foreach my $m (sort { length($a->[0]) <=> length($b->[0]) }
|
||||
&mount::list_mounted()) {
|
||||
local $l = length($m->[0]);
|
||||
if ($m->[0] eq $_[0] || $m->[0] eq "/" ||
|
||||
(length($_[0]) >= $l && substr($_[0], 0, $l+1) eq $m->[0]."/")) {
|
||||
@@ -79,6 +79,17 @@ foreach $m (sort { length($a->[0]) <=> length($b->[0]) }
|
||||
return wantarray ? @$fs : $fs->[2];
|
||||
}
|
||||
|
||||
# is_mount_point(dir)
|
||||
# Returns 1 if some directory is a filesystem mount point
|
||||
sub is_mount_point
|
||||
{
|
||||
local ($dir) = @_;
|
||||
foreach my $m (&mount::list_mounted()) {
|
||||
return 1 if ($m->[0] eq $dir);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
# same_filesystem(fs1, fs2)
|
||||
# Returns 1 if type filesystem types are the same
|
||||
sub same_filesystem
|
||||
|
||||
@@ -5,5 +5,8 @@ is chosen, every file under the directory to backup will be saved. Otherwise,
|
||||
only files that are new or modified since the last dump of a lower level will
|
||||
be written. <p>
|
||||
|
||||
When backing up a directory that is not a filesystem mount point, the only
|
||||
level that can be selected in 0. <p>
|
||||
|
||||
<hr>
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<header>Update /etc/dumpdates file?</header>
|
||||
|
||||
When this option is enabled, the date, time, source and destination of the backup
|
||||
will be recorded in human-readable form in <tt>/etc/dumpdates</tt>. <p>
|
||||
This option can only be enabled when backing up an entire filesystem. When enabled, the source filesystem device name, level, date and time of the backup will be recorded in human-readable form in <tt>/etc/dumpdates</tt>. There may be only one entry per filesystem at each level. This option is useful when using the <tt>dump -W</tt> command-line option to display the most recent dump date and level of each filesystem.<p>
|
||||
|
||||
<hr>
|
||||
|
||||
|
||||
@@ -166,11 +166,7 @@ else {
|
||||
|
||||
if ($_[0]->{'fs'} eq 'xfs') {
|
||||
# Parse xfs options
|
||||
local $mp;
|
||||
foreach $m (&foreign_call("mount", "list_mounted")) {
|
||||
$mp++ if ($m->[0] eq $in{'dir'});
|
||||
}
|
||||
$mp || &error($text{'dump_emp'});
|
||||
&is_mount_point($in{'dir'}) || &error($text{'dump_emp'});
|
||||
$in{'label'} =~ /^\S*$/ && length($in{'label'}) < 256 ||
|
||||
&error($text{'dump_elabel2'});
|
||||
$_[0]->{'label'} = $in{'label'};
|
||||
|
||||
@@ -33,7 +33,7 @@ dump_dest=Backup to
|
||||
dump_file=File or tape device
|
||||
dump_host=Host $1 as user $2 in file or device $3
|
||||
dump_level=Dump level
|
||||
dump_level_0=(Full backup)
|
||||
dump_level_0=0 (Full backup)
|
||||
dump_label=Backup label
|
||||
dump_multi=Split across multiple files?
|
||||
dump_update=Update <tt>/etc/dumpdates</tt> file?
|
||||
@@ -102,6 +102,8 @@ dump_ermt=Missing or invalid path to <tt>rmt</tt> program
|
||||
dump_reverify=Attempt test restore after backup to verify?
|
||||
dump_remount=Remount with <tt>noatime</tt> option during backup?
|
||||
dump_eftpupdate=Adding files to an existing archive is not possible when using FTP.
|
||||
dump_eleveldir=Only level 0 backups are allowed for directories that are not filesystem mount points
|
||||
dump_eupdatedir=The <tt>/etc/dumpdates</tt> file can only be updated for directories that are filesystem mount points
|
||||
|
||||
edit_err=Failed to create backup
|
||||
edit_edir=Missing backup directory
|
||||
|
||||
@@ -259,11 +259,7 @@ if ($_[0]->{'fs'} eq 'tar') {
|
||||
}
|
||||
elsif ($_[0]->{'fs'} eq 'xfs') {
|
||||
# Parse xfs options
|
||||
local $mp;
|
||||
foreach $m (&foreign_call("mount", "list_mounted")) {
|
||||
$mp++ if ($m->[0] eq $in{'dir'});
|
||||
}
|
||||
$mp || &error($text{'dump_emp'});
|
||||
&is_mount_point($in{'dir'}) || &error($text{'dump_emp'});
|
||||
$in{'label'} =~ /^\S*$/ && length($in{'label'}) < 256 ||
|
||||
&error($text{'dump_elabel2'});
|
||||
$_[0]->{'label'} = $in{'label'};
|
||||
@@ -289,11 +285,17 @@ elsif ($_[0]->{'fs'} eq 'xfs') {
|
||||
}
|
||||
}
|
||||
else {
|
||||
# Parse ext2/3 options
|
||||
# Parse ext2/3 dump options
|
||||
$_[0]->{'rsh'} = &rsh_command_parse("rsh_def", "rsh");
|
||||
$_[0]->{'pass'} = $in{'pass'};
|
||||
if ($in{'update'}) {
|
||||
&is_mount_point($in{'dir'}) || &error($text{'dump_eupdatedir'});
|
||||
}
|
||||
$_[0]->{'update'} = $in{'update'};
|
||||
$_[0]->{'multi'} = $in{'multi'};
|
||||
if ($in{'level'} > 0) {
|
||||
&is_mount_point($in{'dir'}) || &error($text{'dump_eleveldir'});
|
||||
}
|
||||
$_[0]->{'level'} = $in{'level'};
|
||||
$in{'label'} =~ /^\S*$/ && length($in{'label'}) < 16 ||
|
||||
&error($text{'dump_elabel'});
|
||||
|
||||
Reference in New Issue
Block a user