1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-03-25 04:37:22 +01:00

fixed SF bug #3038945 "ASA inspect configurations not saved".

Under some circumstances the GUI did not save changes made in the
"Inspectors" tab of the PIX advanced settings dialog into the
object.
This commit is contained in:
Vadim Kurland 2010-08-05 01:11:46 +00:00
parent d314012466
commit 767dc5034e
4 changed files with 38 additions and 20 deletions

View File

@ -1 +1 @@
#define BUILD_NUM 3203
#define BUILD_NUM 3204

View File

@ -1,5 +1,11 @@
2010-08-04 Vadim Kurland <vadim@vk.crocodile.org>
* pixAdvancedDialog.cpp (pixAdvancedDialog::displayCommands):
fixed SF bug #3038945 "ASA inspect configurations not saved".
Under some circumstances the GUI did not save changes made in the
"Inspectors" tab of the PIX advanced settings dialog into the
object.
* ObjectManipulator_tree_ops.cpp (ObjectManipulator::removeObjectFromHistory):
fixed #1661 "Crash after deleting firewall" a sequence where user deleted
an object and then hit "Back" button caused crash.

View File

@ -72,10 +72,7 @@ pixAdvancedDialog::pixAdvancedDialog(QWidget*, FWObject *o)//(parent)
{
m_dialog = new Ui::pixAdvancedDialog_q;
m_dialog->setupUi(static_cast<QDialog*>(this));
obj=o;
//Firewall *fw=Firewall::cast(obj);
//FWOptions *fwopt=fw->getOptionsObject();
obj = o;
string vers="version_"+obj->getStr("version");
string platform = obj->getStr("platform"); // could be 'pix' or 'fwsm'
@ -724,15 +721,12 @@ void pixAdvancedDialog::loadFixups()
}
}
void pixAdvancedDialog::saveFixups()
void pixAdvancedDialog::saveFixups(FWOptions *options)
{
FWOptions *options=(Firewall::cast(obj))->getOptionsObject();
assert(options!=NULL);
for (list<fixupControl>::iterator fi=allFixups.begin(); fi!=allFixups.end(); fi++)
{
string name=fi->fwoption.toLatin1().constData();
int sw=translateFixupSwitchFromWidgetToOption(
string name = fi->fwoption.toLatin1().constData();
int sw = translateFixupSwitchFromWidgetToOption(
fi->switch_widget->currentIndex());
int p1 =(fi->arg1)?fi->arg1->value():0;
@ -746,6 +740,11 @@ void pixAdvancedDialog::saveFixups()
str << sw << " " << p1 << " " << p2 << " " << on << " " << int(ov);
options->setStr( fi->fwoption.toLatin1().constData(), str.str() );
if (fwbdebug)
qDebug() << "pixAdvancedDialog::saveFixups()"
<< name.c_str()
<< str.str().c_str();
}
}
@ -757,13 +756,29 @@ void pixAdvancedDialog::displayCommands()
* need to copy information from widgets that control fixups into
* firewall object's options, so that when we dump the database into
* memory buffer, we get updated info
*
* This creates a problem however: since we save changes into the
* actual object here, the undo/redo commands don't work later on in
* accept() because we do not detect any changes and undo command is
* not placed on undo stack. Need to save FWOptions object, save fixup
* parameters into it, generate commands and then restore FWOptions
* object back
*/
saveFixups();
FWOptions *options = (Firewall::cast(obj))->getOptionsObject();
assert(options!=NULL);
FWOptions *backup_options = new FWOptions();
backup_options->duplicate(options, false);
saveFixups(options);
CompilerDriver_pix driver(obj->getRoot());
driver.setTargetId(FWObjectDatabase::getStringId(obj->getId()));
string inspectors = driver.protocolInspectorCommands();
m_dialog->pix_generated_fixup->setText(inspectors.c_str());
options->duplicate(backup_options, false);
delete backup_options;
}
void pixAdvancedDialog::updateFixupCommandsDisplay()
@ -794,11 +809,7 @@ void pixAdvancedDialog::accept()
data.saveAll(fwoptions);
saveFixups();
// PolicyInstallScript *pis = mgmt->getPolicyInstallScript();
// pis->setCommand( installScript->text() );
// pis->setArguments( installScriptArgs->text() );
saveFixups(fwoptions);
// find first interface marked as "management"
const InetAddr *mgmt_addr = Firewall::cast(new_state)->getManagementAddress();

View File

@ -40,6 +40,7 @@ class QCheckBox;
namespace libfwbuilder {
class FWObject;
class FWOptions;
};
struct fixupControl {
@ -74,15 +75,15 @@ class pixAdvancedDialog : public QDialog
bool syslogDeviceIdSupported;
Ui::pixAdvancedDialog_q *m_dialog;
public:
pixAdvancedDialog(QWidget *parent,libfwbuilder::FWObject *o);
pixAdvancedDialog(QWidget *parent, libfwbuilder::FWObject *o);
~pixAdvancedDialog();
void setDefaultTimeoutValue(const QString &option);
void updateFixupCommandsDisplay();
void loadFixups();
void saveFixups();
void saveFixups(libfwbuilder::FWOptions *options);
int translateFixupSwitchFromOptionToWidget(int o);
int translateFixupSwitchFromWidgetToOption(int o);