Thus spoke Tom Eastep:

> Hmmm -- This is probably because of how "grep" is defined on LRP. Please
> try it with the attached /etc/shorewall/functions file.
>

Pardon me for following up my own post but the previously-posted functions
file was brain-damaged. Here's one that works better...

Regarding the versions of /etc/shorewall/* files, if the file's format
hasn't changed since version 1.0 then the version in the file's header
likewise hasn't changed.

-Tom
-- 
Tom Eastep             \ Alt Email: [EMAIL PROTECTED]
ICQ #60745924           \ Websites: http://seawall.sourceforge.net
[EMAIL PROTECTED]       \          http://seattlefirewall.dyndns.org
Shoreline, Washington USA \         http://shorewall.sourceforge.net
                           \_________________________________________
#
# Shorewall 1.1 -- /etc/shorewall/functions

#
# Suppress all output for a command
#    
qt()  
{ 
    "$@" >/dev/null 2>&1
}
#
# Poor Man's grep -- Some LRP systems have a grep that simply searches for
#                    strings rather than regular expressions. When we are
#                    really looking for regular expressions, we use this one
#
mygrep () 
{
    local pat
    pat="$1"
    shift
    sed "\'$pat'P" -n "$@"
}
#
# Find the zones
#
find_zones() 
{
    while read zone display comments; do
        [ -n "$zone" ] && case "$zone" in
            \#*)
                ;;
            *)
                echo $zone
                ;;
        esac
    done < /etc/shorewall/zones
}

find_display() # $1 = zone
{
    mygrep ^$1 /etc/shorewall/zones | while read z display comments; do
        [ "x$1" = "x$z" ] && echo $display
    done
}

determine_zones() 
{
    if [ -f /etc/shorewall/zones ]; then
        zones=`find_zones`
        zones=`echo $zones` # Remove extra trash
        zonepattern="^$zones"

        while [ -n "`echo "$zonepattern" | mygrep ' '`" ]; do
            zonepattern="`echo "$zonepattern" | sed 's/ /\\\|^/'`"
        done

        for zone in $zones; do
            dsply=`find_display $zone`
            eval ${zone}_display=\$dsply
        done
    else
        zones="net local dmz gw"
        zonepattern="^net\|^local\|^dmz\|^gw"
        net_display=Net
        local_display=Local
        dmz_display=DMZ
        gw_display=Gateway
    fi
}

Reply via email to