mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-27 03:07:43 +02:00
ids-functions.pl: Introduce get_enabled_providers() function.
This function simply returns an array with all enabled ruleset providers. Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
This commit is contained in:
@@ -163,6 +163,36 @@ sub get_ruleset_providers() {
|
|||||||
return sort(@providers);
|
return sort(@providers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
## Function to get a list of all enabled ruleset providers.
|
||||||
|
##
|
||||||
|
## They will be returned as an array.
|
||||||
|
#
|
||||||
|
sub get_enabled_providers () {
|
||||||
|
my %used_providers = ();
|
||||||
|
|
||||||
|
# Array to store the enabled providers.
|
||||||
|
my @enabled_providers = ();
|
||||||
|
|
||||||
|
# Read-in the providers config file.
|
||||||
|
&General::readhasharray("$providers_settings_file", \%used_providers);
|
||||||
|
|
||||||
|
# Loop through the hash of used_providers.
|
||||||
|
foreach my $id (keys %used_providers) {
|
||||||
|
# Skip disabled providers.
|
||||||
|
next unless ($used_providers{$id}[3] eq "enabled");
|
||||||
|
|
||||||
|
# Grab the provider handle.
|
||||||
|
my $provider = "$used_providers{$id}[0]";
|
||||||
|
|
||||||
|
# Add the provider to the array of enabled providers.
|
||||||
|
push(@enabled_providers, $provider);
|
||||||
|
}
|
||||||
|
|
||||||
|
# Return the array.
|
||||||
|
return @enabled_providers;
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
## Function for checking if at least 300MB of free disk space are available
|
## Function for checking if at least 300MB of free disk space are available
|
||||||
## on the "/var" partition.
|
## on the "/var" partition.
|
||||||
|
|||||||
Reference in New Issue
Block a user