Testing DNS Redirect code snippet

Hi Jon,

in detail, its this piece of code (optionsfw.cgi, line 72-95) which does the ‘Save and Restart’:

if ($settings{'ACTION'} eq $Lang::tr{'fw settings save and restart'}) {
if ($settings{'defpol'} ne '1'){
	$errormessage .= $Lang::tr{'new optionsfw later'};
	&General::writehash($filename, \%settings);             # Save good settings
	system("/usr/local/bin/firewallctrl");
}else{
	if ($settings{'POLICY'} ne ''){
		$fwdfwsettings{'POLICY'} = $settings{'POLICY'};
	}
	if ($settings{'POLICY1'} ne ''){
		$fwdfwsettings{'POLICY1'} = $settings{'POLICY1'};
	}
	my $MODE = $fwdfwsettings{'POLICY'};
	my $MODE1 = $fwdfwsettings{'POLICY1'};
	%fwdfwsettings = ();
	$fwdfwsettings{'POLICY'} = "$MODE";
	$fwdfwsettings{'POLICY1'} = "$MODE1";
	&General::writehash("${General::swroot}/firewall/settings", \%fwdfwsettings);
	&General::readhash("${General::swroot}/firewall/settings", \%fwdfwsettings);
	system("/usr/local/bin/firewallctrl");
	system("/etc/rc.d/init.d/firewall restart >/dev/null 2>&1 ");  # <=== THIS IS NOT WORKING!
}
&General::readhash($filename, \%settings);             # Load good settings

}

Its nearly the same as the code from line 48-70. I added just one line:

system("/etc/rc.d/init.d/firewall restart >/dev/null 2>&1 ");

This should call the firewall init script, which then starts adding the choosen iptables rules.

As I see it, its not possible to run such a script through the GUI because it has to be run with root privileges. Didn’t find a solution, yet.

Best,
Matthias