mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-03-21 10:47:16 +01:00
fixes #405
This commit is contained in:
parent
fd621eefc3
commit
e2d4204cd6
@ -66,14 +66,11 @@ CompilerDriver* CompilerDriver_pix::clone()
|
||||
return new CompilerDriver_pix(objdb);
|
||||
}
|
||||
|
||||
string CompilerDriver_pix::protocolInspectorCommands(Firewall *fw)
|
||||
string CompilerDriver_pix::protocolInspectorCommands()
|
||||
{
|
||||
OSConfigurator_pix_os *oscnf =
|
||||
new OSConfigurator_pix_os(objdb , fw, false);
|
||||
oscnf->prolog();
|
||||
string res = oscnf->getProtocolInspectionCommands();
|
||||
delete oscnf;
|
||||
return res;
|
||||
OSConfigurator_pix_os oscnf(objdb , locateObject(), false);
|
||||
oscnf.prolog();
|
||||
return oscnf.getProtocolInspectionCommands();
|
||||
}
|
||||
|
||||
void CompilerDriver_pix::printProlog(QTextStream &file, const string &prolog_code)
|
||||
|
||||
@ -64,7 +64,7 @@ public:
|
||||
const std::string &firewall_id,
|
||||
const std::string &single_rule_id);
|
||||
|
||||
std::string protocolInspectorCommands(libfwbuilder::Firewall *fw);
|
||||
std::string protocolInspectorCommands();
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@ -406,6 +406,12 @@ void CompilerDriver::commonChecks2(Cluster *cluster, Firewall *fw)
|
||||
}
|
||||
}
|
||||
|
||||
void CompilerDriver::setTargetId(const string &id)
|
||||
{
|
||||
fw_by_id = true;
|
||||
fwobjectname = id.c_str();
|
||||
}
|
||||
|
||||
Firewall* CompilerDriver::locateObject()
|
||||
{
|
||||
Firewall* obj;
|
||||
|
||||
@ -118,6 +118,11 @@ public:
|
||||
*/
|
||||
virtual bool configure(const QStringList &args);
|
||||
|
||||
/**
|
||||
* Assign target object by its id
|
||||
*/
|
||||
void setTargetId(const std::string &id);
|
||||
|
||||
/**
|
||||
* create right compiler objects and compile policy, nat and
|
||||
* routing rules for given firewall which can be a member of a
|
||||
|
||||
@ -35,6 +35,8 @@
|
||||
#include "FWWindow.h"
|
||||
#include "FWBSettings.h"
|
||||
|
||||
#include "CompilerDriver_pix.h"
|
||||
|
||||
#include "fwbuilder/FWObjectDatabase.h"
|
||||
#include "fwbuilder/Firewall.h"
|
||||
#include "fwbuilder/Management.h"
|
||||
@ -63,6 +65,7 @@
|
||||
|
||||
using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
using namespace fwcompiler;
|
||||
|
||||
|
||||
pixAdvancedDialog::pixAdvancedDialog(QWidget*, FWObject *o)//(parent)
|
||||
@ -788,6 +791,12 @@ void pixAdvancedDialog::displayCommands()
|
||||
*/
|
||||
saveFixups();
|
||||
|
||||
CompilerDriver_pix driver(obj->getRoot());
|
||||
driver.setTargetId(FWObjectDatabase::getStringId(obj->getId()));
|
||||
string inspectors = driver.protocolInspectorCommands();
|
||||
m_dialog->pix_generated_fixup->setText(inspectors.c_str());
|
||||
|
||||
#if CALL_COMPILER_AS_EXT_PROCESS
|
||||
xmlChar *buffer;
|
||||
int bufsize;
|
||||
obj->getRoot()->saveToBuffer(&buffer, &bufsize);
|
||||
@ -802,6 +811,7 @@ void pixAdvancedDialog::displayCommands()
|
||||
}
|
||||
|
||||
fwb_pix_proc->write(proc_buffer.toAscii());
|
||||
#endif
|
||||
}
|
||||
|
||||
void pixAdvancedDialog::allXMLSent()
|
||||
|
||||
@ -173,7 +173,12 @@ int main(int argc, char **argv)
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
driver.compile();
|
||||
if (only_print_inspection_code)
|
||||
{
|
||||
cout << driver.protocolInspectorCommands();
|
||||
} else
|
||||
driver.compile();
|
||||
|
||||
delete objdb;
|
||||
return 0;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user