Fix function name to avoid clashes

This commit is contained in:
Jamie Cameron
2018-01-15 18:18:13 -08:00
parent d630fe85c3
commit dbfb2a386e
9 changed files with 24 additions and 24 deletions

View File

@ -12,7 +12,7 @@ our (%in, %text, %config);
my @d = split(/\0/, $in{'d'}); my @d = split(/\0/, $in{'d'});
@d || &error($text{'actions_enone'}); @d || &error($text{'actions_enone'});
my @actions = &list_actions(); my @actions = &list_actions();
&lock_all_files(); &lock_all_config_files();
foreach my $file (@d) { foreach my $file (@d) {
my ($action) = grep { $_->[0]->{'file'} eq $file } @actions; my ($action) = grep { $_->[0]->{'file'} eq $file } @actions;
next if (!$action); next if (!$action);
@ -24,7 +24,7 @@ foreach my $file (@d) {
join(" ", map { $_->{'name'} } @users))); join(" ", map { $_->{'name'} } @users)));
&delete_section($file, $def); &delete_section($file, $def);
} }
&unlock_all_files(); &unlock_all_config_files();
&webmin_log("delete", "actions", scalar(@d)); &webmin_log("delete", "actions", scalar(@d));
&redirect("list_actions.cgi"); &redirect("list_actions.cgi");

View File

@ -12,7 +12,7 @@ our (%in, %text, %config);
my @d = split(/\0/, $in{'d'}); my @d = split(/\0/, $in{'d'});
@d || &error($text{'filters_enone'}); @d || &error($text{'filters_enone'});
my @filters = &list_filters(); my @filters = &list_filters();
&lock_all_files(); &lock_all_config_files();
foreach my $file (@d) { foreach my $file (@d) {
my ($filter) = grep { $_->[0]->{'file'} eq $file } @filters; my ($filter) = grep { $_->[0]->{'file'} eq $file } @filters;
next if (!$filter); next if (!$filter);
@ -24,7 +24,7 @@ foreach my $file (@d) {
join(" ", map { $_->{'name'} } @users))); join(" ", map { $_->{'name'} } @users)));
&delete_section($file, $def); &delete_section($file, $def);
} }
&unlock_all_files(); &unlock_all_config_files();
&webmin_log("delete", "filters", scalar(@d)); &webmin_log("delete", "filters", scalar(@d));
&redirect("list_filters.cgi"); &redirect("list_filters.cgi");

View File

@ -12,13 +12,13 @@ our (%in, %text, %config);
my @d = split(/\0/, $in{'d'}); my @d = split(/\0/, $in{'d'});
@d || &error($text{'jails_enone'}); @d || &error($text{'jails_enone'});
my @jails = &list_jails(); my @jails = &list_jails();
&lock_all_files(); &lock_all_config_files();
foreach my $name (@d) { foreach my $name (@d) {
my ($jail) = grep { $_->{'name'} eq $name } @jails; my ($jail) = grep { $_->{'name'} eq $name } @jails;
next if (!$jail); next if (!$jail);
&delete_section($jail->{'file'}, $jail); &delete_section($jail->{'file'}, $jail);
} }
&unlock_all_files(); &unlock_all_config_files();
&webmin_log("delete", "jails", scalar(@d)); &webmin_log("delete", "jails", scalar(@d));
&redirect("list_jails.cgi"); &redirect("list_jails.cgi");

View File

