From 504fb53bcc1eb03af782d800b77ee6a1b6e4077b Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Tue, 26 Apr 2022 05:23:44 +0200 Subject: [PATCH] ids-functions.pl: Add remove_from_etags() function. This function is used to drop the stored etags data of a given provider. Signed-off-by: Stefan Schantl --- config/cfgroot/ids-functions.pl | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/config/cfgroot/ids-functions.pl b/config/cfgroot/ids-functions.pl index 3994d17808..ec4fdacc57 100644 --- a/config/cfgroot/ids-functions.pl +++ b/config/cfgroot/ids-functions.pl @@ -1884,6 +1884,30 @@ sub get_provider_used_rulesfiles($) { return @used_rulesfiles; } +# +## Function to delete the stored etag data of a given provider. +# +sub remove_from_etags ($) { + my ($provider) = @_; + + my %etags; + + # Early exit function if the etags file does not exist. + return unless (-f $etags_file); + + # Read-in etag file. + &General::readhash("$etags_file", \%etags); + + # Check if the hash contains an entry for the given provider. + if ($etags{$provider}) { + # Drop the entry. + delete($etags{$provider}); + + # Write back the etags file. + &General::writehash("$etags_file", \%etags); + } +} + # ## Function to write the lock file for locking the WUI, while ## the autoupdate script runs. -- 2.39.2