Bug 11318

Summary: Temporary textfiles for 'iptables', 'iptablesmangle' and iptablesnat' are not deleted after use.
Product: IPFire Reporter: Matthias Fischer <matthias.fischer>
Component: iptablesAssignee: Assigned to nobody - feel free to grab it and work on it <nobody>
Status: CLOSED FIXED QA Contact:
Severity: Minor Usability    
Priority: - Unknown - CC: matthias.fischer
Version: 2   
Hardware: all   
OS: Linux   

Description Matthias Fischer 2017-04-16 00:50:50 UTC
Hi,

when opening 'iptables.cgi', three text files are created through '/usr/local/bin/getipstat' in directory '/srv/web/ipfire/html'.

These are 'iptables.txt', 'iptablesmangle.txt' and 'iptablesnat.txt', see line 47 in '/srv/web/ipfire/cgi-bin/iptables'.

After closing 'iptables.cgi', these three files are not needed anymore and should be deleted by the last three lines (437-439) in 'iptables,cgi':

...
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");
...

This doesn't work, files stay where they are, nothing happens.

Changing the code to:

...
unlink("/srv/web/ipfire/html/iptables.txt");
unlink("/srv/web/ipfire/html/iptablesmangle.txt");
unlink("/srv/web/ipfire/html/iptablesnat.txt");
...

had no effect, either - '/var/log/httpd/error_log' says:

...
cannot unlink '/srv/web/ipfire/html/...
: Permission denied, referer: https:...
...

Same things seem to happen in '/srv/web/ipfire/cgi-bin/guardian.cgi', line 986 and line 1022-1024.

Best,
Matthias