From 64bbe7fdb9b426de2e8e7ae17e55208199346058 Mon Sep 17 00:00:00 2001 From: Vadim Kurland Date: Wed, 28 Apr 2010 00:38:52 +0000 Subject: [PATCH] fixes #1425 iptables script generated for the empty rule set is broken --- build_num | 2 +- doc/ChangeLog | 5 + src/iptlib/CompilerDriver_ipt.cpp | 3 +- .../linux24/script_body_iptables_restore | 2 +- test/ipt/objects-for-regression-tests.fwb | 138 +++++++++++++++++- 5 files changed, 146 insertions(+), 4 deletions(-) diff --git a/build_num b/build_num index ffdb129d4..11e537a89 100644 --- a/build_num +++ b/build_num @@ -1 +1 @@ -#define BUILD_NUM 2853 +#define BUILD_NUM 2855 diff --git a/doc/ChangeLog b/doc/ChangeLog index fa7e5b82a..ddd480623 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,10 @@ 2010-04-27 vadim + * CompilerDriver_ipt.cpp (CompilerDriver_ipt::dumpScript): fixes #1425 + "iptables script generated for the empty rule set is broken". Compiler + generated empty shell function for empty Policy rule set. It should + always include at least automatic rules. + * SSHSession.cpp (SSHSession::terminate): see #1426, #1428 use QProcess::waitForFinished() instead of just sleep() after we send TERM signal to the background process. Also let Qt process events diff --git a/src/iptlib/CompilerDriver_ipt.cpp b/src/iptlib/CompilerDriver_ipt.cpp index 3a450776e..9a66b672d 100644 --- a/src/iptlib/CompilerDriver_ipt.cpp +++ b/src/iptlib/CompilerDriver_ipt.cpp @@ -158,6 +158,7 @@ string CompilerDriver_ipt::dumpScript(Firewall *fw, conf->setVariable("reset_script", reset_script.c_str()); conf->setVariable("filter", !filter_script.empty()); + conf->setVariable("filter_or_reset", have_reset || !filter_script.empty()); conf->setVariable("filter_script", filter_script.c_str()); conf->setVariable("mangle", !mangle_script.empty()); @@ -170,7 +171,7 @@ string CompilerDriver_ipt::dumpScript(Firewall *fw, !filter_script.empty() || !mangle_script.empty() || !nat_script.empty()); - + conf->setVariable("have_script", have_script); conf->setVariable("ipv4", !ipv6_policy); conf->setVariable("ipv6", ipv6_policy); diff --git a/src/res/configlets/linux24/script_body_iptables_restore b/src/res/configlets/linux24/script_body_iptables_restore index c28988e5f..8fe2c11aa 100644 --- a/src/res/configlets/linux24/script_body_iptables_restore +++ b/src/res/configlets/linux24/script_body_iptables_restore @@ -14,7 +14,7 @@ ## iptables-restore method, not single rule compile {{if have_script}} ( -{{if filter}} +{{if filter_or_reset}} echo '*filter' {{$reset_script}} {{$filter_script}} diff --git a/test/ipt/objects-for-regression-tests.fwb b/test/ipt/objects-for-regression-tests.fwb index e64a155ee..b8f4e5c32 100644 --- a/test/ipt/objects-for-regression-tests.fwb +++ b/test/ipt/objects-for-regression-tests.fwb @@ -1,6 +1,6 @@ - + @@ -3487,6 +3487,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -50627,6 +50653,116 @@ echo '%FWBPROMPT%'; sh /tmp/%FWSCRIPT% + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +