diff --git a/sentry/edit_portsentry.cgi b/sentry/edit_portsentry.cgi
index 5aff154a9..9c7e43b1a 100755
--- a/sentry/edit_portsentry.cgi
+++ b/sentry/edit_portsentry.cgi
@@ -110,29 +110,31 @@ print "
| $text{'portsentry_trigger'} | \n";
printf " |
\n",
&find_value("SCAN_TRIGGER", $conf);
-print " | $text{'portsentry_ignore'} | \n";
-print " |
\n";
-print "\n"
- if (defined($editbelow));
print "\n";
@pids = &get_portsentry_pids();
diff --git a/sentry/save_portsentry.cgi b/sentry/save_portsentry.cgi
index f1b84bff3..8505db56d 100755
--- a/sentry/save_portsentry.cgi
+++ b/sentry/save_portsentry.cgi
@@ -43,31 +43,33 @@ $in{'trigger'} =~ /^\d+$/ || &error($text{'portsentry_etrigger'});
&save_config($conf, "SCAN_TRIGGER", $in{'trigger'});
# Save list of ignored hosts
-if ($config{'portsentry_ignore'}) {
- $ign = $config{'portsentry_ignore'};
+if (defined($in{'ignore'})) {
+ if ($config{'portsentry_ignore'}) {
+ $ign = $config{'portsentry_ignore'};
+ }
+ else {
+ $ign = &find_value("IGNORE_FILE", $conf);
+ }
+ &lock_file($ign);
+ $in{'ignore'} =~ s/\r//g;
+ $in{'ignore'} =~ s/\n*$/\n/;
+ foreach $h (split(/\s+/, $in{'ignore'})) {
+ gethostbyname($h) || &check_ipaddress($h) ||
+ ($h =~ /^([0-9\.]+)\/(\d+)/ && &check_ipaddress($1)) ||
+ &error(&text('portsentry_eignore', $h));
+ }
+ if (defined($in{'editbelow'})) {
+ open(IGNORE, $ign);
+ @below = ;
+ close(IGNORE);
+ @below = @below[$in{'editbelow'} .. $#below];
+ }
+ &open_tempfile(IGNORE, ">$ign");
+ &print_tempfile(IGNORE, $in{'ignore'});
+ &print_tempfile(IGNORE, @below);
+ &close_tempfile(IGNORE);
+ &unlock_file($ign);
}
-else {
- $ign = &find_value("IGNORE_FILE", $conf);
- }
-&lock_file($ign);
-$in{'ignore'} =~ s/\r//g;
-$in{'ignore'} =~ s/\n*$/\n/;
-foreach $h (split(/\s+/, $in{'ignore'})) {
- gethostbyname($h) || &check_ipaddress($h) ||
- ($h =~ /^([0-9\.]+)\/(\d+)/ && &check_ipaddress($1)) ||
- &error(&text('portsentry_eignore', $h));
- }
-if (defined($in{'editbelow'})) {
- open(IGNORE, $ign);
- @below = ;
- close(IGNORE);
- @below = @below[$in{'editbelow'} .. $#below];
- }
-&open_tempfile(IGNORE, ">$ign");
-&print_tempfile(IGNORE, $in{'ignore'});
-&print_tempfile(IGNORE, @below);
-&close_tempfile(IGNORE);
-&unlock_file($ign);
&flush_file_lines();
&unlock_config_files($conf);