From: Stefan Schantl Date: Wed, 31 Mar 2021 09:26:24 +0000 (+0200) Subject: ids-functions.pl: Introduce drop_dl_rulesfile(). X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=61b92664373ef7343a0f4efeaa3a5026bfe5b325;p=people%2Fstevee%2Fipfire-2.x.git 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 --- diff --git a/config/cfgroot/ids-functions.pl b/config/cfgroot/ids-functions.pl index 89fee83ff9..ef4c74a578 100644 --- a/config/cfgroot/ids-functions.pl +++ b/config/cfgroot/ids-functions.pl @@ -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. #