]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
BUG 11318: Fix deletion of temporary files from IPTables-GUI
authorMatthias Fischer <matthias.fischer@ipfire.org>
Sun, 16 Apr 2017 21:01:33 +0000 (23:01 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 18 Apr 2017 10:22:18 +0000 (11:22 +0100)
For details see:
https://bugzilla.ipfire.org/show_bug.cgi?id=11318

Temporary files for 'iptables', 'iptablesmangle' and 'iptablesnat' created by
'iptables.cgi' were not deleted after use but stayed in '/srv/weg/ipfire/html/'.

As a workaround I changed 'getipstat.c' to create these files in '/var/tmp' and the
"open (file..." and "rm" commands in 'iptables.cgi'.

Works here.

Best,
Matthias

Signed-off-by: Matthias Fischer <matthias.fischer@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
html/cgi-bin/iptables.cgi
src/misc-progs/getipstat.c

index 30fce272152e0e041d515344d9ec6ac1605b3df0..b52d74fcfbac81006efa0e33fc4642e91abd39a6 100644 (file)
@@ -88,7 +88,7 @@ END
 # start with an Chain the the name, start- and endline of the
 # chain is extracted into a hash
 
-       open (FILE, '/srv/web/ipfire/html/iptables.txt');
+       open (FILE, '/var/tmp/iptables.txt');
        while (<FILE>){
 
                $iplines[$lines] = $_;
@@ -210,7 +210,7 @@ END
 # start with an Chain the the name, start- and endline of the
 # chain is extracted into a hash
 
-       open (FILE, '/srv/web/ipfire/html/iptablesmangle.txt');
+       open (FILE, '/var/tmp/iptablesmangle.txt');
        while (<FILE>){
 
                $ipmlines[$manlines] = $_;
@@ -337,7 +337,7 @@ END
 # start with an Chain the the name, start- and endline of the
 # chain is extracted into a hash
 
-       open (FILE, '/srv/web/ipfire/html/iptablesnat.txt');
+       open (FILE, '/var/tmp/iptablesnat.txt');
        while (<FILE>){
 
                $ipnatlines[$natlines] = $_;
@@ -434,6 +434,6 @@ print "</table></div><br />";
 &Header::closebigbox();
 &Header::closepage();
 
-system(rm -f "/srv/web/ipfire/html/iptables.txt");
-system(rm -f "/srv/web/ipfire/html/iptablesmangle.txt");
-system(rm -f "/srv/web/ipfire/html/iptablesnat.txt");
+system("rm -f /var/tmp/iptables.txt");
+system("rm -f /var/tmp/iptablesmangle.txt");
+system("rm -f /var/tmp/iptablesnat.txt");
index 38701686e8743ec841e54f58ec8cc25b293eb0b4..c806d54a9b0145aa2f0a11c848bc158f6e70a481 100644 (file)
@@ -3,7 +3,7 @@
  * Get the list from IPTABLES -L
  * 
  */
-         
+
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
@@ -17,11 +17,11 @@ int main(void)
 {
        if (!(initsetuid()))
                exit(1);
-       
-       safe_system("/sbin/iptables -L -v -n > /srv/web/ipfire/html/iptables.txt");
-       safe_system("/sbin/iptables -L -v -n -t nat > /srv/web/ipfire/html/iptablesnat.txt");
-       safe_system("/sbin/iptables -t mangle -L -v -n > /srv/web/ipfire/html/iptablesmangle.txt");
-       safe_system("chown nobody.nobody /srv/web/ipfire/html/iptables.txt /srv/web/ipfire/html/iptablesnat.txt /srv/web/ipfire/html/iptablesmangle.txt");
+
+       safe_system("/sbin/iptables -L -v -n > /var/tmp/iptables.txt");
+       safe_system("/sbin/iptables -L -v -n -t nat > /var/tmp/iptablesnat.txt");
+       safe_system("/sbin/iptables -t mangle -L -v -n > /var/tmp/iptablesmangle.txt");
+       safe_system("chown nobody.nobody /var/tmp/iptables.txt /var/tmp/iptablesnat.txt /var/tmp/iptablesmangle.txt");
        
        return 0;
 }