mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-09-11 23:53:59 +02:00
bugfix 2564
This commit is contained in:
@@ -595,7 +595,6 @@ void newFirewallDialog::addInterface()
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
InetAddr(addr.toLatin1().constData());
|
InetAddr(addr.toLatin1().constData());
|
||||||
InetAddr(netm.toLatin1().constData());
|
|
||||||
}
|
}
|
||||||
catch (FWException &ex)
|
catch (FWException &ex)
|
||||||
{
|
{
|
||||||
@@ -605,6 +604,30 @@ void newFirewallDialog::addInterface()
|
|||||||
"&Continue", QString::null, QString::null, 0, 1 );
|
"&Continue", QString::null, QString::null, 0, 1 );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
InetAddr(netm.toLatin1().constData());
|
||||||
|
}
|
||||||
|
catch (FWException &ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
bool ok = false ;
|
||||||
|
int ilen = netm.toInt (&ok);
|
||||||
|
if (ok&&(ilen>0 && ilen < 32))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QMessageBox::warning(
|
||||||
|
this,"Firewall Builder",
|
||||||
|
tr("Illegal address '%1/%2'").arg(addr).arg(netm),
|
||||||
|
"&Continue", QString::null, QString::null, 0, 1 );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
QStringList qsl;
|
QStringList qsl;
|
||||||
qsl << m_dialog->iface_name->text()
|
qsl << m_dialog->iface_name->text()
|
||||||
@@ -812,8 +835,18 @@ void newFirewallDialog::finishClicked()
|
|||||||
QString addrname=QString("%1:%2:ip").arg(m_dialog->obj_name->text()).arg(name);
|
QString addrname=QString("%1:%2:ip").arg(m_dialog->obj_name->text()).arg(name);
|
||||||
IPv4 *oa = IPv4::cast(mw->createObject(oi, IPv4::TYPENAME,addrname));
|
IPv4 *oa = IPv4::cast(mw->createObject(oi, IPv4::TYPENAME,addrname));
|
||||||
oa->setAddress( InetAddr(addr.toLatin1().constData()) );
|
oa->setAddress( InetAddr(addr.toLatin1().constData()) );
|
||||||
|
|
||||||
|
bool ok = false ;
|
||||||
|
int inetmask = netmask.toInt(&ok);
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
oa->setNetmask( InetAddr(inetmask) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
oa->setNetmask( InetAddr(netmask.toLatin1().constData()) );
|
oa->setNetmask( InetAddr(netmask.toLatin1().constData()) );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// updateObjName has a side effect: it causes redraw of the ruleset
|
// updateObjName has a side effect: it causes redraw of the ruleset
|
||||||
// views in the main window
|
// views in the main window
|
||||||
mw->updateObjName(oi,"","",false);
|
mw->updateObjName(oi,"","",false);
|
||||||
|
|||||||
@@ -503,7 +503,6 @@ void newHostDialog::addInterface()
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
InetAddr(addr.toLatin1().constData());
|
InetAddr(addr.toLatin1().constData());
|
||||||
InetAddr(netm.toLatin1().constData());
|
|
||||||
}
|
}
|
||||||
catch (FWException &ex)
|
catch (FWException &ex)
|
||||||
{
|
{
|
||||||
@@ -513,6 +512,29 @@ void newHostDialog::addInterface()
|
|||||||
"&Continue", QString::null, QString::null, 0, 1 );
|
"&Continue", QString::null, QString::null, 0, 1 );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
InetAddr(netm.toLatin1().constData());
|
||||||
|
}
|
||||||
|
catch (FWException &ex)
|
||||||
|
{
|
||||||
|
bool ok = false ;
|
||||||
|
int ilen = netm.toInt (&ok);
|
||||||
|
if (ok&&(ilen>0 && ilen < 32))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
QMessageBox::warning(
|
||||||
|
this,"Firewall Builder",
|
||||||
|
tr("Illegal address '%1/%2'").arg(addr).arg(netm),
|
||||||
|
"&Continue", QString::null, QString::null, 0, 1 );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
QStringList sl;
|
QStringList sl;
|
||||||
sl << m_dialog->iface_name->text()
|
sl << m_dialog->iface_name->text()
|
||||||
@@ -632,9 +654,19 @@ void newHostDialog::finishClicked()
|
|||||||
mw->createObject(oi, IPv4::TYPENAME,addrname)
|
mw->createObject(oi, IPv4::TYPENAME,addrname)
|
||||||
);
|
);
|
||||||
oa->setAddress( InetAddr(addr.toLatin1().constData()) );
|
oa->setAddress( InetAddr(addr.toLatin1().constData()) );
|
||||||
|
bool ok = false ;
|
||||||
|
int inetmask = netmask.toInt(&ok);
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
oa->setNetmask( InetAddr(inetmask) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
oa->setNetmask( InetAddr(netmask.toLatin1().constData()) );
|
oa->setNetmask( InetAddr(netmask.toLatin1().constData()) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
mw->updateObjName(oi,"","",false);
|
mw->updateObjName(oi,"","",false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user