1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-03-18 17:27:20 +01:00

fixes #2055 Compiler shows success, but there was a fatal error in the config; the problem affected compilers for all platforms, not only pix

This commit is contained in:
Vadim Kurland 2011-02-07 23:05:27 -08:00
parent faa4147b68
commit 99a0b3d412
23 changed files with 57 additions and 32 deletions

View File

@ -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"

View File

@ -1,2 +1,2 @@
#define VERSION "4.2.0.3463"
#define VERSION "4.2.0.3464"
#define GENERATION "4.2"

View File

@ -1,5 +1,10 @@
2011-02-07 Vadim Kurland <vadim@netcitadel.com>
* 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"

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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());
}

View File

@ -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 "";

View File

@ -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());
}

View File

@ -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;

View File

@ -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)
{

View File

@ -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;

View File

@ -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

View File

@ -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)
{

View File

@ -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());
}

View File

@ -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);
}

View File

@ -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();

View File

@ -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

View File

@ -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());
}

View File

@ -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());
}

View File

@ -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());
}

View File

@ -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;

View File

@ -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)
{