]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
ids-functions.pl: Add private function to obtain the sid and rev of a
authorStefan Schantl <stefan.schantl@ipfire.org>
Sun, 20 Mar 2022 14:34:10 +0000 (15:34 +0100)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sat, 26 Mar 2022 10:33:47 +0000 (11:33 +0100)
rule.

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

index 2aab57b41e69f09a749f8ef561557ff75d9ce159..5e23452449ec2a579f0b076fa54a8a5801f7ee2d 100644 (file)
@@ -926,6 +926,27 @@ sub _get_dl_rulesfile($) {
        return $rulesfile;
 }
 
+#
+## Private function to obtain the sid and rev of a rule.
+#
+## Returns an array with the sid as first and the rev as second value.
+#
+sub _get_sid_and_rev ($) {
+       my ($line) = @_;
+
+       my @ret;
+
+       # Use regex to obtain the sid and rev.
+       if ($line =~ m/.*sid:\s*(.*?);.*rev:\s*(.*?);/) {
+               # Add the sid and rev to the array.
+               push(@ret, $1);
+               push(@ret, $2);
+       }
+
+       # Return the array.
+       return @ret;
+}
+
 #
 ## Tiny function to delete the stored ruleset file or tarball for a given provider.
 #