From f8ec1b7a296e6f461278937213a1477e4d29b1f3 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Fri, 18 Oct 2019 01:30:22 +0200 Subject: iptables-xml: Use add_param_to_argv() Extend the shared argv parser by storing whether a given argument was quoted or not, then use it in iptables-xml. One remaining extra bit is extraction of chain name in -A commands, do that afterwards in a loop. Signed-off-by: Phil Sutter Acked-by: Florian Westphal --- iptables/xshared.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'iptables/xshared.c') diff --git a/iptables/xshared.c b/iptables/xshared.c index 5211b647..530ab4c1 100644 --- a/iptables/xshared.c +++ b/iptables/xshared.c @@ -484,7 +484,7 @@ static void add_param(struct xt_param_buf *param, const char *curchar) void add_param_to_argv(char *parsestart, int line) { - int quote_open = 0, escaped = 0; + int quote_open = 0, escaped = 0, quoted = 0; struct xt_param_buf param = {}; char *curchar; @@ -511,6 +511,7 @@ void add_param_to_argv(char *parsestart, int line) } else { if (*curchar == '"') { quote_open = 1; + quoted = 1; continue; } } @@ -533,8 +534,9 @@ void add_param_to_argv(char *parsestart, int line) } param.buffer[param.len] = '\0'; - add_argv(param.buffer, 0); + add_argv(param.buffer, quoted); param.len = 0; + quoted = 0; } } -- cgit v1.2.3