diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl
index a5862e8d0..84aa8aaa6 100644
--- a/config/cfgroot/general-functions.pl
+++ b/config/cfgroot/general-functions.pl
@@ -103,6 +103,41 @@ sub writehash
close FILE;
}
+sub writehashpart
+{
+ # This function replaces the given hash in the original hash by keeping the old
+ # content and just replacing the new content
+
+ my $filename = $_[0];
+ my $newhash = $_[1];
+ my %oldhash;
+ my ($var, $val);
+
+ readhash("${filename}", \%oldhash);
+
+ foreach $var (keys %$newhash){
+ $oldhash{$var}=$newhash->{$var};
+ }
+
+ # write cgi vars to the file.
+ open(FILE, ">${filename}") or die "Unable to write file $filename";
+ flock FILE, 2;
+ foreach $var (keys %oldhash)
+ {
+ if ( $var eq "__CGI__"){next;}
+ $val = $oldhash{$var};
+ # Darren Critchley Jan 17, 2003 added the following because when submitting with a graphic, the x and y
+ # location of the mouse are submitted as well, this was being written to the settings file causing
+ # some serious grief! This skips the variable.x and variable.y
+ if (!($var =~ /(.x|.y)$/)) {
+ if ($val =~ / /) {
+ $val = "\'$val\'"; }
+ if (!($var =~ /^ACTION/)) {
+ print FILE "${var}=${val}\n"; }
+ }
+ }
+ close FILE;
+}
sub age
{
diff --git a/config/rootfiles/core/38/filelists/files b/config/rootfiles/core/38/filelists/files
index 4c5d019ba..aad801010 100644
--- a/config/rootfiles/core/38/filelists/files
+++ b/config/rootfiles/core/38/filelists/files
@@ -4,6 +4,7 @@ var/ipfire/header.pl
var/ipfire/menu.d/50-firewall.menu
var/ipfire/outgoing/bin/outgoingfw.pl
var/ipfire/graphs.pl
+var/ipfire/general-functions.pl
etc/modprobe.d/cfg80211
etc/modprobe.d/pcspeaker
var/ipfire/qos/bin/makeqosscripts.pl
diff --git a/html/cgi-bin/ids.cgi b/html/cgi-bin/ids.cgi
index 75514091d..dc31c4850 100644
--- a/html/cgi-bin/ids.cgi
+++ b/html/cgi-bin/ids.cgi
@@ -26,8 +26,8 @@ use File::Temp qw/ tempfile tempdir /;
use strict;
# enable only the following on debugging purpose
-use warnings;
-use CGI::Carp 'fatalsToBrowser';
+#use warnings;
+#use CGI::Carp 'fatalsToBrowser';
require '/var/ipfire/general-functions.pl';
require "${General::swroot}/lang.pl";
@@ -318,8 +318,14 @@ if ($snortsettings{'ACTION'} eq $Lang::tr{'save'} && $snortsettings{'ACTION2'} e
system('/usr/local/bin/snortctrl restart >/dev/null');
} elsif ($snortsettings{'ACTION'} eq $Lang::tr{'save'} && $snortsettings{'ACTION2'} eq "guardian" ){
+ foreach my $key (keys %snortsettings){
+ if ( $key !~ /^GUARDIAN/ ){
+ delete $snortsettings{$key};
+ }
+ }
+ &General::writehashpart("${General::swroot}/snort/settings", \%snortsettings);
open(IGNOREFILE, ">$snortsettings{'GUARDIAN_IGNOREFILE'}") or die "Unable to write guardian ignore file $snortsettings{'GUARDIAN_IGNOREFILE'}";
- print IGNOREFILE $snortsettings{'IGNOREFILE_CONTENT'};
+ print IGNOREFILE $snortsettings{'GUARDIAN_IGNOREFILE_CONTENT'};
close(IGNOREFILE);
open(GUARDIAN, ">/var/ipfire/guardian/guardian.conf") or die "Unable to write guardian conf /var/ipfire/guardian/guardian.conf";
print GUARDIAN <\n";
+# $debugCount++;
+# }
+# print " Count: $debugCount\n";
+# &Header::closebox();
+# DEBUG DEBUG
+###############
+
if ($errormessage) {
&Header::openbox('100%', 'left', $Lang::tr{'error messages'});
print "$errormessage\n";
@@ -501,11 +520,11 @@ if ( -e "/var/ipfire/guardian/guardian.conf" ) {
&Header::openbox('100%', 'LEFT', $Lang::tr{'guardian configuration'});
print <