]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
ids-functions.pl: Check if the generated stored rulesfile of a provider
authorStefan Schantl <stefan.schantl@ipfire.org>
Thu, 2 Dec 2021 06:43:00 +0000 (07:43 +0100)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sun, 19 Dec 2021 12:25:26 +0000 (13:25 +0100)
exists before returning the filename.

This will prevent from using and processing non existing files.

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

index 64d98a38823cfe5f78184bbbb3d83be9540caac7..8c2d6782f5a30ac0bdb7a693b557477e49d1fe08 100644 (file)
@@ -861,6 +861,12 @@ sub _get_dl_rulesfile($) {
        # Generate the full filename and path for the stored rules file.
        my $rulesfile = "$dl_rules_path/$dl_rulesfile_prefix-$provider$suffix";
 
+       # Check if the file exists.
+       unless (-f "$rulesfile") {
+               # Abort return - nothing.
+               return;
+       }
+
        # Return the generated filename.
        return $rulesfile;
 }