summaryrefslogtreecommitdiffstats
path: root/iptables/xshared.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2019-10-18 01:30:22 +0200
committerPhil Sutter <phil@nwl.cc>2019-10-24 16:20:51 +0200
commitf8ec1b7a296e6f461278937213a1477e4d29b1f3 (patch)
tree61d99b698634ad9b3b79b66400fbf85178e5e6b4 /iptables/xshared.c
parentffb339224f71871d015e4b57ea8dbaf9fd4f8aad (diff)
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 <phil@nwl.cc> Acked-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'iptables/xshared.c')
-rw-r--r--iptables/xshared.c6
1 files changed, 4 insertions, 2 deletions
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;
}
}