diff options
author | Florian Westphal <fw@strlen.de> | 2022-11-30 10:31:52 +0100 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2022-11-30 20:26:23 +0100 |
commit | 83604e7f7327b6b3197f98b4e579a2b88a4c7356 (patch) | |
tree | a6d3808c73531b172c112d590c8232417fdf9aeb /extensions/libxt_LOG.c | |
parent | 71e159f62451736f217792a7f8cfa8ab00add4d0 (diff) |
xlate: get rid of escape_quotes
Its not necessary to escape " characters, we can let xtables-translate
print the entire translation/command enclosed in '' chracters, i.e. nft
'add rule ...', this also takes care of [, { and other special characters
that some shells might parse otherwise (when copy-pasting translated output).
The escape_quotes struct member is retained to avoid an ABI breakage.
This breaks all xlate test cases, fixup in followup patches.
v3: no need to escape ', replace strcmp(x, "") with x[0] (Phil Sutter)
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'extensions/libxt_LOG.c')
-rw-r--r-- | extensions/libxt_LOG.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/extensions/libxt_LOG.c b/extensions/libxt_LOG.c index e3f4290b..b6fe0b2e 100644 --- a/extensions/libxt_LOG.c +++ b/extensions/libxt_LOG.c @@ -151,12 +151,8 @@ static int LOG_xlate(struct xt_xlate *xl, const char *pname = priority2name(loginfo->level); xt_xlate_add(xl, "log"); - if (strcmp(loginfo->prefix, "") != 0) { - if (params->escape_quotes) - xt_xlate_add(xl, " prefix \\\"%s\\\"", loginfo->prefix); - else - xt_xlate_add(xl, " prefix \"%s\"", loginfo->prefix); - } + if (strcmp(loginfo->prefix, "") != 0) + xt_xlate_add(xl, " prefix \"%s\"", loginfo->prefix); if (loginfo->level != LOG_DEFAULT_LEVEL && pname) xt_xlate_add(xl, " level %s", pname); |