Skip to contentSkip to conversation

save/restore fix for ascii strings

PATCH New Michael Rash 1 participant 1 message Dec 23, 2003 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 save/restore fix for ascii strings

Due to lack of quotes, iptables-save/restore is currently broken for ascii strings that contain a space character. The attached trivial patch fixes this.

Let me know if I'm supposed to submit a bug first through bugzilla or something.

--Mike

Michael Rash
http://www.cipherdyne.org
Key fingerprint = 53EA 13EA 472E 3771 894F AC69 95D8 5D6B A742 839F

Index: libipt_string.c
===================================================================
RCS file: /cvspublic/netfilter/userspace/extensions/libipt_string.c,v retrieving revision 1.10

libipt_string.c +3 -3
diff -u -r1.10 libipt_string.c
@@ -178,7 +178,7 @@
 {
 	if (!flags)
 		exit_error(PARAMETER_PROBLEM,
-			   "STRING match: You must specify `--string'");
+			   "STRING match: You must specify `--string' or `--hex-string'");
 }
 
 
@@ -191,7 +191,7 @@
 	const struct ipt_string_info *info =
 	    (const struct ipt_string_info*) match->data;
 
-	printf("STRING match %s%s ", (info->invert) ? "!" : "", info->string);
+	printf("STRING match %s\"%s\" ", (info->invert) ? "!" : "", info->string);
 }
 
 
@@ -202,7 +202,7 @@
 	const struct ipt_string_info *info =
 	    (const struct ipt_string_info*) match->data;
 
-	printf("--string %s%s ", (info->invert) ? "! ": "", info->string);
+	printf("--string %s\"%s\" ", (info->invert) ? "! ": "", info->string);
 }