1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-03-18 17:27:20 +01:00
Compile/install wizard should disable "Next" button
after compile phase is done if all firewalls failed to compile
with no errors.

see #2061
Added
bunch of common shell error messages to make sure installer
recognizes them and mark install as a failure even if ssh fails
to pass termination code.
This commit is contained in:
Vadim Kurland 2011-02-08 20:20:01 -08:00
parent abcafdd4b3
commit 9292895800
13 changed files with 55 additions and 11 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="3466"
BUILD_NUM="3467"
VERSION="$FWB_MAJOR_VERSION.$FWB_MINOR_VERSION.$FWB_MICRO_VERSION.$BUILD_NUM"

View File

@ -1,2 +1,2 @@
#define VERSION "4.2.0.3466"
#define VERSION "4.2.0.3467"
#define GENERATION "4.2"

View File

@ -1,5 +1,17 @@
2011-02-08 vadim <vadim@netcitadel.com>
* SSHUnx.cpp (SSHUnx): fixes #2061 "Installer shows success for
failed installed on FreeBSD due to corrupt script file". Added
bunch of common shell error messages to make sure installer
recognizes them and mark install as a failure even if ssh fails
to pass termination code.
* instDialog.cpp (showPage): fixes #2037 "If there is an error
when compiling firewall then installer should be
aborted". Compile/install wizard should disable "Next" button
after compile phase is done if all firewalls failed to compile
with no errors.
* configlets/bsd/update_bridge: fixes #2042 "add configlet and
shell functions to manage bridge interfaces via shell script on
OpenBSD and FreeBSD". Bridge interfaces are managed incrementally,

View File

@ -3,7 +3,7 @@
%define name fwbuilder
%define version 4.2.0.3466
%define version 4.2.0.3467
%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.3466-1
Version: 4.2.0.3467-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.3466
%define version 4.2.0.3467
%define release 1
%if "%_vendor" == "MandrakeSoft"

View File

@ -92,7 +92,8 @@ void CompilerDriver::compile()
for (list<Firewall*>::iterator it=members.begin(); it!=members.end(); ++it)
{
info("\n");
info(" Firewall " + (*it)->getName() + " member of cluster " + fw->getName());
info(" Firewall " + (*it)->getName() +
" member of cluster " + fw->getName());
CompilerDriver *cl_driver = clone();
cl_driver->configure(args);
@ -100,6 +101,8 @@ void CompilerDriver::compile()
cl_driver->run(objdb->getStringId(fw->getId()),
objdb->getStringId((*it)->getId()),
"");
if (cl_driver->status == BaseCompiler::FWCOMPILER_ERROR)
status = cl_driver->status;
delete cl_driver;
}
}

View File

@ -152,6 +152,7 @@ int main(int argc, char **argv)
}
driver.compile();
delete objdb;
return (driver.getStatus() == BaseCompiler::FWCOMPILER_SUCCESS) ? 0 : 1;
} catch(const FWException &ex)

View File

@ -72,6 +72,12 @@ SSHUnx::SSHUnx(QWidget *_par,
errorsLoggedin << "No such file or directory";
errorsLoggedin << "Cannot allocate memory";
shell_errors << "Syntax error:";
shell_errors << "No command .* found";
shell_errors << "Command not found";
shell_errors << "[fF]ile .* does not exist";
shell_errors << "[iI]nterface .* does not exist";
iptables_errors << "'iptables --help' for more information.";
iptables_errors << "'iptables-restore --help' for more information.";
iptables_errors << "iptables-restore: line .* failed";

View File

@ -38,8 +38,9 @@
class SSHUnx : public SSHSession {
Q_OBJECT
Q_OBJECT;
QStringList shell_errors;
QStringList iptables_errors;
QStringList pfctl_errors;
QStringList route_add_errors;

View File

@ -461,9 +461,24 @@ void instDialog::showPage(const int page)
// Flag compile_complete is set in instDialog::mainLoopCompile()
if (compile_complete)
{
setNextEnabled(page, true);
// See #2037: enable "Next" button only if there is at
// least one firewall that was successfully compiled.
bool can_install = false;
list<Firewall*>::iterator i;
for(i=install_fw_list.begin(); i!=install_fw_list.end(); ++i)
{
Firewall *fw = *i;
if (compile_status[fw] ==
fwcompiler::BaseCompiler::FWCOMPILER_SUCCESS)
{
setNextEnabled(page, true);
m_dialog->nextButton->setDefault(true);
can_install = true;
break;
}
}
if (!can_install) setFinishEnabled(page, true);
setBackEnabled(page, true);
m_dialog->nextButton->setDefault(true);
} else
{
mw->fileSave();

View File

@ -49,6 +49,7 @@
#include <list>
#include "fwbuilder/FWObjectDatabase.h"
#include "fwcompiler/BaseCompiler.h"
class FirewallInstaller;
class instBatchOptionsDialog;
@ -113,7 +114,9 @@ class instDialog : public QDialog, public FakeWizard
std::map<int,QTreeWidgetItem*> opListMapping;
std::list<QRegExp> error_re;
std::list<QRegExp> warning_re;
std::map<libfwbuilder::Firewall*, fwcompiler::BaseCompiler::termination_status>
compile_status;
QString path; //path of the program to execute
// QStringList args; //arguments for that program

View File

@ -359,6 +359,7 @@ void instDialog::setInProcessState(QTreeWidgetItem *item)
void instDialog::opSuccess(Firewall *fw)
{
compile_status[fw] = fwcompiler::BaseCompiler::FWCOMPILER_SUCCESS;
QTreeWidgetItem* itm = opListMapping[(fw)->getId()];
if (itm)
{
@ -373,6 +374,7 @@ void instDialog::opSuccess(Firewall *fw)
void instDialog::opError(Firewall *fw)
{
compile_status[fw] = fwcompiler::BaseCompiler::FWCOMPILER_ERROR;
QTreeWidgetItem* itm = opListMapping[(fw)->getId()];
if (itm)
{
@ -384,6 +386,7 @@ void instDialog::opError(Firewall *fw)
void instDialog::opCancelled(Firewall *fw)
{
compile_status[fw] = fwcompiler::BaseCompiler::FWCOMPILER_ERROR;
QTreeWidgetItem* itm = opListMapping[(fw)->getId()];
// itm can be NULL, for example when we install to PIX cluster
// where we skip one of the members
@ -988,7 +991,7 @@ void instDialog::fillInstallUIList()
list<Firewall*>::iterator i;
for(i=install_fw_list.begin(); i!=install_fw_list.end(); ++i)
{
f=(*i);
f = (*i);
item = new InstallFirewallViewItem(
NULL,
QString::fromUtf8(f->getName().c_str()),