strict/warnings compliance

This commit is contained in:
Jamie Cameron
2026-08-17 21:25:44 -07:00
parent 3851c065a9
commit 1d57df4422
4 changed files with 26 additions and 11 deletions

View File

@@ -2,6 +2,9 @@
# check.cgi
# Check if the firewall is valid
use strict;
use warnings;
our (%text, %config);
require './shorewall-lib.pl';
&ui_print_header(undef, $text{'check_title'}, "");

View File

@@ -2,14 +2,18 @@
# clear.cgi
# Clear out all rules
use strict;
use warnings;
our (%config, %text, %access);
require './shorewall-lib.pl';
if ($access{'nochange'}) {
&redirect("/");
exit 0;
}
&error_setup($text{'clear_err'});
$out = &backquote_logged("$config{'shorewall'} clear 2>&1");
my $out = &backquote_logged("$config{'shorewall'} clear 2>&1");
if ($?) {
&error("<pre>$out</pre>");
}

View File

@@ -1,16 +1,19 @@
#!/usr/bin/perl
# Delete a bunch of table rows
use strict;
use warnings;
our (%in, %text);
require './shorewall-lib.pl';
&ReadParse();
&can_access($in{'table'}) || &error($text{'list_ecannot'});
$pfunc = &get_parser_func(\%in);
my $pfunc = &get_parser_func(\%in);
&error_setup($text{'delete_err'});
@d = split(/\0/, $in{'d'});
my @d = split(/\0/, $in{'d'});
scalar(@d) || &error($text{'delete_enone'});
&lock_table($in{'table'});
foreach $idx (sort { $b <=> $a } @d) {
foreach my $idx (sort { $b <=> $a } @d) {
&delete_table_row($in{'table'}, $pfunc, $idx);
}
&unlock_table($in{'table'});

View File

@@ -2,6 +2,10 @@
# index.cgi
# Display icons for the various shorewall configuration files
use strict;
use warnings;
our (%text, %config, $module_name, $shorewall_version,
$module_config_directory, @shorewall_files, %access);
require './shorewall-lib.pl';
if (!&has_command($config{'shorewall'})) {
@@ -12,9 +16,10 @@ if (!&has_command($config{'shorewall'})) {
else {
# Get the version
$shorewall_version = &get_shorewall_version(1);
&open_tempfile(VERSION, ">$module_config_directory/version");
&print_tempfile(VERSION, $shorewall_version,"\n");
&close_tempfile(VERSION);
my $fh;
&open_tempfile($fh, ">$module_config_directory/version");
&print_tempfile($fh, $shorewall_version,"\n");
&close_tempfile($fh);
&ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1, 0,
&help_search_link("shorewall", "doc", "google"),
@@ -28,10 +33,10 @@ else {
}
else {
# Just show the file icons
@files = grep { &can_access($_) } @shorewall_files;
@titles = map { $text{&clean_name($_)."_title"}."<br>($_)" } @files;
@links = map { "list.cgi?table=".$_ } @files;
@icons = map { "images/".$_.".gif" } @files;
my @files = grep { &can_access($_) } @shorewall_files;
my @titles = map { $text{&clean_name($_)."_title"}."<br>($_)" } @files;
my @links = map { "list.cgi?table=".$_ } @files;
my @icons = map { "images/".$_.".gif" } @files;
&icons_table(\@links, \@titles, \@icons, 4);
# Check if shorewall is running by looking for the 'shorewall'