Effectively use the specified directory as the CONFIG_PATH til .conf is read

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2013-02-13 07:45:24 -08:00
parent c5bb16ac26
commit 138638cb1a
3 changed files with 14 additions and 6 deletions

View File

@ -676,7 +676,11 @@ find_file()
fi
done
if [ -n "$g_shorewalldir" ]; then
echo ${g_shorewalldir}/$1
else
echo ${g_confdir}/$1
fi
;;
esac
}

View File

@ -6375,7 +6375,7 @@ sub isolate_source_interface( $ ) {
} else {
$source =~ tr/<>/[]/;
if ( $source =~ /^(.+?):(\[(?:.+)\],\[(?:.+)\])$/ ) {
if ( $source =~ /^(.+?):(\[(?:.+),\[(?:.+)\])$/ ) {
$iiface = $1;
$inets = $2;
} elsif ( $source =~ /^(.+?):\[(.+)\]\s*$/ ||
@ -6386,7 +6386,7 @@ sub isolate_source_interface( $ ) {
$iiface = $1;
$inets = $2;
} elsif ( $source =~ /:/ ) {
if ( $source =~ /^\[(?:.+)\],\[(?:.+)\]$/ ){
if ( $source =~ /^\[(?:.+),\[(?:.+)\]$/ ){
$inets = $source;
} elsif ( $source =~ /^\[(.+)\]$/ ) {
$inets = $1;
@ -6493,7 +6493,7 @@ sub isolate_dest_interface( $$$$ ) {
} else {
$dest =~ tr/<>/[]/;
if ( $dest =~ /^(.+?):(\[(?:.+)\],\[(?:.+)\])$/ ) {
if ( $dest =~ /^(.+?):(\[(?:.+),\[(?:.+)\])$/ ) {
$diface = $1;
$dnets = $2;
} elsif ( $dest =~ /^(.+?):\[(.+)\]\s*$/ ||
@ -6504,7 +6504,7 @@ sub isolate_dest_interface( $$$$ ) {
$diface = $1;
$dnets = $2;
} elsif ( $dest =~ /:/ ) {
if ( $dest =~ /^\[(?:.+)\],\[(?:.+)\]$/ ){
if ( $dest =~ /^\[(?:.+),\[(?:.+)\]$/ ){
$dnets = $dest;
} elsif ( $dest =~ /^\[(.+)\]$/ ) {
$dnets = $1;

View File

@ -46,7 +46,11 @@ get_config() {
fi
fi
if [ "$(id -u)" -eq 0 ]; then
config=$(find_file $g_program.conf)
else
config="$g_shorewalldir/$g_program.conf"
fi
if [ -f $config ]; then
if [ -r $config ]; then