backup: Fix deleting backup files
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 20 Sep 2018 13:21:41 +0000 (14:21 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 20 Sep 2018 13:21:41 +0000 (14:21 +0100)
Signed-off-by: Arne Fitzenreiter <arne.fitzenreiter@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
config/backup/backup.pl
config/rootfiles/core/124/filelists/files
html/cgi-bin/backup.cgi

index ce16e7f..ce89116 100644 (file)
@@ -138,11 +138,8 @@ elsif ($ARGV[0] eq 'cli') {
 elsif ($ARGV[0] eq 'addonbackup') {
   system("tar -cvzf /var/ipfire/backup/addons/backup/$ARGV[1].ipf --files-from='/var/ipfire/backup/addons/includes/$ARGV[1]'");
 }
-elsif ($ARGV[0] =~ /ipf$/ ) {
-  system("rm /var/ipfire/backup/$ARGV[0]");
-}
-elsif ($ARGV[0] =~ /iso$/ ) {
-  system("rm /var/tmp/backupiso/$ARGV[0]");
+elsif ($ARGV[0] =~ /\.(iso|ipf)$/ ) {
+  unlink("$ARGV[0]");
 }
 elsif ($ARGV[0] eq '') {
  printf "No argument given, please use <include><exclude><cli>\n"
index e3e2957..9d0d14b 100644 (file)
@@ -21,6 +21,7 @@ srv/web/ipfire/html/redirect-templates/legacy/template.html
 usr/bin/install-bootloader
 usr/local/bin/backupiso
 usr/local/bin/rebuild-initrd
+var/ipfire/backup/bin/backup.pl
 var/ipfire/backup/exclude
 var/ipfire/backup/include
 var/ipfire/langs
index 2a03627..cac4146 100644 (file)
@@ -137,8 +137,6 @@ elsif ( $cgiparams{'ACTION'} eq "delete" )
        my $file = &sanitise_file($cgiparams{'FILE'});
        exit(1) unless defined($file);
 
-       $file = &File::Basename::basename($file);
-
        system("/usr/local/bin/backupctrl $file >/dev/null 2>&1");
 }
 
@@ -266,7 +264,7 @@ print <<END
        <td align='right' width='5'>
                <form method='post' action='$ENV{'SCRIPT_NAME'}'>
                <input type='hidden' name='ACTION' value='delete' />
-               <input type='hidden' name='FILE' value='addons//backup/$_.ipf' />
+               <input type='hidden' name='FILE' value='$_.ipf' />
                <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' />
                </form>
        </td>
@@ -305,7 +303,7 @@ print <<END
        <td align='right' width='5'>
                <form method='post' action='$ENV{'SCRIPT_NAME'}'>
                <input type='hidden' name='ACTION' value='delete' />
-               <input type='hidden' name='FILE' value='addons//backup/$_.ipf' />
+               <input type='hidden' name='FILE' value='$_.ipf' />
                <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' />
                </form>
        </td>