From d80ebb06616eafec4161317443dc311850f0672f Mon Sep 17 00:00:00 2001 From: teastep Date: Mon, 14 May 2007 18:24:38 +0000 Subject: [PATCH] Disallow adding a host entry that is already permanent git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@6345 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall-common/lib.dynamiczones | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Shorewall-common/lib.dynamiczones b/Shorewall-common/lib.dynamiczones index e2f61a73d..25ad4ab0c 100644 --- a/Shorewall-common/lib.dynamiczones +++ b/Shorewall-common/lib.dynamiczones @@ -126,11 +126,14 @@ add_to_zone() # $1...${n-1} = [:] $n = zone ;; *) for h in $hostlist; do - list_search +$h $hosts - if [ "$?" -gt 0 ]; then - newhostlist="$newhostlist +$h" + if ! list_search +$h $hosts; then + if ! list_search $h $hosts; then + newhostlist="$newhostlist +$h" + else + error_message "$h is already in zone $zone" + fi else - error_message "$h already in zone $zone" + error_message "$h is already in zone $zone" fi done