From: Stefan Schantl Date: Sun, 20 Mar 2022 14:34:10 +0000 (+0100) Subject: ids-functions.pl: Add private function to obtain the sid and rev of a X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e246285af4c98647217fe96a48d794f959ebf3d8;p=people%2Fstevee%2Fipfire-2.x.git ids-functions.pl: Add private function to obtain the sid and rev of a rule. Signed-off-by: Stefan Schantl --- diff --git a/config/cfgroot/ids-functions.pl b/config/cfgroot/ids-functions.pl index 2aab57b41e..5e23452449 100644 --- a/config/cfgroot/ids-functions.pl +++ b/config/cfgroot/ids-functions.pl @@ -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. #