public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
* [PATCH 1/2] firewall: Silence warnings if blocklist logging is not set.
@ 2023-03-07 12:17 Stefan Schantl
  2023-03-07 12:17 ` [PATCH 2/2] ipblocklist.cgi: Fix settings checkbox handling Stefan Schantl
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Schantl @ 2023-03-07 12:17 UTC (permalink / raw)
  To: development

[-- Attachment #1: Type: text/plain, Size: 725 bytes --]

Reference: #12979.

Signed-off-by: Stefan Schantl <stefan.schantl(a)ipfire.org>
---
 config/firewall/rules.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config/firewall/rules.pl b/config/firewall/rules.pl
index 1b628df16..80985ca53 100644
--- a/config/firewall/rules.pl
+++ b/config/firewall/rules.pl
@@ -761,7 +761,7 @@ sub ipblocklist () {
 			}
 
 			# Check if logging is enabled.
-			if($blocklistsettings{'LOGGING'} eq "on") {
+			if($blocklistsettings{'LOGGING'}) && ($blocklistsettings{'LOGGING'} eq "on")) {
 				# Create logging rule.
 				run("$IPTABLES -A ${blocklist}_DROP -j LOG -m limit --limit 10/second --log-prefix \"BLKLST_$blocklist \"");
 			}
-- 
2.30.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] ipblocklist.cgi: Fix settings checkbox handling
  2023-03-07 12:17 [PATCH 1/2] firewall: Silence warnings if blocklist logging is not set Stefan Schantl
@ 2023-03-07 12:17 ` Stefan Schantl
  2023-03-07 19:01   ` Adolf Belka
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Schantl @ 2023-03-07 12:17 UTC (permalink / raw)
  To: development

[-- Attachment #1: Type: text/plain, Size: 958 bytes --]

Checkboxes does not submit any values if they are not checked.
Default them to "off" in such a case.

This fixes the issue not beeing able to disable the logging.

Fixes #12979.

Signed-off-by: Stefan Schantl <stefan.schantl(a)ipfire.org>
---
 html/cgi-bin/ipblocklist.cgi | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/html/cgi-bin/ipblocklist.cgi b/html/cgi-bin/ipblocklist.cgi
index bb438129c..b79eb155f 100644
--- a/html/cgi-bin/ipblocklist.cgi
+++ b/html/cgi-bin/ipblocklist.cgi
@@ -72,6 +72,10 @@ my @blocklists = &IPblocklist::get_blocklists();
 
 # Process actions
 if ($cgiparams{'ACTION'} eq "$Lang::tr{'save'}") {
+	# Assign checkbox values, in case they are not checked.
+	$cgiparams{'ENABLE'} = "off" unless($cgiparams{'ENABLE'});
+	$cgiparams{'LOGGING'} = "off" unless($cgiparams{'LOGGING'});
+
 	# Array to store if blocklists are missing on the system
 	# and needs to be downloaded first.
 	my @missing_blocklists = ();
-- 
2.30.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] ipblocklist.cgi: Fix settings checkbox handling
  2023-03-07 12:17 ` [PATCH 2/2] ipblocklist.cgi: Fix settings checkbox handling Stefan Schantl
@ 2023-03-07 19:01   ` Adolf Belka
  0 siblings, 0 replies; 3+ messages in thread
From: Adolf Belka @ 2023-03-07 19:01 UTC (permalink / raw)
  To: development

[-- Attachment #1: Type: text/plain, Size: 1104 bytes --]

Reviewed-by: Adolf Belka <adolf.belka(a)ipfire.org>

On 07/03/2023 13:17, Stefan Schantl wrote:
> Checkboxes does not submit any values if they are not checked.
> Default them to "off" in such a case.
>
> This fixes the issue not beeing able to disable the logging.
>
> Fixes #12979.
>
> Signed-off-by: Stefan Schantl <stefan.schantl(a)ipfire.org>
> ---
> html/cgi-bin/ipblocklist.cgi | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/html/cgi-bin/ipblocklist.cgi b/html/cgi-bin/ipblocklist.cgi
> index bb438129c..b79eb155f 100644
> --- a/html/cgi-bin/ipblocklist.cgi
> +++ b/html/cgi-bin/ipblocklist.cgi
> @@ -72,6 +72,10 @@ my @blocklists = &IPblocklist::get_blocklists();
> # Process actions
> if ($cgiparams{'ACTION'} eq "$Lang::tr{'save'}") {
> + # Assign checkbox values, in case they are not checked.
> + $cgiparams{'ENABLE'} = "off" unless($cgiparams{'ENABLE'});
> + $cgiparams{'LOGGING'} = "off" unless($cgiparams{'LOGGING'});
> +
> # Array to store if blocklists are missing on the system
> # and needs to be downloaded first.
> my @missing_blocklists = ();

-- 
Sent from my laptop


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-07 19:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-07 12:17 [PATCH 1/2] firewall: Silence warnings if blocklist logging is not set Stefan Schantl
2023-03-07 12:17 ` [PATCH 2/2] ipblocklist.cgi: Fix settings checkbox handling Stefan Schantl
2023-03-07 19:01   ` Adolf Belka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox