Package: snort
Version: 2.9.15.1-6
Tags: patch

Dear maintainers of snort,

`snort.preinst` uses Perl to get the value of options in
`etc/snort/snort.common.parameters`. Such simple processing can be achieved also with a very similar grep invocation and without cat.

A patch to fix this issue is available at https://salsa.debian.org/jfs/pkg-snort/-/merge_requests/1

Here is a preview of the patch

diff --git a/debian/snort.preinst b/debian/snort.preinst
index 4fc54973..85bdfcf6 100644
--- a/debian/snort.preinst
+++ b/debian/snort.preinst
@@ -26,9 +26,9 @@ check_parameters() {
     [ -r "$DEFAULT" ] && return
        
     # Extract our values from there
-    logdir=`cat $PARAMETERS | perl -ne 'print $1 if /-l\s+([\w\/]+)/'`
-    user_snort=`cat $PARAMETERS | perl -ne 'print $1 if /-u\s+(\w+)/'`
-    group_snort=`cat $PARAMETERS | perl -ne 'print $1 if /-g\s+(\w+)/'`
+    logdir=`grep -P -o -- '-l\s+\K([\w\/]+)' $PARAMETERS`
+    user_snort=`grep -P -o -- '-u\s+\K(\w+)' $PARAMETERS`
+    group_snort=`grep -P -o -- '-g\s+\K(\w+)' $PARAMETERS`
extraparms=`cat $PARAMETERS | sed -e 's/-l[[:space:]]\+[\/[:alnum:]]\+[[:space:]]\+//g; s/-u[[:space:]]\+[[:alnum:]]\+[[:space:]]*//g; s/-g[[:space:]]\+[[:alnum:]]\+[[:space:]]*//g;'`
     echo "Creating new $DEFAULT configuration based on $PARAMETERS"
     cat <<EOF >$DEFAULT

--
Gioele Barabucci

Reply via email to