1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-03-24 04:07:55 +01:00

trim strings provided by the user in various dialogs to make sure we dont end up with file names and other parameters that end with a white space

This commit is contained in:
Vadim Kurland 2011-10-19 10:53:32 -07:00
parent 7f41116700
commit 3db31d6828
14 changed files with 43 additions and 22 deletions

View File

@ -7,7 +7,7 @@ FWB_MICRO_VERSION=1
# build number is like "nano" version number. I am incrementing build
# number during development cycle
#
BUILD_NUM="3582"
BUILD_NUM="3583"
VERSION="$FWB_MAJOR_VERSION.$FWB_MINOR_VERSION.$FWB_MICRO_VERSION.$BUILD_NUM"

View File

@ -1,2 +1,2 @@
#define VERSION "5.0.1.3582"
#define VERSION "5.0.1.3583"
#define GENERATION "5.0"

View File

@ -1,3 +1,13 @@
2011-10-19 Vadim Kurland <vadim@netcitadel.com>
* CompilerDriver_files.cpp (CompilerDriver::getOutputFileNameInternal):
fixed a bug (no number): if the file name user entered in "Output
file name" field in the "advanced settings" dialog of a firewall
object ended with a white space, policy installer failed with an error
"No such file or directory"
* build 5.0.1.3583
2011-10-02 Vadim Kurland <vadim@netcitadel.com>
* shell_functions: see SF bug #3416900 "Replace `command` with

View File

@ -3,7 +3,7 @@
%define name fwbuilder
%define version 5.0.1.3582
%define version 5.0.1.3583
%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: 5.0.1.3582-1
Version: 5.0.1.3583-1
Depends: libqt4-gui (>= 4.4.0), libqt4-network (>= 4.4.0), libxml2, libxslt1.1, libsnmp | libsnmp15
Description: Firewall Builder GUI and policy compilers

View File

@ -1,6 +1,6 @@
%define name fwbuilder
%define version 5.0.1.3582
%define version 5.0.1.3583
%define release 1
%if "%_vendor" == "MandrakeSoft"

View File

