From: Stefan Schantl Date: Wed, 31 Mar 2021 11:39:43 +0000 (+0200) Subject: ids-functions.pl: Introduce move_tmp_ruleset() function. X-Git-Url: http://git.ipfire.org/?p=people%2Fstevee%2Fipfire-2.x.git;a=commitdiff_plain;h=50f348f681102eae5dc6d26f19292389397e77fb ids-functions.pl: Introduce move_tmp_ruleset() function. This function is used to move an extracted temporary ruleset to the rules location. Signed-off-by: Stefan Schantl --- diff --git a/config/cfgroot/ids-functions.pl b/config/cfgroot/ids-functions.pl index 4674d6f884..ed9bb203ba 100644 --- a/config/cfgroot/ids-functions.pl +++ b/config/cfgroot/ids-functions.pl @@ -751,6 +751,27 @@ sub merge_sid_msg (@) { close(FILE); } +# +## A very tiny function to move an extracted ruleset from the temporary directory into +## the rules directory. +# +sub move_tmp_ruleset() { + # Load perl module. + use File::Copy; + + # Do a directory listing of the temporary directory. + opendir DH, $tmp_rules_directory; + + # Loop over all files. + while(my $file = readdir DH) { + # Move them to the rules directory. + move "$tmp_rules_directory/$file" , "$rulespath/$file"; + } + + # Close directory handle. + closedir DH; +} + # ## Function to cleanup the temporary IDS directroy. #