From 760a37b5c9e347def2ba23b9da5768b92c2ef45a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 14 Feb 2011 07:24:23 +0100 Subject: [PATCH] import-ferm: support empty string parameters Change '+' to '*' in parser regex, and quote empty strings in the ferm output. --- NEWS | 1 + src/import-ferm | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 55fd1d7..7f6827a 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,7 @@ v2.0.9 - not yet released * icmp: translate "icmp-type" to "icmpv6-type" in domain "ip6" - add @substr and @length - subchain names can now be expanded + - import-ferm: support empty string parameters v2.0.8 - 4 Nov 2010 diff --git a/src/import-ferm b/src/import-ferm index 8309e23..c39e1e7 100755 --- a/src/import-ferm +++ b/src/import-ferm @@ -66,7 +66,7 @@ use vars qw($indent $table $chain @rules $domain $next_domain); sub ferm_escape($) { local $_ = shift; - return $_ unless /[^-\w.:\/]/s; + return $_ unless /[^-\w.:\/]/s or length == 0; return "\'$_\'"; } @@ -308,7 +308,7 @@ sub flush_domain() { sub tokenize($) { local $_ = shift; my @result; - while (s/^\s*"([^"]+)"//s || s/^\s*(!)// || s/^\s*(\S+)//s) { + while (s/^\s*"([^"]*)"//s || s/^\s*(!)// || s/^\s*(\S+)//s) { push @result, $1; } return @result; -- 2.11.4.GIT