Fix if_match to only do wild-card patches on patters ending in '+'

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@1233 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2004-03-27 16:55:06 +00:00
parent 20fbb4b12a
commit 6454d50051
2 changed files with 15 additions and 4 deletions

View File

@ -25,3 +25,5 @@ Changes since 2.0.0
12) Fix item 10 above :-( 12) Fix item 10 above :-(
13) Replace good code with crap to satisfy 'ash'. 13) Replace good code with crap to satisfy 'ash'.
14) Fix if_match to only do wild-card matches on patterns ending in "+".

View File

@ -532,10 +532,19 @@ if_match() # $1 = Name in interfaces file - may end in "+"
# $2 = Full interface name - may also end in "+" # $2 = Full interface name - may also end in "+"
{ {
local pattern=${1%+} local pattern=${1%+}
local interface=${2%+}
# test "x${interface:0:${#pattern}}" = "x${pattern}" case $1 in
test "x$(echo ${interface} | cut -b -${#pattern} )" = "x${pattern}" *+)
#
# Can't use ${2:0:${#pattern}} because ash and dash don't support that flavor of
# variable expansion :-(
#
test "x$(echo $2 | cut -b -${#pattern} )" = "x${pattern}"
;;
*)
test "x$1" = "x$2"
;;
esac
} }
# #