mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-09-11 07:31:25 +02:00
bugfix 2564,2563
This commit is contained in:
@@ -66,7 +66,7 @@ void NetworkDialog::loadFWObject(FWObject *o)
|
||||
obj=o;
|
||||
Network *s = dynamic_cast<Network*>(obj);
|
||||
assert(s!=NULL);
|
||||
|
||||
|
||||
init=true;
|
||||
|
||||
fillLibraries(m_dialog->libs,obj);
|
||||
@@ -124,9 +124,6 @@ void NetworkDialog::validate(bool *res)
|
||||
0 );
|
||||
}
|
||||
try
|
||||
{
|
||||
InetAddr( m_dialog->netmask->text().toLatin1().constData() );
|
||||
} catch (FWException &ex)
|
||||
{
|
||||
QString len = m_dialog->netmask->text() ;
|
||||
bool ok = false ;
|
||||
@@ -134,8 +131,23 @@ void NetworkDialog::validate(bool *res)
|
||||
if (ok)
|
||||
{
|
||||
if (ilen>0 && ilen < 32)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
else
|
||||
{
|
||||
*res=false;
|
||||
QMessageBox::critical(this, "Firewall Builder",
|
||||
tr("Illegal netmask '%1'").arg( m_dialog->netmask->text() ),
|
||||
tr("&Continue"), 0, 0,
|
||||
0 );
|
||||
|
||||
}
|
||||
}
|
||||
InetAddr( m_dialog->netmask->text().toLatin1().constData() );
|
||||
} catch (FWException &ex)
|
||||
{
|
||||
|
||||
*res=false;
|
||||
QMessageBox::critical(this, "Firewall Builder",
|
||||
tr("Illegal netmask '%1'").arg( m_dialog->netmask->text() ),
|
||||
@@ -158,6 +170,7 @@ void NetworkDialog::applyChanges()
|
||||
{
|
||||
Network *s = dynamic_cast<Network*>(obj);
|
||||
assert(s!=NULL);
|
||||
s->dump(false,false);
|
||||
string oldname=obj->getName();
|
||||
obj->setName( string(m_dialog->obj_name->text().toUtf8().constData()) );
|
||||
obj->setComment( string(m_dialog->comment->toPlainText().toUtf8().constData()) );
|
||||
@@ -173,13 +186,22 @@ void NetworkDialog::applyChanges()
|
||||
|
||||
try
|
||||
{
|
||||
s->setNetmask(
|
||||
InetAddr(m_dialog->netmask->text().toLatin1().constData()) );
|
||||
QString len = m_dialog->netmask->text() ;
|
||||
bool ok = false ;
|
||||
int ilen = len.toInt (&ok);
|
||||
if (ok)
|
||||
{
|
||||
s->setNetmask(InetAddr(ilen));
|
||||
}
|
||||
else
|
||||
{
|
||||
s->setNetmask(
|
||||
InetAddr(m_dialog->netmask->text().toLatin1().constData()) );
|
||||
}
|
||||
} catch (FWException &ex)
|
||||
{
|
||||
/* exception thrown if user types illegal m_dialog->address or m_dialog->netmask */
|
||||
bool ok = false ;
|
||||
s->setNetmask(InetAddr(m_dialog->netmask->text().toInt(&ok)));
|
||||
// bool ok = false ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -606,25 +606,33 @@ void newFirewallDialog::addInterface()
|
||||
}
|
||||
try
|
||||
{
|
||||
InetAddr(netm.toLatin1().constData());
|
||||
}
|
||||
catch (FWException &ex)
|
||||
{
|
||||
|
||||
bool ok = false ;
|
||||
int ilen = netm.toInt (&ok);
|
||||
if (ok&&(ilen>0 && ilen < 32))
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
if (ok)
|
||||
{
|
||||
if (ilen>0 && ilen < 32)
|
||||
{
|
||||
QMessageBox::warning(
|
||||
this,"Firewall Builder",
|
||||
tr("Illegal address '%1/%2'").arg(addr).arg(netm),
|
||||
"&Continue", QString::null, QString::null, 0, 1 );
|
||||
return;
|
||||
"&Continue", QString::null, QString::null, 0, 1 );
|
||||
return ;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
InetAddr(netm.toLatin1().constData());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
catch (FWException &ex)
|
||||
{
|
||||
QMessageBox::warning(
|
||||
this,"Firewall Builder",
|
||||
tr("Illegal address '%1/%2'").arg(addr).arg(netm),
|
||||
"&Continue", QString::null, QString::null, 0, 1 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
+21
-12
@@ -513,27 +513,36 @@ void newHostDialog::addInterface()
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
InetAddr(netm.toLatin1().constData());
|
||||
}
|
||||
catch (FWException &ex)
|
||||
{
|
||||
bool ok = false ;
|
||||
int ilen = netm.toInt (&ok);
|
||||
if (ok&&(ilen>0 && ilen < 32))
|
||||
if (ok)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (ilen>0 && ilen < 32)
|
||||
{
|
||||
QMessageBox::warning(
|
||||
this,"Firewall Builder",
|
||||
tr("Illegal address '%1/%2'").arg(addr).arg(netm),
|
||||
"&Continue", QString::null, QString::null, 0, 1 );
|
||||
return;
|
||||
"&Continue", QString::null, QString::null, 0, 1 );
|
||||
return ;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
InetAddr(netm.toLatin1().constData());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
catch (FWException &ex)
|
||||
{
|
||||
QMessageBox::warning(
|
||||
this,"Firewall Builder",
|
||||
tr("Illegal address '%1/%2'").arg(addr).arg(netm),
|
||||
"&Continue", QString::null, QString::null, 0, 1 );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
QStringList sl;
|
||||
|
||||
Reference in New Issue
Block a user