diff --git a/VERSION b/VERSION index 8f797bf57..ef42b9d7c 100644 --- a/VERSION +++ b/VERSION @@ -7,7 +7,7 @@ FWB_MICRO_VERSION=0 # build number is like "nano" version number. I am incrementing build # number during development cycle # -BUILD_NUM="3463" +BUILD_NUM="3464" VERSION="$FWB_MAJOR_VERSION.$FWB_MINOR_VERSION.$FWB_MICRO_VERSION.$BUILD_NUM" diff --git a/VERSION.h b/VERSION.h index 3be3e7a71..061e7d1a2 100644 --- a/VERSION.h +++ b/VERSION.h @@ -1,2 +1,2 @@ -#define VERSION "4.2.0.3463" +#define VERSION "4.2.0.3464" #define GENERATION "4.2" diff --git a/doc/ChangeLog b/doc/ChangeLog index 012918491..d9f5cc36d 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,10 @@ 2011-02-07 Vadim Kurland + * CompilerDriver_pix_run.cpp (run): fixes #2055 "Compiler shows + success, but there was a fatal error in the config". The bug has + been introduced recently (in 4.2.0) and really affected all + compilers. + * AddressTableDialog.cpp (browse): fixes #1914 "Address table object file name is not created properly if user clicks outside Editor panel" diff --git a/packaging/fwbuilder-static-qt.spec b/packaging/fwbuilder-static-qt.spec index 1e1c70deb..48554165e 100644 --- a/packaging/fwbuilder-static-qt.spec +++ b/packaging/fwbuilder-static-qt.spec @@ -3,7 +3,7 @@ %define name fwbuilder -%define version 4.2.0.3463 +%define version 4.2.0.3464 %define release 1 %if "%_vendor" == "MandrakeSoft" diff --git a/packaging/fwbuilder.control b/packaging/fwbuilder.control index 885e4508d..d2e1aeb16 100644 --- a/packaging/fwbuilder.control +++ b/packaging/fwbuilder.control @@ -4,6 +4,6 @@ Replaces: fwbuilder (<=4.1.1-1), fwbuilder-common, fwbuilder-bsd, fwbuilder-linu Priority: extra Section: checkinstall Maintainer: vadim@fwbuilder.org -Version: 4.2.0.3463-1 +Version: 4.2.0.3464-1 Depends: libqt4-gui (>= 4.3.0), libxml2, libxslt1.1, libsnmp | libsnmp15 Description: Firewall Builder GUI and policy compilers diff --git a/packaging/fwbuilder.spec b/packaging/fwbuilder.spec index 85a7ba5a0..1a4e3981e 100644 --- a/packaging/fwbuilder.spec +++ b/packaging/fwbuilder.spec @@ -1,6 +1,6 @@ %define name fwbuilder -%define version 4.2.0.3463 +%define version 4.2.0.3464 %define release 1 %if "%_vendor" == "MandrakeSoft" diff --git a/src/cisco_lib/CompilerDriver_iosacl_run.cpp b/src/cisco_lib/CompilerDriver_iosacl_run.cpp index 359453e45..d2ee733f9 100644 --- a/src/cisco_lib/CompilerDriver_iosacl_run.cpp +++ b/src/cisco_lib/CompilerDriver_iosacl_run.cpp @@ -378,6 +378,7 @@ QString CompilerDriver_iosacl::run(const std::string &cluster_id, } catch (FWException &ex) { + status = ERROR; return QString::fromUtf8(ex.toString().c_str()); } diff --git a/src/cisco_lib/CompilerDriver_pix_run.cpp b/src/cisco_lib/CompilerDriver_pix_run.cpp index eb13a351b..8689de382 100644 --- a/src/cisco_lib/CompilerDriver_pix_run.cpp +++ b/src/cisco_lib/CompilerDriver_pix_run.cpp @@ -535,9 +535,8 @@ QString CompilerDriver_pix::run(const std::string &cluster_id, } catch (FWException &ex) { - QString err = QString::fromUtf8(ex.toString().c_str()); - qDebug() << err; - return err; + status = ERROR; + return QString::fromUtf8(ex.toString().c_str()); } return ""; diff --git a/src/cisco_lib/CompilerDriver_procurve_acl_run.cpp b/src/cisco_lib/CompilerDriver_procurve_acl_run.cpp index 7857f36d0..e5f39926f 100644 --- a/src/cisco_lib/CompilerDriver_procurve_acl_run.cpp +++ b/src/cisco_lib/CompilerDriver_procurve_acl_run.cpp @@ -366,6 +366,7 @@ QString CompilerDriver_procurve_acl::run(const std::string &cluster_id, } catch (FWException &ex) { + status = ERROR; return QString::fromUtf8(ex.toString().c_str()); } diff --git a/src/cisco_lib/RoutingCompiler_pix.cpp b/src/cisco_lib/RoutingCompiler_pix.cpp index 6549e7a6c..bff46f82c 100644 --- a/src/cisco_lib/RoutingCompiler_pix.cpp +++ b/src/cisco_lib/RoutingCompiler_pix.cpp @@ -71,9 +71,10 @@ bool RoutingCompiler_pix::emptyRDstOrRItf::processNext() if (itfrel->isAny() || gtwrel->isAny()) { - string msg; - msg = "Interface and gateway rule elements can not be empty in the PIX routing rule"; - compiler->abort(rule, msg.c_str()); + compiler->abort( + rule, + "Interface and gateway rule elements can not be empty in " + "the PIX routing rule"); } return true; diff --git a/src/iosacl/iosacl.cpp b/src/iosacl/iosacl.cpp index 0a7b15073..0cb3b8667 100644 --- a/src/iosacl/iosacl.cpp +++ b/src/iosacl/iosacl.cpp @@ -162,7 +162,7 @@ int main(int argc, char **argv) driver.compile(); delete objdb; - return 0; + return (driver.getStatus() == BaseCompiler::SUCCESS) ? 0 : 1; } catch(libfwbuilder::FWException &ex) { diff --git a/src/ipf/ipf.cpp b/src/ipf/ipf.cpp index 9b1355a9c..fe7c38e3a 100644 --- a/src/ipf/ipf.cpp +++ b/src/ipf/ipf.cpp @@ -175,7 +175,7 @@ int main(int argc, char **argv) } driver.compile(); delete objdb; - return 0; + return (driver.getStatus() == BaseCompiler::SUCCESS) ? 0 : 1; } catch(const FWException &ex) { cerr << ex.toString() << endl; diff --git a/src/ipfw/ipfw.cpp b/src/ipfw/ipfw.cpp index fce9a8b6e..eda806638 100644 --- a/src/ipfw/ipfw.cpp +++ b/src/ipfw/ipfw.cpp @@ -171,9 +171,10 @@ int main(int argc, char **argv) } driver.compile(); delete objdb; - return 0; + return (driver.getStatus() == BaseCompiler::SUCCESS) ? 0 : 1; - } catch(const FWException &ex) { + } catch(const FWException &ex) + { cerr << ex.toString() << endl; return 1; #if __GNUC__ >= 3 diff --git a/src/ipt/ipt.cpp b/src/ipt/ipt.cpp index ab403c686..a7988e23c 100644 --- a/src/ipt/ipt.cpp +++ b/src/ipt/ipt.cpp @@ -152,7 +152,7 @@ int main(int argc, char **argv) } driver.compile(); delete objdb; - return 0; + return (driver.getStatus() == BaseCompiler::SUCCESS) ? 0 : 1; } catch(const FWException &ex) { diff --git a/src/iptlib/CompilerDriver_ipt_run.cpp b/src/iptlib/CompilerDriver_ipt_run.cpp index bcbdd4eec..04b9dd80d 100644 --- a/src/iptlib/CompilerDriver_ipt_run.cpp +++ b/src/iptlib/CompilerDriver_ipt_run.cpp @@ -746,6 +746,7 @@ QString CompilerDriver_ipt::run(const std::string &cluster_id, } catch (FWException &ex) { + status = ERROR; return QString::fromUtf8(ex.toString().c_str()); } diff --git a/src/libfwbuilder/src/fwcompiler/BaseCompiler.cpp b/src/libfwbuilder/src/fwcompiler/BaseCompiler.cpp index 87e53f128..548775400 100644 --- a/src/libfwbuilder/src/fwcompiler/BaseCompiler.cpp +++ b/src/libfwbuilder/src/fwcompiler/BaseCompiler.cpp @@ -152,7 +152,7 @@ void BaseCompiler::abort(const string &errstr) throw(FWException) printError(errstr); if (inEmbeddedMode()) throw FatalErrorInSingleRuleCompileMode(errors_buffer.str()); - + status = ERROR; if (test_mode) return; throw FWException("Fatal error"); } @@ -165,13 +165,14 @@ void BaseCompiler::abort(FWObject *fw, message("error", fw, ruleset, rule, errstr); if (inEmbeddedMode()) throw FatalErrorInSingleRuleCompileMode(errors_buffer.str()); - + status = ERROR; if (test_mode) return; throw FWException("Fatal error"); } void BaseCompiler::error(const string &str) { + status = ERROR; printError(str); } @@ -180,6 +181,7 @@ void BaseCompiler::error(FWObject *fw, FWObject *rule, const string &errstr) { + status = ERROR; message("error", fw, ruleset, rule, errstr); } diff --git a/src/libfwbuilder/src/fwcompiler/BaseCompiler.h b/src/libfwbuilder/src/fwcompiler/BaseCompiler.h index e2bd1a1cf..2993175bd 100644 --- a/src/libfwbuilder/src/fwcompiler/BaseCompiler.h +++ b/src/libfwbuilder/src/fwcompiler/BaseCompiler.h @@ -73,15 +73,23 @@ namespace fwcompiler { libfwbuilder::FWObject *ruleset, libfwbuilder::FWObject *rule, const std::string &errstr); + +public: + typedef enum {SUCCESS, ERROR} termination_status; + +protected: + termination_status status; public: - + virtual void setTestMode() { test_mode = true; } bool inTestMode() { return test_mode; } virtual void setEmbeddedMode() { embedded_mode = true; } bool inEmbeddedMode() { return embedded_mode; } + termination_status getStatus() { return status; } + /** * prints error message and aborts the program. If compiler is * in testing mode (flag test_mode==true), then just prints @@ -119,7 +127,13 @@ public: virtual ~BaseCompiler() {}; - BaseCompiler() {test_mode = false; embedded_mode = false; level_macro = "%LEVEL%";}; + BaseCompiler() + { + test_mode = false; + embedded_mode = false; + level_macro = "%LEVEL%"; + status = SUCCESS; + }; std::string getErrors(const std::string &comment_sep); bool haveErrorsAndWarnings(); diff --git a/src/pf/pf.cpp b/src/pf/pf.cpp index 09630eb04..1831214d7 100644 --- a/src/pf/pf.cpp +++ b/src/pf/pf.cpp @@ -155,9 +155,10 @@ int main(int argc, char **argv) } driver.compile(); delete objdb; - return 0; + return (driver.getStatus() == BaseCompiler::SUCCESS) ? 0 : 1; - } catch(const FWException &ex) { + } catch(const FWException &ex) + { cerr << ex.toString() << endl; return 1; #if __GNUC__ >= 3 diff --git a/src/pflib/CompilerDriver_ipf_run.cpp b/src/pflib/CompilerDriver_ipf_run.cpp index 07f1d1b32..6ff49997d 100644 --- a/src/pflib/CompilerDriver_ipf_run.cpp +++ b/src/pflib/CompilerDriver_ipf_run.cpp @@ -416,6 +416,7 @@ QString CompilerDriver_ipf::run(const std::string &cluster_id, } catch (FWException &ex) { + status = ERROR; return QString::fromUtf8(ex.toString().c_str()); } diff --git a/src/pflib/CompilerDriver_ipfw_run.cpp b/src/pflib/CompilerDriver_ipfw_run.cpp index f58442abc..a4ba6626a 100644 --- a/src/pflib/CompilerDriver_ipfw_run.cpp +++ b/src/pflib/CompilerDriver_ipfw_run.cpp @@ -338,6 +338,7 @@ QString CompilerDriver_ipfw::run(const std::string &cluster_id, } catch (FWException &ex) { + status = ERROR; return QString::fromUtf8(ex.toString().c_str()); } diff --git a/src/pflib/CompilerDriver_pf_run.cpp b/src/pflib/CompilerDriver_pf_run.cpp index 12419c2fa..caadf0902 100644 --- a/src/pflib/CompilerDriver_pf_run.cpp +++ b/src/pflib/CompilerDriver_pf_run.cpp @@ -685,6 +685,7 @@ QString CompilerDriver_pf::run(const std::string &cluster_id, } catch (FWException &ex) { + status = ERROR; return QString::fromUtf8(ex.toString().c_str()); } diff --git a/src/pix/pix.cpp b/src/pix/pix.cpp index 7d241d090..a343484d3 100644 --- a/src/pix/pix.cpp +++ b/src/pix/pix.cpp @@ -175,20 +175,16 @@ int main(int argc, char **argv) driver.compile(); delete objdb; - return 0; + return (driver.getStatus() == BaseCompiler::SUCCESS) ? 0 : 1; - } catch(libfwbuilder::FWException &ex) { + } catch(libfwbuilder::FWException &ex) + { cerr << ex.toString() << endl; return 1; - } catch (std::string s) { + } catch (std::string s) + { cerr << s << endl; return 1; -// } catch (std::exception ex) { -// cerr << "exception: " << ex.what() << endl; -// return 1; -// } catch (...) { -// cerr << "Unsupported exception"; -// return 1; } return 0; diff --git a/src/procurve_acl/procurve_acl.cpp b/src/procurve_acl/procurve_acl.cpp index 2b8211e4f..708fd8695 100644 --- a/src/procurve_acl/procurve_acl.cpp +++ b/src/procurve_acl/procurve_acl.cpp @@ -162,7 +162,7 @@ int main(int argc, char **argv) driver.compile(); delete objdb; - return 0; + return (driver.getStatus() == BaseCompiler::SUCCESS) ? 0 : 1; } catch(libfwbuilder::FWException &ex) {