[PATCH] fix iptables-restore escaping of quotes
Philip Craig
philipc at snapgear.com
Mon Dec 20 07:31:57 CET 2004
iptables-restore was losing a character at the start of the parameter
for every escaped quote within the parameter.
This is of signifance when there are " characters in log prefixes.
Note that iptables-save can't generate escaped quotes; I am
generating the input for iptables-restore from a script.
--
Philip Craig - SnapGear, A CyberGuard Company - http://www.SnapGear.com
-------------- next part --------------
Index: iptables-restore.c
===================================================================
--- iptables-restore.c (revision 3377)
+++ iptables-restore.c (working copy)
@@ -336,12 +336,15 @@
param_start = parsestart;
for (curchar = parsestart; *curchar; curchar++) {
+ if (*curchar == '\\' && *(curchar+1) == '"') {
+ if (quote_open) {
+ memmove(curchar, curchar+1,
+ strlen(curchar+1));
+ continue;
+ }
+ }
if (*curchar == '"') {
- /* quote_open cannot be true if there
- * was no previous character. Thus,
- * curchar-1 has to be within bounds */
- if (quote_open &&
- *(curchar-1) != '\\') {
+ if (quote_open) {
quote_open = 0;
*curchar = ' ';
} else {
More information about the netfilter-devel
mailing list