mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-09-11 07:31:25 +02:00
merging id-experimemt r233:HEAD
This commit is contained in:
@@ -1,3 +1,12 @@
|
||||
|
||||
2008-06-08 Vadim Kurland <vadim@vk.crocodile.org>
|
||||
|
||||
* merged branch "id-experiment" r233:HEAD
|
||||
|
||||
2008-06-07 Vadim Kurland <vadim@vk.crocodile.org>
|
||||
|
||||
* main.cpp (main): support for integer object ids
|
||||
|
||||
2008-06-06 Vadim Kurland <vadim@vk.crocodile.org>
|
||||
|
||||
* PolicyCompiler_pf_writers.cpp (PrintRule::_printUser): Support
|
||||
|
||||
@@ -124,7 +124,8 @@ public:
|
||||
/** called by the generated lexer to do error recovery, override to
|
||||
* customize the behaviour.
|
||||
*/
|
||||
virtual void recover(const RecognitionException& ex, const BitSet& tokenSet)
|
||||
virtual void recover(const RecognitionException& ,
|
||||
const BitSet& tokenSet)
|
||||
{
|
||||
consume();
|
||||
consumeUntil(tokenSet);
|
||||
|
||||
@@ -239,7 +239,8 @@ public:
|
||||
/** called by the generated parser to do error recovery, override to
|
||||
* customize the behaviour.
|
||||
*/
|
||||
virtual void recover(const RecognitionException& ex, const BitSet& tokenSet)
|
||||
virtual void recover(const RecognitionException& ,
|
||||
const BitSet& tokenSet)
|
||||
{
|
||||
consume();
|
||||
consumeUntil(tokenSet);
|
||||
|
||||
+14
-12
@@ -150,7 +150,7 @@ int fwbdebug = 0;
|
||||
class UpgradePredicate: public XMLTools::UpgradePredicate
|
||||
{
|
||||
public:
|
||||
virtual bool operator()(const string &msg) const
|
||||
virtual bool operator()(const string&) const
|
||||
{
|
||||
bool res=false;
|
||||
cout << _("Data file has been created in the old version of Firewall Builder.") << endl << flush;
|
||||
@@ -280,7 +280,7 @@ FWObject *getObject(const char *objstr) throw (FWException)
|
||||
}
|
||||
} else {
|
||||
/* got object ID */
|
||||
obj=objdb->getById(objstr,true);
|
||||
obj=objdb->getById(FWObjectDatabase::getIntId(objstr), true);
|
||||
if (obj==NULL)
|
||||
{
|
||||
SNPRINTF(errstr,sizeof(errstr),_("Object with ID='%s' not found"),objstr );
|
||||
@@ -601,7 +601,7 @@ int main(int argc, char * const *argv)
|
||||
{
|
||||
nlib=*i;
|
||||
lib=nlib->getName();
|
||||
if (nlib->getId()!="sysid99")
|
||||
if (nlib->getId()!=FWObjectDatabase::DELETED_OBJECTS_ID)
|
||||
{
|
||||
ro_flag=nlib->isReadOnly();
|
||||
cout << _("Library: ") << lib << ((ro_flag)?"(Read only)":" ") << endl;
|
||||
@@ -880,11 +880,12 @@ int main(int argc, char * const *argv)
|
||||
FWObject *nobj=createObject(objtype,"/"+lib+"/"+systemGroupPaths[objtype]);
|
||||
TCPService *o=TCPService::cast(nobj);
|
||||
o->setName(name);
|
||||
o->setInt("src_range_start",atoi(addr1.c_str()));
|
||||
o->setInt("src_range_end",atoi(addr2.c_str()));
|
||||
o->setInt("dst_range_start",atoi(addr3.c_str()));
|
||||
o->setInt("dst_range_end",atoi(addr4.c_str()));
|
||||
|
||||
|
||||
o->setSrcRangeStart(atoi(addr1.c_str()));
|
||||
o->setSrcRangeEnd( atoi(addr2.c_str()));
|
||||
o->setDstRangeStart(atoi(addr3.c_str()));
|
||||
o->setDstRangeEnd( atoi(addr4.c_str()));
|
||||
|
||||
o->setBool("urg_flag_mask",mask.find('u')!=string::npos || mask.find('U')!=string::npos);
|
||||
o->setBool("ack_flag_mask",mask.find('a')!=string::npos || mask.find('A')!=string::npos);
|
||||
o->setBool("psh_flag_mask",mask.find('p')!=string::npos || mask.find('P')!=string::npos);
|
||||
@@ -910,10 +911,11 @@ int main(int argc, char * const *argv)
|
||||
FWObject *nobj=createObject(objtype,"/"+lib+"/"+systemGroupPaths[objtype]);
|
||||
UDPService *o=UDPService::cast(nobj);
|
||||
o->setName(name);
|
||||
o->setInt("src_range_start",atoi(addr1.c_str()));
|
||||
o->setInt("src_range_end",atoi(addr2.c_str()));
|
||||
o->setInt("dst_range_start",atoi(addr3.c_str()));
|
||||
o->setInt("dst_range_end",atoi(addr4.c_str()));
|
||||
|
||||
o->setSrcRangeStart(atoi(addr1.c_str()));
|
||||
o->setSrcRangeEnd( atoi(addr2.c_str()));
|
||||
o->setDstRangeStart(atoi(addr3.c_str()));
|
||||
o->setDstRangeEnd( atoi(addr4.c_str()));
|
||||
|
||||
}
|
||||
else if (objtype==ICMPService::TYPENAME)
|
||||
|
||||
+10
-10
@@ -238,7 +238,7 @@ int main(int argc, char * const *argv)
|
||||
}
|
||||
} else {
|
||||
/* got object ID */
|
||||
obj=objdb->getById(object,true);
|
||||
obj=objdb->getById(FWObjectDatabase::getIntId(object), true);
|
||||
if (obj==NULL)
|
||||
{
|
||||
SNPRINTF(errstr,sizeof(errstr),_("Object with ID='%s' not found"),object );
|
||||
@@ -255,7 +255,7 @@ int main(int argc, char * const *argv)
|
||||
SNPRINTF(errstr,sizeof(errstr),
|
||||
_("Object %s (ID='%s') does not have attribute %s"),
|
||||
obj->getName().c_str(),
|
||||
obj->getId().c_str(),
|
||||
FWObjectDatabase::getStringId(obj->getId()).c_str(),
|
||||
attr );
|
||||
throw FWException(errstr);
|
||||
}
|
||||
@@ -273,9 +273,9 @@ int main(int argc, char * const *argv)
|
||||
} else
|
||||
{
|
||||
SNPRINTF(errstr,sizeof(errstr),
|
||||
_("Object %s (ID='%s') has no options"),
|
||||
obj->getName().c_str(),
|
||||
obj->getId().c_str() );
|
||||
_("Object %s (ID='%s') has no options"),
|
||||
obj->getName().c_str(),
|
||||
FWObjectDatabase::getStringId(obj->getId()).c_str() );
|
||||
throw FWException(errstr);
|
||||
}
|
||||
} else
|
||||
@@ -283,7 +283,7 @@ int main(int argc, char * const *argv)
|
||||
SNPRINTF(errstr,sizeof(errstr),
|
||||
_("Can not print management address for %s (ID='%s'): only Host and Firewall objects have management interface"),
|
||||
obj->getName().c_str(),
|
||||
obj->getId().c_str() );
|
||||
FWObjectDatabase::getStringId(obj->getId()).c_str() );
|
||||
throw FWException(errstr);
|
||||
}
|
||||
|
||||
@@ -297,7 +297,7 @@ int main(int argc, char * const *argv)
|
||||
SNPRINTF(errstr,sizeof(errstr),
|
||||
_("Can not print address for %s (ID='%s'): objects of this type do not have address"),
|
||||
obj->getName().c_str(),
|
||||
obj->getId().c_str() );
|
||||
FWObjectDatabase::getStringId(obj->getId()).c_str() );
|
||||
throw FWException(errstr);
|
||||
}
|
||||
}
|
||||
@@ -309,7 +309,7 @@ int main(int argc, char * const *argv)
|
||||
SNPRINTF(errstr,sizeof(errstr),
|
||||
_("Can not print label for %s (ID='%s'): only Interface object has label"),
|
||||
obj->getName().c_str(),
|
||||
obj->getId().c_str() );
|
||||
FWObjectDatabase::getStringId(obj->getId()).c_str() );
|
||||
throw FWException(errstr);
|
||||
}
|
||||
}
|
||||
@@ -326,14 +326,14 @@ int main(int argc, char * const *argv)
|
||||
SNPRINTF(errstr,sizeof(errstr),
|
||||
_("Object %s (ID='%s') does not have management interface"),
|
||||
obj->getName().c_str(),
|
||||
obj->getId().c_str() );
|
||||
FWObjectDatabase::getStringId(obj->getId()).c_str() );
|
||||
throw FWException(errstr);
|
||||
}
|
||||
} else {
|
||||
SNPRINTF(errstr,sizeof(errstr),
|
||||
_("Can not print management address for %s (ID='%s'): only Host and Firewall objects have management interface"),
|
||||
obj->getName().c_str(),
|
||||
obj->getId().c_str() );
|
||||
FWObjectDatabase::getStringId(obj->getId()).c_str() );
|
||||
throw FWException(errstr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ void AddressRangeDialog::validate(bool *res)
|
||||
}
|
||||
}
|
||||
|
||||
void AddressRangeDialog::isChanged(bool *res)
|
||||
void AddressRangeDialog::isChanged(bool *)
|
||||
{
|
||||
//*res=(!init && apply->isEnabled());
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ void AddressTableDialog::validate(bool *res)
|
||||
if (!validateName(this,obj,m_dialog->obj_name->text())) { *res=false; return; }
|
||||
}
|
||||
|
||||
void AddressTableDialog::isChanged(bool *res)
|
||||
void AddressTableDialog::isChanged(bool *)
|
||||
{
|
||||
//*res=(!init && apply->isEnabled());
|
||||
}
|
||||
|
||||
@@ -61,10 +61,10 @@ void AskLibForCopyDialog::loadObjects()
|
||||
{
|
||||
FWObject *lib = (*i);
|
||||
|
||||
if ((lib->getId()==DELETED_LIB &&
|
||||
if ((lib->getId()==FWObjectDatabase::DELETED_OBJECTS_ID &&
|
||||
! st->getBool("UI/ShowDeletedObjects"))||
|
||||
lib->getId() == STANDARD_LIB ||
|
||||
lib->getId() == TEMPLATE_LIB)
|
||||
lib->getId() == FWObjectDatabase::STANDARD_LIB_ID ||
|
||||
lib->getId() == FWObjectDatabase::TEMPLATE_LIB_ID)
|
||||
continue;
|
||||
|
||||
int ind = addLib( lib );
|
||||
|
||||
@@ -129,7 +129,7 @@ void DialogData::loadToWidget( DialogOption &dopt , bool override)
|
||||
*/
|
||||
slist.clear();
|
||||
|
||||
unsigned idx = 0;
|
||||
int idx = 0;
|
||||
QStringList::iterator i1 = dopt.mapping.begin();
|
||||
QStringList::iterator i2 = dopt.mapping.begin();
|
||||
++i2;
|
||||
|
||||
+3
-2
@@ -331,7 +331,8 @@ FWBTree::FWBTree()
|
||||
bool FWBTree::isSystem(FWObject *obj)
|
||||
{
|
||||
if (Library::isA(obj))
|
||||
return (obj->getId()==STANDARD_LIB || obj->getId()==DELETED_LIB);
|
||||
return (obj->getId()==FWObjectDatabase::STANDARD_LIB_ID ||
|
||||
obj->getId()==FWObjectDatabase::DELETED_OBJECTS_ID);
|
||||
|
||||
if (FWObjectDatabase::isA(obj)) return true;
|
||||
|
||||
@@ -346,7 +347,7 @@ bool FWBTree::isSystem(FWObject *obj)
|
||||
|
||||
bool FWBTree::isStandardId(FWObject *obj)
|
||||
{
|
||||
return standardIDs[ obj->getId() ];
|
||||
return standardIDs[ FWObjectDatabase::getStringId(obj->getId()).c_str() ];
|
||||
}
|
||||
|
||||
bool FWBTree::validateForInsertion(FWObject *target, FWObject *obj)
|
||||
|
||||
@@ -56,9 +56,9 @@ FWObjectClipboard::~FWObjectClipboard()
|
||||
|
||||
void FWObjectClipboard::clear()
|
||||
{
|
||||
for (vector<string>::iterator i=ids.begin(); i!=ids.end(); ++i)
|
||||
for (vector<int>::iterator i=ids.begin(); i!=ids.end(); ++i)
|
||||
{
|
||||
FWObject *obj= mw->db()->findInIndex(*i);
|
||||
FWObject *obj = mw->db()->findInIndex(*i);
|
||||
if (obj) obj->unref();
|
||||
}
|
||||
ids.clear();
|
||||
@@ -70,7 +70,9 @@ void FWObjectClipboard::add(FWObject *_obj, ProjectPanel * fww)
|
||||
if (fwbdebug)
|
||||
{
|
||||
qDebug("FWObjectClipboard::add adding _obj=%p (id=%s)",
|
||||
_obj,_obj->getId().c_str());
|
||||
_obj,
|
||||
FWObjectDatabase::getStringId(_obj->getId()).c_str()
|
||||
);
|
||||
}
|
||||
|
||||
_obj->ref();
|
||||
@@ -90,20 +92,26 @@ FWObject* FWObjectClipboard::getObject()
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size_t FWObjectClipboard::windowsCount (){return windows.size();}
|
||||
ProjectPanel * FWObjectClipboard::getWindowByIdx (int idx)
|
||||
{
|
||||
if (idx<windowsCount ())
|
||||
{
|
||||
return windows[idx];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
libfwbuilder::FWObject* FWObjectClipboard::getObjectByIdx (int idx)
|
||||
size_t FWObjectClipboard::windowsCount ()
|
||||
{
|
||||
std::string s1 = ids[idx];
|
||||
ProjectPanel * w1 = windows[idx];
|
||||
FWObject *co= w1->db()->findInIndex(s1);
|
||||
return co;
|
||||
//w1->db()->FWObject *co= win->db()->findInIndex(*i);
|
||||
}
|
||||
return windows.size();
|
||||
}
|
||||
|
||||
ProjectPanel * FWObjectClipboard::getWindowByIdx (int idx)
|
||||
{
|
||||
if (idx < int(windowsCount()))
|
||||
{
|
||||
return windows[idx];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
FWObject* FWObjectClipboard::getObjectByIdx (int idx)
|
||||
{
|
||||
int s1 = ids[idx];
|
||||
ProjectPanel * w1 = windows[idx];
|
||||
FWObject *co= w1->db()->findInIndex(s1);
|
||||
return co;
|
||||
//w1->db()->FWObject *co= win->db()->findInIndex(*i);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,8 +36,8 @@ class libfwbuilder::FWObject;
|
||||
class ProjectPanel ;
|
||||
class FWObjectClipboard {
|
||||
|
||||
std::vector<std::string> ids;
|
||||
std::vector<ProjectPanel*> windows;
|
||||
std::vector<int> ids;
|
||||
std::vector<ProjectPanel*> windows;
|
||||
|
||||
public:
|
||||
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
/**
|
||||
* adds an object to the clipboard
|
||||
*/
|
||||
void add(libfwbuilder::FWObject*,ProjectPanel * fww=NULL);
|
||||
void add(libfwbuilder::FWObject*, ProjectPanel * fww=NULL);
|
||||
|
||||
/**
|
||||
* returns the last added object
|
||||
@@ -58,13 +58,16 @@ public:
|
||||
* clear the clipboard
|
||||
*/
|
||||
void clear();
|
||||
size_t windowsCount ();
|
||||
ProjectPanel * getWindowByIdx (int idx);
|
||||
|
||||
size_t windowsCount ();
|
||||
|
||||
ProjectPanel * getWindowByIdx (int idx);
|
||||
libfwbuilder::FWObject* getObjectByIdx (int idx);
|
||||
std::vector<std::string>::iterator begin() { return ids.begin(); }
|
||||
std::vector<std::string>::iterator end() { return ids.end(); }
|
||||
std::vector<std::string>::reverse_iterator rbegin() { return ids.rbegin(); }
|
||||
std::vector<std::string>::reverse_iterator rend() { return ids.rend(); }
|
||||
|
||||
std::vector<int>::iterator begin() { return ids.begin(); }
|
||||
std::vector<int>::iterator end() { return ids.end(); }
|
||||
std::vector<int>::reverse_iterator rbegin() { return ids.rbegin(); }
|
||||
std::vector<int>::reverse_iterator rend() { return ids.rend(); }
|
||||
int size() { return ids.size(); }
|
||||
|
||||
static FWObjectClipboard *obj_clipboard;
|
||||
|
||||
@@ -72,7 +72,7 @@ FWObjectDropArea::FWObjectDropArea(QWidget*p, const char * n, Qt::WFlags f):
|
||||
helperText =tr("Drop object here.");
|
||||
|
||||
}
|
||||
void FWObjectDropArea::paintEvent(QPaintEvent *ev)
|
||||
void FWObjectDropArea::paintEvent(QPaintEvent *)
|
||||
{
|
||||
int w=width();
|
||||
int h=height();
|
||||
@@ -215,7 +215,7 @@ void FWObjectDropArea::dragEnterEvent( QDragEnterEvent *ev)
|
||||
|
||||
void FWObjectDropArea::pasteObject()
|
||||
{
|
||||
vector<string>::iterator i;
|
||||
vector<int>::iterator i;
|
||||
for( i= FWObjectClipboard::obj_clipboard->begin();
|
||||
i!=FWObjectClipboard::obj_clipboard->end(); ++i)
|
||||
{
|
||||
|
||||
@@ -202,10 +202,10 @@ QString FWObjectPropertiesFactory::getObjectProperties(FWObject *obj)
|
||||
{
|
||||
int sps,spe,dps,dpe;
|
||||
|
||||
sps=obj->getInt("src_range_start");
|
||||
spe=obj->getInt("src_range_end");
|
||||
dps=obj->getInt("dst_range_start");
|
||||
dpe=obj->getInt("dst_range_end");
|
||||
sps=TCPUDPService::cast(obj)->getSrcRangeStart();
|
||||
spe=TCPUDPService::cast(obj)->getSrcRangeEnd();
|
||||
dps=TCPUDPService::cast(obj)->getDstRangeStart();
|
||||
dpe=TCPUDPService::cast(obj)->getDstRangeEnd();
|
||||
|
||||
str << sps << ":" << spe << " / ";
|
||||
str << dps << ":" << dpe;
|
||||
@@ -265,7 +265,7 @@ QString FWObjectPropertiesFactory::getObjectPropertiesDetailed(FWObject *obj,
|
||||
if (!tooltip)
|
||||
{
|
||||
str += QObject::tr("<b>Object Id:</b> ");
|
||||
str += QString(obj->getId().c_str()) + "<br>\n";
|
||||
str += QString(FWObjectDatabase::getStringId(obj->getId()).c_str()) + "<br>\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -497,10 +497,10 @@ QString FWObjectPropertiesFactory::getObjectPropertiesDetailed(FWObject *obj,
|
||||
{
|
||||
int sps,spe,dps,dpe;
|
||||
|
||||
sps=obj->getInt("src_range_start");
|
||||
spe=obj->getInt("src_range_end");
|
||||
dps=obj->getInt("dst_range_start");
|
||||
dpe=obj->getInt("dst_range_end");
|
||||
sps=TCPUDPService::cast(obj)->getSrcRangeStart();
|
||||
spe=TCPUDPService::cast(obj)->getSrcRangeEnd();
|
||||
dps=TCPUDPService::cast(obj)->getDstRangeStart();
|
||||
dpe=TCPUDPService::cast(obj)->getDstRangeEnd();
|
||||
|
||||
if (showPath && !tooltip) str += "<b>Path: </b>" + path + "<br>\n";
|
||||
str += "<table cellspacing=\"0\" cellpadding=\"0\">";
|
||||
|
||||
@@ -153,13 +153,13 @@ void FindObjectWidget::find()
|
||||
findNext();
|
||||
}
|
||||
|
||||
bool FindObjectWidget::matchID(const QString &id)
|
||||
bool FindObjectWidget::matchID(int id)
|
||||
{
|
||||
if (m_widget->findDropArea->isEmpty()) return true;
|
||||
QString s=QString::fromUtf8(m_widget->findDropArea->getObject()->getId().c_str() );
|
||||
|
||||
return s==id;
|
||||
int s_id = m_widget->findDropArea->getObject()->getId();
|
||||
return s_id==id;
|
||||
}
|
||||
|
||||
bool FindObjectWidget::matchAttr(libfwbuilder::FWObject *obj)
|
||||
{
|
||||
if (!m_widget->findDropArea->isEmpty()) return true;
|
||||
@@ -206,22 +206,26 @@ bool FindObjectWidget::matchAttr(libfwbuilder::FWObject *obj)
|
||||
if (m_widget->useRegexp->isChecked())
|
||||
{
|
||||
QString port;
|
||||
port.setNum(obj->getInt("src_range_start"));
|
||||
port.setNum(TCPUDPService::cast(obj)->getSrcRangeStart());
|
||||
res |= ( port.indexOf( QRegExp(s) )!=-1 );
|
||||
port.setNum(obj->getInt("src_range_end"));
|
||||
port.setNum(TCPUDPService::cast(obj)->getSrcRangeEnd());
|
||||
res |= ( port.indexOf( QRegExp(s) )!=-1 );
|
||||
port.setNum(obj->getInt("dst_range_start"));
|
||||
port.setNum(TCPUDPService::cast(obj)->getDstRangeStart());
|
||||
res |= ( port.indexOf( QRegExp(s) )!=-1 );
|
||||
port.setNum(obj->getInt("dst_range_end"));
|
||||
port.setNum(TCPUDPService::cast(obj)->getDstRangeEnd());
|
||||
res |= ( port.indexOf( QRegExp(s) )!=-1 );
|
||||
} else
|
||||
{
|
||||
bool conversion_status = false;
|
||||
int port = s.toInt(&conversion_status);
|
||||
res |= (conversion_status && (port == obj->getInt("src_range_start")));
|
||||
res |= (conversion_status && (port == obj->getInt("src_range_end")));
|
||||
res |= (conversion_status && (port == obj->getInt("dst_range_start")));
|
||||
res |= (conversion_status && (port == obj->getInt("dst_range_end")));
|
||||
res |= (conversion_status &&
|
||||
(port == TCPUDPService::cast(obj)->getSrcRangeStart()));
|
||||
res |= (conversion_status &&
|
||||
(port == TCPUDPService::cast(obj)->getSrcRangeEnd()));
|
||||
res |= (conversion_status &&
|
||||
(port == TCPUDPService::cast(obj)->getDstRangeStart()));
|
||||
res |= (conversion_status &&
|
||||
(port == TCPUDPService::cast(obj)->getDstRangeEnd()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -304,14 +308,12 @@ loop:
|
||||
if (FWReference::cast(o)!=NULL)
|
||||
{
|
||||
FWReference *r=FWReference::cast(o);
|
||||
if (
|
||||
matchAttr( r->getPointer() ) &&
|
||||
matchID( QString::fromUtf8(r->getPointer()->getId().c_str()) )) break;
|
||||
if (matchAttr( r->getPointer() ) &&
|
||||
matchID( r->getPointer()->getId() )) break;
|
||||
} else
|
||||
{
|
||||
if (
|
||||
matchAttr( o ) &&
|
||||
matchID( QString::fromUtf8(o->getId().c_str()) )) break;
|
||||
if (matchAttr( o ) &&
|
||||
matchID( o->getId() )) break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -352,7 +354,9 @@ loop:
|
||||
if (fwbdebug)
|
||||
{
|
||||
qDebug("Found object: o=%p id=%s name=%s type=%s",
|
||||
o, o->getId().c_str(),o->getName().c_str(),o->getTypeName().c_str());
|
||||
o,
|
||||
FWObjectDatabase::getStringId(o->getId()).c_str(),
|
||||
o->getName().c_str(),o->getTypeName().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -447,14 +451,12 @@ void FindObjectWidget::replaceAll()
|
||||
if (FWReference::cast(o)!=NULL)
|
||||
{
|
||||
FWReference *r=FWReference::cast(o);
|
||||
if (
|
||||
matchAttr( r->getPointer() ) &&
|
||||
matchID( QString::fromUtf8(r->getPointer()->getId().c_str()) )) break;
|
||||
if (matchAttr( r->getPointer() ) &&
|
||||
matchID( r->getPointer()->getId() )) break;
|
||||
} else
|
||||
{
|
||||
if (
|
||||
matchAttr( o ) &&
|
||||
matchID( QString::fromUtf8(o->getId().c_str()) )) break;
|
||||
if (matchAttr( o ) &&
|
||||
matchID( o->getId() )) break;
|
||||
}
|
||||
}
|
||||
if (treeSeeker==mw->db()->tree_end())
|
||||
@@ -492,7 +494,7 @@ FWObject* FindObjectWidget::_replaceCurrent()
|
||||
if (RuleElement::cast(p)==NULL || !RuleElement::cast(p)->isAny())
|
||||
{
|
||||
/* avoid duplicates */
|
||||
string cp_id=ro->getId();
|
||||
int cp_id = ro->getId();
|
||||
FWObject *oo;
|
||||
FWReference *ref;
|
||||
|
||||
@@ -511,7 +513,7 @@ FWObject* FindObjectWidget::_replaceCurrent()
|
||||
FWObject *to;
|
||||
FWReference *ref;
|
||||
list<FWObject*>::iterator i;
|
||||
string id=m_widget->replaceDropArea->getObject()->getId();
|
||||
int id = m_widget->replaceDropArea->getObject()->getId();
|
||||
for (i=p->begin();i!=p->end();++i)
|
||||
{
|
||||
to=*i;
|
||||
|
||||
@@ -49,7 +49,7 @@ class FindObjectWidget : public QWidget
|
||||
libfwbuilder::Firewall* selectedFirewall;
|
||||
|
||||
bool matchName(const QString &name);
|
||||
bool matchID(const QString &name);
|
||||
bool matchID(int id);
|
||||
bool matchAttr(libfwbuilder::FWObject* obj);
|
||||
bool validateReplaceObject();
|
||||
libfwbuilder::FWObject* _replaceCurrent();
|
||||
|
||||
@@ -220,7 +220,7 @@ void FirewallDialog::validate(bool *res)
|
||||
if (!validateName(this,obj,m_dialog->obj_name->text())) { *res=false; return; }
|
||||
}
|
||||
|
||||
void FirewallDialog::isChanged(bool *res)
|
||||
void FirewallDialog::isChanged(bool*)
|
||||
{
|
||||
if (fwbdebug)
|
||||
qDebug("FirewallDialog::isChanged");
|
||||
|
||||
@@ -263,12 +263,12 @@ void GroupObjectDialog::insertObject(FWObject *o)
|
||||
o->getName().c_str(), g->getName().c_str());
|
||||
|
||||
/* avoid duplicates */
|
||||
string cp_id=o->getId();
|
||||
int cp_id = o->getId();
|
||||
|
||||
map<string, ObjectListViewItem*>::iterator i;
|
||||
map<int, ObjectListViewItem*>::iterator i;
|
||||
for (i=allListViewItems.begin(); i!=allListViewItems.end(); ++i)
|
||||
{
|
||||
string go=(*i).first;
|
||||
int go = (*i).first;
|
||||
//if (FWReference::cast(go)!=NULL) go=FWReference::cast(go)->getPointer();
|
||||
//if (o==go || o->getId()==go->getId()) return;
|
||||
if(go==cp_id) return;
|
||||
@@ -312,7 +312,7 @@ void GroupObjectDialog::addIcon(FWObject *o,bool ref)
|
||||
}
|
||||
|
||||
ObjectIconViewItem *ivitm = new ObjectIconViewItem(iconView,obj_name,pm );
|
||||
ivitm->setProperty("id", o->getId().c_str() );
|
||||
//ivitm->setProperty("id", o->getId().c_str() );
|
||||
ivitm->setProperty("type", o->getTypeName().c_str() );
|
||||
ivitm->setFWObject( o );
|
||||
|
||||
@@ -325,7 +325,7 @@ void GroupObjectDialog::addIcon(FWObject *o,bool ref)
|
||||
tvitm->setText( 1, FWObjectPropertiesFactory::getObjectProperties(o) );
|
||||
tvitm->setIcon( 0, QIcon(pm) );
|
||||
|
||||
tvitm->setProperty("id", o->getId().c_str() );
|
||||
//tvitm->setProperty("id", o->getId().c_str() );
|
||||
tvitm->setProperty("type", o->getTypeName().c_str() );
|
||||
tvitm->setFWObject( o );
|
||||
|
||||
@@ -428,7 +428,7 @@ void GroupObjectDialog::applyChanges()
|
||||
|
||||
set<FWObject*> oldobj;
|
||||
set<FWObject*> newobj;
|
||||
map<string, ObjectListViewItem*>::iterator i;
|
||||
map<int, ObjectListViewItem*>::iterator i;
|
||||
for (i=allListViewItems.begin(); i!=allListViewItems.end(); ++i)
|
||||
{
|
||||
newobj.insert( mw->db()->findInIndex((*i).first) );
|
||||
@@ -647,7 +647,7 @@ void GroupObjectDialog::cutObj()
|
||||
|
||||
void GroupObjectDialog::pasteObj()
|
||||
{
|
||||
vector<string>::iterator i;
|
||||
vector<int>::iterator i;
|
||||
|
||||
for (i= FWObjectClipboard::obj_clipboard->begin();
|
||||
i!=FWObjectClipboard::obj_clipboard->end(); ++i)
|
||||
|
||||
@@ -55,8 +55,8 @@ class GroupObjectDialog : public QWidget
|
||||
std::vector<libfwbuilder::FWObject*> selectedObjects;
|
||||
|
||||
libfwbuilder::FWObject *selectedObject;
|
||||
std::map<std::string, ObjectIconViewItem*> allIconViewItems;
|
||||
std::map<std::string, ObjectListViewItem*> allListViewItems;
|
||||
std::map<int, ObjectIconViewItem*> allIconViewItems;
|
||||
std::map<int, ObjectListViewItem*> allListViewItems;
|
||||
|
||||
bool init;
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ void HostDialog::validate(bool *res)
|
||||
if (!validateName(this,obj,m_dialog->obj_name->text())) { *res=false; return; }
|
||||
}
|
||||
|
||||
void HostDialog::isChanged(bool *res)
|
||||
void HostDialog::isChanged(bool*)
|
||||
{
|
||||
//*res=(!init && apply->isEnabled());
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ void IPv4Dialog::validate(bool *res)
|
||||
}
|
||||
}
|
||||
|
||||
void IPv4Dialog::isChanged(bool *res)
|
||||
void IPv4Dialog::isChanged(bool *)
|
||||
{
|
||||
//*res=(!init && apply->isEnabled());
|
||||
|
||||
|
||||
@@ -587,10 +587,11 @@ FWObject* Importer::getTCPService(int srs, int sre,
|
||||
|
||||
TCPService* s = TCPService::cast(
|
||||
createObject(TCPService::TYPENAME, nstr.str()));
|
||||
s->setInt("src_range_start", srs);
|
||||
s->setInt("src_range_end", sre);
|
||||
s->setInt("dst_range_start", drs);
|
||||
s->setInt("dst_range_end", dre);
|
||||
s->setSrcRangeStart(srs);
|
||||
s->setSrcRangeEnd(sre);
|
||||
s->setDstRangeStart(drs);
|
||||
s->setDstRangeEnd(dre);
|
||||
|
||||
|
||||
if (!flags_mask.empty() && !flags_comp.empty())
|
||||
{
|
||||
@@ -652,10 +653,10 @@ FWObject* Importer::getUDPService(int srs, int sre, int drs, int dre)
|
||||
<< srs << "-" << sre << ":" << drs << "-" << dre;
|
||||
|
||||
UDPService* s = UDPService::cast(createObject(UDPService::TYPENAME, nstr.str()));
|
||||
s->setInt("src_range_start", srs);
|
||||
s->setInt("src_range_end", sre);
|
||||
s->setInt("dst_range_start", drs);
|
||||
s->setInt("dst_range_end", dre);
|
||||
s->setSrcRangeStart(srs);
|
||||
s->setSrcRangeEnd(sre);
|
||||
s->setDstRangeStart(drs);
|
||||
s->setDstRangeEnd(dre);
|
||||
|
||||
s->setComment(cstr.str());
|
||||
all_objects[sstr.str()] = s;
|
||||
|
||||
@@ -63,7 +63,7 @@ InterfaceData::InterfaceData(const libfwbuilder::Interface &iface)
|
||||
networkZone = iface.getStr("network_zone");
|
||||
}
|
||||
|
||||
void InterfaceData::guessLabel(const string &platform)
|
||||
void InterfaceData::guessLabel(const string&)
|
||||
{
|
||||
/*
|
||||
* some firewalls report fairly regular names for interfaces through
|
||||
@@ -88,7 +88,7 @@ void InterfaceData::guessLabel(const string &platform)
|
||||
|
||||
|
||||
|
||||
void InterfaceData::guessSecurityLevel(const string &platform)
|
||||
void InterfaceData::guessSecurityLevel(const string&)
|
||||
{
|
||||
InetAddrMask n10(InetAddr("10.0.0.0"), InetAddr("255.0.0.0"));
|
||||
InetAddrMask n172(InetAddr("172.16.0.0"), InetAddr("255.240.0.0"));
|
||||
|
||||
+16
-13
@@ -163,8 +163,8 @@ void InterfaceDialog::loadFWObject(FWObject *o)
|
||||
|
||||
int n=0;
|
||||
|
||||
netzoneObjectIDs["sysid0"]=n;
|
||||
netzoneObjectNos[n]="sysid0";
|
||||
netzoneObjectIDs[FWObjectDatabase::ANY_ADDRESS_ID] = n;
|
||||
netzoneObjectNos[n] = FWObjectDatabase::ANY_ADDRESS_ID;
|
||||
netzoneObjectNames.push_back(" Any ");
|
||||
|
||||
++n;
|
||||
@@ -177,7 +177,7 @@ void InterfaceDialog::loadFWObject(FWObject *o)
|
||||
FWObject *library= *l;
|
||||
FWObject *o1,*o2;
|
||||
|
||||
if ( library->getId()==DELETED_LIB ) continue;
|
||||
if ( library->getId()==FWObjectDatabase::DELETED_OBJECTS_ID ) continue;
|
||||
|
||||
o1=library->findObjectByName(ObjectGroup::TYPENAME,"Objects");
|
||||
assert(o1!=NULL);
|
||||
@@ -185,15 +185,15 @@ void InterfaceDialog::loadFWObject(FWObject *o)
|
||||
if (o2==NULL)
|
||||
{
|
||||
if (fwbdebug)
|
||||
qDebug("InterfaceDialog::loadFWObject missing Groups group in %s",o1->getId().c_str());
|
||||
qDebug("InterfaceDialog::loadFWObject missing Groups group in %s", FWObjectDatabase::getStringId(o1->getId()).c_str());
|
||||
continue;
|
||||
}
|
||||
// assert(o2!=NULL);
|
||||
|
||||
for (FWObject::iterator i=o2->begin(); i!=o2->end(); ++i)
|
||||
{
|
||||
netzoneObjectIDs[ (*i)->getId().c_str() ]=n;
|
||||
netzoneObjectNos[n]= (*i)->getId().c_str();
|
||||
netzoneObjectIDs[(*i)->getId()] = n;
|
||||
netzoneObjectNos[n] =(*i)->getId();
|
||||
netzoneObjectNames.push_back(
|
||||
tr("Group: ")+ (*i)->getName().c_str() );
|
||||
++n;
|
||||
@@ -203,15 +203,16 @@ void InterfaceDialog::loadFWObject(FWObject *o)
|
||||
if (o2==NULL)
|
||||
{
|
||||
if (fwbdebug)
|
||||
qDebug("InterfaceDialog::loadFWObject missing Networks group in %s",o1->getId().c_str());
|
||||
qDebug("InterfaceDialog::loadFWObject missing Networks group in %s",
|
||||
FWObjectDatabase::getStringId(o1->getId()).c_str());
|
||||
continue;
|
||||
}
|
||||
// assert(o2!=NULL);
|
||||
|
||||
for (FWObject::iterator i1=o2->begin(); i1!=o2->end(); ++i1)
|
||||
{
|
||||
netzoneObjectIDs[ (*i1)->getId().c_str() ]=n;
|
||||
netzoneObjectNos[n]= (*i1)->getId().c_str();
|
||||
netzoneObjectIDs[(*i1)->getId()] = n;
|
||||
netzoneObjectNos[n] = (*i1)->getId();
|
||||
netzoneObjectNames.push_back(
|
||||
tr("Network: ")+ (*i1)->getName().c_str() );
|
||||
++n;
|
||||
@@ -221,8 +222,8 @@ void InterfaceDialog::loadFWObject(FWObject *o)
|
||||
m_dialog->netzone->clear();
|
||||
m_dialog->netzone->addItems( netzoneObjectNames );
|
||||
|
||||
QString id=obj->getStr("network_zone").c_str();
|
||||
if (id=="") id="sysid0"; // any network
|
||||
int id = FWObjectDatabase::getIntId(obj->getStr("network_zone"));
|
||||
if (id==-1) id = FWObjectDatabase::ANY_ADDRESS_ID; // any network
|
||||
m_dialog->netzone->setCurrentIndex( netzoneObjectIDs[id] );
|
||||
}
|
||||
else
|
||||
@@ -290,7 +291,7 @@ void InterfaceDialog::validate(bool *res)
|
||||
if (!validateName(this,obj,m_dialog->obj_name->text())) *res=false;
|
||||
}
|
||||
|
||||
void InterfaceDialog::isChanged(bool *res)
|
||||
void InterfaceDialog::isChanged(bool*)
|
||||
{
|
||||
//*res=(!init && apply->isEnabled());
|
||||
}
|
||||
@@ -342,7 +343,9 @@ void InterfaceDialog::applyChanges()
|
||||
|
||||
if (supports_network_zones)
|
||||
obj->setStr("network_zone",
|
||||
netzoneObjectNos[ m_dialog->netzone->currentIndex() ].toLatin1().constData() );
|
||||
FWObjectDatabase::getStringId(
|
||||
netzoneObjectNos[
|
||||
m_dialog->netzone->currentIndex() ]));
|
||||
|
||||
s->setManagement( m_dialog->management->isChecked() );
|
||||
|
||||
|
||||
@@ -43,8 +43,12 @@ class InterfaceDialog : public QWidget
|
||||
|
||||
libfwbuilder::FWObject *obj;
|
||||
bool init;
|
||||
QMap<QString,int> netzoneObjectIDs;
|
||||
QMap<int,QString> netzoneObjectNos;
|
||||
|
||||
// netzoneObjectIDs : key - object id, value - number in the list
|
||||
QMap<int,int> netzoneObjectIDs;
|
||||
|
||||
// netzoneObjectNos : key - number in the list, value - obj id
|
||||
QMap<int,int> netzoneObjectNos;
|
||||
|
||||
Ui::InterfaceDialog_q *m_dialog;
|
||||
ProjectPanel *m_project;
|
||||
|
||||
@@ -80,7 +80,8 @@ void LibraryDialog::loadFWObject(FWObject *o)
|
||||
m_dialog->obj_name->setText( QString::fromUtf8(s->getName().c_str()) );
|
||||
m_dialog->comment->setText( QString::fromUtf8(s->getComment().c_str()) );
|
||||
|
||||
m_dialog->obj_name->setEnabled( obj->getId() != "syslib000" );
|
||||
m_dialog->obj_name->setEnabled(
|
||||
obj->getId() != FWObjectDatabase::STANDARD_LIB_ID);
|
||||
// apply->setEnabled( obj->getId() != "syslib000" );
|
||||
// comment->setEnabled( !m_project->isSystem(obj) );
|
||||
|
||||
@@ -124,7 +125,8 @@ void LibraryDialog::applyChanges()
|
||||
obj->setStr("color", color.toLatin1().constData());
|
||||
|
||||
/* just for fool-proof'ness, do not allow changing name of the 'Standard' lib */
|
||||
if (oldname!=obj->getName() && obj->getId()=="syslib000")
|
||||
if (oldname!=obj->getName() &&
|
||||
obj->getId()==FWObjectDatabase::STANDARD_LIB_ID)
|
||||
{
|
||||
obj->setName( oldname );
|
||||
}
|
||||
|
||||
@@ -107,8 +107,10 @@ int ObjConflictResolutionDialog::run( FWObject *o1,
|
||||
|
||||
QString p1, p2;
|
||||
|
||||
FWObject *delObjLib1 = o1->getRoot()->getById( DELETED_LIB );
|
||||
FWObject *delObjLib2 = o2->getRoot()->getById( DELETED_LIB );
|
||||
FWObject *delObjLib1 = o1->getRoot()->getById(
|
||||
FWObjectDatabase::DELETED_OBJECTS_ID );
|
||||
FWObject *delObjLib2 = o2->getRoot()->getById(
|
||||
FWObjectDatabase::DELETED_OBJECTS_ID );
|
||||
|
||||
if (delObjLib1!=NULL && o1->isChildOf(delObjLib1))
|
||||
{
|
||||
|
||||
@@ -561,7 +561,7 @@ void ObjectEditor::selectObject(FWObject *o)
|
||||
((GroupObjectDialog *) dialogs[ visible ])->selectObject(o);
|
||||
}
|
||||
|
||||
void ObjectEditor::selectionChanged(FWObject *o)
|
||||
void ObjectEditor::selectionChanged(FWObject*)
|
||||
{
|
||||
/*
|
||||
if (visible==-1) return;
|
||||
|
||||
@@ -56,7 +56,7 @@ using namespace libfwbuilder;
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
ObjectIconView::ObjectIconView(QWidget* parent, const char * name, Qt::WindowFlags f) :
|
||||
ObjectIconView::ObjectIconView(QWidget* parent, const char*, Qt::WindowFlags) :
|
||||
QListWidget(parent)
|
||||
{
|
||||
//setWindowFlags(f);
|
||||
|
||||
@@ -42,14 +42,14 @@ class ObjectIconViewItem : public QListWidgetItem {
|
||||
|
||||
libfwbuilder::FWObject *objptr;
|
||||
QMap<QString, QString> props;
|
||||
std::string ID;
|
||||
int ID;
|
||||
|
||||
public:
|
||||
|
||||
ObjectIconViewItem(QListWidget *parent) : QListWidgetItem(parent) {
|
||||
objptr=NULL;
|
||||
// setDropEnabled(false);
|
||||
ID="";
|
||||
ID=-1;
|
||||
}
|
||||
|
||||
ObjectIconViewItem(QListWidget *parent, const QString &text, const QPixmap &icon ) : QListWidgetItem(parent)
|
||||
@@ -58,11 +58,11 @@ class ObjectIconViewItem : public QListWidgetItem {
|
||||
setText(text);
|
||||
setIcon(QIcon(icon));
|
||||
// setDropEnabled(false);
|
||||
ID="";
|
||||
ID=-1;
|
||||
}
|
||||
|
||||
libfwbuilder::FWObject *getFWObject() { return mw->db()->getById(ID,true); }
|
||||
std::string getFWObjectID() {return ID; }
|
||||
int getFWObjectID() {return ID; }
|
||||
void setFWObject(libfwbuilder::FWObject *obj) {ID=obj->getId(); }
|
||||
|
||||
QString getProperty(const QString &name) { return props[name]; }
|
||||
|
||||
@@ -57,7 +57,8 @@ using namespace libfwbuilder;
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
ObjectListView::ObjectListView(QWidget* parent, const char * name, Qt::WindowFlags f) :
|
||||
ObjectListView::ObjectListView(QWidget* parent, const char*,
|
||||
Qt::WindowFlags f) :
|
||||
QTreeWidget(parent)
|
||||
{
|
||||
setWindowFlags(f);
|
||||
|
||||
@@ -44,31 +44,31 @@ class ObjectListViewItem : public QTreeWidgetItem {
|
||||
libfwbuilder::FWObject *objptr;
|
||||
QMap<QString, QString> props;
|
||||
QString lib;
|
||||
std::string ID;
|
||||
int ID;
|
||||
|
||||
public:
|
||||
|
||||
ObjectListViewItem(QTreeWidget *parent) : QTreeWidgetItem(parent) {
|
||||
objptr=NULL;
|
||||
ID="";
|
||||
ID=-1;
|
||||
}
|
||||
|
||||
ObjectListViewItem(QTreeWidgetItem *parent) : QTreeWidgetItem(parent){
|
||||
objptr=NULL;
|
||||
ID="";
|
||||
ID=-1;
|
||||
}
|
||||
|
||||
libfwbuilder::FWObject *getFWObject() {return mw->db()->getById(ID,true); }
|
||||
std::string getFWObjectID() {return ID; }
|
||||
int getFWObjectID() {return ID; }
|
||||
void setFWObject(libfwbuilder::FWObject *obj) { ID=obj->getId(); }
|
||||
|
||||
ObjectTreeView* getTree();
|
||||
|
||||
QString getLib() { return lib; }
|
||||
void setLib(const QString &l) { lib=l; }
|
||||
void setLib(const QString &l) { lib=l; }
|
||||
|
||||
QString getProperty(const QString &name) { return props[name]; }
|
||||
void setProperty(const QString &name,const QString &val) {
|
||||
void setProperty(const QString &name,const QString &val) {
|
||||
props[name]=val;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -267,7 +267,7 @@ ObjectTreeViewItem* ObjectManipulator::insertObject( ObjectTreeViewItem *itm,
|
||||
string("/FWBuilderResources/Type/") +
|
||||
obj->getTypeName() + "/hidden") ) return NULL;
|
||||
|
||||
nitm=new ObjectTreeViewItem( itm );
|
||||
nitm = new ObjectTreeViewItem( itm );
|
||||
nitm->setLib("");
|
||||
nitm->setText( 0, getTreeLabel(obj) );
|
||||
QPixmap pm;
|
||||
@@ -280,7 +280,7 @@ ObjectTreeViewItem* ObjectManipulator::insertObject( ObjectTreeViewItem *itm,
|
||||
nitm->setIcon( 1, QIcon(pm) );
|
||||
nitm->setFlags(nitm->flags() | Qt::ItemIsDragEnabled);
|
||||
|
||||
nitm->setProperty("id", obj->getId().c_str() );
|
||||
//nitm->setProperty("id", obj->getId().c_str() );
|
||||
nitm->setProperty("type", obj->getTypeName().c_str() );
|
||||
nitm->setFWObject( obj );
|
||||
|
||||
@@ -349,7 +349,8 @@ void ObjectManipulator::showDeletedObjects(bool f)
|
||||
{
|
||||
try
|
||||
{
|
||||
FWObject *dobj = m_project->db()->findInIndex( FWObjectDatabase::getDeletedObjectsId());
|
||||
FWObject *dobj = m_project->db()->findInIndex(
|
||||
FWObjectDatabase::DELETED_OBJECTS_ID);
|
||||
|
||||
if (fwbdebug)
|
||||
qDebug("ObjectManipulator::showDeletedObjects f=%d dobj=%p",f, dobj);
|
||||
@@ -357,7 +358,7 @@ void ObjectManipulator::showDeletedObjects(bool f)
|
||||
if (dobj==NULL)
|
||||
{
|
||||
dobj=m_project->db()->create(Library::TYPENAME);
|
||||
dobj->setId(m_project->db()->getDeletedObjectsId());
|
||||
dobj->setId(FWObjectDatabase::DELETED_OBJECTS_ID);
|
||||
dobj->setName("Deleted Objects");
|
||||
dobj->setReadOnly(false);
|
||||
m_project->db()->add(dobj);
|
||||
@@ -721,13 +722,15 @@ void ObjectManipulator::loadObjects(FWObjectDatabase *)
|
||||
|
||||
if (fwbdebug)
|
||||
qDebug("ObjectManipulator::loadObjects lib %p %s %s",
|
||||
lib, lib->getId().c_str(), lib->getName().c_str() );
|
||||
lib,
|
||||
FWObjectDatabase::getStringId(lib->getId()).c_str(),
|
||||
lib->getName().c_str() );
|
||||
|
||||
if ( lib->getId()==DELETED_LIB &&
|
||||
if ( lib->getId()==FWObjectDatabase::DELETED_OBJECTS_ID &&
|
||||
! st->getBool("UI/ShowDeletedObjects")) continue;
|
||||
|
||||
if ( lib->getId()!=STANDARD_LIB &&
|
||||
lib->getId()!=TEMPLATE_LIB &&
|
||||
if ( lib->getId()!=FWObjectDatabase::STANDARD_LIB_ID &&
|
||||
lib->getId()!=FWObjectDatabase::TEMPLATE_LIB_ID &&
|
||||
firstUserLib==NULL) firstUserLib=*i;
|
||||
|
||||
addTreePage( lib );
|
||||
@@ -858,7 +861,7 @@ void ObjectManipulator::addTreePage( FWObject *lib)
|
||||
itm1->setIcon( 0, pm);
|
||||
}
|
||||
|
||||
itm1->setProperty("id", lib->getId().c_str() );
|
||||
//itm1->setProperty("id", lib->getId().c_str() );
|
||||
itm1->setProperty("type", lib->getTypeName().c_str() );
|
||||
itm1->setFWObject( lib );
|
||||
allItems[lib] = itm1;
|
||||
@@ -1001,9 +1004,9 @@ void ObjectManipulator::contextMenuRequested(const QPoint &pos)
|
||||
*/
|
||||
if (lib==cl) continue;
|
||||
|
||||
if ( lib->getId()==STANDARD_LIB ||
|
||||
lib->getId()==TEMPLATE_LIB ||
|
||||
lib->getId()==DELETED_LIB ||
|
||||
if ( lib->getId()==FWObjectDatabase::STANDARD_LIB_ID ||
|
||||
lib->getId()==FWObjectDatabase::TEMPLATE_LIB_ID ||
|
||||
lib->getId()==FWObjectDatabase::DELETED_OBJECTS_ID ||
|
||||
lib->isReadOnly())
|
||||
continue;
|
||||
QAction* dact=duptargets->addAction(
|
||||
@@ -1255,7 +1258,7 @@ void ObjectManipulator::getMenuState(bool haveMoveTargets,
|
||||
inDeletedObjects = false;
|
||||
|
||||
FWObject *delObjLib =
|
||||
m_project->db()->findInIndex( FWObjectDatabase::getDeletedObjectsId());
|
||||
m_project->db()->findInIndex( FWObjectDatabase::DELETED_OBJECTS_ID);
|
||||
|
||||
vector<FWObject*> so = getCurrentObjectTree()->getSelectedObjects();
|
||||
for (vector<FWObject*>::iterator i=so.begin(); i!=so.end(); ++i)
|
||||
@@ -1275,7 +1278,7 @@ void ObjectManipulator::getMenuState(bool haveMoveTargets,
|
||||
/*
|
||||
* enable Paste menu item only if object can be pasted
|
||||
*/
|
||||
vector<string>::iterator i;
|
||||
vector<int>::iterator i;
|
||||
for (i= FWObjectClipboard::obj_clipboard->begin();
|
||||
i!=FWObjectClipboard::obj_clipboard->end(); ++i)
|
||||
{
|
||||
@@ -1531,7 +1534,7 @@ void ObjectManipulator::moveObject(FWObject *targetLib, FWObject *obj)
|
||||
FWObject *cl=pom->getCurrentLib();
|
||||
if (cl==targetLib) return;
|
||||
|
||||
// bool inDeletedObjects = (obj->getParent()->getId()==FWObjectDatabase::getDeletedObjectsId());
|
||||
// bool inDeletedObjects = (obj->getParent()->getId()==FWObjectDatabase::DELETED_OBJECTS_ID);
|
||||
|
||||
// QString parentType;
|
||||
// QString parentName;
|
||||
@@ -1713,7 +1716,7 @@ void ObjectManipulator::pasteObj()
|
||||
if (pom->getCurrentObjectTree()->getNumSelected()==0) return;
|
||||
FWObject *obj=pom->getCurrentObjectTree()->getSelectedObjects().front();
|
||||
if (obj==NULL) return;
|
||||
vector<string>::iterator i;
|
||||
vector<int>::iterator i;
|
||||
int idx = 0;
|
||||
for (i= FWObjectClipboard::obj_clipboard->begin();
|
||||
i!=FWObjectClipboard::obj_clipboard->end(); ++i)
|
||||
@@ -1722,7 +1725,7 @@ void ObjectManipulator::pasteObj()
|
||||
FWObjectClipboard::obj_clipboard->getObjectByIdx(idx);
|
||||
if (Interface::isA(co) && Firewall::isA(obj))
|
||||
{
|
||||
FWObject *no = pasteTo (obj, co, false, false, true);
|
||||
pasteTo (obj, co, false, false, true);
|
||||
continue ;
|
||||
}
|
||||
pom->copyObjWithDeep(co);
|
||||
@@ -1799,7 +1802,7 @@ FWObject* ObjectManipulator::pasteTo(FWObject *target, FWObject *obj,
|
||||
if (validateOnly) return obj;
|
||||
|
||||
/* check for duplicates. We just won't add an object if it is already there */
|
||||
string cp_id=obj->getId();
|
||||
int cp_id = obj->getId();
|
||||
list<FWObject*>::iterator j;
|
||||
for(j=grp->begin(); j!=grp->end(); ++j)
|
||||
{
|
||||
@@ -1856,7 +1859,7 @@ void ObjectManipulator::lockObject()
|
||||
FWObject *lib = obj->getLibrary();
|
||||
// these lbraries are locked anyway, do not let the user
|
||||
// lock objects inside because they won't be able to unlock them.
|
||||
if (lib->getId()!=STANDARD_LIB && lib->getId()!=TEMPLATE_LIB)
|
||||
if (lib->getId()!=FWObjectDatabase::STANDARD_LIB_ID && lib->getId()!=FWObjectDatabase::TEMPLATE_LIB_ID)
|
||||
obj->setReadOnly(true);
|
||||
}
|
||||
pom->getCurrentObjectTree()->setLockFlags();
|
||||
@@ -1884,7 +1887,7 @@ void ObjectManipulator::unlockObject()
|
||||
{
|
||||
obj= *i;
|
||||
FWObject *lib = obj->getLibrary();
|
||||
if (lib->getId()!=STANDARD_LIB && lib->getId()!=TEMPLATE_LIB)
|
||||
if (lib->getId()!=FWObjectDatabase::STANDARD_LIB_ID && lib->getId()!=FWObjectDatabase::TEMPLATE_LIB_ID)
|
||||
obj->setReadOnly(false);
|
||||
}
|
||||
pom->getCurrentObjectTree()->setLockFlags();
|
||||
@@ -1905,7 +1908,7 @@ void ObjectManipulator::deleteObj()
|
||||
bool emptyingTrash = false;
|
||||
bool emptyingTrashInLib = false;
|
||||
|
||||
FWObject *delObjLib = m_project->db()->findInIndex(FWObjectDatabase::getDeletedObjectsId());
|
||||
FWObject *delObjLib = m_project->db()->findInIndex(FWObjectDatabase::DELETED_OBJECTS_ID);
|
||||
if (fwbdebug)
|
||||
qDebug("ObjectManipulator::deleteObj delObjLib=%p",delObjLib);
|
||||
|
||||
@@ -2052,7 +2055,7 @@ void ObjectManipulator::delObj(FWObject *obj,bool openobj)
|
||||
obj,obj->getName().c_str(),openobj);
|
||||
|
||||
FWObject *parent=obj->getParent();
|
||||
FWObject *delObjLib = m_project->db()->findInIndex( DELETED_LIB );
|
||||
FWObject *delObjLib = m_project->db()->findInIndex( FWObjectDatabase::DELETED_OBJECTS_ID );
|
||||
|
||||
if (fwbdebug)
|
||||
qDebug("ObjectManipulator::delObj deleted obj lib %p",
|
||||
@@ -2067,13 +2070,13 @@ void ObjectManipulator::delObj(FWObject *obj,bool openobj)
|
||||
for (int i = 0 ; i < oms.size(); i++)
|
||||
{
|
||||
ObjectManipulator* pom = oms[i] ;
|
||||
if (obj->getId()==STANDARD_LIB || obj->getId()==DELETED_LIB) return;
|
||||
if (obj->getId()==FWObjectDatabase::STANDARD_LIB_ID || obj->getId()==FWObjectDatabase::DELETED_OBJECTS_ID) return;
|
||||
|
||||
pom->m_project->findObjectWidget->reset();
|
||||
try
|
||||
{
|
||||
|
||||
if (!islib && !isDelObj && obj->getId()!=TEMPLATE_LIB)
|
||||
if (!islib && !isDelObj && obj->getId()!=FWObjectDatabase::TEMPLATE_LIB_ID)
|
||||
pom->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
|
||||
if (fwbdebug)
|
||||
@@ -2112,7 +2115,7 @@ void ObjectManipulator::delObj(FWObject *obj,bool openobj)
|
||||
if (islib && obj->isReadOnly()) obj->setReadOnly(false);
|
||||
// if (firstAction)
|
||||
// {
|
||||
if (obj->getId()==TEMPLATE_LIB) // special case
|
||||
if (obj->getId()==FWObjectDatabase::TEMPLATE_LIB_ID) // special case
|
||||
{
|
||||
if (fwbdebug)
|
||||
qDebug("ObjectManipulator::delObj: "
|
||||
@@ -2410,7 +2413,7 @@ void ObjectManipulator::selectionChanged(QTreeWidgetItem *cur)
|
||||
if (history.empty() || otvi!=history.top().item() )
|
||||
{
|
||||
mw->m_mainWindow->backAction->setEnabled( true );
|
||||
history.push( HistoryItem(otvi,o->getId().c_str()) );
|
||||
history.push( HistoryItem(otvi, o->getId()) );
|
||||
}
|
||||
|
||||
currentObj = obj;
|
||||
@@ -2508,9 +2511,9 @@ void ObjectManipulator::libChanged(int ln)
|
||||
void ObjectManipulator::updateCreateObjectMenu(FWObject* lib)
|
||||
{
|
||||
bool f =
|
||||
lib->getId()==STANDARD_LIB ||
|
||||
lib->getId()==TEMPLATE_LIB ||
|
||||
lib->getId()==DELETED_LIB ||
|
||||
lib->getId()==FWObjectDatabase::STANDARD_LIB_ID ||
|
||||
lib->getId()==FWObjectDatabase::TEMPLATE_LIB_ID ||
|
||||
lib->getId()==FWObjectDatabase::DELETED_OBJECTS_ID ||
|
||||
lib->isReadOnly();
|
||||
|
||||
m_objectManipulator->newButton->setEnabled( !f );
|
||||
@@ -2529,7 +2532,7 @@ void ObjectManipulator::back()
|
||||
/* skip objects that have been deleted */
|
||||
while ( ! history.empty())
|
||||
{
|
||||
if (m_project->db()->findInIndex( history.top().id().toLatin1().constData() )!=NULL) break;
|
||||
if (m_project->db()->findInIndex( history.top().id() )!=NULL) break;
|
||||
history.pop();
|
||||
}
|
||||
|
||||
@@ -2584,15 +2587,17 @@ FWObject* ObjectManipulator::createObject(const QString &objType,
|
||||
|
||||
if (fwbdebug)
|
||||
{
|
||||
qDebug("lib: %s %s",lib->getName().c_str(), lib->getId().c_str());
|
||||
qDebug("lib: %s %s",
|
||||
lib->getName().c_str(),
|
||||
FWObjectDatabase::getStringId(lib->getId()).c_str());
|
||||
qDebug("lib: isReadOnly=%d isLoaded=%d",
|
||||
lib->isReadOnly(), m_project->getAddOnLibs()->isLoaded( lib->getName().c_str() ) );
|
||||
qDebug("libs->count()=%d", m_objectManipulator->libs->count() );
|
||||
}
|
||||
|
||||
while ( lib->getId()==STANDARD_LIB ||
|
||||
lib->getId()==TEMPLATE_LIB ||
|
||||
lib->getId()==DELETED_LIB ||
|
||||
while ( lib->getId()==FWObjectDatabase::STANDARD_LIB_ID ||
|
||||
lib->getId()==FWObjectDatabase::TEMPLATE_LIB_ID ||
|
||||
lib->getId()==FWObjectDatabase::DELETED_OBJECTS_ID ||
|
||||
lib->isReadOnly() )
|
||||
{
|
||||
if (i>=m_objectManipulator->libs->count())
|
||||
@@ -2609,7 +2614,9 @@ FWObject* ObjectManipulator::createObject(const QString &objType,
|
||||
if (fwbdebug)
|
||||
{
|
||||
qDebug("i=%d",i);
|
||||
qDebug("lib: %s %s",lib->getName().c_str(), lib->getId().c_str());
|
||||
qDebug("lib: %s %s",
|
||||
lib->getName().c_str(),
|
||||
FWObjectDatabase::getStringId(lib->getId()).c_str());
|
||||
qDebug("lib: isReadOnly=%d isLoaded=%d",
|
||||
lib->isReadOnly(), m_project->getAddOnLibs()->isLoaded( lib->getName().c_str() ) );
|
||||
}
|
||||
@@ -2657,9 +2664,9 @@ FWObject* ObjectManipulator::createObject(FWObject *parent,
|
||||
objType.toLatin1().constData(), objName.toLatin1().constData());
|
||||
}
|
||||
|
||||
while ( lib->getId()==STANDARD_LIB ||
|
||||
lib->getId()==TEMPLATE_LIB ||
|
||||
lib->getId()==DELETED_LIB ||
|
||||
while ( lib->getId()==FWObjectDatabase::STANDARD_LIB_ID ||
|
||||
lib->getId()==FWObjectDatabase::TEMPLATE_LIB_ID ||
|
||||
lib->getId()==FWObjectDatabase::DELETED_OBJECTS_ID ||
|
||||
lib->isReadOnly() )
|
||||
{
|
||||
if (i >= m_objectManipulator->libs->count())
|
||||
@@ -2678,8 +2685,9 @@ FWObject* ObjectManipulator::createObject(FWObject *parent,
|
||||
}
|
||||
|
||||
|
||||
FWObject* ObjectManipulator::copyObj2Tree(const QString &/*objType*/, const QString &/*objName*/,
|
||||
libfwbuilder::FWObject *copyFrom, FWObject *parent, bool /*askLib*/)
|
||||
FWObject* ObjectManipulator::copyObj2Tree(
|
||||
const QString &/*objType*/, const QString &/*objName*/,
|
||||
FWObject *copyFrom, FWObject *parent, bool /*askLib*/)
|
||||
{
|
||||
if (!validateDialog()) return NULL;
|
||||
ids.clear();
|
||||
@@ -2691,22 +2699,21 @@ FWObject* ObjectManipulator::copyObj2Tree(const QString &/*objType*/, const QStr
|
||||
return copyObjWithDeep(copyFrom);
|
||||
}
|
||||
|
||||
libfwbuilder::FWObject * ObjectManipulator::copyObjWithDeep(libfwbuilder::FWObject *copyFrom)
|
||||
FWObject * ObjectManipulator::copyObjWithDeep(FWObject *copyFrom)
|
||||
{
|
||||
|
||||
if (copyFrom==NULL)
|
||||
return NULL;
|
||||
if (copyFrom==NULL) return NULL;
|
||||
|
||||
FWObject *nobj= copyFrom;
|
||||
if (nobj->getId()!="")
|
||||
if (nobj->getId() > -1)
|
||||
{
|
||||
if (ids.contains(nobj->getId().c_str()))
|
||||
if (ids.contains(nobj->getId()))
|
||||
{
|
||||
|
||||
return nobj;
|
||||
}
|
||||
else
|
||||
{
|
||||
ids.insert(nobj->getId().c_str());
|
||||
ids.insert(nobj->getId());
|
||||
}
|
||||
}
|
||||
//nobj->duplicate(copyFrom,false);
|
||||
|
||||
@@ -59,13 +59,13 @@ namespace libfwbuilder
|
||||
|
||||
class HistoryItem {
|
||||
ObjectTreeViewItem *itm;
|
||||
QString objId;
|
||||
int objId;
|
||||
|
||||
public:
|
||||
HistoryItem(ObjectTreeViewItem *oi,const QString &id) { itm=oi; objId=id; }
|
||||
HistoryItem(ObjectTreeViewItem *oi, int id) { itm=oi; objId=id; }
|
||||
~HistoryItem();
|
||||
ObjectTreeViewItem* item() { return itm; }
|
||||
QString id() { return objId; }
|
||||
int id() { return objId; }
|
||||
};
|
||||
|
||||
/*class ObjToolTip : public QToolTip {
|
||||
@@ -82,8 +82,8 @@ class ObjectManipulator : public QWidget/*ObjectManipulator_q*/ {
|
||||
Q_OBJECT
|
||||
|
||||
std::vector<libfwbuilder::FWObject*> idxToLibs;
|
||||
std::vector<QTreeWidget*> idxToTrees;
|
||||
QSet <QString> ids ;
|
||||
std::vector<QTreeWidget*> idxToTrees;
|
||||
QSet<int> ids ;
|
||||
std::stack<HistoryItem> history;
|
||||
int cacheHits;
|
||||
|
||||
|
||||
@@ -512,13 +512,15 @@ void ObjectTreeView::dropEvent(QDropEvent *ev)
|
||||
if (otvsource!=NULL)
|
||||
{
|
||||
FWObjectDatabase* root = otvsource->getCurrentObject()->getRoot();
|
||||
QString id = dragobj->getId().c_str();
|
||||
FWObject * item = root->getById(id.toAscii().data(),true);
|
||||
qDebug(item->getId().c_str());
|
||||
qDebug(item->getTypeName().c_str());
|
||||
qDebug(dragobj->getId().c_str());
|
||||
qDebug(dragobj->getTypeName().c_str());
|
||||
|
||||
int id = dragobj->getId();
|
||||
FWObject * item = root->getById(id, true);
|
||||
if (fwbdebug)
|
||||
{
|
||||
qDebug("%d", item->getId());
|
||||
qDebug(item->getTypeName().c_str());
|
||||
qDebug("%d", dragobj->getId());
|
||||
qDebug(dragobj->getTypeName().c_str());
|
||||
}
|
||||
//ProjectPanel * ppsource = otvsource->m_project ;
|
||||
}
|
||||
QString n=QString::fromUtf8(dragobj->getName().c_str());
|
||||
@@ -819,7 +821,8 @@ void ObjectTreeView::setLockFlags()
|
||||
FWObject *lib = otvi->getFWObject()->getLibrary();
|
||||
// these lbraries are locked anyway, do not let the user
|
||||
// lock objects inside because they won't be able to unlock them.
|
||||
if (lib->getId()!=STANDARD_LIB && lib->getId()!=TEMPLATE_LIB)
|
||||
if (lib->getId()!=FWObjectDatabase::STANDARD_LIB_ID &&
|
||||
lib->getId()!=FWObjectDatabase::TEMPLATE_LIB_ID)
|
||||
{
|
||||
if (otvi->getFWObject()->getBool("ro")) Unlockable=true;
|
||||
else Lockable=true;
|
||||
|
||||
@@ -92,8 +92,5 @@ bool ObjectTreeViewItem::operator< ( const QTreeWidgetItem & other ) const
|
||||
{
|
||||
return true ;
|
||||
}
|
||||
if (rank1<rank2)
|
||||
{
|
||||
return false ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -62,10 +62,10 @@ class ObjectTreeViewItem : public QTreeWidgetItem {
|
||||
ObjectTreeView* getTree();
|
||||
|
||||
QString getLib() { return lib; }
|
||||
void setLib(const QString &l) { lib=l; }
|
||||
void setLib(const QString &l) { lib=l; }
|
||||
|
||||
QString getProperty(const QString &name) const { return props[name]; }
|
||||
void setProperty(const QString &name,const QString &val) {
|
||||
void setProperty(const QString &name, const QString &val) {
|
||||
props[name]=val;
|
||||
}
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ void PhysicalAddressDialog::validate(bool *res)
|
||||
if (!validateName(this,obj,m_dialog->obj_name->text())) { *res=false; return; }
|
||||
}
|
||||
|
||||
void PhysicalAddressDialog::isChanged(bool *res)
|
||||
void PhysicalAddressDialog::isChanged(bool *)
|
||||
{
|
||||
//*res=(!init && apply->isEnabled());
|
||||
}
|
||||
|
||||
+47
-37
@@ -312,8 +312,8 @@ void ProjectPanel::findIntersectRefs(FWObject *lib,
|
||||
if (ref!=NULL)
|
||||
{
|
||||
FWObject *plib = ref->getPointer()->getLibrary();
|
||||
if ( plib->getId()!=STANDARD_LIB &&
|
||||
plib->getId()!=DELETED_LIB &&
|
||||
if ( plib->getId()!=FWObjectDatabase::STANDARD_LIB_ID &&
|
||||
plib->getId()!=FWObjectDatabase::DELETED_OBJECTS_ID &&
|
||||
plib!=lib )
|
||||
{
|
||||
FWObject* ptr=ref->getPointer();
|
||||
@@ -392,7 +392,7 @@ void ProjectPanel::findIntersectRefs(FWObject *lib,
|
||||
|
||||
|
||||
void ProjectPanel::restoreDepends(FWObject *obj_old, FWObject *obj,
|
||||
const std::map<const std::string, FWObject *> &objByIds)
|
||||
const std::map<int, FWObject *> &objByIds)
|
||||
{
|
||||
Firewall *fw = Firewall::cast(obj);
|
||||
Firewall *fw_old = Firewall::cast(obj_old);
|
||||
@@ -405,7 +405,7 @@ void ProjectPanel::restoreDepends(FWObject *obj_old, FWObject *obj,
|
||||
}
|
||||
|
||||
void ProjectPanel::restorePolicyRefs(Policy *pol, Policy *pol_old,
|
||||
const std::map<const std::string, FWObject *> &objByIds)
|
||||
const std::map<int, FWObject *> &objByIds)
|
||||
{
|
||||
if (!pol || !pol_old)
|
||||
return;
|
||||
@@ -420,7 +420,7 @@ void ProjectPanel::restorePolicyRefs(Policy *pol, Policy *pol_old,
|
||||
}
|
||||
|
||||
void ProjectPanel::restorePolicyRuleRefs(PolicyRule *rule, PolicyRule *rule_old,
|
||||
const std::map<const std::string, FWObject *> &objByIds)
|
||||
const std::map<int, FWObject *> &objByIds)
|
||||
{
|
||||
if (!rule || !rule_old) return;
|
||||
for (int col =0; col < 5; col++)
|
||||
@@ -433,7 +433,7 @@ void ProjectPanel::restorePolicyRuleRefs(PolicyRule *rule, PolicyRule *rule_old,
|
||||
}
|
||||
|
||||
void ProjectPanel::restoreRERefs(RuleElement *re_new, RuleElement *re_old,
|
||||
const std::map<const std::string, FWObject *> &objByIds)
|
||||
const std::map<int, FWObject *> &objByIds)
|
||||
{
|
||||
if (!re_new || ! re_old) return;
|
||||
while((re_new->begin() != re_new->end()) &&
|
||||
@@ -449,7 +449,7 @@ void ProjectPanel::restoreRERefs(RuleElement *re_new, RuleElement *re_old,
|
||||
//qDebug("o_old->getId() = (%s)", o_old->getId().c_str());//).toAscii().constData());// !!!!!
|
||||
//for (std::map<const std::string, FWObject *>::const_iterator i = objByIds.begin(); i != objByIds.end(); i++)
|
||||
//qDebug("i->first.c_str() = (%s)", i->first.c_str());// !!!!!
|
||||
std::map<const std::string, FWObject *>::const_iterator it = objByIds.find(o_old->getId());
|
||||
std::map<int, FWObject *>::const_iterator it = objByIds.find(o_old->getId());
|
||||
if (objByIds.end() != it)
|
||||
{
|
||||
FWObject *o = it->second;
|
||||
@@ -1978,12 +1978,14 @@ void ProjectPanel::startupLoad()
|
||||
}
|
||||
|
||||
QString id = st->getStr("UI/visibleFirewall");
|
||||
int i_id = FWObjectDatabase::getIntId(id.toLatin1().constData());
|
||||
FWObject *show_fw=NULL;
|
||||
if ( !id.isEmpty() ) show_fw = db()->getById(id.toLatin1().constData(),true);
|
||||
if ( !id.isEmpty() ) show_fw = db()->getById(i_id, true);
|
||||
|
||||
id = st->getStr("UI/visibleObject");
|
||||
i_id = FWObjectDatabase::getIntId(id.toLatin1().constData());
|
||||
FWObject *show_obj=NULL;
|
||||
if ( !id.isEmpty() ) show_obj = db()->getById(id.toLatin1().constData(),true);
|
||||
if ( !id.isEmpty() ) show_obj = db()->getById(i_id, true);
|
||||
|
||||
showFirewalls( show_fw==NULL );
|
||||
|
||||
@@ -2078,7 +2080,7 @@ void ProjectPanel::load(QWidget *dialogs_parent)
|
||||
FWObjectDatabase *ndb = new FWObjectDatabase();
|
||||
ndb->load(libfname, &upgrade_predicate,librespath);
|
||||
FWObject *dobj =
|
||||
ndb->findInIndex( FWObjectDatabase::getDeletedObjectsId());
|
||||
ndb->findInIndex( FWObjectDatabase::DELETED_OBJECTS_ID);
|
||||
if (dobj) ndb->remove(dobj, false);
|
||||
|
||||
MergeConflictRes mcr(dlgp);
|
||||
@@ -2187,7 +2189,7 @@ void ProjectPanel::load(QWidget *dialogs_parent,RCS *_rcs,libfwbuilder::FWObject
|
||||
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||
|
||||
/* loadingLib is true if user wants to open a library or master library file */
|
||||
bool loadingLib = editingLibrary();
|
||||
bool loadingLib = editingLibrary();
|
||||
|
||||
/*if (fwbdebug)
|
||||
{
|
||||
@@ -2274,7 +2276,8 @@ void ProjectPanel::load(QWidget *dialogs_parent,RCS *_rcs,libfwbuilder::FWObject
|
||||
for (FWObject::iterator i=ll.begin(); i!=ll.end(); i++)
|
||||
{
|
||||
qDebug("* Library %s %s in the data file",
|
||||
(*i)->getId().c_str(),(*i)->getName().c_str() );
|
||||
FWObjectDatabase::getStringId((*i)->getId()).c_str(),
|
||||
(*i)->getName().c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2285,7 +2288,7 @@ void ProjectPanel::load(QWidget *dialogs_parent,RCS *_rcs,libfwbuilder::FWObject
|
||||
*
|
||||
* However, if I am editing standard library, it should not be read-only.
|
||||
*/
|
||||
FWObject *slib = objdb->findInIndex("syslib000");
|
||||
FWObject *slib = objdb->findInIndex(FWObjectDatabase::STANDARD_LIB_ID);
|
||||
if (fwbdebug)
|
||||
qDebug("standard library read-only status: %d, editingStandardLib: %d",
|
||||
slib->isReadOnly(), editingStandardLib);
|
||||
@@ -2528,7 +2531,8 @@ void ProjectPanel::load(QWidget *dialogs_parent,RCS *_rcs)
|
||||
for (FWObject::iterator i=ll.begin(); i!=ll.end(); i++)
|
||||
{
|
||||
qDebug("* Found library %s %s in the data file",
|
||||
(*i)->getId().c_str(),(*i)->getName().c_str() );
|
||||
FWObjectDatabase::getStringId((*i)->getId()).c_str(),
|
||||
(*i)->getName().c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2538,8 +2542,10 @@ void ProjectPanel::load(QWidget *dialogs_parent,RCS *_rcs)
|
||||
list<FWObject*> ll = ndb->getByType(Library::TYPENAME);
|
||||
for (FWObject::iterator i=ll.begin(); i!=ll.end(); i++)
|
||||
{
|
||||
if ((*i)->getId()==STANDARD_LIB) editingStandardLib=true;
|
||||
if ((*i)->getId()==TEMPLATE_LIB) editingTemplateLib=true;
|
||||
if ((*i)->getId()==FWObjectDatabase::STANDARD_LIB_ID)
|
||||
editingStandardLib=true;
|
||||
if ((*i)->getId()==FWObjectDatabase::TEMPLATE_LIB_ID)
|
||||
editingTemplateLib=true;
|
||||
(*i)->setReadOnly( false );
|
||||
}
|
||||
} else
|
||||
@@ -2563,9 +2569,9 @@ void ProjectPanel::load(QWidget *dialogs_parent,RCS *_rcs)
|
||||
libfname.c_str());
|
||||
assert(nlib1!=NULL);
|
||||
}
|
||||
string nlib1ID = nlib1->getId();
|
||||
int nlib1ID = nlib1->getId();
|
||||
FWObject *dobj =
|
||||
ndb1->findInIndex(FWObjectDatabase::getDeletedObjectsId());
|
||||
ndb1->findInIndex(FWObjectDatabase::DELETED_OBJECTS_ID);
|
||||
if (dobj) ndb1->remove(dobj, false);
|
||||
|
||||
MergeConflictRes mcr(dlgp);
|
||||
@@ -2609,8 +2615,9 @@ void ProjectPanel::load(QWidget *dialogs_parent,RCS *_rcs)
|
||||
for (FWObject::iterator i=ll.begin(); i!=ll.end(); i++)
|
||||
{
|
||||
qDebug("* Library %s %s in the data file",
|
||||
(*i)->getId().c_str(),(*i)->getName().c_str() );
|
||||
}
|
||||
FWObjectDatabase::getStringId((*i)->getId()).c_str(),
|
||||
(*i)->getName().c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2620,12 +2627,15 @@ void ProjectPanel::load(QWidget *dialogs_parent,RCS *_rcs)
|
||||
*
|
||||
* However, if I am editing standard library, it should not be read-only.
|
||||
*/
|
||||
FWObject *slib = objdb->findInIndex("syslib000");
|
||||
if (fwbdebug)
|
||||
qDebug("standard library read-only status: %d, editingStandardLib: %d",
|
||||
slib->isReadOnly(), editingStandardLib);
|
||||
FWObject *slib = objdb->findInIndex(FWObjectDatabase::STANDARD_LIB_ID);
|
||||
if (slib!=NULL )
|
||||
{
|
||||
if (fwbdebug)
|
||||
qDebug("standard library read-only status: %d, editingStandardLib: %d",
|
||||
slib->isReadOnly(), editingStandardLib);
|
||||
|
||||
if (slib!=NULL ) slib->setReadOnly(! editingStandardLib);
|
||||
slib->setReadOnly(! editingStandardLib);
|
||||
}
|
||||
|
||||
/* if the file name has an old extension .xml, change it to .fwb and
|
||||
* warn the user
|
||||
@@ -2869,9 +2879,9 @@ void ProjectPanel::save()
|
||||
continue;
|
||||
}
|
||||
/* skip standard and template libraries unless we edit them */
|
||||
QString s=(*i)->getId().c_str();
|
||||
if (s==STANDARD_LIB && !editingStandardLib) continue;
|
||||
if (s==TEMPLATE_LIB && !editingTemplateLib) continue;
|
||||
int id = (*i)->getId();
|
||||
if (id==FWObjectDatabase::STANDARD_LIB_ID && !editingStandardLib) continue;
|
||||
if (id==FWObjectDatabase::TEMPLATE_LIB_ID && !editingTemplateLib) continue;
|
||||
|
||||
if (fwbdebug) qDebug(" add");
|
||||
userLibs.push_back( *i );
|
||||
@@ -2886,8 +2896,8 @@ void ProjectPanel::save()
|
||||
/* exported libraries are always read-only */
|
||||
list<FWObject*> ll = ndb->getByType(Library::TYPENAME);
|
||||
for (FWObject::iterator i=ll.begin(); i!=ll.end(); i++)
|
||||
if ((*i)->getId()!=STANDARD_LIB &&
|
||||
(*i)->getId()!=DELETED_LIB) (*i)->setReadOnly( true );
|
||||
if ((*i)->getId()!=FWObjectDatabase::STANDARD_LIB_ID &&
|
||||
(*i)->getId()!=FWObjectDatabase::DELETED_OBJECTS_ID) (*i)->setReadOnly( true );
|
||||
}
|
||||
|
||||
ndb->resetTimeLastModified( db()->getTimeLastModified() );
|
||||
@@ -2938,7 +2948,7 @@ void ProjectPanel::loadLibrary(const string &libfpath)
|
||||
FWObjectDatabase *ndb = new FWObjectDatabase();
|
||||
ndb->load(libfpath, &upgrade_predicate, librespath);
|
||||
|
||||
FWObject *dobj = ndb->findInIndex(FWObjectDatabase::getDeletedObjectsId());
|
||||
FWObject *dobj = ndb->findInIndex(FWObjectDatabase::DELETED_OBJECTS_ID);
|
||||
if (dobj) ndb->remove(dobj, false);
|
||||
|
||||
#if 0
|
||||
@@ -3050,7 +3060,7 @@ void ProjectPanel::fileCompare()
|
||||
db1 = new FWObjectDatabase();
|
||||
db1->load(fname1.toLatin1().constData(), &upgrade_predicate, librespath);
|
||||
|
||||
dobj = db1->findInIndex(FWObjectDatabase::getDeletedObjectsId());
|
||||
dobj = db1->findInIndex(FWObjectDatabase::DELETED_OBJECTS_ID);
|
||||
if (dobj) db1->remove(dobj, false);
|
||||
} catch(FWException &ex)
|
||||
{
|
||||
@@ -3068,7 +3078,7 @@ void ProjectPanel::fileCompare()
|
||||
db2 = new FWObjectDatabase();
|
||||
db2->load(fname2.toLatin1().constData(), &upgrade_predicate, librespath);
|
||||
|
||||
dobj = db2->findInIndex(FWObjectDatabase::getDeletedObjectsId());
|
||||
dobj = db2->findInIndex(FWObjectDatabase::DELETED_OBJECTS_ID);
|
||||
if (dobj) db2->remove(dobj, false);
|
||||
} catch(FWException &ex)
|
||||
{
|
||||
@@ -3162,8 +3172,8 @@ void ProjectPanel::findExternalRefs(FWObject *lib,
|
||||
if (ref!=NULL)
|
||||
{
|
||||
FWObject *plib = ref->getPointer()->getLibrary();
|
||||
if ( plib->getId()!=STANDARD_LIB &&
|
||||
plib->getId()!=DELETED_LIB &&
|
||||
if ( plib->getId()!=FWObjectDatabase::STANDARD_LIB_ID &&
|
||||
plib->getId()!=FWObjectDatabase::DELETED_OBJECTS_ID &&
|
||||
plib!=lib )
|
||||
extRefs.push_back(ref);
|
||||
return;
|
||||
@@ -3333,7 +3343,7 @@ void ProjectPanel::exportLibraryTo(QString fname,list<FWObject*> &selectedLibs,
|
||||
for (list<FWObject*>::iterator i=selectedLibs.begin(); i!=selectedLibs.end(); ++i)
|
||||
{
|
||||
FWObject *nlib= ndb->findInIndex( (*i)->getId() );
|
||||
if (nlib && nlib->getId()!=DELETED_LIB)
|
||||
if (nlib && nlib->getId()!=FWObjectDatabase::DELETED_OBJECTS_ID)
|
||||
nlib->setReadOnly( true );
|
||||
}
|
||||
}
|
||||
@@ -3834,7 +3844,7 @@ void ProjectPanel::loadState (QString filename)
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectPanel::splitterMoved ( int pos, int index )
|
||||
void ProjectPanel::splitterMoved ( int , int )
|
||||
{
|
||||
saveState();
|
||||
}
|
||||
|
||||
@@ -103,13 +103,13 @@ class ProjectPanel: public QWidget {
|
||||
const std::list<libfwbuilder::FWObject*> &objList,std::list<libfwbuilder::FWReference*> & refLinfs);
|
||||
|
||||
void restorePolicyRefs(libfwbuilder::Policy *pol, libfwbuilder::Policy *pol_old,
|
||||
const std::map<const std::string, libfwbuilder::FWObject *> &objByIds);
|
||||
const std::map<int, libfwbuilder::FWObject *> &objByIds);
|
||||
void restorePolicyRuleRefs(libfwbuilder::PolicyRule *rule,
|
||||
libfwbuilder::PolicyRule *rule_old,
|
||||
const std::map<const std::string, libfwbuilder::FWObject *> &objByIds);
|
||||
const std::map<int, libfwbuilder::FWObject *> &objByIds);
|
||||
void restoreRERefs(libfwbuilder::RuleElement *re_new,
|
||||
libfwbuilder::RuleElement *re_old,
|
||||
const std::map<const std::string, libfwbuilder::FWObject *> &objByIds);
|
||||
const std::map<int, libfwbuilder::FWObject *> &objByIds);
|
||||
public:
|
||||
libfwbuilder::RuleSet* getCurrentRuleSet () {return visibleRuleSet;};
|
||||
RuleSetView * getCurrentRuleSetView () ;
|
||||
@@ -279,7 +279,7 @@ public:
|
||||
std::list<libfwbuilder::FWObject*> & objList, std::list<libfwbuilder::FWReference*> & refLinfs,
|
||||
libfwbuilder::FWObject *lib);
|
||||
void restoreDepends(libfwbuilder::FWObject *obj_old, libfwbuilder::FWObject *nobj,
|
||||
const std::map<const std::string, libfwbuilder::FWObject *> &objByIds);
|
||||
const std::map<int, libfwbuilder::FWObject *> &objByIds);
|
||||
public slots:
|
||||
void newObject();
|
||||
void info();
|
||||
|
||||
+1
-1
@@ -973,7 +973,7 @@ QString RCS::rlog() throw(libfwbuilder::FWException)
|
||||
throw( FWException( msg.toLatin1().constData() ) );
|
||||
}
|
||||
|
||||
QStringList RCS::rcsdiff(const QString &rev) throw(libfwbuilder::FWException)
|
||||
QStringList RCS::rcsdiff(const QString&) throw(libfwbuilder::FWException)
|
||||
{
|
||||
isDiff();
|
||||
QString temp = stdoutBuffer;
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
using namespace std;
|
||||
|
||||
RCSFileDialog::RCSFileDialog( const QString& dirName, const QString& filter,
|
||||
QWidget* parent, const char* name, bool modal )
|
||||
QWidget* parent, const char* name, bool )
|
||||
: QFileDialog( parent, name, dirName, filter )
|
||||
{
|
||||
if (fwbdebug) qDebug("RCSFileDialog: constructor 1");
|
||||
@@ -68,7 +68,7 @@ RCSFileDialog::RCSFileDialog( const QString& dirName, const QString& filter,
|
||||
if (fwbdebug) qDebug("RCSFileDialog: constructor done");
|
||||
}
|
||||
|
||||
RCSFileDialog::RCSFileDialog( QWidget* parent, const char* name, bool modal )
|
||||
RCSFileDialog::RCSFileDialog( QWidget* parent, const char* , bool )
|
||||
: QFileDialog(parent, "Open file")// name
|
||||
{
|
||||
if (fwbdebug) qDebug("RCSFileDialog: constructor 2");
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
|
||||
int RCSViewItem::compare(QTreeWidgetItem *itm, int col, bool ascending) const
|
||||
int RCSViewItem::compare(QTreeWidgetItem *itm, int col, bool ) const
|
||||
{
|
||||
QString rev1 = text(col);
|
||||
QString rev2 = itm->text(col);
|
||||
|
||||
@@ -132,7 +132,7 @@ void RuleSetDialog::validate(bool *res)
|
||||
}
|
||||
}
|
||||
|
||||
void RuleSetDialog::isChanged(bool *res)
|
||||
void RuleSetDialog::isChanged(bool *)
|
||||
{
|
||||
//*res=(!init && apply->isEnabled());
|
||||
}
|
||||
|
||||
+15
-15
@@ -1624,11 +1624,11 @@ void RuleSetView::paintCell(QPainter *pntr,
|
||||
mwSelObj = om_selected_objects.front();
|
||||
|
||||
if ( (!sel) &&
|
||||
mwSelObj!= NULL &&
|
||||
mwSelObj->getId() != "sysid0" &&
|
||||
mwSelObj->getId() != "sysid1" &&
|
||||
mwSelObj->getId() != "sysid2" &&
|
||||
mwSelObj == o1)
|
||||
mwSelObj!= NULL &&
|
||||
mwSelObj->getId() != FWObjectDatabase::ANY_ADDRESS_ID &&
|
||||
mwSelObj->getId() != FWObjectDatabase::ANY_SERVICE_ID &&
|
||||
mwSelObj->getId() != FWObjectDatabase::ANY_INTERVAL_ID &&
|
||||
mwSelObj == o1)
|
||||
{
|
||||
p.setPen(Qt::red);
|
||||
p.drawLine( 1, y+1, cr.width()-3, y+1 );
|
||||
@@ -2196,8 +2196,8 @@ FWObject* RuleSetView::getSelectedObject()
|
||||
|
||||
void RuleSetView::copyRuleContent(Rule *dst, Rule *src)
|
||||
{
|
||||
string id=dst->getId();
|
||||
int p=dst->getPosition();
|
||||
int id = dst->getId();
|
||||
int p = dst->getPosition();
|
||||
|
||||
if ( src->isDisabled() ) dst->disable();
|
||||
else dst->enable();
|
||||
@@ -2221,7 +2221,7 @@ void RuleSetView::copyRuleContent(Rule *dst, Rule *src)
|
||||
(*j)->duplicate(selem);
|
||||
}
|
||||
|
||||
if (id!="") dst->setId(id);
|
||||
if (id > -1) dst->setId(id);
|
||||
dst->setPosition(p);
|
||||
}
|
||||
|
||||
@@ -3343,13 +3343,13 @@ void RuleSetView::deleteObject(int row, int col, FWObject *obj)
|
||||
{
|
||||
RuleElement *re = getRE(row,col);
|
||||
if (re==NULL || re->isAny()) return;
|
||||
string id = obj->getId();
|
||||
int id = obj->getId();
|
||||
|
||||
if (fwbdebug)
|
||||
{
|
||||
qDebug("RuleSetView::deleteObject row=%d col=%d id=%s",
|
||||
row,col,id.c_str());
|
||||
qDebug("obj = %p",re->getRoot()->findInIndex(id));
|
||||
row, col, FWObjectDatabase::getStringId(id).c_str());
|
||||
qDebug("obj = %p", re->getRoot()->findInIndex(id));
|
||||
int rc = obj->ref()-1; obj->unref();
|
||||
qDebug("obj->ref_counter=%d",rc);
|
||||
}
|
||||
@@ -3430,7 +3430,7 @@ bool RuleSetView::insertObject(int row, int col, FWObject *obj)
|
||||
if (! re->isAny())
|
||||
{
|
||||
/* avoid duplicates */
|
||||
string cp_id=obj->getId();
|
||||
int cp_id = obj->getId();
|
||||
list<FWObject*>::iterator j;
|
||||
for(j=re->begin(); j!=re->end(); ++j)
|
||||
{
|
||||
@@ -3465,7 +3465,7 @@ void RuleSetView::pasteObject()
|
||||
{
|
||||
if (!isTreeReadWrite(this,ruleset)) return;
|
||||
|
||||
vector<string>::iterator i;
|
||||
vector<int>::iterator i;
|
||||
for (i= FWObjectClipboard::obj_clipboard->begin();
|
||||
i!=FWObjectClipboard::obj_clipboard->end(); ++i)
|
||||
{
|
||||
@@ -4204,7 +4204,7 @@ void RuleSetView::pasteRuleAbove()
|
||||
if (fwbdebug) qDebug("Firewall: pasteRuleAbove");
|
||||
|
||||
/* pick rules in reverse order */
|
||||
vector<string>::reverse_iterator i;
|
||||
vector<int>::reverse_iterator i;
|
||||
for (i= FWObjectClipboard::obj_clipboard->rbegin();
|
||||
i!=FWObjectClipboard::obj_clipboard->rend(); ++i)
|
||||
{
|
||||
@@ -4248,7 +4248,7 @@ void RuleSetView::pasteRuleBelow()
|
||||
position = currentRow();
|
||||
|
||||
int n=0;
|
||||
vector<string>::iterator i;
|
||||
vector<int>::iterator i;
|
||||
for (i= FWObjectClipboard::obj_clipboard->begin();
|
||||
i!=FWObjectClipboard::obj_clipboard->end(); ++i,++n)
|
||||
{
|
||||
|
||||
@@ -74,10 +74,10 @@ void TCPServiceDialog::loadFWObject(FWObject *o)
|
||||
init=true;
|
||||
|
||||
m_dialog->obj_name->setText( QString::fromUtf8(s->getName().c_str()) );
|
||||
m_dialog->ss->setValue( s->getInt("src_range_start") );
|
||||
m_dialog->se->setValue( s->getInt("src_range_end") );
|
||||
m_dialog->ds->setValue( s->getInt("dst_range_start") );
|
||||
m_dialog->de->setValue( s->getInt("dst_range_end") );
|
||||
m_dialog->ss->setValue( TCPUDPService::cast(s)->getSrcRangeStart() );
|
||||
m_dialog->se->setValue( TCPUDPService::cast(s)->getSrcRangeEnd() );
|
||||
m_dialog->ds->setValue( TCPUDPService::cast(s)->getDstRangeStart() );
|
||||
m_dialog->de->setValue( TCPUDPService::cast(s)->getDstRangeEnd() );
|
||||
|
||||
m_dialog->urg_m->setChecked( s->getBool("urg_flag_mask") );
|
||||
m_dialog->ack_m->setChecked( s->getBool("ack_flag_mask") );
|
||||
@@ -220,10 +220,11 @@ void TCPServiceDialog::applyChanges()
|
||||
if (m_dialog->ss->value()!=0 && m_dialog->se->value()==0) m_dialog->se->setValue( m_dialog->ss->value() );
|
||||
if (m_dialog->ds->value()!=0 && m_dialog->de->value()==0) m_dialog->de->setValue( m_dialog->ds->value() );
|
||||
|
||||
obj->setInt("src_range_start", m_dialog->ss->value() );
|
||||
obj->setInt("src_range_end", m_dialog->se->value() );
|
||||
obj->setInt("dst_range_start", m_dialog->ds->value() );
|
||||
obj->setInt("dst_range_end", m_dialog->de->value() );
|
||||
|
||||
TCPUDPService::cast(obj)->setSrcRangeStart(m_dialog->ss->value());
|
||||
TCPUDPService::cast(obj)->setSrcRangeEnd(m_dialog->se->value());
|
||||
TCPUDPService::cast(obj)->setDstRangeStart(m_dialog->ds->value());
|
||||
TCPUDPService::cast(obj)->setDstRangeEnd(m_dialog->de->value());
|
||||
|
||||
obj->setBool("urg_flag_mask", m_dialog->urg_m->isChecked() );
|
||||
obj->setBool("ack_flag_mask", m_dialog->ack_m->isChecked() );
|
||||
|
||||
@@ -73,10 +73,10 @@ void UDPServiceDialog::loadFWObject(FWObject *o)
|
||||
init=true;
|
||||
|
||||
m_dialog->obj_name->setText( QString::fromUtf8(s->getName().c_str()) );
|
||||
m_dialog->ss->setValue( s->getInt("src_range_start") );
|
||||
m_dialog->se->setValue( s->getInt("src_range_end") );
|
||||
m_dialog->ds->setValue( s->getInt("dst_range_start") );
|
||||
m_dialog->de->setValue( s->getInt("dst_range_end") );
|
||||
m_dialog->ss->setValue( TCPUDPService::cast(s)->getSrcRangeStart() );
|
||||
m_dialog->se->setValue( TCPUDPService::cast(s)->getSrcRangeEnd() );
|
||||
m_dialog->ds->setValue( TCPUDPService::cast(s)->getDstRangeStart() );
|
||||
m_dialog->de->setValue( TCPUDPService::cast(s)->getDstRangeEnd() );
|
||||
|
||||
m_dialog->comment->setText( QString::fromUtf8(s->getComment().c_str()) );
|
||||
|
||||
@@ -162,10 +162,10 @@ void UDPServiceDialog::applyChanges()
|
||||
if (m_dialog->ss->value()!=0 && m_dialog->se->value()==0) m_dialog->se->setValue( m_dialog->ss->value() );
|
||||
if (m_dialog->ds->value()!=0 && m_dialog->de->value()==0) m_dialog->de->setValue( m_dialog->ds->value() );
|
||||
|
||||
obj->setInt("src_range_start", m_dialog->ss->value() );
|
||||
obj->setInt("src_range_end", m_dialog->se->value() );
|
||||
obj->setInt("dst_range_start", m_dialog->ds->value() );
|
||||
obj->setInt("dst_range_end", m_dialog->de->value() );
|
||||
TCPUDPService::cast(obj)->setSrcRangeStart(m_dialog->ss->value());
|
||||
TCPUDPService::cast(obj)->setSrcRangeEnd(m_dialog->se->value());
|
||||
TCPUDPService::cast(obj)->setDstRangeStart(m_dialog->ds->value());
|
||||
TCPUDPService::cast(obj)->setDstRangeEnd(m_dialog->de->value());
|
||||
|
||||
mw->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
|
||||
|
||||
+12
-9
@@ -171,21 +171,21 @@ bool findDialog::matchAttr(libfwbuilder::FWObject *obj)
|
||||
if (m_dialog->useRegexp->isChecked())
|
||||
{
|
||||
QString port;
|
||||
port.setNum(obj->getInt("src_range_start"));
|
||||
port.setNum(TCPUDPService::cast(obj)->getSrcRangeStart());
|
||||
res |= ( port.indexOf( QRegExp(s) )!=-1 );
|
||||
port.setNum(obj->getInt("src_range_end"));
|
||||
port.setNum(TCPUDPService::cast(obj)->getSrcRangeEnd());
|
||||
res |= ( port.indexOf( QRegExp(s) )!=-1 );
|
||||
port.setNum(obj->getInt("dst_range_start"));
|
||||
port.setNum(TCPUDPService::cast(obj)->getDstRangeStart());
|
||||
res |= ( port.indexOf( QRegExp(s) )!=-1 );
|
||||
port.setNum(obj->getInt("dst_range_end"));
|
||||
port.setNum(TCPUDPService::cast(obj)->getDstRangeEnd());
|
||||
res |= ( port.indexOf( QRegExp(s) )!=-1 );
|
||||
} else
|
||||
{
|
||||
int port = s.toInt();
|
||||
res |= (port == obj->getInt("src_range_start"));
|
||||
res |= (port == obj->getInt("src_range_end"));
|
||||
res |= (port == obj->getInt("dst_range_start"));
|
||||
res |= (port == obj->getInt("dst_range_end"));
|
||||
res |= (port == TCPUDPService::cast(obj)->getSrcRangeStart());
|
||||
res |= (port == TCPUDPService::cast(obj)->getSrcRangeEnd());
|
||||
res |= (port == TCPUDPService::cast(obj)->getDstRangeStart());
|
||||
res |= (port == TCPUDPService::cast(obj)->getDstRangeEnd());
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -302,7 +302,10 @@ loop:
|
||||
if (fwbdebug)
|
||||
{
|
||||
qDebug("Found object: o=%p id=%s name=%s type=%s",
|
||||
o, o->getId().c_str(),o->getName().c_str(),o->getTypeName().c_str());
|
||||
o,
|
||||
FWObjectDatabase::getStringId(o->getId()).c_str(),
|
||||
o->getName().c_str(),
|
||||
o->getTypeName().c_str());
|
||||
}
|
||||
|
||||
m_project->openObject( o );
|
||||
|
||||
+4
-4
@@ -54,10 +54,10 @@ extern int fwbdebug;
|
||||
extern bool registered;
|
||||
extern bool gui_experiment1;
|
||||
|
||||
#define STANDARD_LIB "syslib000"
|
||||
#define USER_LIB "syslib001"
|
||||
#define TEMPLATE_LIB "syslib100"
|
||||
#define DELETED_LIB "sysid99"
|
||||
//#define STANDARD_LIB "syslib000"
|
||||
//#define USER_LIB "syslib001"
|
||||
//#define TEMPLATE_LIB "syslib100"
|
||||
//#define DELETED_LIB "sysid99"
|
||||
|
||||
|
||||
#ifdef NDEBUG
|
||||
|
||||
+12
-12
@@ -124,9 +124,9 @@ class findNamePredicate {
|
||||
};
|
||||
|
||||
class findIdPredicate {
|
||||
QString p;
|
||||
int p;
|
||||
public:
|
||||
findIdPredicate(const QString &_p):p(_p){}
|
||||
findIdPredicate(int _p):p(_p){}
|
||||
bool operator()(const libData &ld) { return ld.id==p; }
|
||||
};
|
||||
|
||||
@@ -158,7 +158,7 @@ Builder GUI and save back to file again."
|
||||
list<libData>::iterator listOfLibraries::add(const QString &path, bool load)
|
||||
{
|
||||
QString name;
|
||||
QString id;
|
||||
int id = -1;
|
||||
|
||||
if ( ! QFile::exists(path) ) return end();
|
||||
|
||||
@@ -172,10 +172,10 @@ list<libData>::iterator listOfLibraries::add(const QString &path, bool load)
|
||||
for (list<FWObject*>::iterator i=libs.begin(); i!=libs.end(); i++)
|
||||
{
|
||||
name = (*i)->getName().c_str();
|
||||
id = (*i)->getId().c_str();
|
||||
if ((*i)->getId() == STANDARD_LIB) continue;
|
||||
if ((*i)->getId() == DELETED_LIB) continue;
|
||||
if ((*i)->getId() == TEMPLATE_LIB) continue;
|
||||
id = (*i)->getId();
|
||||
if (id == FWObjectDatabase::STANDARD_LIB_ID) continue;
|
||||
if (id == FWObjectDatabase::DELETED_OBJECTS_ID) continue;
|
||||
if (id == FWObjectDatabase::TEMPLATE_LIB_ID) continue;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ list<libData>::iterator listOfLibraries::add(const QString &path, bool load)
|
||||
return end();
|
||||
}
|
||||
|
||||
if (id.isEmpty()) return end();
|
||||
if (id == -1) return end();
|
||||
if (name.isEmpty()) return end();
|
||||
|
||||
#if 0
|
||||
@@ -220,9 +220,9 @@ list<libData>::iterator listOfLibraries::add(const QString &path, bool load)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (id == STANDARD_LIB) return end();
|
||||
if (id == DELETED_LIB) return end();
|
||||
if (id == TEMPLATE_LIB) return end();
|
||||
if (id == FWObjectDatabase::STANDARD_LIB_ID) return end();
|
||||
if (id == FWObjectDatabase::DELETED_OBJECTS_ID) return end();
|
||||
if (id == FWObjectDatabase::TEMPLATE_LIB_ID) return end();
|
||||
|
||||
list<libData>::iterator i1=insert(end(),libData( id, name, path, false) );
|
||||
i1->load=load;
|
||||
@@ -255,7 +255,7 @@ bool listOfLibraries::isLoaded(const QString &libName)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool listOfLibraries::isKnown(const QString &id)
|
||||
bool listOfLibraries::isKnown(int id)
|
||||
{
|
||||
list<libData>::iterator it;
|
||||
if ( (it=std::find_if(begin(),end(),findIdPredicate(id)))!=end())
|
||||
|
||||
@@ -39,13 +39,13 @@
|
||||
class libData
|
||||
{
|
||||
public:
|
||||
QString id;
|
||||
int id;
|
||||
QString name;
|
||||
QString path;
|
||||
bool mandatory;
|
||||
bool load;
|
||||
|
||||
libData(const QString &i,const QString &n,const QString &p,bool f)
|
||||
libData(int i, const QString &n, const QString &p, bool f)
|
||||
{ id=i; name=n; path=p; mandatory=f; load=false; }
|
||||
};
|
||||
|
||||
@@ -70,7 +70,7 @@ class listOfLibraries : public std::list<libData>
|
||||
bool getLoad(const QString &libPath);
|
||||
|
||||
bool isLoaded(const QString &libName);
|
||||
bool isKnown(const QString &id);
|
||||
bool isKnown(int id);
|
||||
|
||||
void load();
|
||||
void save();
|
||||
|
||||
+4
-2
@@ -697,10 +697,12 @@ int main( int argc, char ** argv )
|
||||
if (fwbdebug)
|
||||
qDebug("Main: closing. VisibleFirewall = %p",o);
|
||||
|
||||
if (o) st->setStr("UI/visibleFirewall", o->getId().c_str() );
|
||||
if (o) st->setStr("UI/visibleFirewall",
|
||||
FWObjectDatabase::getStringId(o->getId()).c_str());
|
||||
|
||||
o=mw->getOpened();
|
||||
if (o) st->setStr("UI/visibleObject", o->getId().c_str() );
|
||||
if (o) st->setStr("UI/visibleObject",
|
||||
FWObjectDatabase::getStringId(o->getId()).c_str());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -908,7 +908,7 @@ void newFirewallDialog::finishClicked()
|
||||
* TODO: need to add flags to the API to be able to delete objects
|
||||
* without placing them in "Deleted objects" automatically
|
||||
*/
|
||||
FWObject *delObjLib = mw->db()->getById( DELETED_LIB );
|
||||
FWObject *delObjLib = mw->db()->getById( FWObjectDatabase::DELETED_OBJECTS_ID );
|
||||
if (delObjLib!=NULL && delObjLib->getById(tlibID)!=NULL)
|
||||
{
|
||||
if (fwbdebug) qDebug("newFirewallDialog::accept Delete library of templates from 'Deleted objects'");
|
||||
|
||||
@@ -721,7 +721,7 @@ void newHostDialog::finishClicked()
|
||||
if (unloadTemplatesLib)
|
||||
{
|
||||
#if 0
|
||||
FWObject *tlib = mw->db()->getById(TEMPLATE_LIB);
|
||||
FWObject *tlib = mw->db()->getById(FWObjectDatabase::TEMPLATE_LIB_ID);
|
||||
assert (tlib!=NULL);
|
||||
string tlibID = tlib->getId();
|
||||
if (fwbdebug) qDebug(" Delete library of templates");
|
||||
@@ -734,7 +734,7 @@ void newHostDialog::finishClicked()
|
||||
* TODO: need to add flags to the API to be able to delete objects
|
||||
* without placing them in "Deleted objects" automatically
|
||||
*/
|
||||
FWObject *delObjLib = mw->db()->getById( DELETED_LIB );
|
||||
FWObject *delObjLib = mw->db()->getById( FWObjectDatabase::DELETED_OBJECTS_ID );
|
||||
if (delObjLib!=NULL && delObjLib->getById(tlibID)!=NULL)
|
||||
{
|
||||
if (fwbdebug) qDebug(" Delete library of templates from 'Deleted objects'");
|
||||
|
||||
+15
-12
@@ -122,9 +122,9 @@ void fillLibraries(QComboBox *libs, libfwbuilder::FWObject *obj, bool rw)
|
||||
FWObject *libobj = obj->getLibrary();
|
||||
assert(libobj!=NULL);
|
||||
lib = libobj->getName().c_str();
|
||||
standardObj = (libobj->getId()==STANDARD_LIB);
|
||||
templateObj = (libobj->getId()==TEMPLATE_LIB);
|
||||
deletedObj = (libobj->getId()==DELETED_LIB);
|
||||
standardObj = (libobj->getId()==FWObjectDatabase::STANDARD_LIB_ID);
|
||||
templateObj = (libobj->getId()==FWObjectDatabase::TEMPLATE_LIB_ID);
|
||||
deletedObj = (libobj->getId()==FWObjectDatabase::DELETED_OBJECTS_ID);
|
||||
}
|
||||
|
||||
libs->clear();
|
||||
@@ -138,9 +138,12 @@ void fillLibraries(QComboBox *libs, libfwbuilder::FWObject *obj, bool rw)
|
||||
if (libicn.empty())
|
||||
libicn=(":/Icons/"+(*i)->getTypeName()+"/icon-tree").c_str();
|
||||
|
||||
if ( (*i)->getId()==STANDARD_LIB && !standardObj) continue;
|
||||
if ( (*i)->getId()==TEMPLATE_LIB && !templateObj) continue;
|
||||
if ( (*i)->getId()==DELETED_LIB && !deletedObj ) continue;
|
||||
if ( (*i)->getId()==FWObjectDatabase::STANDARD_LIB_ID &&
|
||||
!standardObj) continue;
|
||||
if ( (*i)->getId()==FWObjectDatabase::TEMPLATE_LIB_ID &&
|
||||
!templateObj) continue;
|
||||
if ( (*i)->getId()==FWObjectDatabase::DELETED_OBJECTS_ID &&
|
||||
!deletedObj ) continue;
|
||||
|
||||
if (rw && (*i)->isReadOnly()) continue;
|
||||
if (lib==QString((*i)->getName().c_str())) cn=n;
|
||||
@@ -167,9 +170,9 @@ void fillLibraries(QListWidget *libs, libfwbuilder::FWObject *obj, bool rw)
|
||||
FWObject *libobj = obj->getLibrary();
|
||||
assert(libobj!=NULL);
|
||||
lib = libobj->getName().c_str();
|
||||
standardObj = (libobj->getId()==STANDARD_LIB);
|
||||
templateObj = (libobj->getId()==TEMPLATE_LIB);
|
||||
deletedObj = (libobj->getId()==DELETED_LIB);
|
||||
standardObj = (libobj->getId()==FWObjectDatabase::STANDARD_LIB_ID);
|
||||
templateObj = (libobj->getId()==FWObjectDatabase::TEMPLATE_LIB_ID);
|
||||
deletedObj = (libobj->getId()==FWObjectDatabase::DELETED_OBJECTS_ID);
|
||||
}
|
||||
|
||||
libs->clear();
|
||||
@@ -183,9 +186,9 @@ void fillLibraries(QListWidget *libs, libfwbuilder::FWObject *obj, bool rw)
|
||||
if (libicn.empty())
|
||||
libicn=Resources::global_res->getObjResourceStr(*i,"icon-tree").c_str();
|
||||
|
||||
if ( (*i)->getId()==STANDARD_LIB && !standardObj) continue;
|
||||
if ( (*i)->getId()==TEMPLATE_LIB && !templateObj) continue;
|
||||
if ( (*i)->getId()==DELETED_LIB && !deletedObj ) continue;
|
||||
if ( (*i)->getId()==FWObjectDatabase::STANDARD_LIB_ID && !standardObj) continue;
|
||||
if ( (*i)->getId()==FWObjectDatabase::TEMPLATE_LIB_ID && !templateObj) continue;
|
||||
if ( (*i)->getId()==FWObjectDatabase::DELETED_OBJECTS_ID && !deletedObj ) continue;
|
||||
|
||||
if (rw && (*i)->isReadOnly()) continue;
|
||||
if (lib==QString((*i)->getName().c_str())) cn=n;
|
||||
|
||||
@@ -81,8 +81,8 @@ void findByObjectType(FWObject *o,
|
||||
{
|
||||
if (skip_system_libs)
|
||||
{
|
||||
if (o->getId()==DELETED_LIB) return;
|
||||
if (o->getId()==TEMPLATE_LIB) return;
|
||||
if (o->getId()==FWObjectDatabase::DELETED_OBJECTS_ID) return;
|
||||
if (o->getId()==FWObjectDatabase::TEMPLATE_LIB_ID) return;
|
||||
}
|
||||
|
||||
for (list<FWObject*>::iterator m=o->begin(); m!=o->end(); m++)
|
||||
|
||||
@@ -50,9 +50,9 @@ struct FWObjectNameCmpPredicate :
|
||||
|
||||
class findFWObjectIDPredicate : public std::unary_function<libfwbuilder::FWObject*, bool>
|
||||
{
|
||||
std::string _id;
|
||||
int _id;
|
||||
public:
|
||||
findFWObjectIDPredicate(const std::string &id):_id(id) {}
|
||||
findFWObjectIDPredicate(int id):_id(id) {}
|
||||
bool operator()(const libfwbuilder::FWObject *o) const
|
||||
{return o->getId()==_id;}
|
||||
};
|
||||
|
||||
@@ -310,8 +310,8 @@ string PolicyCompiler_iosacl::PrintRule::_printSrcService(libfwbuilder::Service
|
||||
|
||||
if (TCPService::isA(srv) || UDPService::isA(srv))
|
||||
{
|
||||
int rs=srv->getInt("src_range_start");
|
||||
int re=srv->getInt("src_range_end");
|
||||
int rs=TCPUDPService::cast(srv)->getSrcRangeStart();
|
||||
int re=TCPUDPService::cast(srv)->getSrcRangeEnd();
|
||||
|
||||
if (rs<0) rs=0;
|
||||
if (re<0) re=0;
|
||||
@@ -343,8 +343,8 @@ string PolicyCompiler_iosacl::PrintRule::_printDstService(Service *srv)
|
||||
|
||||
if (TCPService::isA(srv) || UDPService::isA(srv))
|
||||
{
|
||||
int rs=srv->getInt("dst_range_start");
|
||||
int re=srv->getInt("dst_range_end");
|
||||
int rs=TCPUDPService::cast(srv)->getDstRangeStart();
|
||||
int re=TCPUDPService::cast(srv)->getDstRangeEnd();
|
||||
|
||||
if (rs<0) rs=0;
|
||||
if (re<0) re=0;
|
||||
|
||||
@@ -267,8 +267,8 @@ string NATCompiler_ipt::PrintRule::_printSrcPorts(Service *srv)
|
||||
{
|
||||
std::ostringstream ostr;
|
||||
if (TCPService::isA(srv) || UDPService::isA(srv)) {
|
||||
int rs=srv->getInt("src_range_start");
|
||||
int re=srv->getInt("src_range_end");
|
||||
int rs=TCPUDPService::cast(srv)->getSrcRangeStart();
|
||||
int re=TCPUDPService::cast(srv)->getSrcRangeEnd();
|
||||
ostr << _printOPorts(rs,re);
|
||||
}
|
||||
return ostr.str();
|
||||
@@ -278,8 +278,8 @@ string NATCompiler_ipt::PrintRule::_printDstPorts(Service *srv)
|
||||
{
|
||||
std::ostringstream ostr;
|
||||
if (TCPService::isA(srv) || UDPService::isA(srv)) {
|
||||
int rs=srv->getInt("dst_range_start");
|
||||
int re=srv->getInt("dst_range_end");
|
||||
int rs=TCPUDPService::cast(srv)->getDstRangeStart();
|
||||
int re=TCPUDPService::cast(srv)->getDstRangeEnd();
|
||||
ostr << _printOPorts(rs,re);
|
||||
}
|
||||
return ostr.str();
|
||||
@@ -289,8 +289,8 @@ string NATCompiler_ipt::PrintRule::_printSNATPorts(Service *srv)
|
||||
{
|
||||
std::ostringstream ostr;
|
||||
if (TCPService::isA(srv) || UDPService::isA(srv)) {
|
||||
int rs=srv->getInt("src_range_start");
|
||||
int re=srv->getInt("src_range_end");
|
||||
int rs=TCPUDPService::cast(srv)->getSrcRangeStart();
|
||||
int re=TCPUDPService::cast(srv)->getSrcRangeEnd();
|
||||
ostr << _printTPorts(rs,re);
|
||||
}
|
||||
return ostr.str();
|
||||
@@ -300,8 +300,8 @@ string NATCompiler_ipt::PrintRule::_printDNATPorts(Service *srv)
|
||||
{
|
||||
std::ostringstream ostr;
|
||||
if (TCPService::isA(srv) || UDPService::isA(srv)) {
|
||||
int rs=srv->getInt("dst_range_start");
|
||||
int re=srv->getInt("dst_range_end");
|
||||
int rs=TCPUDPService::cast(srv)->getDstRangeStart();
|
||||
int re=TCPUDPService::cast(srv)->getDstRangeEnd();
|
||||
ostr << _printTPorts(rs,re);
|
||||
}
|
||||
return ostr.str();
|
||||
|
||||
+13
-13
@@ -154,9 +154,9 @@ string NATCompiler_ipt::debugPrintRule(Rule *r)
|
||||
NATRule *rule=NATRule::cast(r);
|
||||
|
||||
return NATCompiler::debugPrintRule(rule)+
|
||||
" "+rule->getInterfaceId()+
|
||||
" "+rule->getStr("ipt_chain")+
|
||||
" "+rule->getStr("ipt_target")+
|
||||
" " + FWObjectDatabase::getStringId(rule->getInterfaceId()) +
|
||||
" " + rule->getStr("ipt_chain") +
|
||||
" " + rule->getStr("ipt_target") +
|
||||
" (type="+rule->getRuleTypeAsString()+")";
|
||||
}
|
||||
|
||||
@@ -1209,10 +1209,10 @@ bool NATCompiler_ipt::separatePortRanges::processNext()
|
||||
assert(s!=NULL);
|
||||
|
||||
if ( TCPService::isA(s) || UDPService::isA(s) ) {
|
||||
int srs=s->getInt("src_range_start");
|
||||
int sre=s->getInt("src_range_end");
|
||||
int drs=s->getInt("dst_range_start");
|
||||
int dre=s->getInt("dst_range_end");
|
||||
int srs=TCPUDPService::cast(s)->getSrcRangeStart();
|
||||
int sre=TCPUDPService::cast(s)->getSrcRangeEnd();
|
||||
int drs=TCPUDPService::cast(s)->getDstRangeStart();
|
||||
int dre=TCPUDPService::cast(s)->getDstRangeEnd();
|
||||
|
||||
compiler->normalizePortRange(srs,sre);
|
||||
compiler->normalizePortRange(drs,dre);
|
||||
@@ -1262,8 +1262,8 @@ bool NATCompiler_ipt::separateSourcePorts::processNext()
|
||||
assert(s!=NULL);
|
||||
|
||||
if ( TCPService::isA(s) || UDPService::isA(s) ) {
|
||||
int srs=s->getInt("src_range_start");
|
||||
int sre=s->getInt("src_range_end");
|
||||
int srs=TCPUDPService::cast(s)->getSrcRangeStart();
|
||||
int sre=TCPUDPService::cast(s)->getSrcRangeEnd();
|
||||
|
||||
compiler->normalizePortRange(srs,sre);
|
||||
|
||||
@@ -1317,10 +1317,10 @@ bool NATCompiler_ipt::separateSourceAndDestinationPorts::processNext()
|
||||
assert(s!=NULL);
|
||||
|
||||
if ( TCPService::isA(s) || UDPService::isA(s) ) {
|
||||
int srs=s->getInt("src_range_start");
|
||||
int sre=s->getInt("src_range_end");
|
||||
int drs=s->getInt("dst_range_start");
|
||||
int dre=s->getInt("dst_range_end");
|
||||
int srs=TCPUDPService::cast(s)->getSrcRangeStart();
|
||||
int sre=TCPUDPService::cast(s)->getSrcRangeEnd();
|
||||
int drs=TCPUDPService::cast(s)->getDstRangeStart();
|
||||
int dre=TCPUDPService::cast(s)->getDstRangeEnd();
|
||||
|
||||
compiler->normalizePortRange(srs,sre);
|
||||
compiler->normalizePortRange(drs,dre);
|
||||
|
||||
@@ -640,8 +640,8 @@ string PolicyCompiler_ipt::PrintRule::_printSrcPorts(Service *srv)
|
||||
std::ostringstream str;
|
||||
if (TCPService::isA(srv) || UDPService::isA(srv))
|
||||
{
|
||||
int rs=srv->getInt("src_range_start");
|
||||
int re=srv->getInt("src_range_end");
|
||||
int rs=TCPUDPService::cast(srv)->getSrcRangeStart();
|
||||
int re=TCPUDPService::cast(srv)->getSrcRangeEnd();
|
||||
str << _printPorts(rs,re);
|
||||
}
|
||||
return str.str();
|
||||
@@ -652,8 +652,8 @@ string PolicyCompiler_ipt::PrintRule::_printDstPorts(Service *srv)
|
||||
std::ostringstream str;
|
||||
if (TCPService::isA(srv) || UDPService::isA(srv))
|
||||
{
|
||||
int rs=srv->getInt("dst_range_start");
|
||||
int re=srv->getInt("dst_range_end");
|
||||
int rs=TCPUDPService::cast(srv)->getDstRangeStart();
|
||||
int re=TCPUDPService::cast(srv)->getDstRangeEnd();
|
||||
str << _printPorts(rs,re);
|
||||
}
|
||||
return str.str();
|
||||
@@ -941,7 +941,7 @@ string PolicyCompiler_ipt::PrintRule::_printAddr(Address *o)
|
||||
{
|
||||
compiler->warning(
|
||||
string("Empty inet address in object ") +
|
||||
o->getId());
|
||||
FWObjectDatabase::getStringId(o->getId()));
|
||||
return ostr.str();
|
||||
}
|
||||
|
||||
|
||||
@@ -346,13 +346,13 @@ int PolicyCompiler_ipt::prolog()
|
||||
TCPService *tcpsyn;
|
||||
|
||||
anytcp=Service::cast(dbcopy->create(TCPService::TYPENAME) );
|
||||
anytcp->setId(ANY_TCP_OBJ_ID);
|
||||
anytcp->setId(FWObjectDatabase::registerStringId(ANY_TCP_OBJ_ID));
|
||||
anytcp->setName("AnyTCP");
|
||||
dbcopy->add(anytcp);
|
||||
cacheObj(anytcp); // to keep cache consistent
|
||||
|
||||
tcpsyn=TCPService::cast(dbcopy->create(TCPService::TYPENAME) );
|
||||
tcpsyn->setId(TCP_SYN_OBJ_ID);
|
||||
tcpsyn->setId(FWObjectDatabase::registerStringId(TCP_SYN_OBJ_ID));
|
||||
tcpsyn->setName("tcpSYN");
|
||||
tcpsyn->setTCPFlag(TCPService::SYN,true);
|
||||
tcpsyn->setAllTCPFlagMasks();
|
||||
@@ -360,25 +360,25 @@ int PolicyCompiler_ipt::prolog()
|
||||
cacheObj(tcpsyn); // to keep cache consistent
|
||||
|
||||
anyudp=Service::cast(dbcopy->create(UDPService::TYPENAME) );
|
||||
anyudp->setId(ANY_UDP_OBJ_ID);
|
||||
anyudp->setId(FWObjectDatabase::registerStringId(ANY_UDP_OBJ_ID));
|
||||
anyudp->setName("AnyUDP");
|
||||
dbcopy->add(anyudp);
|
||||
cacheObj(anyudp); // to keep cache consistent
|
||||
|
||||
anyicmp=Service::cast(dbcopy->create(ICMPService::TYPENAME) );
|
||||
anyicmp->setId(ANY_ICMP_OBJ_ID);
|
||||
anyicmp->setId(FWObjectDatabase::registerStringId(ANY_ICMP_OBJ_ID));
|
||||
anyicmp->setName("AnyICMP");
|
||||
dbcopy->add(anyicmp);
|
||||
cacheObj(anyicmp); // to keep cache consistent
|
||||
|
||||
anyip=Service::cast(dbcopy->create(IPService::TYPENAME) );
|
||||
anyip->setId(ANY_IP_OBJ_ID);
|
||||
anyip->setId(FWObjectDatabase::registerStringId(ANY_IP_OBJ_ID));
|
||||
anyip->setName("AnyIP");
|
||||
dbcopy->add(anyip);
|
||||
cacheObj(anyip); // to keep cache consistent
|
||||
|
||||
bcast255=Address::cast(dbcopy->create(IPv4::TYPENAME) );
|
||||
bcast255->setId(BCAST_255_OBJ_ID);
|
||||
bcast255->setId(FWObjectDatabase::registerStringId(BCAST_255_OBJ_ID));
|
||||
bcast255->setName("Broadcast_addr");
|
||||
bcast255->setAddress(InetAddr::getAllOnes());
|
||||
bcast255->setNetmask(InetAddr(InetAddr::getAllOnes()));
|
||||
@@ -577,7 +577,7 @@ bool PolicyCompiler_ipt::splitNonTerminatingTargets::processNext()
|
||||
ndst = r->getDst(); ndst->reset();
|
||||
nsrv = r->getSrv(); nsrv->reset();
|
||||
nitfre = r->getItf(); nitfre->reset();
|
||||
r->setInterfaceId("");
|
||||
r->setInterfaceId(-1);
|
||||
ruleopt = r->getOptionsObject();
|
||||
ruleopt->setInt("limit_value",-1);
|
||||
ruleopt->setInt("limit_value",-1);
|
||||
@@ -615,7 +615,7 @@ bool PolicyCompiler_ipt::InterfacePolicyRulesWithOptimization::processNext()
|
||||
RuleElementItf *itfre=rule->getItf(); assert(itfre);
|
||||
if (itfre->isAny())
|
||||
{
|
||||
rule->setInterfaceId("");
|
||||
rule->setInterfaceId(-1);
|
||||
tmp_queue.push_back(rule);
|
||||
return true;
|
||||
}
|
||||
@@ -864,7 +864,8 @@ bool PolicyCompiler_ipt::Logging2::processNext()
|
||||
if (TCPService::isA(srv))
|
||||
{
|
||||
nsrv->clearChildren();
|
||||
nsrv->addRef(compiler->dbcopy->findInIndex(ANY_TCP_OBJ_ID));
|
||||
nsrv->addRef(compiler->dbcopy->findInIndex(
|
||||
FWObjectDatabase::getIntId(ANY_TCP_OBJ_ID)));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1040,7 +1041,8 @@ bool PolicyCompiler_ipt::SrcNegation::processNext()
|
||||
if (TCPService::isA(srv))
|
||||
{
|
||||
nsrv->clearChildren();
|
||||
nsrv->addRef(compiler->dbcopy->findInIndex(ANY_TCP_OBJ_ID));
|
||||
nsrv->addRef(compiler->dbcopy->findInIndex(
|
||||
FWObjectDatabase::getIntId(ANY_TCP_OBJ_ID)));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1157,7 +1159,8 @@ bool PolicyCompiler_ipt::DstNegation::processNext()
|
||||
if (TCPService::isA(srv))
|
||||
{
|
||||
nsrv->clearChildren();
|
||||
nsrv->addRef(compiler->dbcopy->findInIndex(ANY_TCP_OBJ_ID));
|
||||
nsrv->addRef(compiler->dbcopy->findInIndex(
|
||||
FWObjectDatabase::getIntId(ANY_TCP_OBJ_ID)));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1381,7 +1384,8 @@ bool PolicyCompiler_ipt::TimeNegation::processNext()
|
||||
if (TCPService::isA(srv))
|
||||
{
|
||||
nsrv->clearChildren();
|
||||
nsrv->addRef(compiler->dbcopy->findInIndex(ANY_TCP_OBJ_ID));
|
||||
nsrv->addRef(compiler->dbcopy->findInIndex(
|
||||
FWObjectDatabase::getIntId(ANY_TCP_OBJ_ID)));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1480,7 +1484,7 @@ bool PolicyCompiler_ipt::setChainPreroutingForTag::processNext()
|
||||
rule->getStr("ipt_chain").empty() &&
|
||||
(rule->getDirection()==PolicyRule::Both ||
|
||||
rule->getDirection()==PolicyRule::Inbound) &&
|
||||
rule->getInterfaceId().empty() )
|
||||
rule->getInterfaceId()==-1 )
|
||||
rule->setStr("ipt_chain","PREROUTING");
|
||||
|
||||
tmp_queue.push_back(rule);
|
||||
@@ -1498,7 +1502,7 @@ bool PolicyCompiler_ipt::setChainPostroutingForTag::processNext()
|
||||
rule->getStr("ipt_chain").empty() &&
|
||||
(rule->getDirection()==PolicyRule::Both ||
|
||||
rule->getDirection()==PolicyRule::Outbound) &&
|
||||
rule->getInterfaceId().empty() )
|
||||
rule->getInterfaceId()==-1 )
|
||||
rule->setStr("ipt_chain","POSTROUTING");
|
||||
|
||||
tmp_queue.push_back(rule);
|
||||
@@ -3066,10 +3070,10 @@ bool PolicyCompiler_ipt::separatePortRanges::processNext()
|
||||
|
||||
if ( TCPService::isA(s) || UDPService::isA(s) )
|
||||
{
|
||||
unsigned srs=s->getInt("src_range_start");
|
||||
unsigned sre=s->getInt("src_range_end");
|
||||
unsigned drs=s->getInt("dst_range_start");
|
||||
unsigned dre=s->getInt("dst_range_end");
|
||||
unsigned srs=TCPUDPService::cast(s)->getSrcRangeStart();
|
||||
unsigned sre=TCPUDPService::cast(s)->getSrcRangeEnd();
|
||||
unsigned drs=TCPUDPService::cast(s)->getDstRangeStart();
|
||||
unsigned dre=TCPUDPService::cast(s)->getDstRangeEnd();
|
||||
|
||||
if (srs!=0 && sre==0) sre=srs;
|
||||
if (drs!=0 && dre==0) dre=drs;
|
||||
@@ -3127,9 +3131,10 @@ bool PolicyCompiler_ipt::separateSrcPort::processNext()
|
||||
Service *s=Service::cast(o);
|
||||
assert(s!=NULL);
|
||||
|
||||
if ( TCPService::isA(s) || UDPService::isA(s) ) {
|
||||
int srs=s->getInt("src_range_start");
|
||||
int sre=s->getInt("src_range_end");
|
||||
if ( TCPService::isA(s) || UDPService::isA(s) )
|
||||
{
|
||||
int srs=TCPUDPService::cast(s)->getSrcRangeStart();
|
||||
int sre=TCPUDPService::cast(s)->getSrcRangeEnd();
|
||||
|
||||
compiler->normalizePortRange(srs,sre);
|
||||
|
||||
@@ -3200,7 +3205,8 @@ bool PolicyCompiler_ipt::splitRuleIfSrvAnyActionReject::processNext()
|
||||
compiler->temp_ruleset->add(r);
|
||||
r->duplicate(rule);
|
||||
nsrv=r->getSrv();
|
||||
nsrv->addRef(compiler->dbcopy->findInIndex(ANY_TCP_OBJ_ID));
|
||||
nsrv->addRef(compiler->dbcopy->findInIndex(
|
||||
FWObjectDatabase::getIntId(ANY_TCP_OBJ_ID)));
|
||||
|
||||
FWOptions *ruleopt =r->getOptionsObject();
|
||||
ruleopt->setStr("action_on_reject","TCP RST");
|
||||
@@ -4020,7 +4026,7 @@ string PolicyCompiler_ipt::debugPrintRule(Rule *r)
|
||||
RuleElementInterval *intrel=rule->getWhen();
|
||||
RuleElementItf *itfrel=rule->getItf();
|
||||
|
||||
string iface_id = rule->getInterfaceId();
|
||||
int iface_id = rule->getInterfaceId();
|
||||
// Interface *rule_iface = fw_interfaces[iface_id];
|
||||
|
||||
ostringstream str;
|
||||
|
||||
@@ -102,7 +102,8 @@ void PolicyCompiler_ipt::optimize1::optimizeForRuleElement(PolicyRule *rule,
|
||||
if (TCPService::isA(srv))
|
||||
{
|
||||
re->clearChildren();
|
||||
re->addRef(compiler->dbcopy->findInIndex(ANY_TCP_OBJ_ID));
|
||||
re->addRef(compiler->dbcopy->findInIndex(
|
||||
FWObjectDatabase::getIntId(ANY_TCP_OBJ_ID)));
|
||||
/* also leave a flag indicating that further optimization by service
|
||||
* is not needed */
|
||||
rule->setBool("do_not_optimize_by_srv",true);
|
||||
|
||||
+6
-5
@@ -151,12 +151,12 @@ void assignRuleSetChain(RuleSet *ruleset)
|
||||
|
||||
if (!Compiler::isRootRuleSet(ruleset))
|
||||
rule->setStr("ipt_chain", branch_name);
|
||||
rule->setUniqueId( rule->getId() );
|
||||
rule->setUniqueId( FWObjectDatabase::getStringId(rule->getId()) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void findBranchesInMangleTable(Firewall *fw, list<FWObject*> &all_policies)
|
||||
void findBranchesInMangleTable(Firewall*, list<FWObject*> &all_policies)
|
||||
{
|
||||
// special but common case: if we only have one policy, there is
|
||||
// no need to check if we have to do branching in mangle table
|
||||
@@ -406,8 +406,8 @@ int main(int argc, char * const *argv)
|
||||
|
||||
//objdb->dump(true,true);
|
||||
|
||||
FWObject *slib = objdb->findInIndex("syslib000");
|
||||
if ( slib->isReadOnly()) slib->setReadOnly(false);
|
||||
FWObject *slib = objdb->findInIndex(FWObjectDatabase::STANDARD_LIB_ID);
|
||||
if (slib && slib->isReadOnly()) slib->setReadOnly(false);
|
||||
|
||||
/* Review firewall and OS options and generate commands */
|
||||
Firewall* fw=objdb->findFirewallByName(fwobjectname);
|
||||
@@ -512,7 +512,8 @@ _("Dynamic interface %s should not have an IP address object attached to it. Thi
|
||||
sprintf(errstr,
|
||||
"Interface %s (id=%s) has IP address %s.\n",
|
||||
iface->getName().c_str(),
|
||||
iface->getId().c_str(),
|
||||
FWObjectDatabase::getStringId(
|
||||
iface->getId()).c_str(),
|
||||
ip_addr->toString().c_str());
|
||||
throw FWException(errstr);
|
||||
}
|
||||
|
||||
@@ -270,10 +270,10 @@ bool PolicyCompiler_ipfw::separatePortRanges::processNext()
|
||||
|
||||
if ( TCPService::isA(s) || UDPService::isA(s) )
|
||||
{
|
||||
unsigned srs=s->getInt("src_range_start");
|
||||
unsigned sre=s->getInt("src_range_end");
|
||||
unsigned drs=s->getInt("dst_range_start");
|
||||
unsigned dre=s->getInt("dst_range_end");
|
||||
unsigned srs=TCPUDPService::cast(s)->getSrcRangeStart();
|
||||
unsigned sre=TCPUDPService::cast(s)->getSrcRangeEnd();
|
||||
unsigned drs=TCPUDPService::cast(s)->getDstRangeStart();
|
||||
unsigned dre=TCPUDPService::cast(s)->getDstRangeEnd();
|
||||
|
||||
if (srs!=0 && sre==0) sre=srs;
|
||||
if (drs!=0 && dre==0) dre=drs;
|
||||
@@ -343,10 +343,10 @@ bool PolicyCompiler_ipfw::sortTCPUDPServices::processNext()
|
||||
Service *s=Service::cast(o);
|
||||
assert(s!=NULL);
|
||||
|
||||
unsigned srs=s->getInt("src_range_start");
|
||||
unsigned sre=s->getInt("src_range_end");
|
||||
unsigned drs=s->getInt("dst_range_start");
|
||||
unsigned dre=s->getInt("dst_range_end");
|
||||
unsigned srs=TCPUDPService::cast(s)->getSrcRangeStart();
|
||||
unsigned sre=TCPUDPService::cast(s)->getSrcRangeEnd();
|
||||
unsigned drs=TCPUDPService::cast(s)->getDstRangeStart();
|
||||
unsigned dre=TCPUDPService::cast(s)->getDstRangeEnd();
|
||||
|
||||
if (srs!=0 && sre==0) sre=srs;
|
||||
if (drs!=0 && dre==0) dre=drs;
|
||||
|
||||
@@ -388,8 +388,8 @@ string PolicyCompiler_ipfw::PrintRule::_printSrcService(Service *srv,bool neg)
|
||||
|
||||
if (TCPService::isA(srv) || UDPService::isA(srv))
|
||||
{
|
||||
int rs=srv->getInt("src_range_start");
|
||||
int re=srv->getInt("src_range_end");
|
||||
int rs=TCPUDPService::cast(srv)->getSrcRangeStart();
|
||||
int re=TCPUDPService::cast(srv)->getSrcRangeEnd();
|
||||
string s1= _printPort(rs,re,neg);
|
||||
if (!s1.empty()) res= s1;
|
||||
}
|
||||
@@ -454,8 +454,8 @@ string PolicyCompiler_ipfw::PrintRule::_printDstService(Service *srv,bool neg)
|
||||
|
||||
if (TCPService::isA(srv) || UDPService::isA(srv))
|
||||
{
|
||||
int rs=srv->getInt("dst_range_start");
|
||||
int re=srv->getInt("dst_range_end");
|
||||
int rs=TCPUDPService::cast(srv)->getDstRangeStart();
|
||||
int re=TCPUDPService::cast(srv)->getDstRangeEnd();
|
||||
string s1=_printPort(rs,re,neg);;
|
||||
if (!s1.empty()) res= s1;
|
||||
}
|
||||
|
||||
@@ -383,8 +383,9 @@ void PolicyCompiler_pf::addDefaultPolicyRule()
|
||||
PolicyRule *r;
|
||||
TCPService *ssh =
|
||||
TCPService::cast(dbcopy->create(TCPService::TYPENAME) );
|
||||
ssh->setInt("dst_range_start",22);
|
||||
ssh->setInt("dst_range_end",22);
|
||||
ssh->setDstRangeStart(22);
|
||||
ssh->setDstRangeEnd(22);
|
||||
|
||||
ssh->setName("mgmt_ssh");
|
||||
dbcopy->add(ssh,false);
|
||||
cacheObj(ssh); // to keep cache consistent
|
||||
@@ -887,8 +888,8 @@ bool PolicyCompiler_pf::separateSrcPort::processNext()
|
||||
assert(s!=NULL);
|
||||
|
||||
if ( TCPService::isA(s) || UDPService::isA(s) ) {
|
||||
int srs=s->getInt("src_range_start");
|
||||
int sre=s->getInt("src_range_end");
|
||||
int srs=TCPUDPService::cast(s)->getSrcRangeStart();
|
||||
int sre=TCPUDPService::cast(s)->getSrcRangeEnd();
|
||||
|
||||
compiler->normalizePortRange(srs,sre);
|
||||
|
||||
|
||||
@@ -518,8 +518,8 @@ string PolicyCompiler_pf::PrintRule::_printSrcService(Service *srv, bool neg)
|
||||
ostringstream str;
|
||||
if (TCPService::isA(srv) || UDPService::isA(srv))
|
||||
{
|
||||
int rs=srv->getInt("src_range_start");
|
||||
int re=srv->getInt("src_range_end");
|
||||
int rs=TCPUDPService::cast(srv)->getSrcRangeStart();
|
||||
int re=TCPUDPService::cast(srv)->getSrcRangeEnd();
|
||||
str << _printPort(rs,re,neg);
|
||||
}
|
||||
return str.str();
|
||||
@@ -589,8 +589,8 @@ string PolicyCompiler_pf::PrintRule::_printDstService(Service *srv, bool neg)
|
||||
ostringstream str;
|
||||
if (TCPService::isA(srv) || UDPService::isA(srv))
|
||||
{
|
||||
int rs=srv->getInt("dst_range_start");
|
||||
int re=srv->getInt("dst_range_end");
|
||||
int rs=TCPUDPService::cast(srv)->getDstRangeStart();
|
||||
int re=TCPUDPService::cast(srv)->getDstRangeEnd();
|
||||
str << _printPort(rs,re,neg);
|
||||
}
|
||||
|
||||
|
||||
+27
-21
@@ -455,8 +455,8 @@ bool NATCompiler_pix::verifyRuleElements::processNext()
|
||||
|
||||
if (TCPService::isA(osrv) || UDPService::isA(osrv))
|
||||
{
|
||||
int drs=osrv->getInt("dst_range_start");
|
||||
int dre=osrv->getInt("dst_range_end");
|
||||
int drs=TCPUDPService::cast(osrv)->getDstRangeStart();
|
||||
int dre=TCPUDPService::cast(osrv)->getDstRangeEnd();
|
||||
|
||||
if (drs!=dre)
|
||||
compiler->abort("TCP or UDP service with a port range is not "
|
||||
@@ -464,8 +464,8 @@ bool NATCompiler_pix::verifyRuleElements::processNext()
|
||||
}
|
||||
if (TCPService::isA(tsrv) || UDPService::isA(tsrv))
|
||||
{
|
||||
int drs=tsrv->getInt("dst_range_start");
|
||||
int dre=tsrv->getInt("dst_range_end");
|
||||
int drs=TCPUDPService::cast(tsrv)->getDstRangeStart();
|
||||
int dre=TCPUDPService::cast(tsrv)->getDstRangeEnd();
|
||||
|
||||
if (drs!=dre)
|
||||
compiler->abort("TCP or UDP service with a port range is not "
|
||||
@@ -1346,25 +1346,31 @@ bool NATCompiler_pix::DetectDuplicateNAT::processNext()
|
||||
*(natcmd->o_srv)==*(nc->o_srv)
|
||||
)
|
||||
{
|
||||
compiler->abort("Duplicate NAT detected: rules "
|
||||
+rule->getLabel()
|
||||
+" and "+nc->rule_label
|
||||
+" : "+natcmd->o_src->getAddressPtr()->toString()
|
||||
+"/"+natcmd->o_src->getNetmaskPtr()->toString()
|
||||
+ " "
|
||||
+ natcmd->o_srv->getProtocolName()
|
||||
+ natcmd->o_srv->getStr("src_range_start")+":"
|
||||
+ natcmd->o_srv->getStr("src_range_end")+":"
|
||||
+ " "
|
||||
+"->"+natcmd->o_dst->getAddressPtr()->toString()
|
||||
+"/"+natcmd->o_dst->getNetmaskPtr()->toString()
|
||||
+ " "
|
||||
+ natcmd->o_srv->getStr("dst_range_start")+"/"
|
||||
+ natcmd->o_srv->getStr("dst_range_end"));
|
||||
}
|
||||
ostringstream str;
|
||||
str << "Duplicate NAT detected: rules "
|
||||
<< rule->getLabel()
|
||||
<< " and "<< nc->rule_label
|
||||
<< " : "<< natcmd->o_src->getAddressPtr()->toString()
|
||||
<< "/"<< natcmd->o_src->getNetmaskPtr()->toString()
|
||||
<< " "
|
||||
<< natcmd->o_srv->getProtocolName()
|
||||
<< " "
|
||||
<< TCPUDPService::cast(natcmd->o_srv)->getSrcRangeStart()
|
||||
<< ":"
|
||||
<< TCPUDPService::cast(natcmd->o_srv)->getSrcRangeEnd()
|
||||
<< " "
|
||||
<< "->"<< natcmd->o_dst->getAddressPtr()->toString()
|
||||
<< "/"<< natcmd->o_dst->getNetmaskPtr()->toString()
|
||||
<< " "
|
||||
<< TCPUDPService::cast(natcmd->o_srv)->getDstRangeStart()
|
||||
<< "/"
|
||||
<< TCPUDPService::cast(natcmd->o_srv)->getDstRangeEnd();
|
||||
|
||||
compiler->abort(str.str());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool NATCompiler_pix::DetectOverlappingStatics::processNext()
|
||||
|
||||
@@ -202,7 +202,7 @@ void NATCompiler_pix::PrintRule::_printPort(Service *srv)
|
||||
{
|
||||
if (TCPService::isA(srv) || UDPService::isA(srv))
|
||||
{
|
||||
int drs=srv->getInt("dst_range_start");
|
||||
int drs=TCPUDPService::cast(srv)->getDstRangeStart();
|
||||
|
||||
if (drs!=0) compiler->output << drs << " ";
|
||||
}
|
||||
@@ -214,8 +214,8 @@ string NATCompiler_pix::PrintRule::_printSrcService(Service *srv)
|
||||
|
||||
if (TCPService::isA(srv) || UDPService::isA(srv))
|
||||
{
|
||||
int rs=srv->getInt("src_range_start");
|
||||
int re=srv->getInt("src_range_end");
|
||||
int rs=TCPUDPService::cast(srv)->getSrcRangeStart();
|
||||
int re=TCPUDPService::cast(srv)->getSrcRangeEnd();
|
||||
|
||||
if (rs<0) rs=0;
|
||||
if (re<0) re=0;
|
||||
@@ -238,8 +238,8 @@ string NATCompiler_pix::PrintRule::_printDstService(Service *srv)
|
||||
ostringstream str;
|
||||
|
||||
if (TCPService::isA(srv) || UDPService::isA(srv)) {
|
||||
int rs=srv->getInt("dst_range_start");
|
||||
int re=srv->getInt("dst_range_end");
|
||||
int rs=TCPUDPService::cast(srv)->getDstRangeStart();
|
||||
int re=TCPUDPService::cast(srv)->getDstRangeEnd();
|
||||
|
||||
if (rs<0) rs=0;
|
||||
if (re<0) re=0;
|
||||
|
||||
@@ -203,8 +203,8 @@ bool PolicyCompiler_pix::PrintObjectGroupsAndClearCommands::processNext()
|
||||
Service *s=Service::cast(obj);
|
||||
assert(s!=NULL);
|
||||
|
||||
int rs=s->getInt("dst_range_start");
|
||||
int re=s->getInt("dst_range_end");
|
||||
int rs=TCPUDPService::cast(s)->getDstRangeStart();
|
||||
int re=TCPUDPService::cast(s)->getDstRangeEnd();
|
||||
|
||||
if (rs<0) rs=0;
|
||||
if (re<0) re=0;
|
||||
@@ -304,8 +304,8 @@ string PolicyCompiler_pix::PrintRule::_printSrcService(libfwbuilder::Service *sr
|
||||
|
||||
if (TCPService::isA(srv) || UDPService::isA(srv))
|
||||
{
|
||||
int rs=srv->getInt("src_range_start");
|
||||
int re=srv->getInt("src_range_end");
|
||||
int rs=TCPUDPService::cast(srv)->getSrcRangeStart();
|
||||
int re=TCPUDPService::cast(srv)->getSrcRangeEnd();
|
||||
|
||||
if (rs<0) rs=0;
|
||||
if (re<0) re=0;
|
||||
@@ -328,8 +328,8 @@ string PolicyCompiler_pix::PrintRule::_printDstService(libfwbuilder::Service *sr
|
||||
ostringstream str;
|
||||
|
||||
if (TCPService::isA(srv) || UDPService::isA(srv)) {
|
||||
int rs=srv->getInt("dst_range_start");
|
||||
int re=srv->getInt("dst_range_end");
|
||||
int rs=TCPUDPService::cast(srv)->getDstRangeStart();
|
||||
int re=TCPUDPService::cast(srv)->getDstRangeEnd();
|
||||
|
||||
if (rs<0) rs=0;
|
||||
if (re<0) re=0;
|
||||
@@ -472,7 +472,7 @@ string PolicyCompiler_pix::PrintRule::_printSSHTelnetCommand(PolicyRule *rule
|
||||
Interface *rule_iface = compiler->getCachedFwInterface(rule->getInterfaceId());
|
||||
assert(rule_iface);
|
||||
|
||||
port=srv->getInt("dst_range_start");
|
||||
port=TCPUDPService::cast(srv)->getDstRangeStart();
|
||||
|
||||
for (FWObject::iterator i=rel->begin(); i!=rel->end(); ++i)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user