]> git.ipfire.org Git - people/stevee/ipfire-2.x.git/commitdiff
ids-functions.pl: Introduce move_tmp_ruleset() function.
authorStefan Schantl <stefan.schantl@ipfire.org>
Wed, 31 Mar 2021 11:39:43 +0000 (13:39 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sun, 19 Dec 2021 12:23:00 +0000 (13:23 +0100)
This function is used to move an extracted temporary ruleset to
the rules location.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
config/cfgroot/ids-functions.pl

index 4674d6f8847b344a2aa843ad6a193f8c173dda9b..ed9bb203bae432e2ed27f037e3c9a2594af94f7a 100644 (file)
@@ -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.
 #