summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlaforge <laforge>2001-10-16 09:40:13 +0000
committerlaforge <laforge>2001-10-16 09:40:13 +0000
commit25b6b3aa00ce0e90322493cca41318d1464ccda8 (patch)
tree46d15546737c5857720dd95f9717699a69bfaea0
parent26f5b2a9dc3c7bda24304ce677ec54fa77669024 (diff)
fix bug in iptables-save, ocurring with targets without save() function.
Debian Bug #113011
-rw-r--r--iptables-save.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/iptables-save.c b/iptables-save.c
index aa3b69a..bf75d5e 100644
--- a/iptables-save.c
+++ b/iptables-save.c
@@ -192,14 +192,22 @@ static void print_rule(const struct ipt_entry *e,
struct iptables_target *target
= find_target(t->u.user.name, TRY_LOAD);
- if (target)
+ if (!target) {
+ fprintf(stderr, "Can't find library for target `%s'\n",
+ t->u.user.name);
+ exit(1);
+ }
+
+ if (target->save)
target->save(&e->ip, t);
else {
- /* If some bits are non-zero, it implies we *need*
- to understand it */
- if (t->u.target_size) {
- fprintf(stderr,
- "Can't find library for target `%s'\n",
+ /* If the target size is greater than ipt_entry_target
+ * there is something to be saved, we just don't know
+ * how to print it */
+ if (t->u.target_size !=
+ sizeof(struct ipt_entry_target)) {
+ fprintf(stderr, "Target `%s' is missing "
+ "save function\n",
t->u.user.name);
exit(1);
}