From 16b2d281ce054a41cbe084d7770fc54553ed747d Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Wed, 31 Mar 2021 10:45:14 +0200 Subject: [PATCH] ids-functions.pl: Add cleanup_tmp_directory() function. As the name of the function already says, it is responsible to delete all temporary files after ruleset generation. Signed-off-by: Stefan Schantl --- config/cfgroot/ids-functions.pl | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/config/cfgroot/ids-functions.pl b/config/cfgroot/ids-functions.pl index 1602c42a96..7d2ae802e2 100644 --- a/config/cfgroot/ids-functions.pl +++ b/config/cfgroot/ids-functions.pl @@ -603,8 +603,7 @@ sub oinkmaster () { &merge_sid_msg(@enabled_providers); # Cleanup temporary directory. - # XXX - not implemented yet. - # &cleanup_tmp_directory(); + &cleanup_tmp_directory(); } # @@ -741,6 +740,17 @@ sub merge_sid_msg (@) { close(FILE); } +# +## Function to cleanup the temporary IDS directroy. +# +sub cleanup_tmp_directory () { + # Load rmtree() function from file path perl module. + use File::Path 'rmtree'; + + # Delete temporary directory and all containing files. + rmtree([ "$tmp_directory" ]); +} + # ## Function to do all the logging stuff if the downloading or updating of the ruleset fails. # -- 2.39.2