mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-03-24 20:27:22 +01:00
2009-04-10 vadim <vadim@vk.crocodile.org>
* ObjectManipulator.cpp (ObjectManipulator::findWhereUsedRecursively): fixed bug #2744798 "dependency checking failed". In case when an object was used in a group and group used in a rule of a firewall, the program failed to properly update "last modified" attribute of the firewall when the object was changed.
This commit is contained in:
parent
1cb1984975
commit
1bf12d4f7c
@ -1,3 +1,11 @@
|
||||
2009-04-10 vadim <vadim@vk.crocodile.org>
|
||||
|
||||
* ObjectManipulator.cpp (ObjectManipulator::findWhereUsedRecursively):
|
||||
fixed bug #2744798 "dependency checking failed". In case when an
|
||||
object was used in a group and group used in a rule of a firewall,
|
||||
the program failed to properly update "last modified" attribute
|
||||
of the firewall when the object was changed.
|
||||
|
||||
2009-04-09 vadim <vadim@vk.crocodile.org>
|
||||
|
||||
* VERSION: start v3.0.5
|
||||
|
||||
@ -235,7 +235,6 @@ void FindWhereUsedWidget::humanizeSearchResults(std::set<FWObject *> &resset)
|
||||
for (;i!=resset.end();++i)
|
||||
{
|
||||
FWReference *ref = FWReference::cast(*i);
|
||||
|
||||
if (ref)
|
||||
{
|
||||
FWObject *o = ref->getParent(); // NB! We need parent of this ref.
|
||||
@ -243,18 +242,6 @@ void FindWhereUsedWidget::humanizeSearchResults(std::set<FWObject *> &resset)
|
||||
if (fwbdebug)
|
||||
qDebug("humanizeSearchResults: adding %s (%s)",
|
||||
o->getName().c_str(), o->getTypeName().c_str());
|
||||
#if 0
|
||||
if (RuleElement::cast(o)!=NULL)
|
||||
{
|
||||
tmp_res.insert(o->getParent()); // rule
|
||||
continue;
|
||||
}
|
||||
if (Group::cast(o)!=NULL)
|
||||
{
|
||||
tmp_res.insert(o);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
} else
|
||||
tmp_res.insert(*i);
|
||||
}
|
||||
|
||||
@ -3174,25 +3174,67 @@ bool ObjectManipulator::isSelected()
|
||||
return active;
|
||||
}
|
||||
|
||||
/*
|
||||
* per bug #2412334, FWObjectDatabase::findWhereObjectIsUsed finds
|
||||
* only "direct" uses of object (i.e. it finds group the object is
|
||||
* member of, but not other groups or rules the group is member of).
|
||||
* This method is recursive wrapper around FWObjectDatabase::findWhereObjectIsUsed
|
||||
*/
|
||||
void ObjectManipulator::findWhereUsedRecursively(FWObject *obj,
|
||||
FWObject *top,
|
||||
set<FWObject*> &resset)
|
||||
{
|
||||
if (fwbdebug)
|
||||
qDebug("ObjectManipulator::findWhereUsedRecursively obj=%s (%s)",
|
||||
obj->getName().c_str(), obj->getTypeName().c_str());
|
||||
|
||||
set<FWObject*> resset_tmp;
|
||||
set<FWObject*> resset_tmp2;
|
||||
|
||||
m_project->db()->findWhereObjectIsUsed(obj, top, resset_tmp);
|
||||
|
||||
set<FWObject *>::iterator i = resset_tmp.begin();
|
||||
for ( ; i!=resset_tmp.end(); ++i)
|
||||
{
|
||||
FWObject *parent_obj = *i;
|
||||
FWReference *ref = FWReference::cast(parent_obj);
|
||||
if (ref)
|
||||
parent_obj = ref->getParent(); // NB! We need parent of this ref.
|
||||
|
||||
// add new results to a separate set to avoid modifying the resset_tmp
|
||||
// in the middle of iteration
|
||||
if (Group::cast(parent_obj) && !RuleElement::cast(parent_obj))
|
||||
findWhereUsedRecursively(parent_obj, top, resset_tmp2);
|
||||
}
|
||||
|
||||
resset.insert(resset_tmp.begin(), resset_tmp.end());
|
||||
resset.insert(resset_tmp2.begin(), resset_tmp2.end());
|
||||
}
|
||||
|
||||
list<Firewall *> ObjectManipulator::findFirewallsForObject(FWObject *o)
|
||||
{
|
||||
if (fwbdebug)
|
||||
qDebug("ObjectManipulator::findFirewallsForObject");
|
||||
|
||||
list<Firewall *> fws;
|
||||
|
||||
set<FWObject *> resset;
|
||||
QTime tt;
|
||||
tt.start();
|
||||
FWObject *f=o;
|
||||
while (f!=NULL && !Firewall::isA(f)) f=f->getParent();
|
||||
if (f) fws.push_back(Firewall::cast(f));
|
||||
m_project->db()->findWhereObjectIsUsed(o, m_project->db(), resset);
|
||||
|
||||
findWhereUsedRecursively(o, m_project->db(), resset);
|
||||
|
||||
//m_project->db()->findWhereObjectIsUsed(o, m_project->db(), resset);
|
||||
|
||||
FindWhereUsedWidget::humanizeSearchResults(resset);
|
||||
|
||||
set<FWObject *>::iterator i=resset.begin();
|
||||
set<FWObject *>::iterator i = resset.begin();
|
||||
for ( ;i!=resset.end();++i)
|
||||
{
|
||||
RuleElement *re=RuleElement::cast(*i);
|
||||
RuleElement *re = RuleElement::cast(*i);
|
||||
if (re==NULL) continue;
|
||||
|
||||
Rule *r=Rule::cast(re->getParent());
|
||||
|
||||
@ -122,23 +122,26 @@ class ObjectManipulator : public QWidget/*ObjectManipulator_q*/ {
|
||||
void updateCreateObjectMenu(libfwbuilder::FWObject* lib);
|
||||
void makeNameUnique(libfwbuilder::FWObject* p,libfwbuilder::FWObject* obj);
|
||||
|
||||
libfwbuilder::FWObject* actuallyCreateObject(libfwbuilder::FWObject *parent,
|
||||
const QString &objType,
|
||||
const QString &objName,
|
||||
libfwbuilder::FWObject *copyFrom=NULL);
|
||||
libfwbuilder::FWObject* actuallyCreateObject(
|
||||
libfwbuilder::FWObject *parent,
|
||||
const QString &objType,
|
||||
const QString &objName,
|
||||
libfwbuilder::FWObject *copyFrom=NULL);
|
||||
|
||||
void autorename(libfwbuilder::FWObject *obj,bool ask=true);
|
||||
void extractFirewallsFromGroup(
|
||||
libfwbuilder::ObjectGroup *gr,
|
||||
std::set<libfwbuilder::Firewall*> &fo);
|
||||
|
||||
libfwbuilder::FWObject* actuallyPasteTo(libfwbuilder::FWObject *target,
|
||||
libfwbuilder::FWObject *obj,
|
||||
std::map<int,int> &map_ids);
|
||||
|
||||
bool validateForPaste(libfwbuilder::FWObject *target,
|
||||
libfwbuilder::FWObject *obj);
|
||||
void extractFirewallsFromGroup(libfwbuilder::ObjectGroup *gr,
|
||||
std::set<libfwbuilder::Firewall*> &fo);
|
||||
|
||||
libfwbuilder::FWObject* actuallyPasteTo(libfwbuilder::FWObject *target,
|
||||
libfwbuilder::FWObject *obj,
|
||||
std::map<int,int> &map_ids);
|
||||
|
||||
bool validateForPaste(libfwbuilder::FWObject *target,
|
||||
libfwbuilder::FWObject *obj);
|
||||
|
||||
void findWhereUsedRecursively(libfwbuilder::FWObject *obj,
|
||||
libfwbuilder::FWObject *top,
|
||||
std::set<libfwbuilder::FWObject*> &resset);
|
||||
|
||||
public slots:
|
||||
virtual void libChanged(int l);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user