mirror of
https://gitlab.com/shorewall/code.git
synced 2025-06-19 17:28:35 +02:00
Limit INCLUDE nest level
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@529 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
parent
02a42e2fb0
commit
f16f401910
@ -185,13 +185,17 @@ mutex_off()
|
||||
# Read a file and handle "INCLUDE" directives
|
||||
#
|
||||
|
||||
read_file() # $1 = file name
|
||||
read_file() # $1 = file name, $2 = nest count
|
||||
{
|
||||
local first rest
|
||||
|
||||
while read first rest; do
|
||||
if [ "x$first" = "xINCLUDE" ]; then
|
||||
read_file `find_file ${rest%#*}`
|
||||
if [ $2 -lt 4 ]; then
|
||||
read_file `find_file ${rest%#*}` $(($count + 1))
|
||||
else
|
||||
echo " WARNING: INCLUDE in $1 ignored (nested too deeply)" >&2
|
||||
fi
|
||||
else
|
||||
echo "$first $rest"
|
||||
fi
|
||||
@ -216,7 +220,7 @@ strip_file() # $1 = Base Name of the file, $2 = Full Name of File (optional)
|
||||
[ $# = 1 ] && fname=`find_file $1` || fname=$2
|
||||
|
||||
if [ -f $fname ]; then
|
||||
read_file $fname | cut -d'#' -f1 | grep -v '^[[:space:]]*$' > $TMP_DIR/$1
|
||||
read_file $fname 0 | cut -d'#' -f1 | grep -v '^[[:space:]]*$' > $TMP_DIR/$1
|
||||
else
|
||||
> $TMP_DIR/$1
|
||||
fi
|
||||
|
@ -61,5 +61,8 @@ New Features:
|
||||
#LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVE
|
||||
----- end rules -----
|
||||
|
||||
INCLUDE's may be nested to a level of 3 -- further nested INCLUDE
|
||||
directives are ignored.
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user