@ -492,7 +492,7 @@ push(@rv, "$config{'config_dir'}/jail.local");
return grep { -r $_ } @rv; return grep { -r $_ } @rv;
} }
sub lock_all_files sub lock_all_config_files
{ {
@all_files_for_lock = &list_all_config_files(); @all_files_for_lock = &list_all_config_files();
foreach my $f (@all_files_for_lock) { foreach my $f (@all_files_for_lock) {
@ -500,7 +500,7 @@ foreach my $f (@all_files_for_lock) {
} }
} }
sub unlock_all_files sub unlock_all_config_files
{ {
foreach my $f (reverse(@all_files_for_lock)) { foreach my $f (reverse(@all_files_for_lock)) {
&unlock_file($f); &unlock_file($f);

View File

@ -29,9 +29,9 @@ if ($in{'delete'}) {
my @users = &find_jail_by_action($action); my @users = &find_jail_by_action($action);
@users && &error(&text('action_einuse', @users && &error(&text('action_einuse',
join(" ", map { $_->{'name'} } @users))); join(" ", map { $_->{'name'} } @users)));
&lock_all_files(); &lock_all_config_files();
&delete_section($file, $def); &delete_section($file, $def);
&unlock_all_files(); &unlock_all_config_files();
} }
else { else {
# Validate inputs # Validate inputs
@ -44,7 +44,7 @@ else {
} }
# Create new section if needed # Create new section if needed
&lock_all_files(); &lock_all_config_files();
if ($in{'new'}) { if ($in{'new'}) {
&create_section($file, $def); &create_section($file, $def);
} }
@ -61,7 +61,7 @@ else {
$in{'unban'} =~ s/\r//g; $in{'unban'} =~ s/\r//g;
&save_directive("actionunban", $in{'unban'}, $def); &save_directive("actionunban", $in{'unban'}, $def);
&unlock_all_files(); &unlock_all_config_files();
} }
# Log and redirect # Log and redirect

View File

@ -21,7 +21,7 @@ if (!$in{'socket_def'}) {
} }
# Update config file # Update config file
&lock_all_files(); &lock_all_config_files();
&save_directive("loglevel", $in{'loglevel'}, $def); &save_directive("loglevel", $in{'loglevel'}, $def);
&save_directive("logtarget", &save_directive("logtarget",
@ -30,6 +30,6 @@ if (!$in{'socket_def'}) {
$in{'logtarget_def'}, $def); $in{'logtarget_def'}, $def);
&save_directive("socket", $in{'socket_def'} ? undef : $in{'socket'}, $def); &save_directive("socket", $in{'socket_def'} ? undef : $in{'socket'}, $def);
&unlock_all_files(); &unlock_all_config_files();
&webmin_log("config"); &webmin_log("config");
&redirect(""); &redirect("");

View File

@ -29,9 +29,9 @@ if ($in{'delete'}) {
my @users = &find_jail_by_filter($filter); my @users = &find_jail_by_filter($filter);
@users && &error(&text('filter_einuse', @users && &error(&text('filter_einuse',
join(" ", map { $_->{'name'} } @users))); join(" ", map { $_->{'name'} } @users)));
&lock_all_files(); &lock_all_config_files();
&delete_section($file, $def); &delete_section($file, $def);
&unlock_all_files(); &unlock_all_config_files();
} }
else { else {
# Validate inputs # Validate inputs
@ -45,7 +45,7 @@ else {
$in{'fail'} =~ /\S/ || &error($text{'filter_efail'}); $in{'fail'} =~ /\S/ || &error($text{'filter_efail'});
# Create new section if needed # Create new section if needed
&lock_all_files(); &lock_all_config_files();
if ($in{'new'}) { if ($in{'new'}) {
&create_section($file, $def); &create_section($file, $def);
} }
@ -56,7 +56,7 @@ else {
$in{'ignore'} =~ s/\r//g; $in{'ignore'} =~ s/\r//g;
&save_directive("ignoreregex", $in{'ignore'}, $def); &save_directive("ignoreregex", $in{'ignore'}, $def);
&unlock_all_files(); &unlock_all_config_files();
} }
# Log and redirect # Log and redirect

View File

@ -26,10 +26,10 @@ else {
if ($in{'delete'}) { if ($in{'delete'}) {
# Just delete the jail # Just delete the jail
&lock_all_files(); &lock_all_config_files();
&delete_section($jail->{'file'}, $jail, &delete_section($jail->{'file'}, $jail,
$jail->{'file'} =~ /jail.local$/ ? 1 : 0); $jail->{'file'} =~ /jail.local$/ ? 1 : 0);
&unlock_all_files(); &unlock_all_config_files();
} }
else { else {
# Validate inputs # Validate inputs
@ -102,7 +102,7 @@ else {
} }
# Create new section or rename existing if needed # Create new section or rename existing if needed
&lock_all_files(); &lock_all_config_files();
if ($in{'new'}) { if ($in{'new'}) {
&create_section($jail->{'file'}, $jail); &create_section($jail->{'file'}, $jail);
} }
@ -122,7 +122,7 @@ else {
&save_directive("ignoreip", &save_directive("ignoreip",
@ignoreips ? join(" ", @ignoreips) : undef, $jail); @ignoreips ? join(" ", @ignoreips) : undef, $jail);
&unlock_all_files(); &unlock_all_config_files();
} }
# Log and redirect # Log and redirect

View File

@ -30,7 +30,7 @@ foreach my $ip (@ignoreips) {
# Update the jail # Update the jail
&lock_all_files(); &lock_all_config_files();
foreach my $f ("maxretry", "findtime", "bantime") { foreach my $f ("maxretry", "findtime", "bantime") {
&save_directive($f, $in{$f."_def"} ? undef : $in{$f}, $jail); &save_directive($f, $in{$f."_def"} ? undef : $in{$f}, $jail);
} }
@ -40,7 +40,7 @@ foreach my $f ("maxretry", "findtime", "bantime") {
$jail); $jail);
&save_directive("banaction", $in{'banaction'} || undef, $jail); &save_directive("banaction", $in{'banaction'} || undef, $jail);
&save_directive("protocol", $in{'protocol'} || undef, $jail); &save_directive("protocol", $in{'protocol'} || undef, $jail);
&unlock_all_files(); &unlock_all_config_files();
&webmin_log("jaildef"); &webmin_log("jaildef");
&redirect("list_jails.cgi"); &redirect("list_jails.cgi");