From c3aa139f224f84ef479cc9c46edf05c637fd589f Mon Sep 17 00:00:00 2001 From: Vadim Kurland Date: Tue, 14 Sep 2010 21:59:13 +0000 Subject: [PATCH] * NATCompiler_PrintRule.cpp (processNext): fixed SF bug 3057503 "DNAT rule with dynamic IP has a white space, causing error". --- build_num | 2 +- doc/ChangeLog | 3 +++ src/iptlib/NATCompiler_PrintRule.cpp | 14 ++++++++++++-- test/ipt/objects-for-regression-tests.fwb | 23 ++++++++++++++++++++++- 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/build_num b/build_num index 0e0bff771..b02e99de3 100644 --- a/build_num +++ b/build_num @@ -1 +1 @@ -#define BUILD_NUM 3248 +#define BUILD_NUM 3249 diff --git a/doc/ChangeLog b/doc/ChangeLog index 026b1bb14..c852a9416 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,8 @@ 2010-09-14 Vadim Kurland + * NATCompiler_PrintRule.cpp (processNext): fixed SF bug 3057503 + "DNAT rule with dynamic IP has a white space, causing error". + * PolicyCompiler_PrintRule.cpp (_printIpSetMatch): fixed #1705 "iptables (v>=1.4.4) "--set option deprecated ..." (SF bug 3059893) Option "--set" has been deprecated and renamed "--match-set" in diff --git a/src/iptlib/NATCompiler_PrintRule.cpp b/src/iptlib/NATCompiler_PrintRule.cpp index 597bc76ed..43cc31c0e 100644 --- a/src/iptlib/NATCompiler_PrintRule.cpp +++ b/src/iptlib/NATCompiler_PrintRule.cpp @@ -758,9 +758,19 @@ bool NATCompiler_ipt::PrintRule::processNext() cmdout << "--to-destination "; // if TDst is "any" and this is DNAT rule, then this rule only // translates source port. Skip address part. - if (!tdst->isAny()) cmdout << _printAddr(tdst, false, true); + QString addr_part; + if (!tdst->isAny()) + addr_part = _printAddr(tdst, false, true).c_str(); + string ports = _printDNATPorts(tsrv); - if (!ports.empty()) cmdout << ":" << ports; + if (!ports.empty()) + { + cmdout << addr_part.trimmed().toStdString() + << ":" << ports; + } else + { + cmdout << addr_part.toStdString(); + } if (ropt->getBool("ipt_nat_random")) cmdout << " --random"; if (XMLTools::version_compare(version, "1.4.3")>=0) diff --git a/test/ipt/objects-for-regression-tests.fwb b/test/ipt/objects-for-regression-tests.fwb index 4f6f3d22d..c25e8458b 100644 --- a/test/ipt/objects-for-regression-tests.fwb +++ b/test/ipt/objects-for-regression-tests.fwb @@ -14177,7 +14177,7 @@ - + @@ -14246,6 +14246,27 @@ + + + + + + + + + + + + + + + + + + + + +