ids-functions.pl: Introduce drop_dl_rulesfile().

This tiny function is used, to delete the stored rulesfile in case a
provider will be deleted.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
This commit is contained in:
Stefan Schantl
2021-03-31 11:26:24 +02:00
parent aac869c47e
commit 61b9266437

View File

@@ -837,6 +837,22 @@ sub _get_dl_rulesfile($) {
return $rulesfile;
}
#
## Tiny function to delete the stored ruleset file or tarball for a given provider.
#
sub drop_dl_rulesfile ($) {
my ($provider) = @_;
# Gather the full path and name of the stored rulesfile.
my $rulesfile = &_get_dl_rulesfile($provider);
# Check if the given rulesfile exists.
if (-f $rulesfile) {
# Delete the stored rulesfile.
unlink($rulesfile) or die "Could not delete $rulesfile. $!\n";
}
}
#
## Function to check if the IDS is running.
#