@ -238,7 +238,7 @@ QString CompilerDriver::getOutputFileNameInternal(Firewall *current_fw,
FWOptions* options = current_fw->getOptionsObject();
QString name_from_option =
QString::fromUtf8(options->getStr(option_name.toStdString()).c_str());
QString::fromUtf8(options->getStr(option_name.toStdString()).c_str()).trimmed();
if (!name_from_option.isEmpty()) return name_from_option;
else return fw_name + "." + ext;

View File

@ -129,7 +129,7 @@ void DNSNameDialog::applyChanges()
if (st->getBool("Objects/DNSName/useNameForDNSRecord") &&
m_dialog->obj_name->text() != m_dialog->dnsrec->text())
m_dialog->dnsrec->setText(m_dialog->obj_name->text());
m_dialog->dnsrec->setText(m_dialog->obj_name->text().trimmed());
s->setSourceName( m_dialog->dnsrec->text().trimmed().toLatin1().constData() );

View File

@ -248,12 +248,14 @@ void DialogData::saveAll(FWObject *new_obj)
if (dynamic_cast<QLineEdit*>(i->w)!=NULL)
{
QLineEdit *edit=dynamic_cast<QLineEdit*>(i->w);
use_obj->setStr(i->attr.toLatin1().constData(), edit->text().toLatin1().constData() );
use_obj->setStr(i->attr.toLatin1().constData(),
edit->text().trimmed().toLatin1().constData() );
}
if (dynamic_cast<QTextEdit*>(i->w)!=NULL)
{
QTextEdit *edit=dynamic_cast<QTextEdit*>(i->w);
use_obj->setStr(i->attr.toLatin1().constData(), edit->toPlainText().toLatin1().constData() );
use_obj->setStr(i->attr.toLatin1().constData(),
edit->toPlainText().toLatin1().constData() );
}
if (dynamic_cast<QRadioButton*>(i->w)!=NULL)
{

View File

@ -844,7 +844,7 @@ QString FirewallInstaller::getGeneratedFileName(Firewall *fw)
{
FWOptions *fwopt = fw->getOptionsObject();
QString generated_file;
QString ofname = QString::fromUtf8(fwopt->getStr("output_file").c_str());
QString ofname = QString::fromUtf8(fwopt->getStr("output_file").c_str()).trimmed();
if (!ofname.isEmpty())
{
generated_file = ofname;

View File

@ -141,7 +141,7 @@ void IPv4Dialog::validate(bool *result)
assert(s!=NULL);
try
{
InetAddr( m_dialog->address->text().toLatin1().constData() );
InetAddr( m_dialog->address->text().trimmed().toLatin1().constData() );
} catch (FWException &ex)
{
*result = false;
@ -161,7 +161,7 @@ void IPv4Dialog::validate(bool *result)
{
try
{
InetAddr nm( m_dialog->netmask->text().toLatin1().constData() );
InetAddr nm( m_dialog->netmask->text().trimmed().toLatin1().constData() );
if (!nm.isValidV4Netmask())
{
@ -212,7 +212,7 @@ void IPv4Dialog::applyChanges()
try
{
s->setAddress(
InetAddr(m_dialog->address->text().toLatin1().constData()) );
InetAddr(m_dialog->address->text().trimmed().toLatin1().constData()) );
} catch (FWException &ex) { }
if ( showNetmask )
@ -220,7 +220,7 @@ void IPv4Dialog::applyChanges()
try
{
s->setNetmask(
InetAddr(m_dialog->netmask->text().toLatin1().constData()) );
InetAddr(m_dialog->netmask->text().trimmed().toLatin1().constData()) );
} catch (FWException &ex) { }
} else
s->setNetmask(InetAddr());
@ -240,7 +240,7 @@ void IPv4Dialog::DNSlookup()
if (!dnsBusy)
{
QString name = m_dialog->obj_name->text();
QString name = m_dialog->obj_name->text().trimmed();
if (fwbdebug) qDebug("IPv4Dialog::DNSlookup() name=%s", name.toAscii().constData());
dnsBusy=true;
QApplication::setOverrideCursor( QCursor( Qt::WaitCursor) );

View File

@ -144,7 +144,7 @@ void IPv6Dialog::validate(bool *res)
assert(s!=NULL);
try
{
InetAddr(AF_INET6, m_dialog->address->text().toLatin1().constData() );
InetAddr(AF_INET6, m_dialog->address->text().trimmed().toLatin1().constData() );
} catch (FWException &ex)
{
*res = false;
@ -164,7 +164,7 @@ void IPv6Dialog::validate(bool *res)
try
{
bool ok = false;
InetAddr(AF_INET6, m_dialog->netmask->text().toInt(&ok));
InetAddr(AF_INET6, m_dialog->netmask->text().trimmed().toInt(&ok));
if (!ok) throw FWException("");
} catch (FWException &ex)
{
@ -199,7 +199,7 @@ void IPv6Dialog::applyChanges()
try
{
s->setAddress(
InetAddr(AF_INET6, m_dialog->address->text().toLatin1().constData()) );
InetAddr(AF_INET6, m_dialog->address->text().trimmed().toLatin1().constData()) );
} catch (FWException &ex) { }
if ( showNetmask )
@ -208,7 +208,7 @@ void IPv6Dialog::applyChanges()
{
bool ok = false;
s->setNetmask(
InetAddr(AF_INET6, m_dialog->netmask->text().toInt(&ok)) );
InetAddr(AF_INET6, m_dialog->netmask->text().trimmed().toInt(&ok)) );
if (!ok) throw FWException("");
} catch (FWException &ex) { }
} else
@ -228,7 +228,7 @@ void IPv6Dialog::DNSlookup()
if (!dnsBusy)
{
QString name = m_dialog->obj_name->text();
QString name = m_dialog->obj_name->text().trimmed();
if (fwbdebug)
qDebug("IPv6Dialog::DNSlookup() name=%s",
name.toAscii().constData());

View File

@ -110,9 +110,9 @@ pfAdvancedDialog::pfAdvancedDialog(QWidget *parent,FWObject *o)
QString init_script_name = QString::fromUtf8(
fwopt->getStr("output_file").c_str());
fwopt->getStr("output_file").c_str()).trimmed();
QString conf_file_name = QString::fromUtf8(
fwopt->getStr("conf1_file").c_str());
fwopt->getStr("conf1_file").c_str()).trimmed();
if (!init_script_name.isEmpty() && conf_file_name.isEmpty())
{

View File

@ -156,6 +156,15 @@
</p>
</li>
<li>
<p>
fixed a bug (no number): if the file name user entered in
"Output file name" field in the "advanced settings" dialog of a
firewall object ended with a white space, policy installer failed
with an error "No such file or directory"
</p>
</li>
</ul>