mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-05-02 16:22:55 +02:00
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>
29 lines
622 B
C
29 lines
622 B
C
/* IPFire helper program - IPStat
|
|
*
|
|
* Get the list from IPTABLES -L
|
|
*
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <unistd.h>
|
|
#include <stdlib.h>
|
|
#include <sys/types.h>
|
|
#include <fcntl.h>
|
|
#include "setuid.h"
|
|
|
|
|
|
int main(void)
|
|
{
|
|
if (!(initsetuid()))
|
|
exit(1);
|
|
|
|
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;
|
|
}
|
|
|