mirror of
https://github.com/fwbuilder/fwbuilder
synced 2025-11-06 18:52:58 +01:00
refactor: NULL -> nullptr
This commit is contained in:
parent
1dba7aaae4
commit
a8f38647c9
@ -82,10 +82,8 @@ void LLkParser::traceOut(const char* rname)
|
||||
|
||||
RefToken LLkParser::LT(unsigned int i)
|
||||
{
|
||||
//assert(this!=NULL); //clang error: 'this' pointer cannot be null in well-defined C++ code;
|
||||
assert(inputState!=nullptr);
|
||||
TokenBuffer &tb = inputState->getInput();
|
||||
//assert(&tb!=NULL); //clang error: reference cannot be bound to dereferenced null pointer in well-defined C++ code;
|
||||
return tb.LT(i);
|
||||
}
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ public:
|
||||
_ip_acl = false;
|
||||
_name = "";
|
||||
_workName = "";
|
||||
_interface = NULL;
|
||||
_interface = nullptr;
|
||||
_dir = "in";
|
||||
nlines = 0;
|
||||
_last_rule_label = "";
|
||||
|
||||
@ -45,7 +45,7 @@ int ASA8TwiceNatStaticLogic::countAddresses(FWObject *re)
|
||||
for (FWObject::iterator i1=re->begin(); i1!=re->end(); ++i1)
|
||||
{
|
||||
FWObject *o = FWReference::getObject(*i1);
|
||||
if (Group::cast(o) != NULL) res += countAddresses(o);
|
||||
if (Group::cast(o) != nullptr) res += countAddresses(o);
|
||||
else
|
||||
{
|
||||
Address *addr = Address::cast(o);
|
||||
@ -59,11 +59,11 @@ int ASA8TwiceNatStaticLogic::countAddresses(FWObject *re)
|
||||
ASA8TwiceNatStaticLogic::TwiceNatRuleType ASA8TwiceNatStaticLogic::getAutomaticType()
|
||||
{
|
||||
RuleElementOSrc *osrc_re = rule->getOSrc();
|
||||
assert(osrc_re!=NULL);
|
||||
assert(osrc_re!=nullptr);
|
||||
//Address *osrc = Address::cast(FWReference::getObject(osrc_re->front()));
|
||||
|
||||
RuleElementTSrc *tsrc_re = rule->getTSrc();
|
||||
assert(tsrc_re!=NULL);
|
||||
assert(tsrc_re!=nullptr);
|
||||
//Address *tsrc = Address::cast(FWReference::getObject(tsrc_re->front()));
|
||||
|
||||
if (tsrc_re->isAny()) return STATIC;
|
||||
@ -77,7 +77,7 @@ ASA8TwiceNatStaticLogic::TwiceNatRuleType ASA8TwiceNatStaticLogic::getAutomaticT
|
||||
* back to dynamic
|
||||
*/
|
||||
if (tsrc_re->size() > 1) return DYNAMIC;
|
||||
//if (tsrc == NULL) return DYNAMIC;
|
||||
//if (tsrc == nullptr) return DYNAMIC;
|
||||
|
||||
Address *tsrc = Address::cast(FWReference::getObject(tsrc_re->front()));
|
||||
// ASA sez: "ERROR: Subnet can not be used as mapped source in
|
||||
|
||||
@ -50,7 +50,7 @@ using namespace std;
|
||||
|
||||
void AutomaticRules_cisco::addSshAccessRule()
|
||||
{
|
||||
if (ruleset == NULL) return;
|
||||
if (ruleset == nullptr) return;
|
||||
|
||||
FWOptions *fwopt = fw->getOptionsObject();
|
||||
|
||||
@ -73,7 +73,7 @@ void AutomaticRules_cisco::addSshAccessRule()
|
||||
|
||||
addMgmtRule(
|
||||
mgmt_workstation, fw, ssh,
|
||||
NULL, PolicyRule::Inbound, PolicyRule::Accept,
|
||||
nullptr, PolicyRule::Inbound, PolicyRule::Accept,
|
||||
"backup ssh access rule");
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ using namespace std;
|
||||
|
||||
void AutomaticRules_iosacl::addSshAccessRule()
|
||||
{
|
||||
if (ruleset == NULL) return;
|
||||
if (ruleset == nullptr) return;
|
||||
|
||||
FWOptions *fwopt = fw->getOptionsObject();
|
||||
|
||||
@ -76,7 +76,7 @@ void AutomaticRules_iosacl::addSshAccessRule()
|
||||
|
||||
addMgmtRule(
|
||||
fw, mgmt_workstation, ssh_rev,
|
||||
NULL, PolicyRule::Outbound, PolicyRule::Accept,
|
||||
nullptr, PolicyRule::Outbound, PolicyRule::Accept,
|
||||
"backup ssh access rule (out)");
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ using namespace std;
|
||||
|
||||
void AutomaticRules_nxosacl::addSshAccessRule()
|
||||
{
|
||||
if (ruleset == NULL) return;
|
||||
if (ruleset == nullptr) return;
|
||||
|
||||
FWOptions *fwopt = fw->getOptionsObject();
|
||||
|
||||
@ -76,7 +76,7 @@ void AutomaticRules_nxosacl::addSshAccessRule()
|
||||
|
||||
addMgmtRule(
|
||||
fw, mgmt_workstation, ssh_rev,
|
||||
NULL, PolicyRule::Outbound, PolicyRule::Accept,
|
||||
nullptr, PolicyRule::Outbound, PolicyRule::Accept,
|
||||
"backup ssh access rule (out)");
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,11 +96,11 @@ QString BaseObjectGroup::registerGroupName(const QString &prefix,
|
||||
BaseObjectGroup::object_group_type BaseObjectGroup::getObjectGroupTypeFromFWObject(
|
||||
const FWObject *obj)
|
||||
{
|
||||
if (Address::constcast(obj)!=NULL) return NETWORK;
|
||||
if (IPService::constcast(obj)!=NULL) return PROTO;
|
||||
if (ICMPService::constcast(obj)!=NULL) return ICMP_TYPE;
|
||||
if (TCPService::constcast(obj)!=NULL) return TCP_SERVICE;
|
||||
if (UDPService::constcast(obj)!=NULL) return UDP_SERVICE;
|
||||
if (Address::constcast(obj)!=nullptr) return NETWORK;
|
||||
if (IPService::constcast(obj)!=nullptr) return PROTO;
|
||||
if (ICMPService::constcast(obj)!=nullptr) return ICMP_TYPE;
|
||||
if (TCPService::constcast(obj)!=nullptr) return TCP_SERVICE;
|
||||
if (UDPService::constcast(obj)!=nullptr) return UDP_SERVICE;
|
||||
return UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
@ -108,7 +108,7 @@ string CompilerDriver_iosacl::safetyNetInstall(Firewall *fw)
|
||||
QString err = QObject::tr("Missing address for management host or subnet "
|
||||
"for the temporary ACL.\nPlease enter it in the "
|
||||
"tab 'Script options' in 'Firewall Settings' dialog");
|
||||
abort(fw, NULL, NULL, err.toStdString());
|
||||
abort(fw, nullptr, nullptr, err.toStdString());
|
||||
}
|
||||
|
||||
// if templ_acl_addr is ipv4 address, then we can not create this
|
||||
@ -166,7 +166,7 @@ string CompilerDriver_iosacl::safetyNetInstall(Firewall *fw)
|
||||
{
|
||||
QString err = QObject::tr("Invalid netmask for management subnet: "
|
||||
"'%1'").arg(netmask.c_str());
|
||||
abort(fw, NULL, NULL, err.toStdString());
|
||||
abort(fw, nullptr, nullptr, err.toStdString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -178,7 +178,7 @@ string CompilerDriver_iosacl::safetyNetInstall(Firewall *fw)
|
||||
{
|
||||
QString err = QObject::tr("Invalid address for management subnet: "
|
||||
"'%1'").arg(addr.c_str());
|
||||
abort(fw, NULL, NULL, err.toStdString());
|
||||
abort(fw, nullptr, nullptr, err.toStdString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -123,8 +123,8 @@ QString CompilerDriver_iosacl::run(const std::string &cluster_id,
|
||||
const std::string &firewall_id,
|
||||
const std::string &single_rule_id)
|
||||
{
|
||||
Cluster *cluster = NULL;
|
||||
Firewall *fw = NULL;
|
||||
Cluster *cluster = nullptr;
|
||||
Firewall *fw = nullptr;
|
||||
|
||||
getFirewallAndClusterObjects(cluster_id, firewall_id, &cluster, &fw);
|
||||
|
||||
|
||||
@ -108,7 +108,7 @@ string CompilerDriver_nxosacl::safetyNetInstall(Firewall *fw)
|
||||
QString err = QObject::tr("Missing address for management host or subnet "
|
||||
"for the temporary ACL.\nPlease enter it in the "
|
||||
"tab 'Script options' in 'Firewall Settings' dialog");
|
||||
abort(fw, NULL, NULL, err.toStdString());
|
||||
abort(fw, nullptr, nullptr, err.toStdString());
|
||||
}
|
||||
|
||||
// if templ_acl_addr is ipv4 address, then we can not create this
|
||||
@ -166,7 +166,7 @@ string CompilerDriver_nxosacl::safetyNetInstall(Firewall *fw)
|
||||
{
|
||||
QString err = QObject::tr("Invalid netmask for management subnet: "
|
||||
"'%1'").arg(netmask.c_str());
|
||||
abort(fw, NULL, NULL, err.toStdString());
|
||||
abort(fw, nullptr, nullptr, err.toStdString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -178,7 +178,7 @@ string CompilerDriver_nxosacl::safetyNetInstall(Firewall *fw)
|
||||
{
|
||||
QString err = QObject::tr("Invalid address for management subnet: "
|
||||
"'%1'").arg(addr.c_str());
|
||||
abort(fw, NULL, NULL, err.toStdString());
|
||||
abort(fw, nullptr, nullptr, err.toStdString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -123,8 +123,8 @@ QString CompilerDriver_nxosacl::run(const std::string &cluster_id,
|
||||
const std::string &firewall_id,
|
||||
const std::string &single_rule_id)
|
||||
{
|
||||
Cluster *cluster = NULL;
|
||||
Firewall *fw = NULL;
|
||||
Cluster *cluster = nullptr;
|
||||
Firewall *fw = nullptr;
|
||||
|
||||
getFirewallAndClusterObjects(cluster_id, firewall_id, &cluster, &fw);
|
||||
|
||||
|
||||
@ -191,8 +191,8 @@ QString CompilerDriver_pix::run(const std::string &cluster_id,
|
||||
const std::string &firewall_id,
|
||||
const std::string &single_rule_id)
|
||||
{
|
||||
Cluster *cluster = NULL;
|
||||
Firewall *fw = NULL;
|
||||
Cluster *cluster = nullptr;
|
||||
Firewall *fw = nullptr;
|
||||
|
||||
getFirewallAndClusterObjects(cluster_id, firewall_id, &cluster, &fw);
|
||||
|
||||
@ -224,7 +224,7 @@ QString CompilerDriver_pix::run(const std::string &cluster_id,
|
||||
(*cl_iface)->getFirstByType(FailoverClusterGroup::TYPENAME));
|
||||
if (failover_group)
|
||||
{
|
||||
//FWObject *this_member_interface = NULL; //UNUSED
|
||||
//FWObject *this_member_interface = nullptr; //UNUSED
|
||||
list<FWObject*> other_member_interfaces;
|
||||
for (FWObjectTypedChildIterator it =
|
||||
failover_group->findByType(FWObjectReference::TYPENAME);
|
||||
@ -618,7 +618,7 @@ void CompilerDriver_pix::pixSecurityLevelChecks(Firewall *fw,
|
||||
"be used for ACL. Marking this interface \"unprotected\" "
|
||||
"to exclude it."
|
||||
);
|
||||
warning(fw, NULL, NULL,
|
||||
warning(fw, nullptr, nullptr,
|
||||
err.arg(iface->getName().c_str())
|
||||
.toStdString());
|
||||
iface->setUnprotected(true);
|
||||
@ -657,7 +657,7 @@ void CompilerDriver_pix::pixSecurityLevelChecks(Firewall *fw,
|
||||
// "however interfaces %1 (%2) and %3 (%4)"
|
||||
// " have the same security level."
|
||||
// );
|
||||
// abort(fw, NULL, NULL,
|
||||
// abort(fw, nullptr, nullptr,
|
||||
// err.arg(iface->getName().c_str())
|
||||
// .arg(iface->getLabel().c_str())
|
||||
// .arg(iface2->getName().c_str())
|
||||
@ -672,7 +672,7 @@ void CompilerDriver_pix::pixSecurityLevelChecks(Firewall *fw,
|
||||
"however interfaces %1 (%2) and %3 (%4)"
|
||||
" have the same."
|
||||
);
|
||||
abort(fw, NULL, NULL,
|
||||
abort(fw, nullptr, nullptr,
|
||||
err.arg(iface->getName().c_str())
|
||||
.arg(iface->getLabel().c_str())
|
||||
.arg(iface2->getName().c_str())
|
||||
@ -695,7 +695,7 @@ void CompilerDriver_pix::pixNetworkZoneChecks(Firewall *fw,
|
||||
list<FWObject*> &all_interfaces)
|
||||
{
|
||||
multimap<string, FWObject*> netzone_objects;
|
||||
Helper helper(NULL);
|
||||
Helper helper(nullptr);
|
||||
|
||||
for (std::list<FWObject*>::iterator i=all_interfaces.begin(); i!=all_interfaces.end(); ++i)
|
||||
{
|
||||
@ -715,7 +715,7 @@ void CompilerDriver_pix::pixNetworkZoneChecks(Firewall *fw,
|
||||
if (netzone_id=="")
|
||||
{
|
||||
QString err("Network zone definition is missing for interface '%1' (%2)");
|
||||
abort(fw, NULL, NULL,
|
||||
abort(fw, nullptr, nullptr,
|
||||
err.arg(iface->getName().c_str())
|
||||
.arg(iface->getLabel().c_str()).toStdString());
|
||||
throw FatalErrorInSingleRuleCompileMode();
|
||||
@ -723,11 +723,11 @@ void CompilerDriver_pix::pixNetworkZoneChecks(Firewall *fw,
|
||||
|
||||
FWObject *netzone = objdb->findInIndex(
|
||||
FWObjectDatabase::getIntId(netzone_id));
|
||||
if (netzone==NULL)
|
||||
if (netzone==nullptr)
|
||||
{
|
||||
QString err("Network zone points at nonexisting object for "
|
||||
"interface '%1' (%2)");
|
||||
abort(fw, NULL, NULL,
|
||||
abort(fw, nullptr, nullptr,
|
||||
err.arg(iface->getName().c_str())
|
||||
.arg(iface->getLabel().c_str()).toStdString());
|
||||
throw FatalErrorInSingleRuleCompileMode();
|
||||
@ -758,18 +758,18 @@ void CompilerDriver_pix::pixNetworkZoneChecks(Firewall *fw,
|
||||
helper.expand_group_recursive(netzone, ol);
|
||||
|
||||
FWObject *nz = objdb->createObjectGroup();
|
||||
assert(nz!=NULL);
|
||||
assert(nz!=nullptr);
|
||||
nz->setName("netzone_" + iface->getLabel());
|
||||
objdb->add(nz);
|
||||
|
||||
for (list<FWObject*>::iterator j=ol.begin(); j!=ol.end(); ++j)
|
||||
{
|
||||
Address *addr = Address::cast(*j);
|
||||
if (addr == NULL || addr->getAddressPtr() == NULL)
|
||||
if (addr == nullptr || addr->getAddressPtr() == nullptr)
|
||||
{
|
||||
QString err("Network zone of interface '%1' uses object '%2' "
|
||||
"that is not an address");
|
||||
abort(fw, NULL, NULL,
|
||||
abort(fw, nullptr, nullptr,
|
||||
err.arg(iface->getLabel().c_str())
|
||||
.arg((*j)->getName().c_str()).toStdString());
|
||||
throw FatalErrorInSingleRuleCompileMode();
|
||||
@ -794,7 +794,7 @@ void CompilerDriver_pix::pixNetworkZoneChecks(Firewall *fw,
|
||||
{
|
||||
QString err("Network zone of interface '%1' uses object '%2' "
|
||||
"that is IPv6 address");
|
||||
abort(fw, NULL, NULL,
|
||||
abort(fw, nullptr, nullptr,
|
||||
err.arg(iface->getLabel().c_str())
|
||||
.arg((*j)->getName().c_str()).toStdString());
|
||||
throw FatalErrorInSingleRuleCompileMode();
|
||||
@ -830,7 +830,7 @@ void CompilerDriver_pix::pixNetworkZoneChecks(Firewall *fw,
|
||||
{
|
||||
QString err("Object %1 is used more than once in network "
|
||||
"zone of interface '%2'");
|
||||
abort(fw, NULL, NULL,
|
||||
abort(fw, nullptr, nullptr,
|
||||
err.arg(l->second->getName().c_str())
|
||||
.arg(k->first.c_str()).toStdString());
|
||||
throw FatalErrorInSingleRuleCompileMode();
|
||||
@ -838,7 +838,7 @@ void CompilerDriver_pix::pixNetworkZoneChecks(Firewall *fw,
|
||||
{
|
||||
QString err("Object %1 is used in network zones of "
|
||||
"interfaces '%2' and '%3'");
|
||||
abort(fw, NULL, NULL,
|
||||
abort(fw, nullptr, nullptr,
|
||||
err.arg(l->second->getName().c_str())
|
||||
.arg(k->first.c_str())
|
||||
.arg(l->first.c_str()).toStdString());
|
||||
@ -884,7 +884,7 @@ void CompilerDriver_pix::pixNetworkZoneChecks(Firewall *fw,
|
||||
void CompilerDriver_pix::pixClusterConfigurationChecks(Cluster *cluster,
|
||||
Firewall*)
|
||||
{
|
||||
if (cluster==NULL) return;
|
||||
if (cluster==nullptr) return;
|
||||
|
||||
FWObjectTypedChildIterator it = cluster->findByType(StateSyncClusterGroup::TYPENAME);
|
||||
StateSyncClusterGroup *state_sync_group = StateSyncClusterGroup::cast(*it);
|
||||
@ -893,7 +893,7 @@ void CompilerDriver_pix::pixClusterConfigurationChecks(Cluster *cluster,
|
||||
{
|
||||
QString err("One of the interfaces in the state synchronization group "
|
||||
"must be marked as 'Master'");
|
||||
abort(cluster, NULL, NULL, err.toStdString());
|
||||
abort(cluster, nullptr, nullptr, err.toStdString());
|
||||
throw FatalErrorInSingleRuleCompileMode();
|
||||
}
|
||||
|
||||
@ -934,7 +934,7 @@ void CompilerDriver_pix::pixClusterGroupChecks(ClusterGroup *cluster_group)
|
||||
FWObject *cluster = cluster_group;
|
||||
while (cluster && !Cluster::isA(cluster)) cluster = cluster->getParent();
|
||||
|
||||
FWObject *cluster_interface = NULL;
|
||||
FWObject *cluster_interface = nullptr;
|
||||
FWObject *p = cluster_group->getParent();
|
||||
if (Interface::isA(p)) cluster_interface = p;
|
||||
|
||||
@ -960,7 +960,7 @@ void CompilerDriver_pix::pixClusterGroupChecks(ClusterGroup *cluster_group)
|
||||
"cluster inetrface. Interface %1:%2 has the name "
|
||||
"that is different from the cluster interface name %3");
|
||||
|
||||
abort(cluster, NULL, NULL,
|
||||
abort(cluster, nullptr, nullptr,
|
||||
err.arg(member->getName().c_str())
|
||||
.arg(member_iface->getName().c_str())
|
||||
.arg(cluster_interface->getName().c_str()).toStdString());
|
||||
@ -977,7 +977,7 @@ void CompilerDriver_pix::pixClusterGroupChecks(ClusterGroup *cluster_group)
|
||||
"synchronization or failover must be marked "
|
||||
"'Dedicated Failover'. ");
|
||||
|
||||
abort(member, NULL, NULL,
|
||||
abort(member, nullptr, nullptr,
|
||||
err.arg(member_iface->getName().c_str()).toStdString());
|
||||
throw FatalErrorInSingleRuleCompileMode();
|
||||
}
|
||||
@ -989,7 +989,7 @@ void CompilerDriver_pix::pixClusterGroupChecks(ClusterGroup *cluster_group)
|
||||
"All interfaces used for the state "
|
||||
"synchronization or failover must have ip addresses.");
|
||||
|
||||
abort(member, NULL, NULL,
|
||||
abort(member, nullptr, nullptr,
|
||||
err.arg(member_iface->getName().c_str()).toStdString());
|
||||
throw FatalErrorInSingleRuleCompileMode();
|
||||
}
|
||||
@ -1004,13 +1004,13 @@ void CompilerDriver_pix::pixClusterGroupChecks(ClusterGroup *cluster_group)
|
||||
if (addresses_and_masks.size() >= 2)
|
||||
{
|
||||
QString first_key;
|
||||
const InetAddr *first_network_addr = NULL;
|
||||
const InetAddr *first_network_addr = nullptr;
|
||||
map<QString, const InetAddrMask*>::iterator it;
|
||||
for (it=addresses_and_masks.begin(); it!=addresses_and_masks.end(); ++it)
|
||||
{
|
||||
QString key = it->first;
|
||||
const InetAddrMask *am = it->second;
|
||||
if (first_network_addr == NULL)
|
||||
if (first_network_addr == nullptr)
|
||||
{
|
||||
first_key = key;
|
||||
first_network_addr = am->getNetworkAddressPtr();
|
||||
@ -1024,7 +1024,7 @@ void CompilerDriver_pix::pixClusterGroupChecks(ClusterGroup *cluster_group)
|
||||
"the same subnet. Interfaces %1 and %2 have "
|
||||
"addresses on different subnets: %3 , %4");
|
||||
|
||||
abort(cluster, NULL, NULL,
|
||||
abort(cluster, nullptr, nullptr,
|
||||
err.arg(first_key).arg(key)
|
||||
.arg(first_network_addr->toString().c_str())
|
||||
.arg(network_addr->toString().c_str()).toStdString());
|
||||
|
||||
@ -114,8 +114,8 @@ QString CompilerDriver_procurve_acl::run(const std::string &cluster_id,
|
||||
const std::string &firewall_id,
|
||||
const std::string &single_rule_id)
|
||||
{
|
||||
Cluster *cluster = NULL;
|
||||
Firewall *fw = NULL;
|
||||
Cluster *cluster = nullptr;
|
||||
Firewall *fw = nullptr;
|
||||
|
||||
getFirewallAndClusterObjects(cluster_id, firewall_id, &cluster, &fw);
|
||||
|
||||
|
||||
@ -263,7 +263,7 @@ int Helper::findInterfaceByNetzone(const InetAddr *addr, const InetAddr *nm)
|
||||
<< endl;
|
||||
#endif
|
||||
|
||||
// if addr==NULL, return id of the interfacce that has
|
||||
// if addr==nullptr, return id of the interfacce that has
|
||||
// net_zone=="any"
|
||||
if (addr==nullptr)
|
||||
{
|
||||
|
||||
@ -51,7 +51,7 @@ namespace fwcompiler {
|
||||
* 'obj' belongs to. Returns interface ID
|
||||
*/
|
||||
int findInterfaceByAddress(const libfwbuilder::InetAddr *a,
|
||||
const libfwbuilder::InetAddr *nm=NULL);
|
||||
const libfwbuilder::InetAddr *nm=nullptr);
|
||||
int findInterfaceByAddress(libfwbuilder::Address *obj);
|
||||
|
||||
/**
|
||||
@ -59,7 +59,7 @@ namespace fwcompiler {
|
||||
* that object 'obj' belongs to. Returns interface ID
|
||||
*/
|
||||
int findInterfaceByNetzone(const libfwbuilder::InetAddr *a,
|
||||
const libfwbuilder::InetAddr *nm=NULL);
|
||||
const libfwbuilder::InetAddr *nm=nullptr);
|
||||
int findInterfaceByNetzone(libfwbuilder::Address *obj);
|
||||
std::list<int> findInterfaceByNetzoneOrAll(
|
||||
libfwbuilder::RuleElement *re);
|
||||
|
||||
@ -54,7 +54,7 @@ QString IOSObjectGroup::groupMemberToString(FWObject *obj,
|
||||
case NETWORK:
|
||||
{
|
||||
Address *a = Address::cast(obj);
|
||||
assert(a!=NULL);
|
||||
assert(a!=nullptr);
|
||||
if (AddressRange::cast(a))
|
||||
{
|
||||
const InetAddr &start = AddressRange::cast(a)->getRangeStart();
|
||||
@ -63,7 +63,7 @@ QString IOSObjectGroup::groupMemberToString(FWObject *obj,
|
||||
} else
|
||||
{
|
||||
const InetAddr *addr = a->getAddressPtr();
|
||||
if (Network::cast(obj)!=NULL)
|
||||
if (Network::cast(obj)!=nullptr)
|
||||
{
|
||||
const InetAddr *mask = a->getNetmaskPtr();
|
||||
// Note: the syntax is "A.B.C.D /NN" (there must be space before /)
|
||||
@ -78,7 +78,7 @@ QString IOSObjectGroup::groupMemberToString(FWObject *obj,
|
||||
case PROTO:
|
||||
{
|
||||
Service *s = Service::cast(obj);
|
||||
assert(s!=NULL);
|
||||
assert(s!=nullptr);
|
||||
ostr << s->getProtocolNumber();
|
||||
break;
|
||||
}
|
||||
@ -87,7 +87,7 @@ QString IOSObjectGroup::groupMemberToString(FWObject *obj,
|
||||
{
|
||||
ostr << "icmp ";
|
||||
ICMPService *s = ICMPService::cast(obj);
|
||||
assert(s!=NULL);
|
||||
assert(s!=nullptr);
|
||||
if ( s->getInt("type")== -1) ostr << "";
|
||||
else ostr << s->getInt("type");
|
||||
break;
|
||||
@ -100,7 +100,7 @@ QString IOSObjectGroup::groupMemberToString(FWObject *obj,
|
||||
else ostr << "udp ";
|
||||
|
||||
TCPUDPService *s = TCPUDPService::cast(obj);
|
||||
assert(s!=NULL);
|
||||
assert(s!=nullptr);
|
||||
|
||||
int rs = s->getDstRangeStart();
|
||||
int re = s->getDstRangeEnd();
|
||||
|
||||
@ -76,7 +76,7 @@ NATCompiler_asa8::~NATCompiler_asa8()
|
||||
*/
|
||||
bool NATCompiler_asa8::VerifyValidityOfDNSOption::processNext()
|
||||
{
|
||||
NATRule *rule = getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule = getNext(); if (rule==nullptr) return false;
|
||||
FWOptions *ropt = rule->getOptionsObject();
|
||||
|
||||
if (ropt->getBool("asa8_nat_dns"))
|
||||
@ -118,7 +118,7 @@ bool NATCompiler_asa8::VerifyValidityOfDNSOption::processNext()
|
||||
*/
|
||||
bool NATCompiler_asa8::VerifyValidityOfTSrc::processNext()
|
||||
{
|
||||
NATRule *rule = getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule = getNext(); if (rule==nullptr) return false;
|
||||
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
@ -127,15 +127,15 @@ bool NATCompiler_asa8::VerifyValidityOfTSrc::processNext()
|
||||
if (tsrc_re->size()==1) return true;
|
||||
if (tsrc_re->size()==2)
|
||||
{
|
||||
FWObject *obj1 = NULL;
|
||||
FWObject *obj2 = NULL;
|
||||
FWObject *obj1 = nullptr;
|
||||
FWObject *obj2 = nullptr;
|
||||
for (FWObject::iterator it=tsrc_re->begin(); it!=tsrc_re->end(); ++it)
|
||||
{
|
||||
if (obj1 == NULL) obj1 = FWReference::getObject(*it);
|
||||
if (obj2 == NULL) obj2 = FWReference::getObject(*it);
|
||||
if (obj1 == nullptr) obj1 = FWReference::getObject(*it);
|
||||
if (obj2 == nullptr) obj2 = FWReference::getObject(*it);
|
||||
}
|
||||
if (Interface::isA(obj1) && Address::cast(obj2)!=NULL) return true;
|
||||
if (Interface::isA(obj1) && Group::cast(obj2)!=NULL) return true;
|
||||
if (Interface::isA(obj1) && Address::cast(obj2)!=nullptr) return true;
|
||||
if (Interface::isA(obj1) && Group::cast(obj2)!=nullptr) return true;
|
||||
QString err("Invalid combination of objects in TSrc: %1 (%2) and %3 (%4) ");
|
||||
compiler->abort(
|
||||
rule,
|
||||
@ -151,7 +151,7 @@ bool NATCompiler_asa8::VerifyValidityOfTSrc::processNext()
|
||||
|
||||
bool NATCompiler_asa8::VerifyRules::processNext()
|
||||
{
|
||||
NATRule *rule = getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule = getNext(); if (rule==nullptr) return false;
|
||||
string version = compiler->fw->getStr("version");
|
||||
|
||||
RuleElementOSrc *osrc=rule->getOSrc(); assert(osrc);
|
||||
@ -208,7 +208,7 @@ bool NATCompiler_asa8::VerifyRules::processNext()
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( Group::cast( compiler->getFirstTSrv(rule) )!=NULL)
|
||||
if ( Group::cast( compiler->getFirstTSrv(rule) )!=nullptr)
|
||||
{
|
||||
compiler->abort(
|
||||
rule,
|
||||
@ -220,7 +220,7 @@ bool NATCompiler_asa8::VerifyRules::processNext()
|
||||
{
|
||||
Network *a1=Network::cast(compiler->getFirstOSrc(rule));
|
||||
Network *a2=Network::cast(compiler->getFirstTSrc(rule));
|
||||
if ( a1==NULL || a2==NULL ||
|
||||
if ( a1==nullptr || a2==nullptr ||
|
||||
a1->getNetmaskPtr()->getLength()!=a2->getNetmaskPtr()->getLength() )
|
||||
{
|
||||
compiler->abort(
|
||||
@ -235,7 +235,7 @@ bool NATCompiler_asa8::VerifyRules::processNext()
|
||||
{
|
||||
Network *a1=Network::cast(compiler->getFirstODst(rule));
|
||||
Network *a2=Network::cast(compiler->getFirstTDst(rule));
|
||||
if ( a1==NULL || a2==NULL ||
|
||||
if ( a1==nullptr || a2==nullptr ||
|
||||
a1->getNetmaskPtr()->getLength()!=a2->getNetmaskPtr()->getLength() )
|
||||
{
|
||||
compiler->abort(
|
||||
@ -267,7 +267,7 @@ bool NATCompiler_asa8::VerifyRules::processNext()
|
||||
|
||||
bool NATCompiler_asa8::verifyInterfacesInNatRule::processNext()
|
||||
{
|
||||
NATRule *rule = getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule = getNext(); if (rule==nullptr) return false;
|
||||
tmp_queue.push_back(rule);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ QString NATCompiler_asa8::PrintRule::printSingleObject(FWObject *obj)
|
||||
NamedObject* asa8_object = pix_comp->named_objects_manager->getNamedObject(obj);
|
||||
if (asa8_object) return asa8_object->getCommandWord();
|
||||
|
||||
if (BaseObjectGroup::cast(obj)!=NULL) return obj->getName().c_str();
|
||||
if (BaseObjectGroup::cast(obj)!=nullptr) return obj->getName().c_str();
|
||||
|
||||
if (Interface::isA(obj) && obj->isChildOf(compiler->fw)) return "interface";
|
||||
|
||||
@ -98,25 +98,25 @@ void NATCompiler_asa8::PrintRule::printSDNAT(NATRule *rule)
|
||||
QStringList cmd;
|
||||
|
||||
RuleElementOSrc *osrc_re = rule->getOSrc();
|
||||
assert(osrc_re!=NULL);
|
||||
assert(osrc_re!=nullptr);
|
||||
FWObject *osrc = FWReference::getObject(osrc_re->front());
|
||||
|
||||
RuleElementODst *odst_re = rule->getODst();
|
||||
assert(odst_re!=NULL);
|
||||
assert(odst_re!=nullptr);
|
||||
FWObject *odst = FWReference::getObject(odst_re->front());
|
||||
|
||||
RuleElementOSrv *osrv_re = rule->getOSrv();
|
||||
assert(osrv_re!=NULL);
|
||||
assert(osrv_re!=nullptr);
|
||||
FWObject *osrv = FWReference::getObject(osrv_re->front());
|
||||
|
||||
RuleElementTSrc *tsrc_re = rule->getTSrc();
|
||||
assert(tsrc_re!=NULL);
|
||||
assert(tsrc_re!=nullptr);
|
||||
|
||||
Address *tdst = compiler->getFirstTDst(rule); assert(tdst);
|
||||
Service *tsrv = compiler->getFirstTSrv(rule); assert(tsrv);
|
||||
|
||||
RuleElementItfInb *itf_in_re = rule->getItfInb(); assert(itf_in_re!=NULL);
|
||||
RuleElementItfOutb *itf_out_re = rule->getItfOutb(); assert(itf_out_re!=NULL);
|
||||
RuleElementItfInb *itf_in_re = rule->getItfInb(); assert(itf_in_re!=nullptr);
|
||||
RuleElementItfOutb *itf_out_re = rule->getItfOutb(); assert(itf_out_re!=nullptr);
|
||||
|
||||
Interface *i_iface = Interface::cast(
|
||||
FWObjectReference::getObject(itf_in_re->front()));
|
||||
|
||||
@ -141,7 +141,7 @@ void NATCompiler_pix::_expand_addr_recursive_pix(Rule *rule,
|
||||
}
|
||||
|
||||
if (o->getId() == FWObjectDatabase::ANY_ADDRESS_ID ||
|
||||
MultiAddress::cast(o)!=NULL ||
|
||||
MultiAddress::cast(o)!=nullptr ||
|
||||
Interface::cast(o) ||
|
||||
physAddress::cast(o))
|
||||
{
|
||||
@ -152,7 +152,7 @@ void NATCompiler_pix::_expand_addr_recursive_pix(Rule *rule,
|
||||
|
||||
if (addrlist.empty())
|
||||
{
|
||||
if (RuleElement::cast(s)==NULL) ol.push_back(s);
|
||||
if (RuleElement::cast(s)==nullptr) ol.push_back(s);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -240,8 +240,8 @@ string NATCompiler_pix::debugPrintRule(Rule *r)
|
||||
{
|
||||
NATRule *rule=NATRule::cast(r);
|
||||
|
||||
RuleElementItfInb *itf_in_re = rule->getItfInb(); assert(itf_in_re!=NULL);
|
||||
RuleElementItfOutb *itf_out_re = rule->getItfOutb(); assert(itf_out_re!=NULL);
|
||||
RuleElementItfInb *itf_in_re = rule->getItfInb(); assert(itf_in_re!=nullptr);
|
||||
RuleElementItfOutb *itf_out_re = rule->getItfOutb(); assert(itf_out_re!=nullptr);
|
||||
|
||||
ostringstream os;
|
||||
|
||||
@ -255,7 +255,7 @@ string NATCompiler_pix::debugPrintRule(Rule *r)
|
||||
{
|
||||
if ( ! rule->exists("nat_cmd") ) break;
|
||||
NATCmd *natcmd = nat_commands[ rule->getInt("nat_cmd") ];
|
||||
if (natcmd != NULL)
|
||||
if (natcmd != nullptr)
|
||||
{
|
||||
os <<" NATCmd: ";
|
||||
os << " rule=[" << natcmd->rule_label << "]";
|
||||
@ -281,7 +281,7 @@ string NATCompiler_pix::debugPrintRule(Rule *r)
|
||||
{
|
||||
if ( ! rule->exists("sc_cmd") ) break;
|
||||
StaticCmd *scmd=static_commands[ rule->getInt("sc_cmd") ];
|
||||
if (scmd!=NULL)
|
||||
if (scmd!=nullptr)
|
||||
{
|
||||
string iaddr_str = _print_addr(scmd->iaddr->getAddressPtr());
|
||||
string oaddr_str = _print_addr(scmd->oaddr->getAddressPtr());
|
||||
@ -338,7 +338,7 @@ bool NATCompiler_pix::storeProcessedRules::processNext()
|
||||
|
||||
bool NATCompiler_pix::VerifyRules::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
string version = compiler->fw->getStr("version");
|
||||
|
||||
if (rule->getRuleType()==NATRule::SDNAT)
|
||||
@ -439,7 +439,7 @@ bool NATCompiler_pix::VerifyRules::processNext()
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( Group::cast( compiler->getFirstTSrv(rule) )!=NULL)
|
||||
if ( Group::cast( compiler->getFirstTSrv(rule) )!=nullptr)
|
||||
{
|
||||
compiler->abort(
|
||||
rule,
|
||||
@ -451,7 +451,7 @@ bool NATCompiler_pix::VerifyRules::processNext()
|
||||
{
|
||||
Network *a1=Network::cast(compiler->getFirstOSrc(rule));
|
||||
Network *a2=Network::cast(compiler->getFirstTSrc(rule));
|
||||
if ( a1==NULL || a2==NULL ||
|
||||
if ( a1==nullptr || a2==nullptr ||
|
||||
a1->getNetmaskPtr()->getLength()!=a2->getNetmaskPtr()->getLength() )
|
||||
{
|
||||
compiler->abort(
|
||||
@ -465,7 +465,7 @@ bool NATCompiler_pix::VerifyRules::processNext()
|
||||
{
|
||||
Network *a1=Network::cast(compiler->getFirstODst(rule));
|
||||
Network *a2=Network::cast(compiler->getFirstTDst(rule));
|
||||
if ( a1==NULL || a2==NULL ||
|
||||
if ( a1==nullptr || a2==nullptr ||
|
||||
a1->getNetmaskPtr()->getLength()!=a2->getNetmaskPtr()->getLength() )
|
||||
{
|
||||
compiler->abort(
|
||||
@ -487,12 +487,12 @@ bool NATCompiler_pix::VerifyRules::processNext()
|
||||
bool NATCompiler_pix::AssignInterface::processNext()
|
||||
{
|
||||
Helper helper(compiler);
|
||||
NATRule *rule = getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule = getNext(); if (rule==nullptr) return false;
|
||||
|
||||
RuleElement *itf_re;
|
||||
|
||||
Address *a1 = NULL;
|
||||
Address *a2 = NULL;
|
||||
Address *a1 = nullptr;
|
||||
Address *a2 = nullptr;
|
||||
|
||||
if (rule->getRuleType()==NATRule::SNAT || rule->getRuleType()==NATRule::SDNAT)
|
||||
{
|
||||
@ -512,7 +512,7 @@ bool NATCompiler_pix::AssignInterface::processNext()
|
||||
a2 = compiler->getFirstODst(rule);
|
||||
}
|
||||
|
||||
assert(a1!=NULL && a2!=NULL);
|
||||
assert(a1!=nullptr && a2!=nullptr);
|
||||
|
||||
int org_intf_id = helper.findInterfaceByNetzone(a1);
|
||||
int trn_intf_id = helper.findInterfaceByNetzone(a2);
|
||||
@ -534,10 +534,10 @@ bool NATCompiler_pix::AssignInterface::processNext()
|
||||
return true;
|
||||
}
|
||||
|
||||
itf_re = rule->getItfInb(); assert(itf_re!=NULL);
|
||||
itf_re = rule->getItfInb(); assert(itf_re!=nullptr);
|
||||
if (itf_re->isAny() && ! itf_re->hasRef(iface_org)) itf_re->addRef(iface_org);
|
||||
|
||||
itf_re = rule->getItfOutb(); assert(itf_re!=NULL);
|
||||
itf_re = rule->getItfOutb(); assert(itf_re!=nullptr);
|
||||
if (itf_re->isAny() && ! itf_re->hasRef(iface_trn)) itf_re->addRef(iface_trn);
|
||||
|
||||
if (org_intf_id == trn_intf_id)
|
||||
@ -558,14 +558,14 @@ bool NATCompiler_pix::AssignInterface::processNext()
|
||||
|
||||
bool NATCompiler_pix::verifyInterfaces::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
tmp_queue.push_back(rule);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool NATCompiler_pix::verifyRuleElements::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
Address *osrc=compiler->getFirstOSrc(rule); assert(osrc);
|
||||
Address *odst=compiler->getFirstODst(rule); assert(odst);
|
||||
@ -672,7 +672,7 @@ bool NATCompiler_pix::verifyRuleElements::processNext()
|
||||
|
||||
bool NATCompiler_pix::fillTranslatedSrv::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
@ -694,7 +694,7 @@ bool NATCompiler_pix::fillTranslatedSrv::processNext()
|
||||
*/
|
||||
bool NATCompiler_pix::ExpandAddressRanges::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
@ -731,13 +731,13 @@ bool NATCompiler_pix::ExpandAddressRanges::processNext()
|
||||
*/
|
||||
bool NATCompiler_pix::ReplaceFirewallObjectsODst::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
list<FWObject*> cl;
|
||||
RuleElementODst *rel;
|
||||
Address *obj=NULL;
|
||||
Address *obj=nullptr;
|
||||
|
||||
switch (rule->getRuleType()) {
|
||||
|
||||
@ -746,7 +746,7 @@ bool NATCompiler_pix::ReplaceFirewallObjectsODst::processNext()
|
||||
return true;
|
||||
case NATRule::DNAT:
|
||||
rel=rule->getODst(); assert(rel);
|
||||
obj=compiler->getFirstODst(rule); assert(obj!=NULL);
|
||||
obj=compiler->getFirstODst(rule); assert(obj!=nullptr);
|
||||
|
||||
if (obj->getId()==compiler->getFwId() )
|
||||
{
|
||||
@ -779,11 +779,11 @@ bool NATCompiler_pix::ReplaceFirewallObjectsODst::processNext()
|
||||
bool NATCompiler_pix::ReplaceFirewallObjectsTSrc::processNext()
|
||||
{
|
||||
Helper helper(compiler);
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
list<FWObject*> cl;
|
||||
RuleElementTSrc *rel;
|
||||
Address *obj=NULL;
|
||||
Address *obj=nullptr;
|
||||
|
||||
switch (rule->getRuleType()) {
|
||||
|
||||
@ -797,12 +797,12 @@ bool NATCompiler_pix::ReplaceFirewallObjectsTSrc::processNext()
|
||||
case NATRule::SNAT:
|
||||
{
|
||||
int osrc_level=100;
|
||||
Address *osrc=NULL;
|
||||
Interface *osrc_iface=NULL;
|
||||
Address *osrc=nullptr;
|
||||
Interface *osrc_iface=nullptr;
|
||||
|
||||
if ( ! rule->getOSrc()->isAny())
|
||||
{
|
||||
osrc=compiler->getFirstOSrc(rule); assert(osrc!=NULL);
|
||||
osrc=compiler->getFirstOSrc(rule); assert(osrc!=nullptr);
|
||||
osrc_iface = Interface::cast(
|
||||
compiler->dbcopy->findInIndex( helper.findInterfaceByNetzone(osrc)));
|
||||
osrc_level = osrc_iface->getSecurityLevel();
|
||||
@ -818,7 +818,7 @@ bool NATCompiler_pix::ReplaceFirewallObjectsTSrc::processNext()
|
||||
}
|
||||
|
||||
obj = compiler->getFirstTSrc(rule);
|
||||
assert(obj!=NULL);
|
||||
assert(obj!=nullptr);
|
||||
|
||||
if (obj->getId()==compiler->getFwId() )
|
||||
{
|
||||
@ -838,11 +838,11 @@ bool NATCompiler_pix::ReplaceFirewallObjectsTSrc::processNext()
|
||||
}
|
||||
} else
|
||||
{
|
||||
Address *odst = compiler->getFirstODst(rule); assert(odst!=NULL);
|
||||
Address *odst = compiler->getFirstODst(rule); assert(odst!=nullptr);
|
||||
FWObject *odst_iface =
|
||||
compiler->dbcopy->findInIndex(
|
||||
helper.findInterfaceByNetzone(odst ) );
|
||||
if (odst_iface!=NULL) cl.push_back(odst_iface);
|
||||
if (odst_iface!=nullptr) cl.push_back(odst_iface);
|
||||
}
|
||||
|
||||
if ( ! cl.empty() )
|
||||
@ -869,9 +869,9 @@ bool NATCompiler_pix::ReplaceFirewallObjectsTSrc::processNext()
|
||||
void NATCompiler_pix::UseFirewallInterfaces::scanInterfaces(RuleElement *rel)
|
||||
{
|
||||
FWObject *o= rel->front();
|
||||
if (FWReference::cast(o)!=NULL) o=FWReference::cast(o)->getPointer();
|
||||
if (FWReference::cast(o)!=nullptr) o=FWReference::cast(o)->getPointer();
|
||||
Address *obj=Address::cast(o);
|
||||
if(obj==NULL)
|
||||
if(obj==nullptr)
|
||||
{
|
||||
compiler->abort(rel->getParent(),
|
||||
"Broken rule element "+
|
||||
@ -879,20 +879,20 @@ void NATCompiler_pix::UseFirewallInterfaces::scanInterfaces(RuleElement *rel)
|
||||
" in rule "+
|
||||
NATRule::cast(rel->getParent())->getLabel()+
|
||||
" ( found object with type "+
|
||||
string((o!=NULL)?o->getTypeName():"<NULL>") +
|
||||
string((o!=nullptr)?o->getTypeName():"<nullptr>") +
|
||||
")");
|
||||
return;
|
||||
}
|
||||
|
||||
const InetAddr *obj_addr = obj->getAddressPtr();
|
||||
if (obj_addr==NULL) return;
|
||||
if (obj_addr==nullptr) return;
|
||||
|
||||
list<FWObject*> l2=compiler->fw->getByType(Interface::TYPENAME);
|
||||
for (list<FWObject*>::iterator i=l2.begin(); i!=l2.end(); ++i)
|
||||
{
|
||||
Interface *iface=Interface::cast(*i);
|
||||
const InetAddr *iface_addr = iface->getAddressPtr();
|
||||
if (iface_addr == NULL) continue;
|
||||
if (iface_addr == nullptr) continue;
|
||||
if (*iface_addr == *obj_addr)
|
||||
{
|
||||
rel->removeRef(obj);
|
||||
@ -904,7 +904,7 @@ void NATCompiler_pix::UseFirewallInterfaces::scanInterfaces(RuleElement *rel)
|
||||
|
||||
bool NATCompiler_pix::UseFirewallInterfaces::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
@ -923,7 +923,7 @@ bool NATCompiler_pix::processNONATRules::processNext()
|
||||
{
|
||||
Helper helper(compiler);
|
||||
NATCompiler_pix *pix_comp = dynamic_cast<NATCompiler_pix*>(compiler);
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
if (rule->getRuleType()==NATRule::NONAT)
|
||||
@ -952,11 +952,11 @@ bool NATCompiler_pix::processNONATRules::processNext()
|
||||
// n0.o_iface = odst_iface;
|
||||
|
||||
RuleElement *itf_re = rule->getItfInb();
|
||||
assert(itf_re!=NULL);
|
||||
assert(itf_re!=nullptr);
|
||||
if ( ! itf_re->hasRef(osrc_iface)) itf_re->addRef(osrc_iface);
|
||||
|
||||
itf_re = rule->getItfOutb();
|
||||
assert(itf_re!=NULL);
|
||||
assert(itf_re!=nullptr);
|
||||
if ( ! itf_re->hasRef(odst_iface)) itf_re->addRef(odst_iface);
|
||||
|
||||
n0.src = osrc;
|
||||
@ -980,11 +980,11 @@ bool NATCompiler_pix::processNONATRules::processNext()
|
||||
compiler->dbcopy->findInIndex(helper.findInterfaceByNetzone(odst)));
|
||||
|
||||
RuleElement *itf_re = rule->getItfInb();
|
||||
assert(itf_re!=NULL);
|
||||
assert(itf_re!=nullptr);
|
||||
if ( ! itf_re->hasRef(osrc_iface)) itf_re->addRef(osrc_iface);
|
||||
|
||||
itf_re = rule->getItfOutb();
|
||||
assert(itf_re!=NULL);
|
||||
assert(itf_re!=nullptr);
|
||||
if ( ! itf_re->hasRef(odst_iface)) itf_re->addRef(odst_iface);
|
||||
|
||||
}
|
||||
@ -997,7 +997,7 @@ bool NATCompiler_pix::createNATCmd::processNext()
|
||||
{
|
||||
// Helper helper(compiler);
|
||||
NATCompiler_pix *pix_comp = dynamic_cast<NATCompiler_pix*>(compiler);
|
||||
NATRule *rule = getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule = getNext(); if (rule==nullptr) return false;
|
||||
string version = compiler->fw->getStr("version");
|
||||
|
||||
if (rule->getRuleType()==NATRule::SNAT)
|
||||
@ -1030,7 +1030,7 @@ bool NATCompiler_pix::createNATCmd::processNext()
|
||||
natcmd->nat_acl_name = pix_comp->getNATACLname(rule,"");
|
||||
pix_comp->registerACL(natcmd->nat_acl_name);
|
||||
|
||||
if (Interface::cast(tsrc)!=NULL || o_iface->isDyn())
|
||||
if (Interface::cast(tsrc)!=nullptr || o_iface->isDyn())
|
||||
{
|
||||
natcmd->type = INTERFACE;
|
||||
} else
|
||||
@ -1080,7 +1080,7 @@ bool NATCompiler_pix::createNATCmd::processNext()
|
||||
bool NATCompiler_pix::createStaticCmd::processNext()
|
||||
{
|
||||
NATCompiler_pix *pix_comp=dynamic_cast<NATCompiler_pix*>(compiler);
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
if (rule->getRuleType()==NATRule::DNAT)
|
||||
@ -1128,7 +1128,7 @@ bool NATCompiler_pix::createStaticCmd::processNext()
|
||||
bool NATCompiler_pix::clearOSrc::processNext()
|
||||
{
|
||||
// NATCompiler_pix *pix_comp=dynamic_cast<NATCompiler_pix*>(compiler);
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
if (rule->getBool("clear_osrc"))
|
||||
{
|
||||
@ -1143,15 +1143,15 @@ bool NATCompiler_pix::clearOSrc::processNext()
|
||||
|
||||
bool NATCompiler_pix::processMultiAddressObjectsInRE::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
RuleElement *re=RuleElement::cast( rule->getFirstByType(re_type) );
|
||||
|
||||
for (FWObject::iterator i=re->begin(); i!=re->end(); i++)
|
||||
{
|
||||
FWObject *o= *i;
|
||||
if (FWReference::cast(o)!=NULL) o=FWReference::cast(o)->getPointer();
|
||||
if (FWReference::cast(o)!=nullptr) o=FWReference::cast(o)->getPointer();
|
||||
MultiAddress *atrt = MultiAddress::cast(o);
|
||||
if (atrt!=NULL && atrt->isRunTime())
|
||||
if (atrt!=nullptr && atrt->isRunTime())
|
||||
{
|
||||
compiler->abort(
|
||||
rule,
|
||||
|
||||
@ -44,7 +44,7 @@ class triplet {
|
||||
libfwbuilder::Address *src;
|
||||
libfwbuilder::Address *dst;
|
||||
libfwbuilder::Service *srv;
|
||||
triplet() {src=NULL; dst=NULL; srv=NULL;}
|
||||
triplet() {src=nullptr; dst=nullptr; srv=nullptr;}
|
||||
triplet(libfwbuilder::Address *s,
|
||||
libfwbuilder::Address *d,
|
||||
libfwbuilder::Service *v) {src=s; dst=d; srv=v;}
|
||||
@ -85,7 +85,7 @@ list<NATRule*> NATCompiler_pix::findMatchingDNATRules(
|
||||
for (FWObject::iterator i=final_ruleset->begin(); i!=final_ruleset->end(); ++i)
|
||||
{
|
||||
NATRule *rule = NATRule::cast(*i);
|
||||
if (rule == NULL) continue; // skip RuleSetOptions object
|
||||
if (rule == nullptr) continue; // skip RuleSetOptions object
|
||||
|
||||
switch (rule->getRuleType())
|
||||
{
|
||||
@ -106,14 +106,14 @@ list<NATRule*> NATCompiler_pix::findMatchingDNATRules(
|
||||
|
||||
const InetAddr *dst_to_compare_addr = dst_to_compare->getAddressPtr();
|
||||
|
||||
// dst_to_compare_addr can be NULL if object in rule
|
||||
// dst_to_compare_addr can be nullptr if object in rule
|
||||
// element is a dynamic interface or a group. We should
|
||||
// have expanded groups by now, but dynamic interface can
|
||||
// still be there.
|
||||
|
||||
if (*(src->getAddressPtr()) == *(osrc->getAddressPtr()) &&
|
||||
(osrv->isAny() || srv->getId()==tsrv->getId()) &&
|
||||
(dst_to_compare_addr == NULL ||
|
||||
(dst_to_compare_addr == nullptr ||
|
||||
*(dst->getAddressPtr()) == *(dst_to_compare_addr)))
|
||||
{
|
||||
if (osrv->isAny())
|
||||
|
||||
@ -239,7 +239,7 @@ bool NATCompiler_pix::mergeNATCmd::processNext()
|
||||
bool NATCompiler_pix::optimizeDefaultNAT::processNext()
|
||||
{
|
||||
// NATCompiler_pix *pix_comp=dynamic_cast<NATCompiler_pix*>(compiler);
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
RuleElementOSrc *osrc=rule->getOSrc();
|
||||
@ -260,7 +260,7 @@ bool NATCompiler_pix::optimizeDefaultNAT::processNext()
|
||||
*/
|
||||
FWObject *o=osrc->front();
|
||||
string osrc_id;
|
||||
if (FWReference::cast(o)!=NULL)
|
||||
if (FWReference::cast(o)!=nullptr)
|
||||
osrc_id = FWObjectDatabase::getStringId(FWReference::cast(o)->getPointerId());
|
||||
else
|
||||
osrc_id = FWObjectDatabase::getStringId(o->getId());
|
||||
@ -294,7 +294,7 @@ bool NATCompiler_pix::SuppressDuplicateNONATStatics::processNext()
|
||||
{
|
||||
Helper helper(compiler);
|
||||
// NATCompiler_pix *pix_comp=dynamic_cast<NATCompiler_pix*>(compiler);
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
if (rule->getRuleType()== NATRule::NONAT &&
|
||||
rule->getInt("nonat_type")==NONAT_STATIC)
|
||||
@ -357,7 +357,7 @@ string NATCompiler_pix::DetectOverlap::printGlobalPoolAddress(const Address &poo
|
||||
bool NATCompiler_pix::DetectGlobalPoolProblems::processNext()
|
||||
{
|
||||
NATCompiler_pix *pix_comp=dynamic_cast<NATCompiler_pix*>(compiler);
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
if (rule->getRuleType()== NATRule::SNAT )
|
||||
@ -424,7 +424,7 @@ bool NATCompiler_pix::DetectGlobalPoolProblems::processNext()
|
||||
bool NATCompiler_pix::DetectOverlappingGlobalPoolsAndStaticRules::processNext()
|
||||
{
|
||||
NATCompiler_pix *pix_comp=dynamic_cast<NATCompiler_pix*>(compiler);
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
if (rule->getRuleType()== NATRule::DNAT )
|
||||
@ -455,9 +455,9 @@ bool NATCompiler_pix::DetectOverlappingGlobalPoolsAndStaticRules::processNext()
|
||||
IPv4 addr;
|
||||
|
||||
Interface *iface=Interface::cast(natcmd->t_addr);
|
||||
if (iface!=NULL && iface->isDyn()) return true;
|
||||
if (iface!=nullptr && iface->isDyn()) return true;
|
||||
|
||||
if (iface!=NULL && iface->getId()==outa->getId()) return true;
|
||||
if (iface!=nullptr && iface->getId()==outa->getId()) return true;
|
||||
|
||||
addr.setAddress(*(natcmd->t_addr->getAddressPtr()));
|
||||
addr.setNetmask(*(natcmd->t_addr->getNetmaskPtr()));
|
||||
@ -486,7 +486,7 @@ bool NATCompiler_pix::DetectOverlappingGlobalPoolsAndStaticRules::processNext()
|
||||
bool NATCompiler_pix::DetectDuplicateNAT::processNext()
|
||||
{
|
||||
NATCompiler_pix *pix_comp=dynamic_cast<NATCompiler_pix*>(compiler);
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
if (rule->getRuleType()== NATRule::SNAT)
|
||||
@ -550,7 +550,7 @@ return true;
|
||||
bool NATCompiler_pix::DetectOverlappingStatics::processNext()
|
||||
{
|
||||
NATCompiler_pix *pix_comp=dynamic_cast<NATCompiler_pix*>(compiler);
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
if (rule->getRuleType()== NATRule::DNAT )
|
||||
|
||||
@ -128,7 +128,7 @@ string NATCompiler_pix::PrintRule::_printDstService(Service *srv)
|
||||
|
||||
string NATCompiler_pix::PrintRule::_printConnOptions(NATRule *rule)
|
||||
{
|
||||
if (rule==NULL) return "";
|
||||
if (rule==nullptr) return "";
|
||||
|
||||
ostringstream ostr;
|
||||
|
||||
@ -170,8 +170,8 @@ void NATCompiler_pix::PrintRule::printNONAT(NATRule *rule)
|
||||
Address *tdst=compiler->getFirstTDst(rule); assert(tdst);
|
||||
Service *tsrv=compiler->getFirstTSrv(rule); assert(tsrv);
|
||||
|
||||
RuleElementItfInb *itf_in_re = rule->getItfInb(); assert(itf_in_re!=NULL);
|
||||
RuleElementItfOutb *itf_out_re = rule->getItfOutb(); assert(itf_out_re!=NULL);
|
||||
RuleElementItfInb *itf_in_re = rule->getItfInb(); assert(itf_in_re!=nullptr);
|
||||
RuleElementItfOutb *itf_out_re = rule->getItfOutb(); assert(itf_out_re!=nullptr);
|
||||
|
||||
Interface *i_iface = Interface::cast(
|
||||
FWObjectReference::getObject(itf_in_re->front()));
|
||||
@ -265,8 +265,8 @@ void NATCompiler_pix::PrintRule::printSNAT(NATRule *rule)
|
||||
Address *tdst = compiler->getFirstTDst(rule); assert(tdst);
|
||||
Service *tsrv = compiler->getFirstTSrv(rule); assert(tsrv);
|
||||
|
||||
RuleElementItfInb *itf_in_re = rule->getItfInb(); assert(itf_in_re!=NULL);
|
||||
RuleElementItfOutb *itf_out_re = rule->getItfOutb(); assert(itf_out_re!=NULL);
|
||||
RuleElementItfInb *itf_in_re = rule->getItfInb(); assert(itf_in_re!=nullptr);
|
||||
RuleElementItfOutb *itf_out_re = rule->getItfOutb(); assert(itf_out_re!=nullptr);
|
||||
|
||||
Interface *i_iface = Interface::cast(
|
||||
FWObjectReference::getObject(itf_in_re->front()));
|
||||
@ -399,8 +399,8 @@ void NATCompiler_pix::PrintRule::printDNAT(NATRule *rule)
|
||||
Address *tdst = compiler->getFirstTDst(rule); assert(tdst);
|
||||
Service *tsrv = compiler->getFirstTSrv(rule); assert(tsrv);
|
||||
|
||||
RuleElementItfInb *itf_in_re = rule->getItfInb(); assert(itf_in_re!=NULL);
|
||||
RuleElementItfOutb *itf_out_re = rule->getItfOutb(); assert(itf_out_re!=NULL);
|
||||
RuleElementItfInb *itf_in_re = rule->getItfInb(); assert(itf_in_re!=nullptr);
|
||||
RuleElementItfOutb *itf_out_re = rule->getItfOutb(); assert(itf_out_re!=nullptr);
|
||||
|
||||
Interface *i_iface = Interface::cast(
|
||||
FWObjectReference::getObject(itf_in_re->front()));
|
||||
@ -432,7 +432,7 @@ void NATCompiler_pix::PrintRule::printDNAT(NATRule *rule)
|
||||
if (TCPService::cast(osrv)) { use_ports=true; compiler->output << "tcp "; }
|
||||
if (UDPService::cast(osrv)) { use_ports=true; compiler->output << "udp "; }
|
||||
|
||||
if (Interface::cast(scmd->oaddr)!=NULL)
|
||||
if (Interface::cast(scmd->oaddr)!=nullptr)
|
||||
{
|
||||
compiler->output << "interface ";
|
||||
if (use_ports) _printPort(scmd->osrv);
|
||||
@ -509,7 +509,7 @@ void NATCompiler_pix::PrintRule::printDNAT(NATRule *rule)
|
||||
compiler->output << "udp ";
|
||||
}
|
||||
|
||||
if (Interface::cast(scmd->oaddr)!=NULL)
|
||||
if (Interface::cast(scmd->oaddr)!=nullptr)
|
||||
compiler->output << "interface ";
|
||||
else
|
||||
compiler->output << outa->toString() << " ";
|
||||
@ -533,7 +533,7 @@ bool NATCompiler_pix::PrintRule::processNext()
|
||||
string("/FWBuilderResources/Target/options/") +
|
||||
"version_" + version + "/pix_commands/clear_acl");
|
||||
|
||||
NATRule *rule = getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule = getNext(); if (rule==nullptr) return false;
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
bool suppress_comments =
|
||||
|
||||
@ -54,7 +54,7 @@ QString NXOSObjectGroup::groupMemberToString(FWObject *obj,
|
||||
case NETWORK:
|
||||
{
|
||||
Address *a = Address::cast(obj);
|
||||
assert(a!=NULL);
|
||||
assert(a!=nullptr);
|
||||
if (AddressRange::cast(a))
|
||||
{
|
||||
const InetAddr &start = AddressRange::cast(a)->getRangeStart();
|
||||
@ -63,7 +63,7 @@ QString NXOSObjectGroup::groupMemberToString(FWObject *obj,
|
||||
} else
|
||||
{
|
||||
const InetAddr *addr = a->getAddressPtr();
|
||||
if (Network::cast(obj)!=NULL)
|
||||
if (Network::cast(obj)!=nullptr)
|
||||
{
|
||||
const InetAddr *mask = a->getNetmaskPtr();
|
||||
// Note: the syntax is "A.B.C.D /NN" (there must be space before /)
|
||||
@ -78,7 +78,7 @@ QString NXOSObjectGroup::groupMemberToString(FWObject *obj,
|
||||
case PROTO:
|
||||
{
|
||||
Service *s = Service::cast(obj);
|
||||
assert(s!=NULL);
|
||||
assert(s!=nullptr);
|
||||
ostr << s->getProtocolNumber();
|
||||
break;
|
||||
}
|
||||
@ -87,7 +87,7 @@ QString NXOSObjectGroup::groupMemberToString(FWObject *obj,
|
||||
{
|
||||
ostr << "icmp ";
|
||||
ICMPService *s = ICMPService::cast(obj);
|
||||
assert(s!=NULL);
|
||||
assert(s!=nullptr);
|
||||
if ( s->getInt("type")== -1) ostr << "";
|
||||
else ostr << s->getInt("type");
|
||||
break;
|
||||
@ -100,7 +100,7 @@ QString NXOSObjectGroup::groupMemberToString(FWObject *obj,
|
||||
else ostr << "udp ";
|
||||
|
||||
TCPUDPService *s = TCPUDPService::cast(obj);
|
||||
assert(s!=NULL);
|
||||
assert(s!=nullptr);
|
||||
|
||||
int rs = s->getDstRangeStart();
|
||||
int re = s->getDstRangeEnd();
|
||||
|
||||
@ -80,7 +80,7 @@ BaseObjectGroup* CreateObjectGroups::findObjectGroup(RuleElement *re)
|
||||
for (FWObject::iterator i=object_groups->begin(); i!=object_groups->end(); ++i)
|
||||
{
|
||||
BaseObjectGroup *og = dynamic_cast<BaseObjectGroup*>(*i);
|
||||
assert(og!=NULL);
|
||||
assert(og!=nullptr);
|
||||
|
||||
if (og->size()==0 || (og->size()!=re->size()) ) continue;
|
||||
|
||||
@ -96,12 +96,12 @@ BaseObjectGroup* CreateObjectGroups::findObjectGroup(RuleElement *re)
|
||||
}
|
||||
if (match) return og;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool CreateObjectGroups::processNext()
|
||||
{
|
||||
Rule *rule = prev_processor->getNextRule(); if (rule==NULL) return false;
|
||||
Rule *rule = prev_processor->getNextRule(); if (rule==nullptr) return false;
|
||||
string version = compiler->fw->getStr("version");
|
||||
string platform = compiler->fw->getStr("platform");
|
||||
|
||||
@ -122,7 +122,7 @@ bool CreateObjectGroups::processNext()
|
||||
}
|
||||
|
||||
BaseObjectGroup *obj_group = findObjectGroup(re);
|
||||
if (obj_group==NULL)
|
||||
if (obj_group==nullptr)
|
||||
{
|
||||
obj_group = named_objects_manager->createObjectGroup();
|
||||
named_objects_manager->getObjectGroupsGroup()->add(obj_group);
|
||||
@ -169,12 +169,12 @@ void CreateObjectGroupsForTSrc::packObjects(RuleElement *re,
|
||||
{
|
||||
// put all objects inside of the group, except for the interface
|
||||
// if it belongs to the firewall
|
||||
FWObject *re_interface = NULL;
|
||||
FWObject *re_interface = nullptr;
|
||||
for (FWObject::iterator i1=re->begin(); i1!=re->end(); ++i1)
|
||||
{
|
||||
FWObject *o = *i1;
|
||||
FWObject *obj = o;
|
||||
if (FWReference::cast(o)!=NULL)
|
||||
if (FWReference::cast(o)!=nullptr)
|
||||
obj = FWReference::cast(o)->getPointer();
|
||||
if (Interface::isA(obj) && obj->isChildOf(compiler->fw))
|
||||
{
|
||||
@ -198,13 +198,13 @@ void CreateObjectGroupsForTSrc::packObjects(RuleElement *re,
|
||||
|
||||
void createNamedObjectsCommon::printObjectsForRE(FWObject *re)
|
||||
{
|
||||
if (RuleElement::cast(re)!=NULL && RuleElement::cast(re)->isAny()) return;
|
||||
if (RuleElement::cast(re)!=nullptr && RuleElement::cast(re)->isAny()) return;
|
||||
|
||||
for (FWObject::iterator it=re->begin(); it!=re->end(); ++it)
|
||||
{
|
||||
FWObject *obj = FWReference::getObject(*it);
|
||||
if (Interface::isA(obj)) continue;
|
||||
if (BaseObjectGroup::cast(obj)!=NULL) printObjectsForRE(obj);
|
||||
if (BaseObjectGroup::cast(obj)!=nullptr) printObjectsForRE(obj);
|
||||
else named_objects_manager->addNamedObject(obj);
|
||||
}
|
||||
}
|
||||
@ -216,13 +216,13 @@ void createNamedObjectsCommon::printObjectsForRE(FWObject *re)
|
||||
*/
|
||||
void createNamedObjectsForPolicy::printObjectsForRE(FWObject *re)
|
||||
{
|
||||
if (RuleElement::cast(re)!=NULL && RuleElement::cast(re)->isAny()) return;
|
||||
if (RuleElement::cast(re)!=nullptr && RuleElement::cast(re)->isAny()) return;
|
||||
|
||||
for (FWObject::iterator it=re->begin(); it!=re->end(); ++it)
|
||||
{
|
||||
FWObject *obj = FWReference::getObject(*it);
|
||||
if (Interface::isA(obj)) continue;
|
||||
if (BaseObjectGroup::cast(obj)!=NULL) printObjectsForRE(obj);
|
||||
if (BaseObjectGroup::cast(obj)!=nullptr) printObjectsForRE(obj);
|
||||
if (AddressRange::isA(obj)) named_objects_manager->addNamedObject(obj);
|
||||
}
|
||||
}
|
||||
|
||||
@ -130,13 +130,13 @@ NamedObjectsManager::~NamedObjectsManager()
|
||||
|
||||
void NamedObjectsManager::addNamedObject(const FWObject *obj)
|
||||
{
|
||||
if (getNamedObject(obj) == NULL)
|
||||
if (getNamedObject(obj) == nullptr)
|
||||
named_objects[obj->getId()] = new NamedObject(obj, platform.c_str());
|
||||
}
|
||||
|
||||
NamedObject* NamedObjectsManager::getNamedObject(const FWObject *obj)
|
||||
{
|
||||
if (named_objects.count(obj->getId()) == 0) return NULL;
|
||||
if (named_objects.count(obj->getId()) == 0) return nullptr;
|
||||
else
|
||||
return named_objects[obj->getId()];
|
||||
}
|
||||
@ -161,7 +161,7 @@ string NamedObjectsManager::getNamedObjectsDefinitions()
|
||||
for (it=named_objects.begin(); it!=named_objects.end(); ++it)
|
||||
{
|
||||
NamedObject *nobj = it->second;
|
||||
if (nobj==NULL) continue;
|
||||
if (nobj==nullptr) continue;
|
||||
output << nobj->getCommand();
|
||||
}
|
||||
|
||||
@ -172,7 +172,7 @@ string NamedObjectsManager::getNamedObjectsDefinitions()
|
||||
i!=object_groups->end(); ++i)
|
||||
{
|
||||
BaseObjectGroup *og = dynamic_cast<BaseObjectGroup*>(*i);
|
||||
assert(og!=NULL);
|
||||
assert(og!=nullptr);
|
||||
if (og->size()==0) continue;
|
||||
output << og->toString(this); // ends with an empty line
|
||||
}
|
||||
@ -187,7 +187,7 @@ string NamedObjectsManager::getClearCommands()
|
||||
|
||||
BaseObjectGroup* NamedObjectsManager::createObjectGroup()
|
||||
{
|
||||
BaseObjectGroup *grp = NULL;
|
||||
BaseObjectGroup *grp = nullptr;
|
||||
if (platform == "pix")
|
||||
{
|
||||
if (XMLTools::version_compare(version, "8.0")<0)
|
||||
@ -200,7 +200,7 @@ BaseObjectGroup* NamedObjectsManager::createObjectGroup()
|
||||
|
||||
if (platform == "iosacl") grp = new IOSObjectGroup();
|
||||
|
||||
assert(grp!=NULL);
|
||||
assert(grp!=nullptr);
|
||||
|
||||
return grp;
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ string NamedObjectsManagerIOS::getClearCommands()
|
||||
for (FWObject::iterator i=object_groups->begin(); i!=object_groups->end(); ++i)
|
||||
{
|
||||
BaseObjectGroup *og = dynamic_cast<BaseObjectGroup*>(*i);
|
||||
assert(og!=NULL);
|
||||
assert(og!=nullptr);
|
||||
output << "no " << og->getObjectGroupHeader() << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@ string NamedObjectsManagerNXOS::getClearCommands()
|
||||
for (FWObject::iterator i=object_groups->begin(); i!=object_groups->end(); ++i)
|
||||
{
|
||||
BaseObjectGroup *og = dynamic_cast<BaseObjectGroup*>(*i);
|
||||
assert(og!=NULL);
|
||||
assert(og!=nullptr);
|
||||
output << "no " << og->getObjectGroupHeader() << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -210,7 +210,7 @@ string OSConfigurator_pix_os::_printInterfaceConfiguration()
|
||||
|
||||
if (iface->getOptionsObject()->getBool("cluster_interface")) continue;
|
||||
|
||||
Configlet *cnf = NULL;
|
||||
Configlet *cnf = nullptr;
|
||||
QString configlet_name;
|
||||
if (iface->isDedicatedFailover())
|
||||
{
|
||||
@ -278,7 +278,7 @@ string OSConfigurator_pix_os::_printInterfaceConfiguration()
|
||||
|
||||
_getAddressConfigurationForInterface(
|
||||
iface, &addr, &netm,
|
||||
(configure_standby_address) ? &standby_addr : NULL);
|
||||
(configure_standby_address) ? &standby_addr : nullptr);
|
||||
|
||||
if (!addr.isEmpty() && !netm.isEmpty())
|
||||
{
|
||||
@ -660,7 +660,7 @@ string OSConfigurator_pix_os::_printSysopt()
|
||||
string version = fw->getStr("version");
|
||||
|
||||
FWOptions *options=fw->getOptionsObject();
|
||||
assert(options!=NULL);
|
||||
assert(options!=nullptr);
|
||||
|
||||
bool tcpmss = fw->getOptionsObject()->getBool("pix_tcpmss");
|
||||
int tcpmss_val = fw->getOptionsObject()->getInt("pix_tcpmss_value");
|
||||
|
||||
@ -125,7 +125,7 @@ string OSConfigurator_pix_os::_printFixups()
|
||||
string platform = fw->getStr("platform");
|
||||
string version = fw->getStr("version");
|
||||
FWOptions *options = fw->getOptionsObject();
|
||||
assert(options!=NULL);
|
||||
assert(options!=nullptr);
|
||||
|
||||
string lst = Resources::platform_res[platform]->getResourceStr(
|
||||
"/FWBuilderResources/Target/options/version_" + version +
|
||||
|
||||
@ -62,7 +62,7 @@ string OSConfigurator_pix_os::_printMPFPolicyMap()
|
||||
string version = fw->getStr("version");
|
||||
string vers = "version_" + version;
|
||||
FWOptions *options = fw->getOptionsObject();
|
||||
assert(options!=NULL);
|
||||
assert(options!=nullptr);
|
||||
|
||||
std::list<InspectionClassMap> defaultClassMaps;
|
||||
std::list<InspectionClassMap> customClassMaps;
|
||||
|
||||
@ -63,7 +63,7 @@ string OSConfigurator_pix_os::_printPolicyMapTypeInspect()
|
||||
string version = fw->getStr("version");
|
||||
string vers = "version_" + version;
|
||||
FWOptions *options = fw->getOptionsObject();
|
||||
assert(options!=NULL);
|
||||
assert(options!=nullptr);
|
||||
|
||||
// first, generate commands for ip-options
|
||||
|
||||
|
||||
@ -80,7 +80,7 @@ string PolicyCompiler_cisco::createRuleLabel(const string &txt,
|
||||
ostringstream str;
|
||||
|
||||
str << rule_num;
|
||||
if (iface!=NULL) str << "(" << iface->getLabel() << ")";
|
||||
if (iface!=nullptr) str << "(" << iface->getLabel() << ")";
|
||||
else str << "(" << txt << ")";
|
||||
return str.str();
|
||||
}
|
||||
@ -134,7 +134,7 @@ string PolicyCompiler_cisco::debugPrintRule(Rule *r)
|
||||
PolicyRule *rule = PolicyRule::cast(r);
|
||||
|
||||
// FWObject *rule_iface = dbcopy->findInIndex(rule->getInterfaceId());
|
||||
// string iname = (rule_iface!=NULL)?rule_iface->getName():"";
|
||||
// string iname = (rule_iface!=nullptr)?rule_iface->getName():"";
|
||||
|
||||
string dir = rule->getDirectionAsString();
|
||||
|
||||
@ -150,7 +150,7 @@ string PolicyCompiler_cisco::debugPrintRule(Rule *r)
|
||||
|
||||
bool PolicyCompiler_cisco::splitIfSrcAny::processNext()
|
||||
{
|
||||
PolicyRule *rule=getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
RuleElementSrc *srcrel=rule->getSrc();
|
||||
Address *src = compiler->getFirstSrc(rule);
|
||||
@ -159,7 +159,7 @@ bool PolicyCompiler_cisco::splitIfSrcAny::processNext()
|
||||
(
|
||||
srcrel->isAny() ||
|
||||
|
||||
( srcrel->size()==1 && src!=NULL &&
|
||||
( srcrel->size()==1 && src!=nullptr &&
|
||||
!compiler->complexMatch(src,compiler->fw) &&
|
||||
srcrel->getBool("single_object_negation"))
|
||||
)
|
||||
@ -189,7 +189,7 @@ bool PolicyCompiler_cisco::splitIfSrcAny::processNext()
|
||||
*/
|
||||
bool PolicyCompiler_cisco::splitIfDstAny::processNext()
|
||||
{
|
||||
PolicyRule *rule=getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
RuleElementSrv *srvrel=rule->getSrv();
|
||||
RuleElementDst *dstrel=rule->getDst();
|
||||
@ -200,10 +200,10 @@ bool PolicyCompiler_cisco::splitIfDstAny::processNext()
|
||||
for (list<FWObject*>::iterator i1=srvrel->begin(); i1!=srvrel->end(); ++i1)
|
||||
{
|
||||
FWObject *o = *i1;
|
||||
FWObject *obj = NULL;
|
||||
if (FWReference::cast(o)!=NULL) obj=FWReference::cast(o)->getPointer();
|
||||
FWObject *obj = nullptr;
|
||||
if (FWReference::cast(o)!=nullptr) obj=FWReference::cast(o)->getPointer();
|
||||
Service *s=Service::cast(obj);
|
||||
assert(s!=NULL);
|
||||
assert(s!=nullptr);
|
||||
|
||||
if (ICMPService::isA(s)) cl.push_back(s);
|
||||
|
||||
@ -220,7 +220,7 @@ bool PolicyCompiler_cisco::splitIfDstAny::processNext()
|
||||
(
|
||||
dstrel->isAny() ||
|
||||
|
||||
( dstrel->size()==1 && dst!=NULL &&
|
||||
( dstrel->size()==1 && dst!=nullptr &&
|
||||
!compiler->complexMatch(dst,compiler->fw) &&
|
||||
dstrel->getBool("single_object_negation"))
|
||||
)
|
||||
@ -251,7 +251,7 @@ bool PolicyCompiler_cisco::splitIfDstAny::processNext()
|
||||
|
||||
bool PolicyCompiler_cisco::NegationPhase1::processNext()
|
||||
{
|
||||
PolicyRule *rule=getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
return true;
|
||||
|
||||
#ifdef DO_NEGATION
|
||||
@ -373,7 +373,7 @@ bool PolicyCompiler_cisco::NegationPhase1::processNext()
|
||||
*/
|
||||
bool PolicyCompiler_cisco::splitIfRuleElementMatchesFW::processNext()
|
||||
{
|
||||
PolicyRule *rule = getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule = getNext(); if (rule==nullptr) return false;
|
||||
PolicyCompiler_cisco *cisco_comp = dynamic_cast<PolicyCompiler_cisco*>(compiler);
|
||||
|
||||
RuleElement *re = RuleElement::cast(rule->getFirstByType(re_type));
|
||||
@ -385,7 +385,7 @@ bool PolicyCompiler_cisco::splitIfRuleElementMatchesFW::processNext()
|
||||
{
|
||||
FWObject *obj = FWReference::getObject(*i1);
|
||||
Address *a = Address::cast(obj);
|
||||
assert(a!=NULL);
|
||||
assert(a!=nullptr);
|
||||
|
||||
if (cisco_comp->complexMatch(a,cisco_comp->fw))
|
||||
{
|
||||
@ -431,7 +431,7 @@ bool PolicyCompiler_cisco::specialCaseWithDynInterface::dropDynamicInterface(
|
||||
FWObject *obj = FWObjectReference::getObject(*i1);
|
||||
Interface *ifs = Interface::cast( obj );
|
||||
|
||||
if (ifs!=NULL && ifs->isDyn())
|
||||
if (ifs!=nullptr && ifs->isDyn())
|
||||
{
|
||||
if (ifs->getId()==rule_iface->getId() && dir==cmp_dir)
|
||||
cl.push_back(obj); // keep it
|
||||
@ -477,7 +477,7 @@ bool PolicyCompiler_cisco::specialCaseWithDynInterface::dropDynamicInterface(
|
||||
*/
|
||||
bool PolicyCompiler_cisco::specialCaseWithDynInterface::processNext()
|
||||
{
|
||||
PolicyRule *rule=getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
if ( dropDynamicInterface( rule, PolicyRule::Outbound, rule->getSrc() ) &&
|
||||
dropDynamicInterface( rule, PolicyRule::Inbound, rule->getDst() ) )
|
||||
@ -493,19 +493,19 @@ bool PolicyCompiler_cisco::specialCaseWithDynInterface::processNext()
|
||||
*/
|
||||
bool PolicyCompiler_cisco::tcpServiceToFW::processNext()
|
||||
{
|
||||
PolicyRule *rule = getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule = getNext(); if (rule==nullptr) return false;
|
||||
PolicyCompiler_cisco *cisco_comp =
|
||||
dynamic_cast<PolicyCompiler_cisco*>(compiler);
|
||||
Q_UNUSED(cisco_comp);
|
||||
|
||||
RuleElementSrv *srv = rule->getSrv();
|
||||
Address *a = compiler->getFirstDst(rule);
|
||||
assert(a!=NULL);
|
||||
assert(a!=nullptr);
|
||||
|
||||
if (rule->getAction()==PolicyRule::Accept
|
||||
&&
|
||||
(
|
||||
(Cluster::cast(a) != NULL && Cluster::cast(a)->hasMember(compiler->fw))
|
||||
(Cluster::cast(a) != nullptr && Cluster::cast(a)->hasMember(compiler->fw))
|
||||
||
|
||||
a->getId() == compiler->fw->getId()
|
||||
)
|
||||
@ -516,7 +516,7 @@ bool PolicyCompiler_cisco::tcpServiceToFW::processNext()
|
||||
{
|
||||
FWObject *obj = FWReference::getObject(*i1);
|
||||
Service *s = Service::cast(obj);
|
||||
assert(s!=NULL);
|
||||
assert(s!=nullptr);
|
||||
|
||||
if (TCPService::isA(s) &&
|
||||
TCPUDPService::cast(s)->getDstRangeStart()==port &&
|
||||
@ -558,13 +558,13 @@ bool PolicyCompiler_cisco::tcpServiceToFW::processNext()
|
||||
*/
|
||||
bool PolicyCompiler_cisco::replaceFWinSRCInterfacePolicy::processNext()
|
||||
{
|
||||
PolicyRule *rule=getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
// FWObject *rule_iface = compiler->dbcopy->findInIndex(rule->getInterfaceId());
|
||||
RuleElementItf *intf_re = rule->getItf();
|
||||
Interface *rule_iface = Interface::cast(
|
||||
FWObjectReference::getObject(intf_re->front()));
|
||||
|
||||
if ( rule_iface!=NULL && rule->getDirection()==PolicyRule::Outbound)
|
||||
if ( rule_iface!=nullptr && rule->getDirection()==PolicyRule::Outbound)
|
||||
{
|
||||
RuleElementSrc *src = rule->getSrc();
|
||||
|
||||
@ -581,13 +581,13 @@ bool PolicyCompiler_cisco::replaceFWinSRCInterfacePolicy::processNext()
|
||||
|
||||
bool PolicyCompiler_cisco::replaceFWinDSTInterfacePolicy::processNext()
|
||||
{
|
||||
PolicyRule *rule=getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
// FWObject *rule_iface = compiler->dbcopy->findInIndex(rule->getInterfaceId());
|
||||
RuleElementItf *intf_re = rule->getItf();
|
||||
Interface *rule_iface = Interface::cast(
|
||||
FWObjectReference::getObject(intf_re->front()));
|
||||
|
||||
if ( rule_iface!=NULL && rule->getDirection()==PolicyRule::Inbound)
|
||||
if ( rule_iface!=nullptr && rule->getDirection()==PolicyRule::Inbound)
|
||||
{
|
||||
RuleElementDst *dst = rule->getDst();
|
||||
|
||||
@ -609,7 +609,7 @@ bool PolicyCompiler_cisco::replaceFWinDSTInterfacePolicy::processNext()
|
||||
bool PolicyCompiler_cisco::replaceFWinDSTPolicy::processNext()
|
||||
{
|
||||
Helper helper(compiler);
|
||||
PolicyRule *rule=getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
// FWObject *rule_iface = compiler->dbcopy->findInIndex(rule->getInterfaceId());
|
||||
RuleElementItf *intf_re = rule->getItf();
|
||||
|
||||
@ -645,7 +645,7 @@ bool PolicyCompiler_cisco::replaceFWinDSTPolicy::processNext()
|
||||
|
||||
bool PolicyCompiler_cisco::equalObjCISCO::operator()(FWObject *o)
|
||||
{
|
||||
if (ICMPService::cast(obj)!=NULL && ICMPService::cast(o)!=NULL)
|
||||
if (ICMPService::cast(obj)!=nullptr && ICMPService::cast(o)!=nullptr)
|
||||
{
|
||||
return (obj->getInt("type")==o->getInt("type"));
|
||||
} else
|
||||
@ -655,7 +655,7 @@ bool PolicyCompiler_cisco::equalObjCISCO::operator()(FWObject *o)
|
||||
/* re_type can be either RuleElementSrc::TYPENAME or RuleElementDst::TYPENAME */
|
||||
bool PolicyCompiler_cisco::removeRedundantAddresses::processNext()
|
||||
{
|
||||
PolicyRule *rule=getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
RuleElement *re=RuleElement::cast(rule->getFirstByType(re_type));
|
||||
if (re->size()==1)
|
||||
@ -668,7 +668,7 @@ bool PolicyCompiler_cisco::removeRedundantAddresses::processNext()
|
||||
for (list<FWObject*>::iterator i1=re->begin(); i1!=re->end(); ++i1)
|
||||
{
|
||||
Address *a = Address::cast(FWReference::getObject(*i1));
|
||||
assert(a!=NULL); // assuming all objects are addresses.
|
||||
assert(a!=nullptr); // assuming all objects are addresses.
|
||||
status[a] = false;
|
||||
}
|
||||
|
||||
@ -704,15 +704,15 @@ bool PolicyCompiler_cisco::removeRedundantAddresses::processNext()
|
||||
|
||||
bool PolicyCompiler_cisco::processMultiAddressObjectsInRE::processNext()
|
||||
{
|
||||
PolicyRule *rule = getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule = getNext(); if (rule==nullptr) return false;
|
||||
RuleElement *re = RuleElement::cast( rule->getFirstByType(re_type) );
|
||||
|
||||
for (FWObject::iterator i=re->begin(); i!=re->end(); i++)
|
||||
{
|
||||
FWObject *o = *i;
|
||||
if (FWReference::cast(o)!=NULL) o = FWReference::cast(o)->getPointer();
|
||||
if (FWReference::cast(o)!=nullptr) o = FWReference::cast(o)->getPointer();
|
||||
MultiAddress *atrt = MultiAddress::cast(o);
|
||||
if (atrt!=NULL && atrt->isRunTime())
|
||||
if (atrt!=nullptr && atrt->isRunTime())
|
||||
{
|
||||
compiler->abort(
|
||||
rule,
|
||||
|
||||
@ -57,7 +57,7 @@ using namespace std;
|
||||
*/
|
||||
bool PolicyCompiler_cisco::setInterfaceAndDirectionBySrc::processNext()
|
||||
{
|
||||
PolicyRule *rule=getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
Helper helper(compiler);
|
||||
|
||||
list<int> intf_id_list;
|
||||
@ -69,7 +69,7 @@ bool PolicyCompiler_cisco::setInterfaceAndDirectionBySrc::processNext()
|
||||
bool cluster_member =
|
||||
compiler->fw->getOptionsObject()->getBool("cluster_member");
|
||||
|
||||
Cluster *cluster = NULL;
|
||||
Cluster *cluster = nullptr;
|
||||
if (cluster_member)
|
||||
cluster = Cluster::cast(
|
||||
compiler->dbcopy->findInIndex(
|
||||
@ -103,7 +103,7 @@ bool PolicyCompiler_cisco::setInterfaceAndDirectionBySrc::processNext()
|
||||
new_rule->duplicate(rule);
|
||||
// new_rule->setInterfaceId(intf_id);
|
||||
|
||||
RuleElementItf *itf_re = new_rule->getItf(); assert(itf_re!=NULL);
|
||||
RuleElementItf *itf_re = new_rule->getItf(); assert(itf_re!=nullptr);
|
||||
itf_re->reset();
|
||||
itf_re->addRef(ifs);
|
||||
|
||||
@ -121,7 +121,7 @@ bool PolicyCompiler_cisco::setInterfaceAndDirectionBySrc::processNext()
|
||||
// forwarded so we should consider them as matching the fw.
|
||||
//
|
||||
FWObject *d = dstre->front();
|
||||
if (FWReference::cast(d)!=NULL) d = FWReference::cast(d)->getPointer();
|
||||
if (FWReference::cast(d)!=nullptr) d = FWReference::cast(d)->getPointer();
|
||||
if (!compiler->complexMatch(Address::cast(d), compiler->fw, true, false))
|
||||
tmp_queue.push_back(rule);
|
||||
return true;
|
||||
@ -133,7 +133,7 @@ bool PolicyCompiler_cisco::setInterfaceAndDirectionBySrc::processNext()
|
||||
|
||||
bool PolicyCompiler_cisco::setInterfaceAndDirectionByDst::processNext()
|
||||
{
|
||||
PolicyRule *rule=getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
Helper helper(compiler);
|
||||
|
||||
if (rule->getBool("interface_and_direction_set_from_src"))
|
||||
@ -151,7 +151,7 @@ bool PolicyCompiler_cisco::setInterfaceAndDirectionByDst::processNext()
|
||||
bool cluster_member =
|
||||
compiler->fw->getOptionsObject()->getBool("cluster_member");
|
||||
|
||||
Cluster *cluster = NULL;
|
||||
Cluster *cluster = nullptr;
|
||||
if (cluster_member)
|
||||
cluster = Cluster::cast(
|
||||
compiler->dbcopy->findInIndex(
|
||||
@ -185,7 +185,7 @@ bool PolicyCompiler_cisco::setInterfaceAndDirectionByDst::processNext()
|
||||
|
||||
// new_rule->setInterfaceId(intf_id);
|
||||
|
||||
RuleElementItf *itf_re = new_rule->getItf(); assert(itf_re!=NULL);
|
||||
RuleElementItf *itf_re = new_rule->getItf(); assert(itf_re!=nullptr);
|
||||
itf_re->reset();
|
||||
itf_re->addRef(ifs);
|
||||
|
||||
@ -201,7 +201,7 @@ bool PolicyCompiler_cisco::setInterfaceAndDirectionByDst::processNext()
|
||||
|
||||
bool PolicyCompiler_cisco::setInterfaceAndDirectionIfInterfaceSet::processNext()
|
||||
{
|
||||
PolicyRule *rule=getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
//RuleElementItf *itfre=rule->getItf();
|
||||
|
||||
@ -229,7 +229,7 @@ bool PolicyCompiler_cisco::setInterfaceAndDirectionIfInterfaceSet::processNext()
|
||||
new_rule->duplicate(rule);
|
||||
|
||||
// new_rule->setInterfaceId( rule_iface_id );
|
||||
itf_re = new_rule->getItf(); assert(itf_re!=NULL);
|
||||
itf_re = new_rule->getItf(); assert(itf_re!=nullptr);
|
||||
itf_re->reset();
|
||||
itf_re->addRef(rule_iface);
|
||||
|
||||
@ -242,7 +242,7 @@ bool PolicyCompiler_cisco::setInterfaceAndDirectionIfInterfaceSet::processNext()
|
||||
new_rule->duplicate(rule);
|
||||
|
||||
// new_rule->setInterfaceId( rule_iface_id );
|
||||
itf_re = new_rule->getItf(); assert(itf_re!=NULL);
|
||||
itf_re = new_rule->getItf(); assert(itf_re!=nullptr);
|
||||
itf_re->reset();
|
||||
itf_re->addRef(rule_iface);
|
||||
|
||||
@ -256,7 +256,7 @@ bool PolicyCompiler_cisco::setInterfaceAndDirectionIfInterfaceSet::processNext()
|
||||
new_rule->duplicate(rule);
|
||||
|
||||
// new_rule->setInterfaceId( rule_iface_id );
|
||||
itf_re = new_rule->getItf(); assert(itf_re!=NULL);
|
||||
itf_re = new_rule->getItf(); assert(itf_re!=nullptr);
|
||||
itf_re->reset();
|
||||
itf_re->addRef(rule_iface);
|
||||
|
||||
@ -272,7 +272,7 @@ bool PolicyCompiler_cisco::pickACL::processNext()
|
||||
{
|
||||
PolicyCompiler_cisco *cisco_comp = dynamic_cast<PolicyCompiler_cisco*>(
|
||||
compiler);
|
||||
PolicyRule *rule = getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule = getNext(); if (rule==nullptr) return false;
|
||||
|
||||
// Interface *rule_iface = Interface::cast(compiler->dbcopy->findInIndex(
|
||||
// rule->getInterfaceId()));
|
||||
@ -281,7 +281,7 @@ bool PolicyCompiler_cisco::pickACL::processNext()
|
||||
Interface *rule_iface = Interface::cast(
|
||||
FWObjectReference::getObject(intf_re->front()));
|
||||
|
||||
if(rule_iface==NULL)
|
||||
if(rule_iface==nullptr)
|
||||
{
|
||||
compiler->abort(rule, "Missing interface assignment");
|
||||
return true;
|
||||
|
||||
@ -89,10 +89,10 @@ bool PolicyCompiler_iosacl::checkForDynamicInterface::findDynamicInterface(
|
||||
for (list<FWObject*>::iterator i1=rel->begin(); i1!=rel->end(); ++i1)
|
||||
{
|
||||
FWObject *o = *i1;
|
||||
FWObject *obj = NULL;
|
||||
if (FWReference::cast(o)!=NULL) obj=FWReference::cast(o)->getPointer();
|
||||
FWObject *obj = nullptr;
|
||||
if (FWReference::cast(o)!=nullptr) obj=FWReference::cast(o)->getPointer();
|
||||
Interface *iface=Interface::cast(obj);
|
||||
if (iface!=NULL && iface->isDyn())
|
||||
if (iface!=nullptr && iface->isDyn())
|
||||
compiler->abort(
|
||||
rule,
|
||||
"Dynamic interface can not be used in the IOS ACL rules.");
|
||||
@ -103,7 +103,7 @@ bool PolicyCompiler_iosacl::checkForDynamicInterface::findDynamicInterface(
|
||||
|
||||
bool PolicyCompiler_iosacl::checkForDynamicInterface::processNext()
|
||||
{
|
||||
PolicyRule *rule = getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule = getNext(); if (rule==nullptr) return false;
|
||||
|
||||
findDynamicInterface(rule,rule->getSrc());
|
||||
findDynamicInterface(rule,rule->getDst());
|
||||
@ -129,7 +129,7 @@ void PolicyCompiler_iosacl::mirrorRule::duplicateRuleElement(
|
||||
bool PolicyCompiler_iosacl::mirrorRule::processNext()
|
||||
{
|
||||
//PolicyCompiler_iosacl *iosacl_comp=dynamic_cast<PolicyCompiler_iosacl*>(compiler);
|
||||
PolicyRule *rule = getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule = getNext(); if (rule==nullptr) return false;
|
||||
if (rule->getOptionsObject()->getBool("iosacl_add_mirror_rule"))
|
||||
{
|
||||
PolicyRule *r= compiler->dbcopy->createPolicyRule();
|
||||
@ -167,7 +167,7 @@ bool PolicyCompiler_iosacl::mirrorRule::processNext()
|
||||
{
|
||||
Service *nobj = mirror.getMirroredService(
|
||||
Service::cast(FWReference::getObject(*i1)));
|
||||
if (nobj->getParent() == NULL)
|
||||
if (nobj->getParent() == nullptr)
|
||||
compiler->persistent_objects->add(nobj, false);
|
||||
nsrv->addRef(nobj);
|
||||
}
|
||||
@ -182,10 +182,10 @@ bool PolicyCompiler_iosacl::mirrorRule::processNext()
|
||||
bool PolicyCompiler_iosacl::SpecialServices::processNext()
|
||||
{
|
||||
//PolicyCompiler_iosacl *iosacl_comp=dynamic_cast<PolicyCompiler_iosacl*>(compiler);
|
||||
PolicyRule *rule=getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
Service *s = compiler->getFirstSrv(rule);
|
||||
|
||||
if (IPService::cast(s)!=NULL)
|
||||
if (IPService::cast(s)!=nullptr)
|
||||
{
|
||||
if (s->getBool("rr") ||
|
||||
s->getBool("ssrr") ||
|
||||
@ -194,7 +194,7 @@ bool PolicyCompiler_iosacl::SpecialServices::processNext()
|
||||
rule,
|
||||
"IOS ACL does not support checking for IP options in ACLs.");
|
||||
}
|
||||
if (TCPService::cast(s)!=NULL && TCPService::cast(s)->inspectFlags())
|
||||
if (TCPService::cast(s)!=nullptr && TCPService::cast(s)->inspectFlags())
|
||||
{
|
||||
string version = compiler->fw->getStr("version");
|
||||
if (XMLTools::version_compare(version, "12.4")<0)
|
||||
@ -211,7 +211,7 @@ bool PolicyCompiler_iosacl::SpecialServices::processNext()
|
||||
*/
|
||||
bool PolicyCompiler_iosacl::splitTCPServiceWithFlags::processNext()
|
||||
{
|
||||
PolicyRule *rule=getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
RuleElementSrv *srv = rule->getSrv();
|
||||
|
||||
if (srv->size() > 1)
|
||||
@ -220,10 +220,10 @@ bool PolicyCompiler_iosacl::splitTCPServiceWithFlags::processNext()
|
||||
for (list<FWObject*>::iterator i1=srv->begin(); i1!=srv->end(); ++i1)
|
||||
{
|
||||
FWObject *o = *i1;
|
||||
FWObject *obj = NULL;
|
||||
if (FWReference::cast(o)!=NULL) obj=FWReference::cast(o)->getPointer();
|
||||
FWObject *obj = nullptr;
|
||||
if (FWReference::cast(o)!=nullptr) obj=FWReference::cast(o)->getPointer();
|
||||
Service *s=Service::cast(obj);
|
||||
assert(s!=NULL);
|
||||
assert(s!=nullptr);
|
||||
|
||||
TCPService *tcp_srv = TCPService::cast(s);
|
||||
if (tcp_srv && (tcp_srv->inspectFlags() || tcp_srv->getEstablished()))
|
||||
|
||||
@ -124,7 +124,7 @@ void PolicyCompiler_iosacl::PrintCompleteACLs::printRulesForACL::operator()(
|
||||
assert (acl_name!="");
|
||||
|
||||
ciscoACL *rule_acl = iosacl_comp->acls[acl_name];
|
||||
assert(rule_acl!=NULL);
|
||||
assert(rule_acl!=nullptr);
|
||||
|
||||
if (acl == rule_acl)
|
||||
{
|
||||
@ -199,17 +199,17 @@ string PolicyCompiler_iosacl::PrintRule::_printRule(PolicyRule *rule)
|
||||
assert(dstobj);
|
||||
assert(srvobj);
|
||||
|
||||
if (FWReference::cast(srcobj)!=NULL)
|
||||
if (FWReference::cast(srcobj)!=nullptr)
|
||||
{
|
||||
srcobj=FWReference::cast(srcobj)->getPointer();
|
||||
assert(srcobj);
|
||||
}
|
||||
if (FWReference::cast(dstobj)!=NULL)
|
||||
if (FWReference::cast(dstobj)!=nullptr)
|
||||
{
|
||||
dstobj=FWReference::cast(dstobj)->getPointer();
|
||||
assert(dstobj);
|
||||
}
|
||||
if (FWReference::cast(srvobj)!=NULL)
|
||||
if (FWReference::cast(srvobj)!=nullptr)
|
||||
{
|
||||
srvobj=FWReference::cast(srvobj)->getPointer();
|
||||
assert(srvobj);
|
||||
@ -219,7 +219,7 @@ string PolicyCompiler_iosacl::PrintRule::_printRule(PolicyRule *rule)
|
||||
assert (acl_name!="");
|
||||
|
||||
ciscoACL *acl = iosacl_comp->acls[acl_name];
|
||||
assert(acl!=NULL);
|
||||
assert(acl!=nullptr);
|
||||
|
||||
/*
|
||||
* Assemble ACL command in aclstr
|
||||
@ -244,12 +244,12 @@ string PolicyCompiler_iosacl::PrintRule::_printRule(PolicyRule *rule)
|
||||
*
|
||||
*/
|
||||
|
||||
if ( pgsrv!=NULL && pgsrv->isServiceGroup())
|
||||
if ( pgsrv!=nullptr && pgsrv->isServiceGroup())
|
||||
{
|
||||
aclstr << "object-group " << pgsrv->getName();
|
||||
aclstr << " ";
|
||||
|
||||
if ( pgsrc!=NULL && pgsrc->isObjectGroup())
|
||||
if ( pgsrc!=nullptr && pgsrc->isObjectGroup())
|
||||
{
|
||||
aclstr << "object-group " << pgsrc->getName();
|
||||
aclstr << " ";
|
||||
@ -258,7 +258,7 @@ string PolicyCompiler_iosacl::PrintRule::_printRule(PolicyRule *rule)
|
||||
aclstr << _printAddr( compiler->getFirstSrc(rule) );
|
||||
}
|
||||
|
||||
if ( pgdst!=NULL && pgdst->isObjectGroup())
|
||||
if ( pgdst!=nullptr && pgdst->isObjectGroup())
|
||||
{
|
||||
aclstr << "object-group " << pgdst->getName();
|
||||
aclstr << " ";
|
||||
@ -272,7 +272,7 @@ string PolicyCompiler_iosacl::PrintRule::_printRule(PolicyRule *rule)
|
||||
aclstr << _printProtocol(Service::cast(srvobj));
|
||||
aclstr << " ";
|
||||
|
||||
if ( pgsrc!=NULL && pgsrc->isObjectGroup())
|
||||
if ( pgsrc!=nullptr && pgsrc->isObjectGroup())
|
||||
{
|
||||
aclstr << "object-group " << pgsrc->getName();
|
||||
aclstr << " ";
|
||||
@ -283,7 +283,7 @@ string PolicyCompiler_iosacl::PrintRule::_printRule(PolicyRule *rule)
|
||||
|
||||
aclstr << _printSrcService( compiler->getFirstSrv(rule) );
|
||||
|
||||
if ( pgdst!=NULL && pgdst->isObjectGroup())
|
||||
if ( pgdst!=nullptr && pgdst->isObjectGroup())
|
||||
{
|
||||
aclstr << "object-group " << pgdst->getName();
|
||||
aclstr << " ";
|
||||
@ -368,7 +368,7 @@ string PolicyCompiler_iosacl::PrintRule::_printIPServiceOptions(PolicyRule *r)
|
||||
{
|
||||
Service *srv = compiler->getFirstSrv(r);
|
||||
const IPService *ip;
|
||||
if ((ip=IPService::constcast(srv))!=NULL)
|
||||
if ((ip=IPService::constcast(srv))!=nullptr)
|
||||
{
|
||||
string version = compiler->fw->getStr("version");
|
||||
|
||||
@ -496,7 +496,7 @@ string PolicyCompiler_iosacl::PrintRule::_printProtocol(Service *srv)
|
||||
string PolicyCompiler_iosacl::PrintRule::_printAddr(Address *o)
|
||||
{
|
||||
PolicyCompiler_iosacl *iosacl_comp = dynamic_cast<PolicyCompiler_iosacl*>(compiler);
|
||||
if (Interface::cast(o)!=NULL)
|
||||
if (Interface::cast(o)!=nullptr)
|
||||
{
|
||||
Interface *interface_ = Interface::cast(o);
|
||||
if (interface_->isDyn())
|
||||
@ -513,7 +513,7 @@ string PolicyCompiler_iosacl::PrintRule::_printAddr(Address *o)
|
||||
const InetAddr *nm = o->getNetmaskPtr();
|
||||
InetAddr srcmask;
|
||||
|
||||
if (nm != NULL)
|
||||
if (nm != nullptr)
|
||||
{
|
||||
srcmask = *nm;
|
||||
} else
|
||||
@ -535,8 +535,8 @@ string PolicyCompiler_iosacl::PrintRule::_printAddr(Address *o)
|
||||
str << "any ";
|
||||
} else
|
||||
{
|
||||
if (Interface::cast(o)==NULL &&
|
||||
Interface::cast(o->getParent())==NULL &&
|
||||
if (Interface::cast(o)==nullptr &&
|
||||
Interface::cast(o->getParent())==nullptr &&
|
||||
o->dimension() > 1 &&
|
||||
!srcmask.isHostMask())
|
||||
{
|
||||
@ -585,7 +585,7 @@ string PolicyCompiler_iosacl::PrintRule::_printAddr(Address *o)
|
||||
*/
|
||||
bool PolicyCompiler_iosacl::PrintRule::processNext()
|
||||
{
|
||||
PolicyRule *rule=getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
|
||||
@ -91,10 +91,10 @@ bool PolicyCompiler_nxosacl::checkForDynamicInterface::findDynamicInterface(
|
||||
for (list<FWObject*>::iterator i1=rel->begin(); i1!=rel->end(); ++i1)
|
||||
{
|
||||
FWObject *o = *i1;
|
||||
FWObject *obj = NULL;
|
||||
if (FWReference::cast(o)!=NULL) obj=FWReference::cast(o)->getPointer();
|
||||
FWObject *obj = nullptr;
|
||||
if (FWReference::cast(o)!=nullptr) obj=FWReference::cast(o)->getPointer();
|
||||
Interface *iface=Interface::cast(obj);
|
||||
if (iface!=NULL && iface->isDyn())
|
||||
if (iface!=nullptr && iface->isDyn())
|
||||
compiler->abort(
|
||||
rule,
|
||||
"Dynamic interface can not be used in the NXOS ACL rules.");
|
||||
@ -105,7 +105,7 @@ bool PolicyCompiler_nxosacl::checkForDynamicInterface::findDynamicInterface(
|
||||
|
||||
bool PolicyCompiler_nxosacl::checkForDynamicInterface::processNext()
|
||||
{
|
||||
PolicyRule *rule = getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule = getNext(); if (rule==nullptr) return false;
|
||||
|
||||
findDynamicInterface(rule,rule->getSrc());
|
||||
findDynamicInterface(rule,rule->getDst());
|
||||
@ -131,7 +131,7 @@ void PolicyCompiler_nxosacl::mirrorRule::duplicateRuleElement(
|
||||
bool PolicyCompiler_nxosacl::mirrorRule::processNext()
|
||||
{
|
||||
//PolicyCompiler_nxosacl *nxosacl_comp=dynamic_cast<PolicyCompiler_nxosacl*>(compiler);
|
||||
PolicyRule *rule = getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule = getNext(); if (rule==nullptr) return false;
|
||||
if (rule->getOptionsObject()->getBool("nxosacl_add_mirror_rule"))
|
||||
{
|
||||
PolicyRule *r= compiler->dbcopy->createPolicyRule();
|
||||
@ -169,7 +169,7 @@ bool PolicyCompiler_nxosacl::mirrorRule::processNext()
|
||||
{
|
||||
Service *nobj = mirror.getMirroredService(
|
||||
Service::cast(FWReference::getObject(*i1)));
|
||||
if (nobj->getParent() == NULL)
|
||||
if (nobj->getParent() == nullptr)
|
||||
compiler->persistent_objects->add(nobj, false);
|
||||
nsrv->addRef(nobj);
|
||||
}
|
||||
@ -184,10 +184,10 @@ bool PolicyCompiler_nxosacl::mirrorRule::processNext()
|
||||
bool PolicyCompiler_nxosacl::SpecialServices::processNext()
|
||||
{
|
||||
//PolicyCompiler_nxosacl *nxosacl_comp=dynamic_cast<PolicyCompiler_nxosacl*>(compiler);
|
||||
PolicyRule *rule=getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
Service *s = compiler->getFirstSrv(rule);
|
||||
|
||||
if (IPService::cast(s)!=NULL)
|
||||
if (IPService::cast(s)!=nullptr)
|
||||
{
|
||||
if (s->getBool("rr") ||
|
||||
s->getBool("ssrr") ||
|
||||
@ -196,7 +196,7 @@ bool PolicyCompiler_nxosacl::SpecialServices::processNext()
|
||||
rule,
|
||||
"NXOS ACL does not support checking for IP options in ACLs.");
|
||||
}
|
||||
if (TCPService::cast(s)!=NULL && TCPService::cast(s)->inspectFlags())
|
||||
if (TCPService::cast(s)!=nullptr && TCPService::cast(s)->inspectFlags())
|
||||
{
|
||||
string version = compiler->fw->getStr("version");
|
||||
if (XMLTools::version_compare(version, "12.4")<0)
|
||||
@ -213,7 +213,7 @@ bool PolicyCompiler_nxosacl::SpecialServices::processNext()
|
||||
*/
|
||||
bool PolicyCompiler_nxosacl::splitTCPServiceWithFlags::processNext()
|
||||
{
|
||||
PolicyRule *rule=getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
RuleElementSrv *srv = rule->getSrv();
|
||||
|
||||
if (srv->size() > 1)
|
||||
@ -222,10 +222,10 @@ bool PolicyCompiler_nxosacl::splitTCPServiceWithFlags::processNext()
|
||||
for (list<FWObject*>::iterator i1=srv->begin(); i1!=srv->end(); ++i1)
|
||||
{
|
||||
FWObject *o = *i1;
|
||||
FWObject *obj = NULL;
|
||||
if (FWReference::cast(o)!=NULL) obj=FWReference::cast(o)->getPointer();
|
||||
FWObject *obj = nullptr;
|
||||
if (FWReference::cast(o)!=nullptr) obj=FWReference::cast(o)->getPointer();
|
||||
Service *s=Service::cast(obj);
|
||||
assert(s!=NULL);
|
||||
assert(s!=nullptr);
|
||||
|
||||
TCPService *tcp_srv = TCPService::cast(s);
|
||||
if (tcp_srv && (tcp_srv->inspectFlags() || tcp_srv->getEstablished()))
|
||||
|
||||
@ -124,7 +124,7 @@ void PolicyCompiler_nxosacl::PrintCompleteACLs::printRulesForACL::operator()(
|
||||
assert (acl_name!="");
|
||||
|
||||
ciscoACL *rule_acl = nxosacl_comp->acls[acl_name];
|
||||
assert(rule_acl!=NULL);
|
||||
assert(rule_acl!=nullptr);
|
||||
|
||||
if (acl == rule_acl)
|
||||
{
|
||||
@ -199,17 +199,17 @@ string PolicyCompiler_nxosacl::PrintRule::_printRule(PolicyRule *rule)
|
||||
assert(dstobj);
|
||||
assert(srvobj);
|
||||
|
||||
if (FWReference::cast(srcobj)!=NULL)
|
||||
if (FWReference::cast(srcobj)!=nullptr)
|
||||
{
|
||||
srcobj=FWReference::cast(srcobj)->getPointer();
|
||||
assert(srcobj);
|
||||
}
|
||||
if (FWReference::cast(dstobj)!=NULL)
|
||||
if (FWReference::cast(dstobj)!=nullptr)
|
||||
{
|
||||
dstobj=FWReference::cast(dstobj)->getPointer();
|
||||
assert(dstobj);
|
||||
}
|
||||
if (FWReference::cast(srvobj)!=NULL)
|
||||
if (FWReference::cast(srvobj)!=nullptr)
|
||||
{
|
||||
srvobj=FWReference::cast(srvobj)->getPointer();
|
||||
assert(srvobj);
|
||||
@ -219,7 +219,7 @@ string PolicyCompiler_nxosacl::PrintRule::_printRule(PolicyRule *rule)
|
||||
assert (acl_name!="");
|
||||
|
||||
ciscoACL *acl = nxosacl_comp->acls[acl_name];
|
||||
assert(acl!=NULL);
|
||||
assert(acl!=nullptr);
|
||||
|
||||
/*
|
||||
* Assemble ACL command in aclstr
|
||||
@ -244,12 +244,12 @@ string PolicyCompiler_nxosacl::PrintRule::_printRule(PolicyRule *rule)
|
||||
*
|
||||
*/
|
||||
|
||||
if ( pgsrv!=NULL && pgsrv->isServiceGroup())
|
||||
if ( pgsrv!=nullptr && pgsrv->isServiceGroup())
|
||||
{
|
||||
aclstr << "object-group " << pgsrv->getName();
|
||||
aclstr << " ";
|
||||
|
||||
if ( pgsrc!=NULL && pgsrc->isObjectGroup())
|
||||
if ( pgsrc!=nullptr && pgsrc->isObjectGroup())
|
||||
{
|
||||
aclstr << "object-group " << pgsrc->getName();
|
||||
aclstr << " ";
|
||||
@ -258,7 +258,7 @@ string PolicyCompiler_nxosacl::PrintRule::_printRule(PolicyRule *rule)
|
||||
aclstr << _printAddr( compiler->getFirstSrc(rule) );
|
||||
}
|
||||
|
||||
if ( pgdst!=NULL && pgdst->isObjectGroup())
|
||||
if ( pgdst!=nullptr && pgdst->isObjectGroup())
|
||||
{
|
||||
aclstr << "object-group " << pgdst->getName();
|
||||
aclstr << " ";
|
||||
@ -272,7 +272,7 @@ string PolicyCompiler_nxosacl::PrintRule::_printRule(PolicyRule *rule)
|
||||
aclstr << _printProtocol(Service::cast(srvobj));
|
||||
aclstr << " ";
|
||||
|
||||
if ( pgsrc!=NULL && pgsrc->isObjectGroup())
|
||||
if ( pgsrc!=nullptr && pgsrc->isObjectGroup())
|
||||
{
|
||||
aclstr << "object-group " << pgsrc->getName();
|
||||
aclstr << " ";
|
||||
@ -283,7 +283,7 @@ string PolicyCompiler_nxosacl::PrintRule::_printRule(PolicyRule *rule)
|
||||
|
||||
aclstr << _printSrcService( compiler->getFirstSrv(rule) );
|
||||
|
||||
if ( pgdst!=NULL && pgdst->isObjectGroup())
|
||||
if ( pgdst!=nullptr && pgdst->isObjectGroup())
|
||||
{
|
||||
aclstr << "object-group " << pgdst->getName();
|
||||
aclstr << " ";
|
||||
@ -368,7 +368,7 @@ string PolicyCompiler_nxosacl::PrintRule::_printIPServiceOptions(PolicyRule *r)
|
||||
{
|
||||
Service *srv = compiler->getFirstSrv(r);
|
||||
const IPService *ip;
|
||||
if ((ip=IPService::constcast(srv))!=NULL)
|
||||
if ((ip=IPService::constcast(srv))!=nullptr)
|
||||
{
|
||||
string version = compiler->fw->getStr("version");
|
||||
|
||||
@ -496,7 +496,7 @@ string PolicyCompiler_nxosacl::PrintRule::_printProtocol(Service *srv)
|
||||
string PolicyCompiler_nxosacl::PrintRule::_printAddr(Address *o)
|
||||
{
|
||||
PolicyCompiler_nxosacl *nxosacl_comp = dynamic_cast<PolicyCompiler_nxosacl*>(compiler);
|
||||
if (Interface::cast(o)!=NULL)
|
||||
if (Interface::cast(o)!=nullptr)
|
||||
{
|
||||
Interface *interface_ = Interface::cast(o);
|
||||
if (interface_->isDyn())
|
||||
@ -513,7 +513,7 @@ string PolicyCompiler_nxosacl::PrintRule::_printAddr(Address *o)
|
||||
const InetAddr *nm = o->getNetmaskPtr();
|
||||
InetAddr srcmask;
|
||||
|
||||
if (nm != NULL)
|
||||
if (nm != nullptr)
|
||||
{
|
||||
srcmask = *nm;
|
||||
} else
|
||||
@ -535,8 +535,8 @@ string PolicyCompiler_nxosacl::PrintRule::_printAddr(Address *o)
|
||||
str << "any ";
|
||||
} else
|
||||
{
|
||||
if (Interface::cast(o)==NULL &&
|
||||
Interface::cast(o->getParent())==NULL &&
|
||||
if (Interface::cast(o)==nullptr &&
|
||||
Interface::cast(o->getParent())==nullptr &&
|
||||
o->dimension() > 1 &&
|
||||
!srcmask.isHostMask())
|
||||
{
|
||||
@ -585,7 +585,7 @@ string PolicyCompiler_nxosacl::PrintRule::_printAddr(Address *o)
|
||||
*/
|
||||
bool PolicyCompiler_nxosacl::PrintRule::processNext()
|
||||
{
|
||||
PolicyRule *rule=getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
|
||||
@ -101,10 +101,10 @@ bool PolicyCompiler_pix::checkVersionAndDynamicInterface::findDynamicInterface(
|
||||
for (list<FWObject*>::iterator i1=rel->begin(); i1!=rel->end(); ++i1)
|
||||
{
|
||||
FWObject *o = *i1;
|
||||
FWObject *obj = NULL;
|
||||
if (FWReference::cast(o)!=NULL) obj=FWReference::cast(o)->getPointer();
|
||||
FWObject *obj = nullptr;
|
||||
if (FWReference::cast(o)!=nullptr) obj=FWReference::cast(o)->getPointer();
|
||||
Interface *iface=Interface::cast(obj);
|
||||
if (iface!=NULL && iface->isDyn() && (vers=="6.1" || vers=="6.2"))
|
||||
if (iface!=nullptr && iface->isDyn() && (vers=="6.1" || vers=="6.2"))
|
||||
{
|
||||
compiler->abort(
|
||||
rule,
|
||||
@ -119,7 +119,7 @@ bool PolicyCompiler_pix::checkVersionAndDynamicInterface::findDynamicInterface(
|
||||
|
||||
bool PolicyCompiler_pix::checkVersionAndDynamicInterface::processNext()
|
||||
{
|
||||
PolicyRule *rule = getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule = getNext(); if (rule==nullptr) return false;
|
||||
|
||||
Service *s = compiler->getFirstSrv(rule);
|
||||
|
||||
@ -159,7 +159,7 @@ bool PolicyCompiler_pix::checkVersionAndDynamicInterface::processNext()
|
||||
*/
|
||||
bool PolicyCompiler_pix::PrepareForICMPCmd::processNext()
|
||||
{
|
||||
PolicyRule *rule=getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
Address *dst=compiler->getFirstDst(rule);
|
||||
Service *srv=compiler->getFirstSrv(rule);
|
||||
@ -176,7 +176,7 @@ bool PolicyCompiler_pix::PrepareForICMPCmd::processNext()
|
||||
|
||||
bool PolicyCompiler_pix::SplitSRCForICMPCmd::processNext()
|
||||
{
|
||||
PolicyRule *rule=getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
if (rule->getBool("icmp_cmd"))
|
||||
{
|
||||
@ -191,10 +191,10 @@ bool PolicyCompiler_pix::SplitSRCForICMPCmd::processNext()
|
||||
for (FWObject::iterator i=src->begin(); i!=src->end(); ++i)
|
||||
{
|
||||
FWObject *o = *i;
|
||||
FWObject *obj = NULL;
|
||||
if (FWReference::cast(o)!=NULL) obj=FWReference::cast(o)->getPointer();
|
||||
FWObject *obj = nullptr;
|
||||
if (FWReference::cast(o)!=nullptr) obj=FWReference::cast(o)->getPointer();
|
||||
Address *a=Address::cast(obj);
|
||||
assert(a!=NULL);
|
||||
assert(a!=nullptr);
|
||||
|
||||
PolicyRule *new_rule= compiler->dbcopy->createPolicyRule();
|
||||
compiler->temp_ruleset->add(new_rule);
|
||||
@ -222,7 +222,7 @@ bool PolicyCompiler_pix::SplitSRCForICMPCmd::processNext()
|
||||
bool PolicyCompiler_pix::RejectAction::processNext()
|
||||
{
|
||||
PolicyCompiler_pix *pix_comp=dynamic_cast<PolicyCompiler_pix*>(compiler);
|
||||
PolicyRule *rule=getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
if (rule->getAction()==PolicyRule::Reject)
|
||||
pix_comp->resetinbound=true;
|
||||
@ -236,7 +236,7 @@ bool PolicyCompiler_pix::RejectAction::processNext()
|
||||
*/
|
||||
bool PolicyCompiler_pix::splitIfTelnetSSHICMPtoFw::processNext()
|
||||
{
|
||||
PolicyRule *rule=getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
// PolicyCompiler_pix *pix_comp=dynamic_cast<PolicyCompiler_pix*>(compiler);
|
||||
|
||||
Address *dst=compiler->getFirstDst(rule);
|
||||
@ -247,7 +247,7 @@ bool PolicyCompiler_pix::splitIfTelnetSSHICMPtoFw::processNext()
|
||||
{
|
||||
FWObject *o = *i1;
|
||||
FWObject *obj = o;
|
||||
if (FWReference::cast(o)!=NULL) obj=FWReference::cast(o)->getPointer();
|
||||
if (FWReference::cast(o)!=nullptr) obj=FWReference::cast(o)->getPointer();
|
||||
|
||||
PolicyRule *r= compiler->dbcopy->createPolicyRule();
|
||||
compiler->temp_ruleset->add(r);
|
||||
@ -275,7 +275,7 @@ bool PolicyCompiler_pix::splitIfTelnetSSHICMPtoFw::processNext()
|
||||
*/
|
||||
bool PolicyCompiler_pix::AvoidObjectGroup::processNext()
|
||||
{
|
||||
PolicyRule *rule=getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
// PolicyCompiler_pix *pix_comp=dynamic_cast<PolicyCompiler_pix*>(compiler);
|
||||
|
||||
RuleElement *srv=RuleElement::cast(rule->getFirstByType(RuleElementSrv::TYPENAME));
|
||||
@ -286,7 +286,7 @@ bool PolicyCompiler_pix::AvoidObjectGroup::processNext()
|
||||
}
|
||||
|
||||
FWObject *o = srv->front();
|
||||
if (FWReference::cast(o)!=NULL) o=FWReference::cast(o)->getPointer();
|
||||
if (FWReference::cast(o)!=nullptr) o=FWReference::cast(o)->getPointer();
|
||||
if (ICMPService::isA(o))
|
||||
{
|
||||
/* we have a rule with multiple icmp services in Srv. We do not want
|
||||
@ -327,7 +327,7 @@ bool PolicyCompiler_pix::AvoidObjectGroup::processNext()
|
||||
*/
|
||||
bool PolicyCompiler_pix::AddressRangesIfTcpServiceToFW::processNext()
|
||||
{
|
||||
PolicyRule *rule = getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule = getNext(); if (rule==nullptr) return false;
|
||||
|
||||
if (rule->getBool("tcp_service_to_fw"))
|
||||
{
|
||||
|
||||
@ -41,7 +41,7 @@ using namespace std;
|
||||
|
||||
bool PolicyCompiler_pix::matchTranslatedAddresses::processNext()
|
||||
{
|
||||
PolicyRule *rule = getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule = getNext(); if (rule==nullptr) return false;
|
||||
|
||||
string version = compiler->fw->getStr("version");
|
||||
|
||||
@ -60,21 +60,21 @@ bool PolicyCompiler_pix::matchTranslatedAddresses::processNext()
|
||||
FWObject *o1 = *i1;
|
||||
FWObject *o2 = *i2;
|
||||
FWObject *o3 = *i3;
|
||||
FWObject *obj1 = NULL;
|
||||
FWObject *obj2 = NULL;
|
||||
FWObject *obj3 = NULL;
|
||||
FWObject *obj1 = nullptr;
|
||||
FWObject *obj2 = nullptr;
|
||||
FWObject *obj3 = nullptr;
|
||||
|
||||
obj1 = FWReference::getObject(o1);
|
||||
Address *src = Address::cast(obj1);
|
||||
assert(src!=NULL);
|
||||
assert(src!=nullptr);
|
||||
|
||||
obj2 = FWReference::getObject(o2);
|
||||
Address *dst = Address::cast(obj2);
|
||||
assert(dst!=NULL);
|
||||
assert(dst!=nullptr);
|
||||
|
||||
obj3 = FWReference::getObject(o3);
|
||||
Service *srv = Service::cast(obj3);
|
||||
assert(srv!=NULL);
|
||||
assert(srv!=nullptr);
|
||||
|
||||
list<NATRule*> tl = findMatchingNATRules(src, dst, srv);
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ using namespace std;
|
||||
|
||||
bool PolicyCompiler_pix::InterfaceAndDirection_v6::processNext()
|
||||
{
|
||||
PolicyRule *rule = getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule = getNext(); if (rule==nullptr) return false;
|
||||
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
@ -92,7 +92,7 @@ bool PolicyCompiler_pix::InterfaceAndDirection_v6::processNext()
|
||||
*/
|
||||
bool PolicyCompiler_pix::SplitDirection_v6::processNext()
|
||||
{
|
||||
PolicyRule *rule = getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule = getNext(); if (rule==nullptr) return false;
|
||||
// FWObject *rule_iface = compiler->dbcopy->findInIndex(rule->getInterfaceId());
|
||||
RuleElementItf *intf_re = rule->getItf();
|
||||
|
||||
@ -162,7 +162,7 @@ bool PolicyCompiler_pix::SplitDirection_v6::processNext()
|
||||
bool PolicyCompiler_pix::EmulateOutboundACL_v6::processNext()
|
||||
{
|
||||
Helper helper(compiler);
|
||||
PolicyRule *rule = getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule = getNext(); if (rule==nullptr) return false;
|
||||
// FWObject *rule_iface = compiler->dbcopy->findInIndex(rule->getInterfaceId());
|
||||
RuleElementItf *intf_re = rule->getItf();
|
||||
FWObject *rule_iface = FWObjectReference::getObject(intf_re->front());
|
||||
@ -218,7 +218,7 @@ bool PolicyCompiler_pix::EmulateOutboundACL_v6::processNext()
|
||||
|
||||
r->duplicate(rule);
|
||||
// r->setInterfaceId((*i)->getId());
|
||||
RuleElementItf *itf_re = r->getItf(); assert(itf_re!=NULL);
|
||||
RuleElementItf *itf_re = r->getItf(); assert(itf_re!=nullptr);
|
||||
itf_re->reset();
|
||||
itf_re->addRef(*i);
|
||||
|
||||
@ -280,7 +280,7 @@ bool PolicyCompiler_pix::EmulateOutboundACL_v6::processNext()
|
||||
*/
|
||||
bool PolicyCompiler_pix::assignRuleToInterface_v6::processNext()
|
||||
{
|
||||
PolicyRule *rule = getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule = getNext(); if (rule==nullptr) return false;
|
||||
Helper helper(compiler);
|
||||
|
||||
RuleElementSrc *src = rule->getSrc(); assert(src);
|
||||
@ -330,7 +330,7 @@ bool PolicyCompiler_pix::assignRuleToInterface_v6::processNext()
|
||||
|
||||
r->duplicate(rule);
|
||||
// r->setInterfaceId(intf->getId());
|
||||
RuleElementItf *itf_re = r->getItf(); assert(itf_re!=NULL);
|
||||
RuleElementItf *itf_re = r->getItf(); assert(itf_re!=nullptr);
|
||||
itf_re->reset();
|
||||
itf_re->addRef(intf);
|
||||
|
||||
@ -363,14 +363,14 @@ bool PolicyCompiler_pix::assignRuleToInterface_v6::processNext()
|
||||
bool PolicyCompiler_pix::pickACL_v6::processNext()
|
||||
{
|
||||
PolicyCompiler_pix *pix_comp = dynamic_cast<PolicyCompiler_pix*>(compiler);
|
||||
PolicyRule *rule = getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule = getNext(); if (rule==nullptr) return false;
|
||||
// Interface *rule_iface = Interface::cast(compiler->dbcopy->findInIndex(rule->getInterfaceId()));
|
||||
|
||||
RuleElementItf *intf_re = rule->getItf();
|
||||
Interface *rule_iface = Interface::cast(
|
||||
FWObjectReference::getObject(intf_re->front()));
|
||||
|
||||
if (intf_re->isAny() || rule_iface==NULL)
|
||||
if (intf_re->isAny() || rule_iface==nullptr)
|
||||
compiler->abort(rule, "Missing interface assignment");
|
||||
|
||||
string acl_name = rule_iface->getLabel() + "_acl_in";
|
||||
|
||||
@ -188,7 +188,7 @@ string PolicyCompiler_pix::PrintRule::_printDstService(Service *srv)
|
||||
|
||||
string PolicyCompiler_pix::PrintRule::_printAddr(libfwbuilder::Address *o)
|
||||
{
|
||||
if (Interface::cast(o)!=NULL)
|
||||
if (Interface::cast(o)!=nullptr)
|
||||
{
|
||||
Interface *interface_=Interface::cast(o);
|
||||
if (interface_->isDyn())
|
||||
@ -204,10 +204,10 @@ string PolicyCompiler_pix::PrintRule::_printAddr(libfwbuilder::Address *o)
|
||||
{
|
||||
InetAddr srcmask = *(o->getNetmaskPtr());
|
||||
|
||||
if (Interface::cast(o)!=NULL)
|
||||
if (Interface::cast(o)!=nullptr)
|
||||
srcmask = InetAddr(InetAddr::getAllOnes());
|
||||
|
||||
if (IPv4::cast(o)!=NULL)
|
||||
if (IPv4::cast(o)!=nullptr)
|
||||
srcmask = InetAddr(InetAddr::getAllOnes());
|
||||
|
||||
|
||||
@ -253,7 +253,7 @@ string PolicyCompiler_pix::PrintRule::_printICMPCommand(PolicyRule *rule)
|
||||
Address *src = compiler->getFirstSrc(rule);
|
||||
RuleElementSrv *srvrel = rule->getSrv();
|
||||
FWObject *srv = srvrel->front();
|
||||
if (FWReference::cast(srv)!=NULL) srv = FWReference::cast(srv)->getPointer();
|
||||
if (FWReference::cast(srv)!=nullptr) srv = FWReference::cast(srv)->getPointer();
|
||||
|
||||
// Interface *rule_iface =
|
||||
// Interface::cast(compiler->dbcopy->findInIndex(rule->getInterfaceId()));
|
||||
@ -264,12 +264,12 @@ string PolicyCompiler_pix::PrintRule::_printICMPCommand(PolicyRule *rule)
|
||||
|
||||
assert(rule_iface);
|
||||
|
||||
if (PIXObjectGroup::cast(srv)!=NULL)
|
||||
if (PIXObjectGroup::cast(srv)!=nullptr)
|
||||
{
|
||||
for (FWObject::iterator i1=srv->begin(); i1!=srv->end(); ++i1)
|
||||
{
|
||||
ICMPService *s = ICMPService::cast(FWReference::getObject(*i1));
|
||||
assert(s!=NULL);
|
||||
assert(s!=nullptr);
|
||||
|
||||
ostringstream str1;
|
||||
str1 << "icmp ";
|
||||
@ -319,18 +319,18 @@ string PolicyCompiler_pix::PrintRule::_printSSHTelnetCommand(PolicyRule *rule)
|
||||
{
|
||||
FWObject *o = FWReference::getObject(*i);
|
||||
|
||||
if (dynamic_cast<PIXObjectGroup*>(o)!=NULL)
|
||||
if (dynamic_cast<PIXObjectGroup*>(o)!=nullptr)
|
||||
{
|
||||
for (FWObject::iterator j=o->begin(); j!=o->end(); ++j)
|
||||
{
|
||||
Address *a = Address::cast(FWReference::getObject(*j));
|
||||
assert(a!=NULL);
|
||||
assert(a!=nullptr);
|
||||
str << _printSingleSSHTelnetCommand(port, a, rule_iface->getLabel());
|
||||
}
|
||||
} else
|
||||
{
|
||||
Address *a = Address::cast(o);
|
||||
assert(a!=NULL);
|
||||
assert(a!=nullptr);
|
||||
str << _printSingleSSHTelnetCommand(port, a, rule_iface->getLabel());
|
||||
}
|
||||
}
|
||||
@ -368,7 +368,7 @@ string PolicyCompiler_pix::PrintRule::_printSingleSSHTelnetCommand(
|
||||
bool PolicyCompiler_pix::PrintRule::processNext()
|
||||
{
|
||||
PolicyCompiler_pix *pix_comp = dynamic_cast<PolicyCompiler_pix*>(compiler);
|
||||
PolicyRule *rule = getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule = getNext(); if (rule==nullptr) return false;
|
||||
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
@ -418,7 +418,7 @@ bool PolicyCompiler_pix::PrintRule::processNext()
|
||||
assert(acl_name!="");
|
||||
|
||||
ciscoACL *acl = pix_comp->acls[acl_name];
|
||||
assert(acl!=NULL);
|
||||
assert(acl!=nullptr);
|
||||
|
||||
if (compiler->fw->getOptionsObject()->getBool("pix_use_acl_remarks"))
|
||||
{
|
||||
@ -446,9 +446,9 @@ bool PolicyCompiler_pix::PrintRule::processNext()
|
||||
PIXObjectGroup *pgsrc = PIXObjectGroup::cast(srcobj);
|
||||
PIXObjectGroup *pgdst = PIXObjectGroup::cast(dstobj);
|
||||
Service *srv_s = Service::cast(srvobj);
|
||||
assert(pgsrv!=NULL || srv_s!=NULL);
|
||||
assert(pgsrv!=nullptr || srv_s!=nullptr);
|
||||
|
||||
if ( pgsrv!=NULL && pgsrv->isServiceGroup())
|
||||
if ( pgsrv!=nullptr && pgsrv->isServiceGroup())
|
||||
{
|
||||
aclstr << pgsrv->getSrvTypeName();
|
||||
} else
|
||||
@ -464,7 +464,7 @@ bool PolicyCompiler_pix::PrintRule::processNext()
|
||||
aclstr << "object " << asa8_object->getCommandWord().toStdString() << " ";
|
||||
} else
|
||||
{
|
||||
if (pgsrc!=NULL)
|
||||
if (pgsrc!=nullptr)
|
||||
{
|
||||
aclstr << "object-group " << srcobj->getName() << " ";
|
||||
} else
|
||||
@ -473,7 +473,7 @@ bool PolicyCompiler_pix::PrintRule::processNext()
|
||||
}
|
||||
}
|
||||
|
||||
if ( pgsrv==NULL )
|
||||
if ( pgsrv==nullptr )
|
||||
aclstr << _printSrcService( compiler->getFirstSrv(rule) );
|
||||
|
||||
asa8_object = pix_comp->named_objects_manager->getNamedObject(dstobj);
|
||||
@ -482,7 +482,7 @@ bool PolicyCompiler_pix::PrintRule::processNext()
|
||||
aclstr << "object " << asa8_object->getCommandWord().toStdString() << " ";
|
||||
} else
|
||||
{
|
||||
if (pgdst!=NULL)
|
||||
if (pgdst!=nullptr)
|
||||
{
|
||||
aclstr << "object-group " << dstobj->getName() << " ";
|
||||
} else
|
||||
@ -491,7 +491,7 @@ bool PolicyCompiler_pix::PrintRule::processNext()
|
||||
}
|
||||
}
|
||||
|
||||
if (pgsrv!=NULL)
|
||||
if (pgsrv!=nullptr)
|
||||
{
|
||||
aclstr << "object-group " << srvobj->getName() << " ";
|
||||
} else
|
||||
|
||||
@ -49,7 +49,7 @@ bool RoutingCompiler_cisco::eliminateDuplicateRules::processNext()
|
||||
dynamic_cast<RoutingCompiler_cisco*>(compiler);
|
||||
|
||||
RoutingRule *rule = getNext();
|
||||
if (rule == NULL) return false;
|
||||
if (rule == nullptr) return false;
|
||||
|
||||
if (rule->isFallback() || rule->isHidden())
|
||||
{
|
||||
|
||||
@ -49,7 +49,7 @@ RoutingCompiler_cisco::PrintRule::PrintRule(const std::string &name) :
|
||||
bool RoutingCompiler_cisco::PrintRule::processNext()
|
||||
{
|
||||
RoutingRule *rule = getNext();
|
||||
if (rule == NULL) return false;
|
||||
if (rule == nullptr) return false;
|
||||
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
@ -60,7 +60,7 @@ string RoutingCompiler_cisco::PrintRule::_printAddr(Address *o)
|
||||
{
|
||||
std::ostringstream ostr;
|
||||
|
||||
if (Interface::cast(o)!=NULL)
|
||||
if (Interface::cast(o)!=nullptr)
|
||||
{
|
||||
Interface *iface=Interface::cast(o);
|
||||
if (iface->isDyn())
|
||||
@ -73,7 +73,7 @@ string RoutingCompiler_cisco::PrintRule::_printAddr(Address *o)
|
||||
addr = o->getAddressPtr();
|
||||
mask = o->getNetmaskPtr();
|
||||
|
||||
if (addr==NULL)
|
||||
if (addr==nullptr)
|
||||
{
|
||||
FWObject *obj=o;
|
||||
/*
|
||||
@ -82,7 +82,7 @@ string RoutingCompiler_cisco::PrintRule::_printAddr(Address *o)
|
||||
* Interface are inherited from Address, we can't use cast. Use isA
|
||||
* instead
|
||||
*/
|
||||
while (obj!=NULL &&
|
||||
while (obj!=nullptr &&
|
||||
!Host::isA(obj) &&
|
||||
!Firewall::isA(obj) &&
|
||||
!Network::isA(obj)) obj=obj->getParent();
|
||||
@ -99,7 +99,7 @@ string RoutingCompiler_cisco::PrintRule::_printAddr(Address *o)
|
||||
{
|
||||
ostr << addr->toString();
|
||||
|
||||
if (Interface::cast(o)==NULL &&
|
||||
if (Interface::cast(o)==nullptr &&
|
||||
Address::cast(o)->dimension() > 1 &&
|
||||
!mask->isHostMask())
|
||||
{
|
||||
@ -124,7 +124,7 @@ string RoutingCompiler_cisco::PrintRule::_printRGtw(RoutingRule *rule)
|
||||
RuleElementRGtw *gtwrel = rule->getRGtw();
|
||||
ref = gtwrel->front();
|
||||
Address *gtw = Address::cast(FWReference::cast(ref)->getPointer());
|
||||
if (gtw == NULL) compiler->abort(rule, "Broken GTW");
|
||||
if (gtw == nullptr) compiler->abort(rule, "Broken GTW");
|
||||
|
||||
string gateway = _printAddr(gtw);
|
||||
if (gateway != "default ") return gateway;
|
||||
@ -139,7 +139,7 @@ string RoutingCompiler_cisco::PrintRule::_printRItf(RoutingRule *rule)
|
||||
ref = itfrel->front();
|
||||
Interface *itf = Interface::cast(FWReference::cast(ref)->getPointer());
|
||||
|
||||
if (itf != NULL) return itf->getLabel() + " ";
|
||||
if (itf != nullptr) return itf->getLabel() + " ";
|
||||
else return "";
|
||||
}
|
||||
|
||||
@ -150,7 +150,7 @@ string RoutingCompiler_cisco::PrintRule::_printRDst(RoutingRule *rule)
|
||||
RuleElementRDst *dstrel = rule->getRDst();
|
||||
ref = dstrel->front();
|
||||
Address *dst = Address::cast(FWReference::cast(ref)->getPointer());
|
||||
if (dst==NULL) compiler->abort(rule, "Broken DST");
|
||||
if (dst==nullptr) compiler->abort(rule, "Broken DST");
|
||||
|
||||
string dest = _printAddr(dst);
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ void RoutingCompiler_iosacl::epilog()
|
||||
*/
|
||||
bool RoutingCompiler_iosacl::ExpandMultipleAddressesExceptInterface::processNext()
|
||||
{
|
||||
RoutingRule *rule=getNext(); if (rule==NULL) return false;
|
||||
RoutingRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
RuleElementRDst *dst = rule->getRDst(); assert(dst);
|
||||
@ -74,7 +74,7 @@ bool RoutingCompiler_iosacl::ExpandMultipleAddressesExceptInterface::processNext
|
||||
RuleElementRGtw *gtwrel = rule->getRGtw(); assert(gtwrel);
|
||||
Address *gtw = Address::cast(
|
||||
FWReference::cast(gtwrel->front())->getPointer());
|
||||
if (gtw == NULL)
|
||||
if (gtw == nullptr)
|
||||
compiler->abort(rule, "Broken GTW");
|
||||
if (Interface::isA(gtw) && gtw->isChildOf(compiler->fw)) return true;
|
||||
compiler->_expand_addr(rule, gtwrel, false);
|
||||
@ -84,7 +84,7 @@ bool RoutingCompiler_iosacl::ExpandMultipleAddressesExceptInterface::processNext
|
||||
|
||||
bool RoutingCompiler_iosacl::checkRItfAndGw::processNext()
|
||||
{
|
||||
RoutingRule *rule=getNext(); if (rule==NULL) return false;
|
||||
RoutingRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
RuleElementRItf *itfrel = rule->getRItf(); assert(itfrel);
|
||||
|
||||
@ -56,7 +56,7 @@ RoutingCompiler_iosacl::PrintRule::PrintRule(const std::string &name) :
|
||||
|
||||
bool RoutingCompiler_iosacl::PrintRule::processNext()
|
||||
{
|
||||
RoutingRule *rule = getNext(); if (rule == NULL) return false;
|
||||
RoutingRule *rule = getNext(); if (rule == nullptr) return false;
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
string rl = rule->getLabel();
|
||||
@ -132,7 +132,7 @@ string RoutingCompiler_iosacl::PrintRule::_printRItf(RoutingRule *rule)
|
||||
{
|
||||
Interface *itf =
|
||||
Interface::cast(FWObjectReference::getObject(itfrel->front()));
|
||||
if (itf != NULL) return itf->getName() + " ";
|
||||
if (itf != nullptr) return itf->getName() + " ";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
@ -144,7 +144,7 @@ string RoutingCompiler_iosacl::PrintRule::RoutingRuleToString(RoutingRule *rule)
|
||||
RuleElementRDst *dstrel = rule->getRDst();
|
||||
ref = dstrel->front();
|
||||
Address *dst = Address::cast(FWReference::cast(ref)->getPointer());
|
||||
if(dst == NULL) compiler->abort(rule, "Broken DST");
|
||||
if(dst == nullptr) compiler->abort(rule, "Broken DST");
|
||||
|
||||
std::ostringstream command_line;
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ void RoutingCompiler_nxosacl::epilog()
|
||||
*/
|
||||
bool RoutingCompiler_nxosacl::ExpandMultipleAddressesExceptInterface::processNext()
|
||||
{
|
||||
RoutingRule *rule=getNext(); if (rule==NULL) return false;
|
||||
RoutingRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
RuleElementRDst *dst = rule->getRDst(); assert(dst);
|
||||
@ -74,7 +74,7 @@ bool RoutingCompiler_nxosacl::ExpandMultipleAddressesExceptInterface::processNex
|
||||
RuleElementRGtw *gtwrel = rule->getRGtw(); assert(gtwrel);
|
||||
Address *gtw = Address::cast(
|
||||
FWReference::cast(gtwrel->front())->getPointer());
|
||||
if (gtw == NULL)
|
||||
if (gtw == nullptr)
|
||||
compiler->abort(rule, "Broken GTW");
|
||||
if (Interface::isA(gtw) && gtw->isChildOf(compiler->fw)) return true;
|
||||
compiler->_expand_addr(rule, gtwrel, false);
|
||||
@ -84,7 +84,7 @@ bool RoutingCompiler_nxosacl::ExpandMultipleAddressesExceptInterface::processNex
|
||||
|
||||
bool RoutingCompiler_nxosacl::checkRItfAndGw::processNext()
|
||||
{
|
||||
RoutingRule *rule=getNext(); if (rule==NULL) return false;
|
||||
RoutingRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
RuleElementRItf *itfrel = rule->getRItf(); assert(itfrel);
|
||||
|
||||
@ -56,7 +56,7 @@ RoutingCompiler_nxosacl::PrintRule::PrintRule(const std::string &name) :
|
||||
|
||||
bool RoutingCompiler_nxosacl::PrintRule::processNext()
|
||||
{
|
||||
RoutingRule *rule = getNext(); if (rule == NULL) return false;
|
||||
RoutingRule *rule = getNext(); if (rule == nullptr) return false;
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
string rl = rule->getLabel();
|
||||
@ -132,7 +132,7 @@ string RoutingCompiler_nxosacl::PrintRule::_printRItf(RoutingRule *rule)
|
||||
{
|
||||
Interface *itf =
|
||||
Interface::cast(FWObjectReference::getObject(itfrel->front()));
|
||||
if (itf != NULL) return itf->getName() + " ";
|
||||
if (itf != nullptr) return itf->getName() + " ";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
@ -144,7 +144,7 @@ string RoutingCompiler_nxosacl::PrintRule::RoutingRuleToString(RoutingRule *rule
|
||||
RuleElementRDst *dstrel = rule->getRDst();
|
||||
ref = dstrel->front();
|
||||
Address *dst = Address::cast(FWReference::cast(ref)->getPointer());
|
||||
if(dst == NULL) compiler->abort(rule, "Broken DST");
|
||||
if(dst == nullptr) compiler->abort(rule, "Broken DST");
|
||||
|
||||
std::ostringstream command_line;
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ void RoutingCompiler_pix::epilog()
|
||||
|
||||
bool RoutingCompiler_pix::emptyRDstOrRItf::processNext()
|
||||
{
|
||||
RoutingRule *rule=getNext(); if (rule==NULL) return false;
|
||||
RoutingRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
RuleElementRGtw *gtwrel = rule->getRGtw();
|
||||
|
||||
@ -47,7 +47,7 @@ RoutingCompiler_pix::PrintRule::PrintRule(const std::string &name) :
|
||||
bool RoutingCompiler_pix::PrintRule::processNext()
|
||||
{
|
||||
RoutingRule *rule = getNext();
|
||||
if (rule == NULL) return false;
|
||||
if (rule == nullptr) return false;
|
||||
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
@ -106,7 +106,7 @@ string RoutingCompiler_pix::PrintRule::RoutingRuleToString(RoutingRule *rule)
|
||||
RuleElementRDst *dstrel = rule->getRDst();
|
||||
ref = dstrel->front();
|
||||
Address *dst = Address::cast(FWReference::cast(ref)->getPointer());
|
||||
if(dst == NULL) compiler->abort(rule, "Broken DST");
|
||||
if(dst == nullptr) compiler->abort(rule, "Broken DST");
|
||||
|
||||
std::ostringstream command_line;
|
||||
|
||||
|
||||
@ -38,10 +38,10 @@ globalNATPool::globalNATPool(int id,Interface *ifs,Address *a)
|
||||
nat_id=id;
|
||||
iface=ifs;
|
||||
addr= a;
|
||||
if (Interface::cast(a)!=NULL || iface->isDyn()) {
|
||||
if (Interface::cast(a)!=nullptr || iface->isDyn()) {
|
||||
type=INTERFACE;
|
||||
} else {
|
||||
type= (AddressRange::cast(a)!=NULL)?ADDRESS_RANGE:SINGLE_ADDRESS;
|
||||
type= (AddressRange::cast(a)!=nullptr)?ADDRESS_RANGE:SINGLE_ADDRESS;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -31,21 +31,21 @@ using namespace std;
|
||||
bool InspectionClassMap::isDefault()
|
||||
{
|
||||
InspectionProtocol *ip = InspectionProtocol::protocols[fixup_name];
|
||||
if (ip!=NULL) return (ip->par1==port1 && ip->par2==port2);
|
||||
if (ip!=nullptr) return (ip->par1==port1 && ip->par2==port2);
|
||||
return false;
|
||||
}
|
||||
|
||||
string InspectionClassMap::getIPProtocol()
|
||||
{
|
||||
InspectionProtocol *ip = InspectionProtocol::protocols[fixup_name];
|
||||
if (ip!=NULL) return ip->ip_proto;
|
||||
if (ip!=nullptr) return ip->ip_proto;
|
||||
return "";
|
||||
}
|
||||
|
||||
string InspectionClassMap::getPrintableName()
|
||||
{
|
||||
InspectionProtocol *ip = InspectionProtocol::protocols[fixup_name];
|
||||
if (ip!=NULL) return ip->printable_name;
|
||||
if (ip!=nullptr) return ip->printable_name;
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ using namespace std;
|
||||
bool SpecialServices::processNext()
|
||||
{
|
||||
PolicyCompiler_pix *pix_comp = dynamic_cast<PolicyCompiler_pix*>(compiler);
|
||||
Rule *rule = prev_processor->getNextRule(); if (rule==NULL) return false;
|
||||
Rule *rule = prev_processor->getNextRule(); if (rule==nullptr) return false;
|
||||
RuleElement *re = RuleElement::cast(rule->getFirstByType(re_type));
|
||||
|
||||
if (re->size() == 0)
|
||||
@ -53,7 +53,7 @@ bool SpecialServices::processNext()
|
||||
|
||||
string version = compiler->fw->getStr("version");
|
||||
|
||||
if (IPService::cast(s)!=NULL)
|
||||
if (IPService::cast(s)!=nullptr)
|
||||
{
|
||||
if (s->getBool("short_fragm") ||
|
||||
s->getBool("fragm") )
|
||||
@ -72,7 +72,7 @@ bool SpecialServices::processNext()
|
||||
}
|
||||
}
|
||||
|
||||
if (TCPService::cast(s)!=NULL)
|
||||
if (TCPService::cast(s)!=nullptr)
|
||||
{
|
||||
if (s->getBool("ack_flag") ||
|
||||
s->getBool("fin_flag") ||
|
||||
@ -86,7 +86,7 @@ bool SpecialServices::processNext()
|
||||
}
|
||||
}
|
||||
|
||||
if (CustomService::cast(s)!=NULL && pix_comp==NULL)
|
||||
if (CustomService::cast(s)!=nullptr && pix_comp==nullptr)
|
||||
{
|
||||
compiler->abort(
|
||||
rule,
|
||||
|
||||
@ -49,7 +49,7 @@ void splitByNetworkZonesForRE::AddToInterface(
|
||||
RuleElement *new_re;
|
||||
|
||||
new_rule = rules[interface_id];
|
||||
if (new_rule==NULL)
|
||||
if (new_rule==nullptr)
|
||||
{
|
||||
new_rule = Rule::cast(compiler->dbcopy->create(rule->getTypeName()));
|
||||
compiler->temp_ruleset->add(new_rule);
|
||||
@ -66,7 +66,7 @@ void splitByNetworkZonesForRE::AddToInterface(
|
||||
bool splitByNetworkZonesForRE::processNext()
|
||||
{
|
||||
Helper helper(compiler);
|
||||
Rule *rule = prev_processor->getNextRule(); if (rule==NULL) return false;
|
||||
Rule *rule = prev_processor->getNextRule(); if (rule==nullptr) return false;
|
||||
RuleElement *re = RuleElement::cast(rule->getFirstByType(re_type));
|
||||
|
||||
if (re->size()==1)
|
||||
@ -81,7 +81,7 @@ bool splitByNetworkZonesForRE::processNext()
|
||||
for (list<FWObject*>::iterator i1=re->begin(); i1!=re->end(); ++i1)
|
||||
{
|
||||
Address *a = Address::cast(FWReference::getObject(*i1));
|
||||
assert(a!=NULL);
|
||||
assert(a!=nullptr);
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@ -50,10 +50,10 @@ void init_win()
|
||||
*/
|
||||
#if defined(Q_OS_WIN32) || defined(Q_OS_MACX)
|
||||
|
||||
// if (QCoreApplication::instance()==NULL)
|
||||
// if (QCoreApplication::instance()==nullptr)
|
||||
// {
|
||||
// int ac = 0;
|
||||
// char **av = { NULL };
|
||||
// char **av = { nullptr };
|
||||
// new QApplication( ac, av );
|
||||
// }
|
||||
QDir dir(QCoreApplication::applicationDirPath());
|
||||
@ -106,7 +106,7 @@ void init_win()
|
||||
#elif defined(Q_OS_MACX)
|
||||
|
||||
char *lname = getenv("LOGNAME");
|
||||
if (lname!=NULL)
|
||||
if (lname!=nullptr)
|
||||
user_name = QString(lname);
|
||||
else
|
||||
{
|
||||
|
||||
@ -44,7 +44,7 @@ AutomaticRules::AutomaticRules(Firewall *fw, Library *persistent_objects)
|
||||
{
|
||||
this->fw = fw;
|
||||
this->persistent_objects = persistent_objects;
|
||||
ruleset = NULL;
|
||||
ruleset = nullptr;
|
||||
|
||||
list<FWObject*> all_policies = fw->getByType(Policy::TYPENAME);
|
||||
for (FWObject::iterator it=all_policies.begin(); it!=all_policies.end(); ++it)
|
||||
@ -74,7 +74,7 @@ PolicyRule* AutomaticRules::addMgmtRule(
|
||||
{
|
||||
(void) related; // Unused
|
||||
|
||||
if (ruleset == NULL) return NULL;
|
||||
if (ruleset == nullptr) return nullptr;
|
||||
|
||||
/* Insert PolicyRules at top so they do not get shadowed by other
|
||||
* rules. Call insertRuleAtTop() with hidden_rule argument true to
|
||||
@ -84,34 +84,34 @@ PolicyRule* AutomaticRules::addMgmtRule(
|
||||
*/
|
||||
|
||||
PolicyRule* rule = PolicyRule::cast(ruleset->insertRuleAtTop(true));
|
||||
assert(rule != NULL);
|
||||
assert(rule != nullptr);
|
||||
|
||||
ostringstream str;
|
||||
str << rule->getPosition() << " " << label << " (automatic)" ;
|
||||
rule->setLabel(str.str());
|
||||
|
||||
FWObject *re;
|
||||
re = rule->getSrc(); assert(re!=NULL);
|
||||
re = rule->getSrc(); assert(re!=nullptr);
|
||||
RuleElementSrc::cast(re)->reset();
|
||||
if(src != NULL)
|
||||
if(src != nullptr)
|
||||
re->addRef(src);
|
||||
|
||||
re = rule->getDst(); assert(re!=NULL);
|
||||
re = rule->getDst(); assert(re!=nullptr);
|
||||
RuleElementDst::cast(re)->reset();
|
||||
if(dst != NULL)
|
||||
if(dst != nullptr)
|
||||
re->addRef(dst);
|
||||
|
||||
re = rule->getSrv(); assert(re!=NULL);
|
||||
re = rule->getSrv(); assert(re!=nullptr);
|
||||
RuleElementSrv::cast(re)->reset();
|
||||
if(service != NULL)
|
||||
if(service != nullptr)
|
||||
re->addRef(service);
|
||||
|
||||
re = rule->getWhen(); assert(re!=NULL);
|
||||
re = rule->getWhen(); assert(re!=nullptr);
|
||||
RuleElementInterval::cast(re)->reset();
|
||||
|
||||
re = rule->getItf(); assert(re!=NULL);
|
||||
re = rule->getItf(); assert(re!=nullptr);
|
||||
RuleElementItf::cast(re)->reset();
|
||||
if(iface != NULL)
|
||||
if(iface != nullptr)
|
||||
{
|
||||
re->addRef(iface);
|
||||
// rule->setInterfaceId(iface->getId());
|
||||
|
||||
@ -115,7 +115,7 @@ CompilerDriver::CompilerDriver(FWObjectDatabase *db) : BaseCompiler()
|
||||
|
||||
CompilerDriver::~CompilerDriver()
|
||||
{
|
||||
if (persistent_objects->getParent() == NULL)
|
||||
if (persistent_objects->getParent() == nullptr)
|
||||
delete persistent_objects;
|
||||
else
|
||||
{
|
||||
@ -126,7 +126,7 @@ CompilerDriver::~CompilerDriver()
|
||||
}
|
||||
}
|
||||
|
||||
if (workspace->getParent() == NULL)
|
||||
if (workspace->getParent() == nullptr)
|
||||
delete workspace;
|
||||
else
|
||||
{
|
||||
@ -364,7 +364,7 @@ void CompilerDriver::commonChecks(Firewall *fw)
|
||||
if (output_file_names.count(ofname) > 0)
|
||||
{
|
||||
QString err("Member firewalls use the same output file name %1");
|
||||
error(cluster, NULL, NULL, err.arg(ofname.c_str()).toStdString());
|
||||
error(cluster, nullptr, nullptr, err.arg(ofname.c_str()).toStdString());
|
||||
}
|
||||
output_file_names.insert(ofname);
|
||||
}
|
||||
@ -427,7 +427,7 @@ void CompilerDriver::commonChecks2(Cluster *cluster, Firewall *fw)
|
||||
}
|
||||
}
|
||||
if ( ! have_top )
|
||||
warning(fw, NULL, NULL,"Missing top level NAT ruleset");
|
||||
warning(fw, nullptr, nullptr,"Missing top level NAT ruleset");
|
||||
|
||||
have_top = false;
|
||||
for (list<FWObject*>::iterator p=all_policies.begin(); p!=all_policies.end(); ++p)
|
||||
@ -439,7 +439,7 @@ void CompilerDriver::commonChecks2(Cluster *cluster, Firewall *fw)
|
||||
}
|
||||
}
|
||||
if ( ! have_top )
|
||||
warning(fw, NULL, NULL,"Missing top level Policy ruleset");
|
||||
warning(fw, nullptr, nullptr,"Missing top level Policy ruleset");
|
||||
|
||||
|
||||
list<FWObject*> interfaces = fw->getByTypeDeep(Interface::TYPENAME);
|
||||
@ -459,7 +459,7 @@ void CompilerDriver::commonChecks2(Cluster *cluster, Firewall *fw)
|
||||
{
|
||||
QString err("'*' must be the last character in "
|
||||
"the wildcard's interface name: '%1'.");
|
||||
abort(fw, NULL, NULL,
|
||||
abort(fw, nullptr, nullptr,
|
||||
err.arg(iface->getName().c_str()).toStdString());
|
||||
throw FatalErrorInSingleRuleCompileMode();
|
||||
}
|
||||
@ -480,7 +480,7 @@ void CompilerDriver::commonChecks2(Cluster *cluster, Firewall *fw)
|
||||
QString err("Wildcard interface '%1' should not have "
|
||||
"physcal address object attached to it. "
|
||||
"The physical address object will be ignored.");
|
||||
error(fw, NULL, NULL,
|
||||
error(fw, nullptr, nullptr,
|
||||
err.arg(iface->getName().c_str()).toStdString());
|
||||
for (list<FWObject*>::iterator j=l3.begin(); j!=l3.end(); ++j)
|
||||
iface->remove(*j);
|
||||
@ -501,7 +501,7 @@ void CompilerDriver::commonChecks2(Cluster *cluster, Firewall *fw)
|
||||
{
|
||||
QString err("Dynamic interface %1 has IP address "
|
||||
"that is used in the firewall policy rule.");
|
||||
abort(fw, NULL, NULL,
|
||||
abort(fw, nullptr, nullptr,
|
||||
err.arg(iface->getName().c_str()).toStdString());
|
||||
throw FatalErrorInSingleRuleCompileMode();
|
||||
}
|
||||
@ -509,7 +509,7 @@ void CompilerDriver::commonChecks2(Cluster *cluster, Firewall *fw)
|
||||
QString err("Dynamic interface %1 should not have an "
|
||||
"IP address object attached to it. "
|
||||
"This IP address object will be ignored.");
|
||||
error(fw, NULL, NULL,
|
||||
error(fw, nullptr, nullptr,
|
||||
err.arg(iface->getName().c_str()).toStdString());
|
||||
for (list<FWObject*>::iterator j=l3.begin(); j!=l3.end(); ++j)
|
||||
iface->remove(*j);
|
||||
@ -546,7 +546,7 @@ void CompilerDriver::commonChecks2(Cluster *cluster, Firewall *fw)
|
||||
all_ipv6.empty())
|
||||
{
|
||||
QString err("Missing IP address for interface %1");
|
||||
abort(fw, NULL, NULL,
|
||||
abort(fw, nullptr, nullptr,
|
||||
err.arg(iface->getName().c_str()).toStdString());
|
||||
throw FatalErrorInSingleRuleCompileMode();
|
||||
}
|
||||
@ -560,7 +560,7 @@ void CompilerDriver::commonChecks2(Cluster *cluster, Firewall *fw)
|
||||
if (ip_addr && ip_addr->isAny())
|
||||
{
|
||||
QString err("Interface %1 (id=%2) has IP address %3.");
|
||||
abort(fw, NULL, NULL,
|
||||
abort(fw, nullptr, nullptr,
|
||||
err.arg(iface->getName().c_str())
|
||||
.arg(FWObjectDatabase::getStringId(
|
||||
iface->getId()).c_str())
|
||||
@ -571,7 +571,7 @@ void CompilerDriver::commonChecks2(Cluster *cluster, Firewall *fw)
|
||||
if (ip_addr && netmask && netmask->isAny())
|
||||
{
|
||||
QString err("Interface %1 (id=%2) has invalid netmask %3.");
|
||||
abort(fw, NULL, NULL,
|
||||
abort(fw, nullptr, nullptr,
|
||||
err.arg(iface->getName().c_str())
|
||||
.arg(FWObjectDatabase::getStringId(
|
||||
iface->getId()).c_str())
|
||||
@ -587,7 +587,7 @@ void CompilerDriver::commonChecks2(Cluster *cluster, Firewall *fw)
|
||||
{
|
||||
Resources* os_res = Resources::os_res[fw->getStr("host_OS")];
|
||||
string os_family = fw->getStr("host_OS");
|
||||
if (os_res!=NULL)
|
||||
if (os_res!=nullptr)
|
||||
os_family = os_res->getResourceStr("/FWBuilderResources/Target/family");
|
||||
|
||||
std::unique_ptr<interfaceProperties> int_prop(
|
||||
@ -600,7 +600,7 @@ void CompilerDriver::commonChecks2(Cluster *cluster, Firewall *fw)
|
||||
QString err;
|
||||
if (!int_prop->validateInterface(parent, iface, true, err))
|
||||
{
|
||||
abort(fw, NULL, NULL, err.toStdString());
|
||||
abort(fw, nullptr, nullptr, err.toStdString());
|
||||
throw FatalErrorInSingleRuleCompileMode();
|
||||
}
|
||||
#endif
|
||||
@ -639,7 +639,7 @@ void CompilerDriver::commonChecks2(Cluster *cluster, Firewall *fw)
|
||||
"is only allowed if this object is a copy of another "
|
||||
"top-level interface with the same name"
|
||||
);
|
||||
abort(fw, NULL, NULL,
|
||||
abort(fw, nullptr, nullptr,
|
||||
err.arg(iface->getName().c_str()).toStdString());
|
||||
throw FatalErrorInSingleRuleCompileMode();
|
||||
}
|
||||
@ -695,15 +695,15 @@ void CompilerDriver::findImportedRuleSets(Firewall *fw,
|
||||
for (list<FWObject*>::iterator i=all_policies.begin(); i!=all_policies.end(); ++i)
|
||||
{
|
||||
RuleSet *ruleset = RuleSet::cast(*i);
|
||||
if (ruleset == NULL) continue; // should not happen
|
||||
if (ruleset == nullptr) continue; // should not happen
|
||||
|
||||
for (list<FWObject*>::iterator r=ruleset->begin(); r!=ruleset->end(); ++r)
|
||||
{
|
||||
Rule *rule = Rule::cast(*r);
|
||||
if (rule == NULL) continue; // skip RuleSetOptions object
|
||||
if (rule == nullptr) continue; // skip RuleSetOptions object
|
||||
|
||||
RuleSet *branch_ruleset = rule->getBranch();
|
||||
if (branch_ruleset!=NULL)
|
||||
if (branch_ruleset!=nullptr)
|
||||
{
|
||||
// qDebug() << "ruleset=" << ruleset->getName().c_str()
|
||||
// << "branch=" << branch_ruleset->getName().c_str();
|
||||
@ -776,10 +776,10 @@ void CompilerDriver::_findImportedRuleSetsRecursively(
|
||||
for (list<FWObject*>::iterator r=branch_ruleset->begin(); r!=branch_ruleset->end(); ++r)
|
||||
{
|
||||
Rule *rule = Rule::cast(*r);
|
||||
if (rule == NULL) continue; // skip RuleSetOptions object
|
||||
if (rule == nullptr) continue; // skip RuleSetOptions object
|
||||
|
||||
RuleSet *next_branch_ruleset = rule->getBranch();
|
||||
if (next_branch_ruleset!=NULL &&
|
||||
if (next_branch_ruleset!=nullptr &&
|
||||
local_branch_ruleset_counters.count(next_branch_ruleset)==0)
|
||||
{
|
||||
local_branch_ruleset_counters[next_branch_ruleset] = 1;
|
||||
@ -804,7 +804,7 @@ void CompilerDriver::validateClusterGroups(Cluster *cluster)
|
||||
{
|
||||
string host_os = cluster->getStr("host_OS");
|
||||
Resources* os_res = Resources::os_res[host_os];
|
||||
if (os_res==NULL) return;
|
||||
if (os_res==nullptr) return;
|
||||
|
||||
// check if state sync groups are of supported type
|
||||
list<string> state_sync_protocols;
|
||||
@ -818,7 +818,7 @@ void CompilerDriver::validateClusterGroups(Cluster *cluster)
|
||||
if (!isSupported(&state_sync_protocols, state_sync_type))
|
||||
{
|
||||
QString err("State sync group type '%1' is not supported");
|
||||
abort(cluster, NULL, NULL, err.arg(state_sync_type.c_str()).toStdString());
|
||||
abort(cluster, nullptr, nullptr, err.arg(state_sync_type.c_str()).toStdString());
|
||||
throw FatalErrorInSingleRuleCompileMode();
|
||||
}
|
||||
}
|
||||
@ -837,7 +837,7 @@ void CompilerDriver::validateClusterGroups(Cluster *cluster)
|
||||
if (!isSupported(&failover_protocols, failover_type))
|
||||
{
|
||||
QString err("Failover group type '%1' is not supported");
|
||||
abort(cluster, NULL, NULL, err.arg(failover_type.c_str()).toStdString());
|
||||
abort(cluster, nullptr, nullptr, err.arg(failover_type.c_str()).toStdString());
|
||||
throw FatalErrorInSingleRuleCompileMode();
|
||||
}
|
||||
|
||||
@ -845,7 +845,7 @@ void CompilerDriver::validateClusterGroups(Cluster *cluster)
|
||||
if (l2.size() == 0)
|
||||
{
|
||||
QString err("Failover group of cluster interface '%1' is empty");
|
||||
abort(cluster, NULL, NULL,
|
||||
abort(cluster, nullptr, nullptr,
|
||||
err.arg(parent->getName().c_str()).toStdString());
|
||||
throw FatalErrorInSingleRuleCompileMode();
|
||||
}
|
||||
@ -948,7 +948,7 @@ void CompilerDriver::mergeRuleSets(Cluster *cluster, Firewall *fw,
|
||||
list<FWObject*>::iterator it = fw_ruleset->begin();
|
||||
for ( ; it!=fw_ruleset->end(); ++it)
|
||||
{
|
||||
if (Rule::cast(*it)!=NULL) rule_cntr++;
|
||||
if (Rule::cast(*it)!=nullptr) rule_cntr++;
|
||||
}
|
||||
|
||||
if (rule_cntr > 0)
|
||||
@ -956,7 +956,7 @@ void CompilerDriver::mergeRuleSets(Cluster *cluster, Firewall *fw,
|
||||
QString err("ignoring cluster rule set \"%1\" "
|
||||
"because member firewall \"%2\" "
|
||||
"has rule set with the same name.");
|
||||
warning(fw, fw_ruleset, NULL,
|
||||
warning(fw, fw_ruleset, nullptr,
|
||||
err.arg(fw_ruleset->getName().c_str())
|
||||
.arg(fw->getName().c_str()).toStdString());
|
||||
} else
|
||||
@ -985,7 +985,7 @@ void CompilerDriver::mergeRuleSets(Cluster *cluster, Firewall *fw,
|
||||
*/
|
||||
void CompilerDriver::populateClusterElements(Cluster *cluster, Firewall *fw)
|
||||
{
|
||||
if (cluster==NULL) return;
|
||||
if (cluster==nullptr) return;
|
||||
|
||||
#ifdef DEBUG_CLUSTER_INTERFACES
|
||||
cerr << "CompilerDriver::populateClusterElements " << endl;
|
||||
@ -1057,9 +1057,9 @@ void CompilerDriver::populateClusterElements(Cluster *cluster, Firewall *fw)
|
||||
{
|
||||
Interface *member_iface =
|
||||
failover_group->getInterfaceForMemberFirewall(fw);
|
||||
if (member_iface == NULL) continue;
|
||||
if (member_iface == nullptr) continue;
|
||||
|
||||
assert(fw->getOptionsObject() != NULL);
|
||||
assert(fw->getOptionsObject() != nullptr);
|
||||
|
||||
member_iface->getOptionsObject()->setStr(
|
||||
"failover_group_id",
|
||||
@ -1086,7 +1086,7 @@ void CompilerDriver::populateClusterElements(Cluster *cluster, Firewall *fw)
|
||||
* belongs to the firewall and is therefore valid.
|
||||
*/
|
||||
Interface* new_cl_if = Interface::cast(fw->addCopyOf(cluster_interface, true));
|
||||
assert(new_cl_if != NULL);
|
||||
assert(new_cl_if != nullptr);
|
||||
new_cl_if->getOptionsObject()->setBool("cluster_interface", true);
|
||||
}
|
||||
}
|
||||
@ -1127,7 +1127,7 @@ void CompilerDriver::copyFailoverInterface(Cluster * /*UNUSED cluster */,
|
||||
Interface *iface)
|
||||
{
|
||||
Interface* cluster_if = Interface::cast(cluster_group->getParent());
|
||||
assert(cluster_if != NULL);
|
||||
assert(cluster_if != nullptr);
|
||||
|
||||
/* Add copy of the cluster interface to the firewall object
|
||||
*
|
||||
@ -1139,7 +1139,7 @@ void CompilerDriver::copyFailoverInterface(Cluster * /*UNUSED cluster */,
|
||||
* rejected.
|
||||
*/
|
||||
Interface* new_cl_if = Interface::cast(fw->addCopyOf(cluster_if, true));
|
||||
assert(new_cl_if != NULL);
|
||||
assert(new_cl_if != nullptr);
|
||||
new_cl_if->getOptionsObject()->setBool("cluster_interface", true);
|
||||
new_cl_if->getOptionsObject()->setStr("base_device", iface->getName());
|
||||
new_cl_if->getOptionsObject()->setStr(
|
||||
@ -1206,12 +1206,12 @@ void CompilerDriver::processStateSyncGroups(Cluster *cluster, Firewall *member_f
|
||||
*/
|
||||
int CompilerDriver::checkCluster(Cluster* cluster)
|
||||
{
|
||||
assert(cluster != NULL);
|
||||
assert(cluster != nullptr);
|
||||
FWObjectTypedChildIterator cluster_ifaces = cluster->findByType(Interface::TYPENAME);
|
||||
if (cluster_ifaces == cluster_ifaces.end())
|
||||
{
|
||||
/* No configured cluster interface found */
|
||||
abort(cluster, NULL, NULL, "The cluster has no interfaces.");
|
||||
abort(cluster, nullptr, nullptr, "The cluster has no interfaces.");
|
||||
throw FatalErrorInSingleRuleCompileMode();
|
||||
}
|
||||
|
||||
@ -1219,22 +1219,22 @@ int CompilerDriver::checkCluster(Cluster* cluster)
|
||||
{
|
||||
string iface_name = Interface::cast(*cluster_ifaces)->getName();
|
||||
const InetAddr* iface_address = Interface::cast(*cluster_ifaces)->getAddressPtr();
|
||||
if (iface_address==NULL) continue; // cluster interface with no address
|
||||
if (iface_address==nullptr) continue; // cluster interface with no address
|
||||
FWObjectTypedChildIterator other_ifaces = cluster_ifaces;
|
||||
for (++other_ifaces; other_ifaces != cluster_ifaces.end(); ++other_ifaces)
|
||||
{
|
||||
if (iface_name == Interface::cast(*other_ifaces)->getName())
|
||||
{
|
||||
QString err("Found duplicate cluster interface %1");
|
||||
abort(cluster, NULL, NULL, err.arg(iface_name.c_str()).toStdString());
|
||||
abort(cluster, nullptr, nullptr, err.arg(iface_name.c_str()).toStdString());
|
||||
throw FatalErrorInSingleRuleCompileMode();
|
||||
}
|
||||
const InetAddr *other_iface_address = Interface::cast(*other_ifaces)->getAddressPtr();
|
||||
if (other_iface_address==NULL) continue; // cluster interface with no address
|
||||
if (other_iface_address==nullptr) continue; // cluster interface with no address
|
||||
if (*iface_address == *other_iface_address)
|
||||
{
|
||||
QString err("Found duplicate cluster interface address %1");
|
||||
abort(cluster, NULL, NULL, err.arg(iface_address->toString().c_str()).toStdString());
|
||||
abort(cluster, nullptr, nullptr, err.arg(iface_address->toString().c_str()).toStdString());
|
||||
throw FatalErrorInSingleRuleCompileMode();
|
||||
}
|
||||
}
|
||||
@ -1293,7 +1293,7 @@ void CompilerDriver::getFirewallAndClusterObjects(const string &cluster_id,
|
||||
workspace->add(*fw);
|
||||
(*fw)->duplicate(orig_fw);
|
||||
|
||||
if (*cl != NULL)
|
||||
if (*cl != nullptr)
|
||||
{
|
||||
const map<int, int> &id_map = (*fw)->getIDMappingTable();
|
||||
map<int, int>::const_iterator it;
|
||||
|
||||
@ -58,7 +58,7 @@ bool CompilerDriver::prepare(const QStringList &_args)
|
||||
if (!single_rule_compile_on)
|
||||
{
|
||||
Firewall *fw = locateObject();
|
||||
if (fw == NULL)
|
||||
if (fw == nullptr)
|
||||
{
|
||||
cerr << "Firewall or cluster object not found" << endl;
|
||||
return false;
|
||||
@ -127,16 +127,16 @@ void CompilerDriver::compile()
|
||||
*/
|
||||
QMap<QString,QString> CompilerDriver::compileSingleRule(const string &rule_id)
|
||||
{
|
||||
Cluster *cluster = NULL;
|
||||
Firewall *fw = NULL;
|
||||
Cluster *cluster = nullptr;
|
||||
Firewall *fw = nullptr;
|
||||
|
||||
Rule *rule = Rule::cast(
|
||||
objdb->findInIndex(FWObjectDatabase::getIntId(rule_id)));
|
||||
if (rule==NULL)
|
||||
if (rule==nullptr)
|
||||
throw FWException(string("Rule with ID=") + rule_id + " not found");
|
||||
|
||||
FWObject *p = rule;
|
||||
while (p && Firewall::cast(p)==NULL) p = p->getParent();
|
||||
while (p && Firewall::cast(p)==nullptr) p = p->getParent();
|
||||
|
||||
if (Cluster::isA(p)) cluster = Cluster::cast(p);
|
||||
if (Firewall::isA(p)) fw = Firewall::cast(p);
|
||||
|
||||
@ -186,7 +186,7 @@ void CompilerDriver::determineOutputFileNames(Cluster *cluster,
|
||||
|
||||
}
|
||||
|
||||
if (prepend_cluster_name_to_output_file && cluster_member && cluster!=NULL)
|
||||
if (prepend_cluster_name_to_output_file && cluster_member && cluster!=nullptr)
|
||||
{
|
||||
for (int i=0; i<file_names.size(); ++i)
|
||||
{
|
||||
|
||||
@ -44,7 +44,7 @@ bool freebsdInterfaces::manageIpAddresses(Interface *intf,
|
||||
if (intf->isDyn())
|
||||
{
|
||||
FWObject *p = intf;
|
||||
while (Firewall::cast(p) == NULL) p = p->getParent();
|
||||
while (Firewall::cast(p) == nullptr) p = p->getParent();
|
||||
Firewall *fw = Firewall::cast(p);
|
||||
FWOptions* options = fw->getOptionsObject();
|
||||
return options->getBool("generate_rc_conf_file");
|
||||
|
||||
@ -55,12 +55,12 @@ bool interfaceProperties::parseVlan(const QString&, QString*, int*)
|
||||
|
||||
bool interfaceProperties::looksLikeVlanInterface(InterfaceData *intf)
|
||||
{
|
||||
return parseVlan(intf->name.c_str(), NULL, NULL);
|
||||
return parseVlan(intf->name.c_str(), nullptr, nullptr);
|
||||
}
|
||||
|
||||
bool interfaceProperties::looksLikeVlanInterface(const QString &int_name)
|
||||
{
|
||||
return parseVlan(int_name, NULL, NULL);
|
||||
return parseVlan(int_name, nullptr, nullptr);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -172,7 +172,7 @@ bool interfaceProperties::manageIpAddresses(Interface *intf,
|
||||
FWObject *fw = Host::getParentHost(intf);
|
||||
//FWObject *fw = intf->getParentHost();
|
||||
Resources *os_res = Resources::os_res[fw->getStr("host_OS")];
|
||||
assert(os_res != NULL);
|
||||
assert(os_res != nullptr);
|
||||
|
||||
if (intf->isDyn()) return false;
|
||||
if (intf->isBridgePort()) return false;
|
||||
@ -447,7 +447,7 @@ bool interfaceProperties::isEligibleForCluster(Interface *intf)
|
||||
Interface *iface = Interface::cast(*i);
|
||||
assert(iface);
|
||||
Interface *parent_iface = Interface::cast(iface->getParent());
|
||||
if (parent_iface == NULL)
|
||||
if (parent_iface == nullptr)
|
||||
continue;
|
||||
if (parent_iface->getOptionsObject()->getStr("type") == "bonding" &&
|
||||
iface->getName() == intf->getName())
|
||||
@ -468,7 +468,7 @@ void interfaceProperties::guessSubInterfaceTypeAndAttributes(Interface *intf)
|
||||
{
|
||||
Interface *parent_intf = Interface::cast(intf->getParent());
|
||||
|
||||
if (parent_intf == NULL)
|
||||
if (parent_intf == nullptr)
|
||||
return;
|
||||
|
||||
// Do not modify read-only object
|
||||
@ -479,7 +479,7 @@ void interfaceProperties::guessSubInterfaceTypeAndAttributes(Interface *intf)
|
||||
|
||||
// Resources* os_res = Resources::os_res[f->getStr("host_OS")];
|
||||
// string os_family = f->getStr("host_OS");
|
||||
// if (os_res!=NULL)
|
||||
// if (os_res!=nullptr)
|
||||
// os_family = os_res->getResourceStr("/FWBuilderResources/Target/family");
|
||||
|
||||
QString err;
|
||||
@ -491,7 +491,7 @@ void interfaceProperties::guessSubInterfaceTypeAndAttributes(Interface *intf)
|
||||
InterfaceData *idata = new InterfaceData(*intf);
|
||||
//parseVlan(idata);
|
||||
idata->interface_type = "8021q";
|
||||
parseVlan(idata->name.c_str(), NULL, &(idata->vlan_id));
|
||||
parseVlan(idata->name.c_str(), nullptr, &(idata->vlan_id));
|
||||
if (!idata->interface_type.empty())
|
||||
{
|
||||
intf->getOptionsObject()->setStr("type", idata->interface_type);
|
||||
|
||||
@ -47,7 +47,7 @@ interfaceProperties* interfacePropertiesObjectFactory::getInterfacePropertiesObj
|
||||
{
|
||||
Resources* os_res = Resources::os_res[fw->getStr("host_OS")];
|
||||
string os_family = fw->getStr("host_OS");
|
||||
if (os_res!=NULL)
|
||||
if (os_res!=nullptr)
|
||||
os_family = os_res->getResourceStr("/FWBuilderResources/Target/family");
|
||||
return getInterfacePropertiesObject(os_family);
|
||||
}
|
||||
|
||||
@ -40,8 +40,8 @@ bool iosInterfaces::parseVlan(const QString &name, QString *base_name, int *vlan
|
||||
QRegExp vlan_name_pattern("([a-zA-Z-]+\\d{1,}/\\d{1,})\\.(\\d{1,})");
|
||||
if (vlan_name_pattern.indexIn(name) != -1)
|
||||
{
|
||||
if (base_name!=NULL) *base_name = vlan_name_pattern.cap(1);
|
||||
if (vlan_id!=NULL) *vlan_id = vlan_name_pattern.cap(2).toInt();
|
||||
if (base_name!=nullptr) *base_name = vlan_name_pattern.cap(1);
|
||||
if (vlan_id!=nullptr) *vlan_id = vlan_name_pattern.cap(2).toInt();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@ -40,8 +40,8 @@ bool junosInterfaces::parseVlan(const QString &name, QString *base_name, int *vl
|
||||
QRegExp vlan_name_pattern("unit (\\d{1,})");
|
||||
if (vlan_name_pattern.indexIn(name) != -1)
|
||||
{
|
||||
if (base_name!=NULL) *base_name = QString("unit");
|
||||
if (vlan_id!=NULL) *vlan_id = vlan_name_pattern.cap(1).toInt();
|
||||
if (base_name!=nullptr) *base_name = QString("unit");
|
||||
if (vlan_id!=nullptr) *vlan_id = vlan_name_pattern.cap(1).toInt();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@ -47,8 +47,8 @@ bool linux24Interfaces::parseVlan(const QString &name, QString *base_name, int *
|
||||
{
|
||||
if (vlan_name_patterns[idx].indexIn(name) != -1)
|
||||
{
|
||||
if (base_name!=NULL) *base_name = vlan_name_patterns[idx].cap(1);
|
||||
if (vlan_id!=NULL) *vlan_id = vlan_name_patterns[idx].cap(2).toInt();
|
||||
if (base_name!=nullptr) *base_name = vlan_name_patterns[idx].cap(1);
|
||||
if (vlan_id!=nullptr) *vlan_id = vlan_name_patterns[idx].cap(2).toInt();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -154,9 +154,9 @@ eth4 Link encap:Ethernet HWaddr 00:0C:29:F6:BE:BE
|
||||
list<InterfaceData*> vlan_subinterfaces;
|
||||
list<InterfaceData*> bond_subinterfaces;
|
||||
list<InterfaceData*> bridge_subinterfaces;
|
||||
InterfaceData *vlan_parent_interface = NULL;
|
||||
InterfaceData *bond_parent_interface = NULL;
|
||||
InterfaceData *bridge_parent_interface = NULL;
|
||||
InterfaceData *vlan_parent_interface = nullptr;
|
||||
InterfaceData *bond_parent_interface = nullptr;
|
||||
InterfaceData *bridge_parent_interface = nullptr;
|
||||
list<InterfaceData*>::iterator intf;
|
||||
|
||||
bool bonding = false;
|
||||
@ -221,7 +221,7 @@ eth4 Link encap:Ethernet HWaddr 00:0C:29:F6:BE:BE
|
||||
case VLAN_INTERFACE:
|
||||
{
|
||||
(*intf)->interface_type = "8021q";
|
||||
parseVlan((*intf)->name.c_str(), NULL, &((*intf)->vlan_id));
|
||||
parseVlan((*intf)->name.c_str(), nullptr, &((*intf)->vlan_id));
|
||||
//parseVlan(*intf);
|
||||
bond_subinterfaces.push_back(*intf);
|
||||
continue;
|
||||
@ -258,7 +258,7 @@ eth4 Link encap:Ethernet HWaddr 00:0C:29:F6:BE:BE
|
||||
case VLAN_INTERFACE:
|
||||
{
|
||||
(*intf)->interface_type = "8021q";
|
||||
parseVlan((*intf)->name.c_str(), NULL, &((*intf)->vlan_id));
|
||||
parseVlan((*intf)->name.c_str(), nullptr, &((*intf)->vlan_id));
|
||||
//parseVlan(*intf);
|
||||
bridge_subinterfaces.push_back(*intf);
|
||||
// special case: vlan interface can be part of
|
||||
@ -287,7 +287,7 @@ eth4 Link encap:Ethernet HWaddr 00:0C:29:F6:BE:BE
|
||||
case VLAN_INTERFACE:
|
||||
{
|
||||
(*intf)->interface_type = "8021q";
|
||||
parseVlan((*intf)->name.c_str(), NULL, &((*intf)->vlan_id));
|
||||
parseVlan((*intf)->name.c_str(), nullptr, &((*intf)->vlan_id));
|
||||
//parseVlan(*intf);
|
||||
vlan_subinterfaces.push_back(*intf);
|
||||
continue;
|
||||
|
||||
@ -40,8 +40,8 @@ bool nxosInterfaces::parseVlan(const QString &name, QString *base_name, int *vla
|
||||
QRegExp vlan_name_pattern("([a-zA-Z-]+\\d{1,}/\\d{1,})\\.(\\d{1,})");
|
||||
if (vlan_name_pattern.indexIn(name) != -1)
|
||||
{
|
||||
if (base_name!=NULL) *base_name = vlan_name_pattern.cap(1);
|
||||
if (vlan_id!=NULL) *vlan_id = vlan_name_pattern.cap(2).toInt();
|
||||
if (base_name!=nullptr) *base_name = vlan_name_pattern.cap(1);
|
||||
if (vlan_id!=nullptr) *vlan_id = vlan_name_pattern.cap(2).toInt();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@ -35,8 +35,8 @@ bool openbsdInterfaces::parseVlan(const QString &name, QString *base_name, int *
|
||||
QRegExp vlan_name_pattern(QRegExp("(vlan)(\\d{1,})"));
|
||||
if (vlan_name_pattern.indexIn(name) != -1)
|
||||
{
|
||||
if (base_name!=NULL) *base_name = vlan_name_pattern.cap(1);
|
||||
if (vlan_id!=NULL) *vlan_id = vlan_name_pattern.cap(2).toInt();
|
||||
if (base_name!=nullptr) *base_name = vlan_name_pattern.cap(1);
|
||||
if (vlan_id!=nullptr) *vlan_id = vlan_name_pattern.cap(2).toInt();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@ -44,8 +44,8 @@ bool pixInterfaces::parseVlan(const QString &name, QString *base_name, int *vlan
|
||||
QRegExp vlan_name_pattern("([a-zA-Z-]+\\d{1,}(/\\d{1,})*)\\.(\\d{1,})");
|
||||
if (vlan_name_pattern.indexIn(name) != -1)
|
||||
{
|
||||
if (base_name!=NULL) *base_name = vlan_name_pattern.cap(1);
|
||||
if (vlan_id!=NULL) *vlan_id = vlan_name_pattern.cap(3).toInt();
|
||||
if (base_name!=nullptr) *base_name = vlan_name_pattern.cap(1);
|
||||
if (vlan_id!=nullptr) *vlan_id = vlan_name_pattern.cap(3).toInt();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@ -60,8 +60,8 @@ bool procurveInterfaces::parseVlan(
|
||||
{
|
||||
if (name == "DEFAULT_VLAN")
|
||||
{
|
||||
if (base_name!=NULL) *base_name = "vlan";
|
||||
if (vlan_id!=NULL) *vlan_id = 1;
|
||||
if (base_name!=nullptr) *base_name = "vlan";
|
||||
if (vlan_id!=nullptr) *vlan_id = 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -69,8 +69,8 @@ bool procurveInterfaces::parseVlan(
|
||||
QRegExp vlan_name_pattern("(vlan|Vlan|VLAN) *(\\d{1,})");
|
||||
if (vlan_name_pattern.indexIn(name) != -1)
|
||||
{
|
||||
if (base_name!=NULL) *base_name = vlan_name_pattern.cap(1);
|
||||
if (vlan_id!=NULL) *vlan_id = vlan_name_pattern.cap(2).toInt();
|
||||
if (base_name!=nullptr) *base_name = vlan_name_pattern.cap(1);
|
||||
if (vlan_id!=nullptr) *vlan_id = vlan_name_pattern.cap(2).toInt();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@ -80,9 +80,9 @@ using namespace std;
|
||||
static QString filename;
|
||||
static QString print_output_file_name;
|
||||
bool auto_load_from_rcs_head_revision = false;
|
||||
FWBApplication *app = NULL;
|
||||
FWWindow *mw = NULL;
|
||||
FWBSettings *st = NULL;
|
||||
FWBApplication *app = nullptr;
|
||||
FWWindow *mw = nullptr;
|
||||
FWBSettings *st = nullptr;
|
||||
int fwbdebug = 0;
|
||||
bool safemode = false;
|
||||
bool cli_print = false;
|
||||
|
||||
@ -669,7 +669,7 @@ NATRule* IPTImporter::createNATBranch(
|
||||
|
||||
void IPTImporter::pushRule()
|
||||
{
|
||||
// assert(current_ruleset!=NULL);
|
||||
// assert(current_ruleset!=nullptr);
|
||||
if (current_rule==nullptr) return;
|
||||
|
||||
if (current_table=="nat") pushNATRule();
|
||||
@ -1104,12 +1104,12 @@ void IPTImporter::pushPolicyRule()
|
||||
// {
|
||||
// ruleset = RuleSet::cast(
|
||||
// getFirewallObject()->getFirstByType(Policy::TYPENAME));
|
||||
// assert(ruleset!=NULL);
|
||||
// assert(ruleset!=nullptr);
|
||||
// } else
|
||||
// {
|
||||
// UnidirectionalRuleSet *rs = getUnidirRuleSet(
|
||||
// current_chain, Policy::TYPENAME);
|
||||
// assert(rs!=NULL);
|
||||
// assert(rs!=nullptr);
|
||||
// ruleset = rs->ruleset;
|
||||
// }
|
||||
|
||||
@ -1502,7 +1502,7 @@ void IPTImporter::pushNATRule()
|
||||
|
||||
// RuleSet *nat = RuleSet::cast(
|
||||
// getFirewallObject()->getFirstByType(NAT::TYPENAME));
|
||||
// assert( nat!=NULL );
|
||||
// assert( nat!=nullptr );
|
||||
// nat->add(current_rule);
|
||||
|
||||
current_rule = nullptr;
|
||||
|
||||
@ -123,14 +123,14 @@ Importer::Importer(FWObject *_lib,
|
||||
{
|
||||
this->fwname = fwname;
|
||||
library = _lib;
|
||||
fw = NULL;
|
||||
fw = nullptr;
|
||||
error_counter = 0;
|
||||
logger = log;
|
||||
platform = _platform;
|
||||
|
||||
current_interface = NULL;
|
||||
current_ruleset = NULL;
|
||||
current_rule = NULL;
|
||||
current_interface = nullptr;
|
||||
current_ruleset = nullptr;
|
||||
current_rule = nullptr;
|
||||
|
||||
error_tracker = new ObjectMakerErrorTracker();
|
||||
|
||||
@ -212,7 +212,7 @@ void Importer::clear()
|
||||
|
||||
Firewall* Importer::getFirewallObject()
|
||||
{
|
||||
if (fw!=NULL) return fw;
|
||||
if (fw!=nullptr) return fw;
|
||||
|
||||
ObjectMaker maker(Library::cast(library), error_tracker);
|
||||
FWObject *nobj = commitObject(
|
||||
@ -275,7 +275,7 @@ void Importer::ignoreCurrentInterface()
|
||||
string name = current_interface->getName();
|
||||
current_interface->getParent()->remove(current_interface);
|
||||
all_interfaces.erase(name);
|
||||
current_interface = NULL;
|
||||
current_interface = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -299,7 +299,7 @@ void Importer::addAddressObjectToInterface(Interface*intf,
|
||||
void Importer::addInterfaceAddress(const std::string &a,
|
||||
const std::string &nm)
|
||||
{
|
||||
if (current_interface!=NULL)
|
||||
if (current_interface!=nullptr)
|
||||
{
|
||||
addAddressObjectToInterface(current_interface, a, nm);
|
||||
addMessageToLog("Interface address: " + a + "/" + nm);
|
||||
@ -324,12 +324,12 @@ void Importer::addInterfaceAddress(const std::string &label,
|
||||
|
||||
void Importer::setInterfaceComment(const std::string &descr)
|
||||
{
|
||||
// current_interface can be NULL if parser encountered command
|
||||
// current_interface can be nullptr if parser encountered command
|
||||
// that looked like interface description but in reality was
|
||||
// description of something else. For example this happens when
|
||||
// it finds command "description" under "controller" in Cisco router
|
||||
// configuration.
|
||||
if (current_interface!=NULL)
|
||||
if (current_interface!=nullptr)
|
||||
{
|
||||
current_interface->setComment(descr);
|
||||
addMessageToLog("Interface comment: " + descr);
|
||||
@ -338,7 +338,7 @@ void Importer::setInterfaceComment(const std::string &descr)
|
||||
|
||||
void Importer::setInterfaceLabel(const std::string &descr)
|
||||
{
|
||||
if (current_interface!=NULL)
|
||||
if (current_interface!=nullptr)
|
||||
{
|
||||
current_interface->setLabel(descr);
|
||||
addMessageToLog("Interface label: " + descr);
|
||||
@ -377,7 +377,7 @@ void Importer::setInterfaceParametes(const std::string &phys_intf_or_label,
|
||||
|
||||
void Importer::setInterfaceSecurityLevel(const std::string &seclevel)
|
||||
{
|
||||
if (current_interface!=NULL)
|
||||
if (current_interface!=nullptr)
|
||||
{
|
||||
QString sl(seclevel.c_str());
|
||||
current_interface->setSecurityLevel(sl.toInt());
|
||||
@ -386,7 +386,7 @@ void Importer::setInterfaceSecurityLevel(const std::string &seclevel)
|
||||
|
||||
void Importer::setInterfaceVlanId(const std::string &vlan_id)
|
||||
{
|
||||
if (current_interface!=NULL)
|
||||
if (current_interface!=nullptr)
|
||||
{
|
||||
FWOptions *ifopt = (Interface::cast(current_interface))->getOptionsObject();
|
||||
ifopt->setStr("type", "8021q");
|
||||
@ -410,7 +410,7 @@ UnidirectionalRuleSet* Importer::getUnidirRuleSet(
|
||||
const std::string &ruleset_name, const string &ruleset_type_name)
|
||||
{
|
||||
UnidirectionalRuleSet *rs = all_rulesets[ruleset_name];
|
||||
if (rs==NULL)
|
||||
if (rs==nullptr)
|
||||
{
|
||||
// got 'ip access-group' command before the access list was defined
|
||||
rs = new UnidirectionalRuleSet();
|
||||
@ -458,7 +458,7 @@ void Importer::setInterfaceAndDirectionForRuleSet(const std::string &ruleset_nam
|
||||
const std::string &intf_name,
|
||||
const std::string &dir)
|
||||
{
|
||||
Interface *intf = NULL;
|
||||
Interface *intf = nullptr;
|
||||
if ( ! intf_name.empty())
|
||||
{
|
||||
intf = all_interfaces[intf_name];
|
||||
@ -467,9 +467,9 @@ void Importer::setInterfaceAndDirectionForRuleSet(const std::string &ruleset_nam
|
||||
if (current_interface) intf = current_interface;
|
||||
}
|
||||
|
||||
if (intf == NULL)
|
||||
if (intf == nullptr)
|
||||
{
|
||||
// current_interface is NULL and _intf_name is empty. Not enough
|
||||
// current_interface is nullptr and _intf_name is empty. Not enough
|
||||
// information to associate ruleset with an interface.
|
||||
QString err("Can not associate rule set %1 with any interface\n");
|
||||
addMessageToLog(err.arg(QString::fromUtf8(ruleset_name.c_str())));
|
||||
@ -513,7 +513,7 @@ void Importer::newPolicyRule()
|
||||
|
||||
// check if all child objects were populated properly
|
||||
FWOptions *ropt = current_rule->getOptionsObject();
|
||||
assert(ropt!=NULL);
|
||||
assert(ropt!=nullptr);
|
||||
ropt->setBool("stateless", true);
|
||||
}
|
||||
|
||||
@ -530,14 +530,14 @@ void Importer::newNATRule()
|
||||
|
||||
void Importer::pushRule()
|
||||
{
|
||||
assert(current_ruleset!=NULL);
|
||||
assert(current_rule!=NULL);
|
||||
assert(current_ruleset!=nullptr);
|
||||
assert(current_rule!=nullptr);
|
||||
// populate all elements of the rule
|
||||
|
||||
PolicyRule *rule = PolicyRule::cast(current_rule);
|
||||
|
||||
FWOptions *ropt = current_rule->getOptionsObject();
|
||||
assert(ropt!=NULL);
|
||||
assert(ropt!=nullptr);
|
||||
|
||||
if (action=="permit")
|
||||
{
|
||||
@ -588,7 +588,7 @@ void Importer::pushRule()
|
||||
addStandardImportComment(
|
||||
current_rule, QString::fromUtf8(rule_comment.c_str()));
|
||||
|
||||
current_rule = NULL;
|
||||
current_rule = nullptr;
|
||||
rule_comment = "";
|
||||
|
||||
clear();
|
||||
@ -614,7 +614,7 @@ FWObject* Importer::makeAddressObj(const std::string addr, const std::string net
|
||||
if ( (addr=="" && netm=="") ||
|
||||
(addr==InetAddr::getAny().toString() &&
|
||||
netm==InetAddr::getAny().toString()))
|
||||
return NULL; // this is 'any'
|
||||
return nullptr; // this is 'any'
|
||||
|
||||
ObjectSignature sig(error_tracker);
|
||||
sig.type_name = Address::TYPENAME;
|
||||
@ -640,7 +640,7 @@ FWObject* Importer::makeDstObj()
|
||||
|
||||
FWObject* Importer::makeSrvObj()
|
||||
{
|
||||
if (protocol=="") return NULL; // this is 'any'
|
||||
if (protocol=="") return nullptr; // this is 'any'
|
||||
FWObject *s;
|
||||
if (protocol=="icmp")
|
||||
{
|
||||
@ -675,7 +675,7 @@ FWObject* Importer::makeSrvObj()
|
||||
}
|
||||
}
|
||||
}
|
||||
// if create*Service returns NULL, this is 'any'
|
||||
// if create*Service returns nullptr, this is 'any'
|
||||
return commitObject(s);
|
||||
}
|
||||
|
||||
@ -683,7 +683,7 @@ void Importer::addSrc()
|
||||
{
|
||||
PolicyRule *rule = PolicyRule::cast(current_rule);
|
||||
RuleElementSrc* src = rule->getSrc();
|
||||
assert(src!=NULL);
|
||||
assert(src!=nullptr);
|
||||
FWObject *s = makeSrcObj();
|
||||
if (s) src->addRef( s );
|
||||
}
|
||||
@ -692,7 +692,7 @@ void Importer::addDst()
|
||||
{
|
||||
PolicyRule *rule = PolicyRule::cast(current_rule);
|
||||
RuleElementDst* dst = rule->getDst();
|
||||
assert(dst!=NULL);
|
||||
assert(dst!=nullptr);
|
||||
FWObject *s = makeDstObj();
|
||||
if (s) dst->addRef( s );
|
||||
}
|
||||
@ -701,7 +701,7 @@ void Importer::addSrv()
|
||||
{
|
||||
PolicyRule *rule = PolicyRule::cast(current_rule);
|
||||
RuleElementSrv* srv = rule->getSrv();
|
||||
assert(srv!=NULL);
|
||||
assert(srv!=nullptr);
|
||||
FWObject *s = makeSrvObj();
|
||||
if (s) srv->addRef( s );
|
||||
}
|
||||
@ -710,7 +710,7 @@ void Importer::addOSrc()
|
||||
{
|
||||
NATRule *rule = NATRule::cast(current_rule);
|
||||
RuleElementOSrc* src = rule->getOSrc();
|
||||
assert(src!=NULL);
|
||||
assert(src!=nullptr);
|
||||
FWObject *s = makeSrcObj();
|
||||
if (s) src->addRef( s );
|
||||
}
|
||||
@ -719,7 +719,7 @@ void Importer::addODst()
|
||||
{
|
||||
NATRule *rule = NATRule::cast(current_rule);
|
||||
RuleElementODst* dst = rule->getODst();
|
||||
assert(dst!=NULL);
|
||||
assert(dst!=nullptr);
|
||||
FWObject *s = makeDstObj();
|
||||
if (s) dst->addRef( s );
|
||||
}
|
||||
@ -728,7 +728,7 @@ void Importer::addOSrv()
|
||||
{
|
||||
NATRule *rule = NATRule::cast(current_rule);
|
||||
RuleElementOSrv* srv = rule->getOSrv();
|
||||
assert(srv!=NULL);
|
||||
assert(srv!=nullptr);
|
||||
FWObject *s= makeSrvObj();
|
||||
if (s) srv->addRef( s );
|
||||
}
|
||||
@ -749,13 +749,13 @@ Firewall* Importer::finalize()
|
||||
FWObject* Importer::createTCPService(const QString &)
|
||||
{
|
||||
// Default implementation
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
FWObject* Importer::createUDPService(const QString &)
|
||||
{
|
||||
// Default implementation
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
FWObject* Importer::createGroupOfInterfaces(
|
||||
@ -800,7 +800,7 @@ FWObject* Importer::createGroupOfInterfaces(
|
||||
void Importer::markCurrentRuleBad()
|
||||
{
|
||||
FWOptions *ropt = current_rule->getOptionsObject();
|
||||
assert(ropt!=NULL);
|
||||
assert(ropt!=nullptr);
|
||||
ropt->setStr("color", getBadRuleColor());
|
||||
|
||||
QStringList comment;
|
||||
@ -932,7 +932,7 @@ void Importer::addMessageToLog(const QString &msg)
|
||||
void Importer::addStandardImportComment(FWObject *obj,
|
||||
const QString &additional_comment)
|
||||
{
|
||||
if (obj == NULL) return;
|
||||
if (obj == nullptr) return;
|
||||
|
||||
// what if this object has been found in a read-only library?
|
||||
if (obj->isReadOnly()) return;
|
||||
|
||||
@ -158,7 +158,7 @@ protected:
|
||||
const std::string &netm);
|
||||
std::string getBadRuleColor();
|
||||
|
||||
// this method returns fw. It is created if fw==NULL
|
||||
// this method returns fw. It is created if fw==nullptr
|
||||
// Using getFirewallObject() instead of accessing fw directly
|
||||
// provides a way to create firewall object only when
|
||||
// it is really needed.
|
||||
@ -171,10 +171,10 @@ protected:
|
||||
// However in other cases there could have been an error after
|
||||
// the object was created. This method allows us to tell one
|
||||
// situation from another.
|
||||
bool haveFirewallObject() { return (fw!=NULL); }
|
||||
bool haveFirewallObject() { return (fw!=nullptr); }
|
||||
|
||||
// checks if ruleset "rsname" exists. Returns pointer if yes,
|
||||
// otherwise returns NULL
|
||||
// otherwise returns nullptr
|
||||
virtual UnidirectionalRuleSet* checkUnidirRuleSet(const std::string &rsname);
|
||||
|
||||
// finds and rturns pointer to ruleset "rsname". If it does not
|
||||
@ -316,7 +316,7 @@ public:
|
||||
|
||||
virtual void setHostName(const std::string &hn);
|
||||
virtual libfwbuilder::Interface* newInterface(const std::string &interface_name);
|
||||
virtual void clearCurrentInterface() { current_interface = NULL; }
|
||||
virtual void clearCurrentInterface() { current_interface = nullptr; }
|
||||
virtual void ignoreCurrentInterface();
|
||||
virtual void addInterfaceAddress(const std::string &a,
|
||||
const std::string &nm);
|
||||
|
||||
@ -262,12 +262,12 @@ void PIXImporter::fixServiceObjectUsedForBothSrcAndDstPorts()
|
||||
named_objects_registry.count(dst_port_spec.c_str()) > 0)
|
||||
dst_port_obj = named_objects_registry[dst_port_spec.c_str()];
|
||||
|
||||
// if both src_port_obj and dst_port_obj are NULL, this means
|
||||
// if both src_port_obj and dst_port_obj are nullptr, this means
|
||||
// both port operations are in-line port matches that will be
|
||||
// taken are of in the base class functions
|
||||
if (src_port_obj == nullptr && dst_port_obj == nullptr) return;
|
||||
|
||||
// If only one of the two is NULL, use base class functions to
|
||||
// If only one of the two is nullptr, use base class functions to
|
||||
// fill it in from its port_op and port_spec variables
|
||||
if (dst_port_obj == nullptr)
|
||||
{
|
||||
|
||||
@ -95,7 +95,7 @@ void PIXImporter::addGlobalPool()
|
||||
|
||||
void PIXImporter::pushNATRule()
|
||||
{
|
||||
assert(current_ruleset!=NULL);
|
||||
assert(current_ruleset!=nullptr);
|
||||
|
||||
switch (rule_type)
|
||||
{
|
||||
@ -140,7 +140,7 @@ void PIXImporter::buildDNATRule()
|
||||
if (mapped_a == "interface")
|
||||
{
|
||||
RuleElementODst* odst = rule->getODst();
|
||||
assert(odst!=NULL);
|
||||
assert(odst!=nullptr);
|
||||
odst->addRef(post_intf);
|
||||
} else
|
||||
{
|
||||
@ -156,7 +156,7 @@ void PIXImporter::buildDNATRule()
|
||||
dst_nm = real_nm;
|
||||
|
||||
RuleElement* tdst = rule->getTDst();
|
||||
assert(tdst!=NULL);
|
||||
assert(tdst!=nullptr);
|
||||
FWObject *s = makeDstObj();
|
||||
if (s) tdst->addRef( s );
|
||||
}
|
||||
@ -168,7 +168,7 @@ void PIXImporter::buildDNATRule()
|
||||
dst_port_spec = mapped_port_spec;
|
||||
|
||||
RuleElement* osrv = rule->getOSrv();
|
||||
assert(osrv!=NULL);
|
||||
assert(osrv!=nullptr);
|
||||
FWObject *s = Importer::makeSrvObj();
|
||||
|
||||
if (s) osrv->addRef( s );
|
||||
@ -181,18 +181,18 @@ void PIXImporter::buildDNATRule()
|
||||
dst_port_spec = real_port_spec;
|
||||
|
||||
RuleElement* tsrv = rule->getTSrv();
|
||||
assert(tsrv!=NULL);
|
||||
assert(tsrv!=nullptr);
|
||||
FWObject *s = Importer::makeSrvObj();
|
||||
|
||||
if (s) tsrv->addRef( s );
|
||||
}
|
||||
|
||||
RuleElement *itf_i_re = rule->getItfInb();
|
||||
assert(itf_i_re!=NULL);
|
||||
assert(itf_i_re!=nullptr);
|
||||
itf_i_re->addRef(post_intf);
|
||||
|
||||
RuleElement *itf_o_re = rule->getItfOutb();
|
||||
assert(itf_o_re!=NULL);
|
||||
assert(itf_o_re!=nullptr);
|
||||
itf_o_re->addRef(pre_intf);
|
||||
|
||||
if ( ! real_addr_acl.empty())
|
||||
@ -244,7 +244,7 @@ void PIXImporter::buildDNATRule()
|
||||
FWObject *old_obj = FWReference::getObject(*it);
|
||||
TCPUDPService *tcpudp = TCPUDPService::cast(
|
||||
mirrorServiceObjectRecursively(old_obj));
|
||||
if (tcpudp == NULL) tsrv->addRef(old_obj);
|
||||
if (tcpudp == nullptr) tsrv->addRef(old_obj);
|
||||
else
|
||||
{
|
||||
if (tcpudp->getSrcRangeEnd() > 0)
|
||||
@ -318,13 +318,13 @@ void PIXImporter::buildSNATRule()
|
||||
src_nm = nat_nm;
|
||||
|
||||
RuleElement* osrc = rule->getOSrc();
|
||||
assert(osrc!=NULL);
|
||||
assert(osrc!=nullptr);
|
||||
FWObject *s = makeSrcObj();
|
||||
if (s) osrc->addRef( s );
|
||||
}
|
||||
|
||||
ObjectSignature sig(error_tracker);
|
||||
FWObject *addr = NULL;
|
||||
FWObject *addr = nullptr;
|
||||
|
||||
if (pool.start == "interface")
|
||||
{
|
||||
@ -346,20 +346,20 @@ void PIXImporter::buildSNATRule()
|
||||
}
|
||||
|
||||
RuleElement* tsrc = rule->getTSrc();
|
||||
assert(tsrc!=NULL);
|
||||
assert(tsrc!=nullptr);
|
||||
if (addr) tsrc->addRef( addr );
|
||||
|
||||
if (pre_intf)
|
||||
{
|
||||
RuleElement *itf_i_re = rule->getItfInb();
|
||||
assert(itf_i_re!=NULL);
|
||||
assert(itf_i_re!=nullptr);
|
||||
itf_i_re->addRef(pre_intf);
|
||||
}
|
||||
|
||||
if (post_intf)
|
||||
{
|
||||
RuleElement *itf_o_re = rule->getItfOutb();
|
||||
assert(itf_o_re!=NULL);
|
||||
assert(itf_o_re!=nullptr);
|
||||
itf_o_re->addRef(post_intf);
|
||||
}
|
||||
|
||||
@ -404,13 +404,13 @@ void PIXImporter::buildNoNATRule()
|
||||
src_nm = nat_nm;
|
||||
|
||||
RuleElement* osrc = rule->getOSrc();
|
||||
assert(osrc!=NULL);
|
||||
assert(osrc!=nullptr);
|
||||
FWObject *s = makeSrcObj();
|
||||
if (s) osrc->addRef( s );
|
||||
}
|
||||
|
||||
RuleElement *itf_i_re = rule->getItfInb();
|
||||
assert(itf_i_re!=NULL);
|
||||
assert(itf_i_re!=nullptr);
|
||||
itf_i_re->addRef(pre_intf);
|
||||
|
||||
if ( ! nat_acl.empty())
|
||||
|
||||
@ -50,7 +50,7 @@ AddressObjectMaker::~AddressObjectMaker() {}
|
||||
|
||||
FWObject* AddressObjectMaker::createObject(ObjectSignature &sig)
|
||||
{
|
||||
FWObject *obj = NULL;
|
||||
FWObject *obj = nullptr;
|
||||
|
||||
if (sig.type_name == AddressRange::TYPENAME)
|
||||
obj = createAddressRange(sig);
|
||||
@ -61,7 +61,7 @@ FWObject* AddressObjectMaker::createObject(ObjectSignature &sig)
|
||||
if (sig.type_name == DNSName::TYPENAME)
|
||||
obj = createDNSName(sig);
|
||||
|
||||
if (obj == NULL)
|
||||
if (obj == nullptr)
|
||||
obj = createAddress(sig);
|
||||
|
||||
// Now I should build new signature because actual object type has
|
||||
@ -72,11 +72,11 @@ FWObject* AddressObjectMaker::createObject(ObjectSignature &sig)
|
||||
if ( ! sig.object_name.isEmpty())
|
||||
{
|
||||
obj->setName(sig.object_name.toUtf8().constData());
|
||||
obj->dispatch(&new_sig, (void*)(NULL));
|
||||
obj->dispatch(&new_sig, (void*)(nullptr));
|
||||
registerNamedObject(new_sig, obj);
|
||||
} else
|
||||
{
|
||||
obj->dispatch(&new_sig, (void*)(NULL));
|
||||
obj->dispatch(&new_sig, (void*)(nullptr));
|
||||
registerAnonymousObject(new_sig, obj);
|
||||
}
|
||||
|
||||
@ -150,7 +150,7 @@ FWObject* AddressObjectMaker::createAddress(ObjectSignature &sig)
|
||||
|
||||
return net;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
FWObject* AddressObjectMaker::createAddressRange(ObjectSignature &sig)
|
||||
@ -195,7 +195,7 @@ FWObject* AddressObjectMaker::createAddressTable(ObjectSignature &sig)
|
||||
AddressTable *at = AddressTable::cast(
|
||||
ObjectMaker::createObject(AddressTable::TYPENAME,
|
||||
sig.object_name.toUtf8().constData()));
|
||||
assert(at!=NULL);
|
||||
assert(at!=nullptr);
|
||||
at->setRunTime(true);
|
||||
at->setSourceName(sig.address_table_name.toStdString());
|
||||
return at;
|
||||
@ -209,7 +209,7 @@ FWObject* AddressObjectMaker::createDNSName(ObjectSignature &sig)
|
||||
DNSName *dns_obj = DNSName::cast(
|
||||
ObjectMaker::createObject(DNSName::TYPENAME,
|
||||
sig.object_name.toUtf8().constData()));
|
||||
assert(dns_obj!=NULL);
|
||||
assert(dns_obj!=nullptr);
|
||||
dns_obj->setRunTime(true);
|
||||
dns_obj->setSourceName(sig.dns_name.toStdString());
|
||||
return dns_obj;
|
||||
|
||||
@ -122,7 +122,7 @@ public:
|
||||
{
|
||||
library = l;
|
||||
error_tracker = et;
|
||||
last_created = NULL;
|
||||
last_created = nullptr;
|
||||
}
|
||||
virtual ~ObjectMaker() {};
|
||||
|
||||
|
||||
@ -67,7 +67,7 @@ ServiceObjectMaker::ServiceObjectMaker(Library *l, ObjectMakerErrorTracker *et)
|
||||
sig.type_name = IPService::TYPENAME;
|
||||
sig.protocol = 0;
|
||||
sig.fragments = false;
|
||||
registerAnonymousObject(sig, NULL); // "any"
|
||||
registerAnonymousObject(sig, nullptr); // "any"
|
||||
}
|
||||
|
||||
ServiceObjectMaker::~ServiceObjectMaker() {}
|
||||
@ -249,13 +249,13 @@ FWObject* ServiceObjectMaker::getUDPService(int srs, int sre, int drs, int dre)
|
||||
|
||||
FWObject* ServiceObjectMaker::getTagService(const QString &tagcode)
|
||||
{
|
||||
TagService *s = NULL;
|
||||
TagService *s = nullptr;
|
||||
|
||||
QString name = QString("tag-%1").arg(tagcode);
|
||||
|
||||
s = TagService::cast(
|
||||
ObjectMaker::createObject(TagService::TYPENAME, name.toStdString()));
|
||||
assert(s!=NULL);
|
||||
assert(s!=nullptr);
|
||||
s->setCode(tagcode.toStdString());
|
||||
|
||||
return s;
|
||||
@ -265,18 +265,18 @@ FWObject* ServiceObjectMaker::getMirroredServiceObject(FWObject *obj)
|
||||
{
|
||||
string new_name = obj->getName() + "-mirror";
|
||||
QString qs_new_name = QString::fromUtf8(new_name.c_str());
|
||||
FWObject *new_obj = NULL;
|
||||
FWObject *new_obj = nullptr;
|
||||
if (TCPService::isA(obj) || UDPService::isA(obj))
|
||||
{
|
||||
ObjectMirror mirror;
|
||||
new_obj = mirror.getMirroredService(Service::cast(obj));
|
||||
if (new_obj!=NULL)
|
||||
if (new_obj!=nullptr)
|
||||
{
|
||||
if (TCPService::isA(new_obj))
|
||||
TCPService::cast(new_obj)->setEstablished(false);
|
||||
|
||||
ObjectSignature sig(error_tracker);
|
||||
new_obj->dispatch(&sig, (void*)(NULL));
|
||||
new_obj->dispatch(&sig, (void*)(nullptr));
|
||||
sig.object_name = "";
|
||||
|
||||
FWObject *matching_obj = findMatchingObject(sig);
|
||||
|
||||
@ -73,7 +73,7 @@ using namespace fwcompiler;
|
||||
|
||||
int fwbdebug = 0;
|
||||
|
||||
FWObjectDatabase *objdb = NULL;
|
||||
FWObjectDatabase *objdb = nullptr;
|
||||
|
||||
|
||||
class UpgradePredicate: public XMLTools::UpgradePredicate
|
||||
@ -155,7 +155,7 @@ int main(int argc, char **argv)
|
||||
objdb->setFileName("");
|
||||
FWObjectDatabase *ndb = new FWObjectDatabase();
|
||||
ndb->load(filename, &upgrade_predicate, Constants::getDTDDirectory());
|
||||
objdb->merge(ndb, NULL);
|
||||
objdb->merge(ndb, nullptr);
|
||||
delete ndb;
|
||||
objdb->setFileName(filename);
|
||||
objdb->reIndex();
|
||||
|
||||
@ -71,7 +71,7 @@ using namespace fwcompiler;
|
||||
|
||||
int fwbdebug = 0;
|
||||
|
||||
FWObjectDatabase *objdb = NULL;
|
||||
FWObjectDatabase *objdb = nullptr;
|
||||
|
||||
|
||||
class UpgradePredicate: public XMLTools::UpgradePredicate
|
||||
@ -151,7 +151,7 @@ int main(int argc, char **argv)
|
||||
objdb->setFileName("");
|
||||
FWObjectDatabase *ndb = new FWObjectDatabase();
|
||||
ndb->load(filename, &upgrade_predicate, Constants::getDTDDirectory());
|
||||
objdb->merge(ndb, NULL);
|
||||
objdb->merge(ndb, nullptr);
|
||||
delete ndb;
|
||||
objdb->setFileName(filename);
|
||||
objdb->reIndex();
|
||||
|
||||
@ -51,7 +51,7 @@ using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
using namespace fwcompiler;
|
||||
|
||||
FWObjectDatabase *objdb = NULL;
|
||||
FWObjectDatabase *objdb = nullptr;
|
||||
|
||||
class UpgradePredicate: public XMLTools::UpgradePredicate
|
||||
{
|
||||
|
||||
@ -58,7 +58,7 @@ PolicyRule* AutomaticRules_ipt::addMgmtRule(
|
||||
iface, direction, action,
|
||||
label);
|
||||
|
||||
FWOptions *ruleopt = rule->getOptionsObject(); assert(ruleopt!=NULL);
|
||||
FWOptions *ruleopt = rule->getOptionsObject(); assert(ruleopt!=nullptr);
|
||||
if (related)
|
||||
{
|
||||
ruleopt->setBool("stateless", false);
|
||||
@ -74,7 +74,7 @@ PolicyRule* AutomaticRules_ipt::addMgmtRule(
|
||||
|
||||
void AutomaticRules_ipt::addConntrackRule()
|
||||
{
|
||||
if (ruleset == NULL) return;
|
||||
if (ruleset == nullptr) return;
|
||||
|
||||
FWOptions* options = fw->getOptionsObject();
|
||||
string conntrack_iface_name = options->getStr("state_sync_interface");
|
||||
@ -91,7 +91,7 @@ void AutomaticRules_ipt::addConntrackRule()
|
||||
FWObjectDatabase::getIntId(conntrack_group_id)));
|
||||
|
||||
Resources *os_res = Resources::os_res[fw->getStr("host_OS")];
|
||||
assert(os_res != NULL);
|
||||
assert(os_res != nullptr);
|
||||
|
||||
string default_address =
|
||||
os_res->getResourceStr("/FWBuilderResources/Target/protocols/conntrack/default_address");
|
||||
@ -138,7 +138,7 @@ void AutomaticRules_ipt::addConntrackRule()
|
||||
/* Find conntrack interface */
|
||||
Interface* conntrack_iface = Interface::cast(fw->findObjectByName(Interface::TYPENAME, conntrack_iface_name));
|
||||
|
||||
if (conntrack_iface == NULL)
|
||||
if (conntrack_iface == nullptr)
|
||||
{
|
||||
throw FWException(
|
||||
"Unable to get CONNTRACK interface ("+ conntrack_iface_name +")");
|
||||
@ -147,7 +147,7 @@ void AutomaticRules_ipt::addConntrackRule()
|
||||
/* Add automatic rules for CONNTRACK */
|
||||
if (ucast)
|
||||
{
|
||||
Interface *fw_iface = NULL;
|
||||
Interface *fw_iface = nullptr;
|
||||
list<Interface*> other_interfaces;
|
||||
for (FWObjectTypedChildIterator it =
|
||||
state_sync_group->findByType(FWObjectReference::TYPENAME);
|
||||
@ -186,7 +186,7 @@ void AutomaticRules_ipt::addConntrackRule()
|
||||
}
|
||||
} else
|
||||
{
|
||||
addMgmtRule(NULL,
|
||||
addMgmtRule(nullptr,
|
||||
conntrack_dst,
|
||||
conntrack_srv,
|
||||
conntrack_iface,
|
||||
@ -206,10 +206,10 @@ void AutomaticRules_ipt::addConntrackRule()
|
||||
|
||||
void AutomaticRules_ipt::addFailoverRules()
|
||||
{
|
||||
if (ruleset == NULL) return;
|
||||
if (ruleset == nullptr) return;
|
||||
|
||||
Resources *os_res = Resources::os_res[fw->getStr("host_OS")];
|
||||
assert(os_res != NULL);
|
||||
assert(os_res != nullptr);
|
||||
|
||||
string default_heartbeat_port =
|
||||
os_res->getResourceStr(
|
||||
@ -245,13 +245,13 @@ void AutomaticRules_ipt::addFailoverRules()
|
||||
FWObject *failover_group =
|
||||
iface->getFirstByType(FailoverClusterGroup::TYPENAME);
|
||||
|
||||
PolicyRule *rule = NULL;
|
||||
PolicyRule *rule = nullptr;
|
||||
|
||||
string fw_iface_id = iface->getOptionsObject()->getStr("base_interface_id");
|
||||
Interface *fw_iface =
|
||||
Interface::cast(
|
||||
ruleset->getRoot()->findInIndex(FWObjectDatabase::getIntId(fw_iface_id)));
|
||||
if (fw_iface == NULL)
|
||||
if (fw_iface == nullptr)
|
||||
{
|
||||
throw FWException(
|
||||
QString("Can not find interface of the firewall "
|
||||
@ -309,9 +309,9 @@ void AutomaticRules_ipt::addFailoverRules()
|
||||
if (other_iface->getId() == fw_iface->getId()) continue;
|
||||
// if interface is dynamic, we can't use it in the rule
|
||||
// (because it belongs to another machine, not the fw
|
||||
// we compile for so we can't use script). NULL means "any"
|
||||
// we compile for so we can't use script). nullptr means "any"
|
||||
// in the call to addMgmtRule()
|
||||
if (other_iface->isDyn()) other_iface = NULL;
|
||||
if (other_iface->isDyn()) other_iface = nullptr;
|
||||
|
||||
if (!use_ipsec_ah)
|
||||
{
|
||||
@ -390,9 +390,9 @@ void AutomaticRules_ipt::addFailoverRules()
|
||||
if (other_iface->getId() == fw_iface->getId()) continue;
|
||||
// if interface is dynamic, we can't use it in the rule
|
||||
// (because it belongs to another machine, not the fw
|
||||
// we compile for so we can't use script). NULL means "any"
|
||||
// we compile for so we can't use script). nullptr means "any"
|
||||
// in the call to addMgmtRule()
|
||||
if (other_iface->isDyn()) other_iface = NULL;
|
||||
if (other_iface->isDyn()) other_iface = nullptr;
|
||||
|
||||
if (ucast)
|
||||
{
|
||||
@ -453,9 +453,9 @@ void AutomaticRules_ipt::addFailoverRules()
|
||||
if (other_iface->getId() == fw_iface->getId()) continue;
|
||||
// if interface is dynamic, we can't use it in the rule
|
||||
// (because it belongs to another machine, not the fw
|
||||
// we compile for so we can't use script). NULL means "any"
|
||||
// we compile for so we can't use script). nullptr means "any"
|
||||
// in the call to addMgmtRule()
|
||||
if (other_iface->isDyn()) other_iface = NULL;
|
||||
if (other_iface->isDyn()) other_iface = nullptr;
|
||||
|
||||
addMgmtRule(other_iface, openais_dst, openais_srv, iface,
|
||||
PolicyRule::Inbound, PolicyRule::Accept,
|
||||
@ -469,7 +469,7 @@ void AutomaticRules_ipt::addFailoverRules()
|
||||
if (rule)
|
||||
{
|
||||
FWOptions *ruleopt = rule->getOptionsObject();
|
||||
assert(ruleopt!=NULL);
|
||||
assert(ruleopt!=nullptr);
|
||||
ruleopt->setInt("firewall_is_part_of_any_and_networks", 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ void CompilerDriver_ipt::assignRuleSetChain(RuleSet *ruleset)
|
||||
for (FWObject::iterator r=ruleset->begin(); r!=ruleset->end(); r++)
|
||||
{
|
||||
Rule *rule = Rule::cast(*r);
|
||||
if (rule == NULL) continue; // skip RuleSetOptions object
|
||||
if (rule == nullptr) continue; // skip RuleSetOptions object
|
||||
if (rule->isDisabled()) continue;
|
||||
|
||||
if (!ruleset->isTop())
|
||||
@ -104,13 +104,13 @@ void CompilerDriver_ipt::findBranchesInMangleTable(Firewall *fw,
|
||||
r!=(*i)->end(); ++r)
|
||||
{
|
||||
PolicyRule *rule = PolicyRule::cast(*r);
|
||||
if (rule == NULL) continue; // skip RuleSetOptions object
|
||||
if (rule == nullptr) continue; // skip RuleSetOptions object
|
||||
FWOptions *ruleopt = rule->getOptionsObject();
|
||||
if (rule->getAction() == PolicyRule::Branch &&
|
||||
! ruleopt->getBool("ipt_branch_in_mangle"))
|
||||
{
|
||||
RuleSet *ruleset = rule->getBranch();
|
||||
if (ruleset == NULL)
|
||||
if (ruleset == nullptr)
|
||||
{
|
||||
abort(fw, *i, rule,
|
||||
"Action branch does not point to any rule set");
|
||||
@ -120,7 +120,7 @@ void CompilerDriver_ipt::findBranchesInMangleTable(Firewall *fw,
|
||||
br!=ruleset->end(); ++br)
|
||||
{
|
||||
PolicyRule *b_rule = PolicyRule::cast(*br);
|
||||
if (b_rule == NULL) continue;
|
||||
if (b_rule == nullptr) continue;
|
||||
if (b_rule->getTagging() || b_rule->getClassification())
|
||||
ruleopt->setBool("ipt_branch_in_mangle", true);
|
||||
}
|
||||
@ -157,7 +157,7 @@ string CompilerDriver_ipt::dumpScript(Firewall *fw,
|
||||
ostringstream script;
|
||||
string prolog_place = fw->getOptionsObject()->getStr("prolog_place");
|
||||
|
||||
Configlet *conf = NULL;
|
||||
Configlet *conf = nullptr;
|
||||
bool have_auto = !automatic_rules_script.empty() || !automatic_mangle_script.empty();
|
||||
|
||||
if (single_rule_compile_on)
|
||||
@ -229,7 +229,7 @@ std::unique_ptr<PolicyCompiler_ipt> CompilerDriver_ipt::createPolicyCompiler(
|
||||
minus_n_commands_filter));
|
||||
}
|
||||
|
||||
if (policy_compiler.get()==NULL)
|
||||
if (policy_compiler.get()==nullptr)
|
||||
abort("Unrecognized firewall platform " +
|
||||
fw->getStr("platform") +
|
||||
" (family " + platform_family+")");
|
||||
|
||||
@ -112,8 +112,8 @@ QString CompilerDriver_ipt::run(const std::string &cluster_id,
|
||||
// see #2212 Create temporary copy of the firewall and cluster
|
||||
// objects and pass them to the compilers.
|
||||
|
||||
Cluster *cluster = NULL;
|
||||
Firewall *fw = NULL;
|
||||
Cluster *cluster = nullptr;
|
||||
Firewall *fw = nullptr;
|
||||
|
||||
getFirewallAndClusterObjects(cluster_id, firewall_id, &cluster, &fw);
|
||||
|
||||
@ -199,7 +199,7 @@ QString CompilerDriver_ipt::run(const std::string &cluster_id,
|
||||
oscnf = std::unique_ptr<OSConfigurator_linux24>(
|
||||
new OSConfigurator_secuwall(objdb , fw, false));
|
||||
|
||||
if (oscnf.get()==NULL)
|
||||
if (oscnf.get()==nullptr)
|
||||
{
|
||||
abort("Unrecognized host OS " + fw->getStr("host_OS") +
|
||||
" (family " + os_family+")");
|
||||
@ -330,7 +330,7 @@ QString CompilerDriver_ipt::run(const std::string &cluster_id,
|
||||
|
||||
// First, process branch NAT rulesets, then top NAT ruleset
|
||||
|
||||
NAT *top_nat = NULL;
|
||||
NAT *top_nat = nullptr;
|
||||
for (list<FWObject*>::iterator p=all_nat.begin();
|
||||
p!=all_nat.end(); ++p)
|
||||
{
|
||||
@ -475,11 +475,11 @@ QString CompilerDriver_ipt::run(const std::string &cluster_id,
|
||||
* now write generated scripts to files
|
||||
*/
|
||||
|
||||
char *timestr = NULL;
|
||||
char *timestr = nullptr;
|
||||
time_t tm;
|
||||
struct tm *stm;
|
||||
|
||||
tm = time(NULL);
|
||||
tm = time(nullptr);
|
||||
stm = localtime(&tm);
|
||||
timestr = strdup(ctime(&tm));
|
||||
timestr[strlen(timestr)-1] = '\0';
|
||||
@ -690,7 +690,7 @@ QString CompilerDriver_ipt::run(const std::string &cluster_id,
|
||||
if (fw->getOptionsObject()->getBool("add_mgmt_ssh_rule_when_stoped"))
|
||||
{
|
||||
std::unique_ptr<PolicyCompiler_ipt> policy_compiler =
|
||||
createPolicyCompiler(fw, false, NULL, NULL);
|
||||
createPolicyCompiler(fw, false, nullptr, nullptr);
|
||||
PolicyCompiler_ipt::PrintRule* print_rule =
|
||||
policy_compiler->createPrintRuleProcessor();
|
||||
print_rule->setContext(policy_compiler.get());
|
||||
|
||||
@ -51,7 +51,7 @@ int MangleTableCompiler_ipt::prolog()
|
||||
|
||||
bool MangleTableCompiler_ipt::keepMangleTableRules::processNext()
|
||||
{
|
||||
PolicyRule *rule = getNext(); if (rule==NULL) return false;
|
||||
PolicyRule *rule = getNext(); if (rule==nullptr) return false;
|
||||
FWOptions *ruleopt = rule->getOptionsObject();
|
||||
PolicyCompiler_ipt *ipt_comp = dynamic_cast<PolicyCompiler_ipt*>(compiler);
|
||||
|
||||
|
||||
@ -217,8 +217,8 @@ string NATCompiler_ipt::PrintRule::_printChainDirectionAndInterface(NATRule *rul
|
||||
{
|
||||
QStringList res;
|
||||
|
||||
RuleElementItfInb *itf_in_re = rule->getItfInb(); assert(itf_in_re!=NULL);
|
||||
RuleElementItfOutb *itf_out_re = rule->getItfOutb(); assert(itf_out_re!=NULL);
|
||||
RuleElementItfInb *itf_in_re = rule->getItfInb(); assert(itf_in_re!=nullptr);
|
||||
RuleElementItfOutb *itf_out_re = rule->getItfOutb(); assert(itf_out_re!=nullptr);
|
||||
|
||||
QString iface_in_name = getInterfaceName(itf_in_re);
|
||||
QString iface_out_name = getInterfaceName(itf_out_re);
|
||||
@ -404,7 +404,7 @@ string NATCompiler_ipt::PrintRule::_printSrcService(RuleElementOSrv *rel)
|
||||
* find the object. I'd rather use a cached copy in the compiler
|
||||
*/
|
||||
FWObject *o=rel->front();
|
||||
if (o && FWReference::cast(o)!=NULL)
|
||||
if (o && FWReference::cast(o)!=nullptr)
|
||||
o=FWReference::cast(o)->getPointer();
|
||||
|
||||
Service *srv= Service::cast(o);
|
||||
@ -421,7 +421,7 @@ string NATCompiler_ipt::PrintRule::_printSrcService(RuleElementOSrv *rel)
|
||||
bool first=true;
|
||||
for (FWObject::iterator i=rel->begin(); i!=rel->end(); i++) {
|
||||
FWObject *o= *i;
|
||||
if (FWReference::cast(o)!=NULL) o=FWReference::cast(o)->getPointer();
|
||||
if (FWReference::cast(o)!=nullptr) o=FWReference::cast(o)->getPointer();
|
||||
|
||||
Service *s=Service::cast( o );
|
||||
assert(s);
|
||||
@ -449,7 +449,7 @@ string NATCompiler_ipt::PrintRule::_printDstService(RuleElementOSrv *rel)
|
||||
std::ostringstream ostr;
|
||||
|
||||
FWObject *o=rel->front();
|
||||
if (o && FWReference::cast(o)!=NULL)
|
||||
if (o && FWReference::cast(o)!=nullptr)
|
||||
o=FWReference::cast(o)->getPointer();
|
||||
|
||||
Service *srv= Service::cast(o);
|
||||
@ -489,7 +489,7 @@ string NATCompiler_ipt::PrintRule::_printDstService(RuleElementOSrv *rel)
|
||||
for (FWObject::iterator i=rel->begin(); i!=rel->end(); i++)
|
||||
{
|
||||
FWObject *o= *i;
|
||||
if (FWReference::cast(o)!=NULL) o=FWReference::cast(o)->getPointer();
|
||||
if (FWReference::cast(o)!=nullptr) o=FWReference::cast(o)->getPointer();
|
||||
|
||||
Service *s=Service::cast( o );
|
||||
assert(s);
|
||||
@ -543,7 +543,7 @@ string NATCompiler_ipt::PrintRule::_printAddr(Address *o,
|
||||
std::ostringstream ostr;
|
||||
|
||||
MultiAddressRunTime *atrt = MultiAddressRunTime::cast(o);
|
||||
if (atrt!=NULL)
|
||||
if (atrt!=nullptr)
|
||||
{
|
||||
if (atrt->getSubstitutionTypeName()==AddressTable::TYPENAME)
|
||||
{
|
||||
@ -560,10 +560,10 @@ string NATCompiler_ipt::PrintRule::_printAddr(Address *o,
|
||||
// to MultiAddressRunTime at this point. If we get some other
|
||||
// kind of MultiAddressRunTime object, we do not know what to do
|
||||
// with it so we stop.
|
||||
assert(atrt==NULL);
|
||||
assert(atrt==nullptr);
|
||||
}
|
||||
|
||||
if (print_range && AddressRange::cast(o)!=NULL)
|
||||
if (print_range && AddressRange::cast(o)!=nullptr)
|
||||
{
|
||||
InetAddr a1 = AddressRange::cast(o)->getRangeStart();
|
||||
InetAddr a2 = AddressRange::cast(o)->getRangeEnd();
|
||||
@ -571,7 +571,7 @@ string NATCompiler_ipt::PrintRule::_printAddr(Address *o,
|
||||
} else
|
||||
{
|
||||
Interface *iface = Interface::cast(o);
|
||||
if (iface!=NULL && iface->isDyn() && iface->getBool("use_var_address"))
|
||||
if (iface!=nullptr && iface->isDyn() && iface->getBool("use_var_address"))
|
||||
{
|
||||
ostr << "$" << ipt_comp->getInterfaceVarName(iface, ipt_comp->ipv6)
|
||||
<< " ";
|
||||
@ -581,7 +581,7 @@ string NATCompiler_ipt::PrintRule::_printAddr(Address *o,
|
||||
const InetAddr* addr = o->getAddressPtr();
|
||||
const InetAddr* mask = o->getNetmaskPtr();
|
||||
|
||||
if (addr==NULL)
|
||||
if (addr==nullptr)
|
||||
{
|
||||
compiler->warning(
|
||||
string("Empty inet address in object ") +
|
||||
@ -596,7 +596,7 @@ string NATCompiler_ipt::PrintRule::_printAddr(Address *o,
|
||||
{
|
||||
ostr << addr->toString();
|
||||
|
||||
if (Interface::cast(o)==NULL &&
|
||||
if (Interface::cast(o)==nullptr &&
|
||||
Address::cast(o)->dimension() > 1 &&
|
||||
!mask->isHostMask())
|
||||
{
|
||||
@ -628,7 +628,7 @@ bool NATCompiler_ipt::PrintRule::processNext()
|
||||
{
|
||||
NATCompiler_ipt *ipt_comp = dynamic_cast<NATCompiler_ipt*>(compiler);
|
||||
NATRule *rule=getNext();
|
||||
if (rule==NULL) return false;
|
||||
if (rule==nullptr) return false;
|
||||
|
||||
FWOptions *ropt = rule->getOptionsObject();
|
||||
|
||||
@ -686,10 +686,10 @@ bool NATCompiler_ipt::PrintRule::processNext()
|
||||
}
|
||||
|
||||
const InetAddr *osrc_addr = osrc->getAddressPtr();
|
||||
if (osrc_addr==NULL || !osrc_addr->isAny())
|
||||
if (osrc_addr==nullptr || !osrc_addr->isAny())
|
||||
{
|
||||
MultiAddressRunTime *atrt = MultiAddressRunTime::cast(osrc);
|
||||
if (atrt!=NULL && atrt->getSubstitutionTypeName()==AddressTable::TYPENAME &&
|
||||
if (atrt!=nullptr && atrt->getSubstitutionTypeName()==AddressTable::TYPENAME &&
|
||||
ipt_comp->using_ipset)
|
||||
{
|
||||
cmdout << _printIpSetMatch(osrc, osrcrel);
|
||||
@ -714,7 +714,7 @@ bool NATCompiler_ipt::PrintRule::processNext()
|
||||
if (!odst->isAny())
|
||||
{
|
||||
MultiAddressRunTime *atrt = MultiAddressRunTime::cast(odst);
|
||||
if (atrt!=NULL && atrt->getSubstitutionTypeName()==AddressTable::TYPENAME &&
|
||||
if (atrt!=nullptr && atrt->getSubstitutionTypeName()==AddressTable::TYPENAME &&
|
||||
ipt_comp->using_ipset)
|
||||
{
|
||||
cmdout << _printIpSetMatch(odst, odstrel);
|
||||
|
||||
@ -76,7 +76,7 @@ struct subnetInfo {
|
||||
Interface *iface;
|
||||
IPv4 *ipv4;
|
||||
int nmlength;
|
||||
subnetInfo() { iface=NULL; ipv4=NULL; nmlength=0; }
|
||||
subnetInfo() { iface=nullptr; ipv4=nullptr; nmlength=0; }
|
||||
subnetInfo(Interface *i,IPv4 *a,int n) { iface=i; ipv4=a; nmlength=n; }
|
||||
};
|
||||
|
||||
@ -253,7 +253,7 @@ bool compare_addresses_ptr(const InetAddr* a1, const InetAddr* a2)
|
||||
*/
|
||||
bool NATCompiler_ipt::ConvertLoadBalancingRules::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
@ -265,8 +265,8 @@ bool NATCompiler_ipt::ConvertLoadBalancingRules::processNext()
|
||||
for(list<FWObject*>::iterator i=tdst->begin(); i!=tdst->end(); i++)
|
||||
{
|
||||
FWObject *o= *i;
|
||||
FWObject *obj = NULL;
|
||||
if (FWReference::cast(o)!=NULL)
|
||||
FWObject *obj = nullptr;
|
||||
if (FWReference::cast(o)!=nullptr)
|
||||
obj=FWReference::cast(o)->getPointer();
|
||||
//const InetAddrMask *a = Address::cast(obj)->getAddressObjectInetAddrMask();
|
||||
const InetAddr *ip_addr = Address::cast(obj)->getAddressPtr();
|
||||
@ -324,7 +324,7 @@ bool NATCompiler_ipt::ConvertLoadBalancingRules::processNext()
|
||||
*/
|
||||
bool NATCompiler_ipt::splitSDNATRule::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
if ( rule->getRuleType()==NATRule::SDNAT)
|
||||
{
|
||||
@ -433,7 +433,7 @@ bool NATCompiler_ipt::splitSDNATRule::processNext()
|
||||
TCPUDPService *tu_tsrv = TCPUDPService::cast(tsrv);
|
||||
if (tu_tsrv && tu_tsrv->getDstRangeStart() != 0)
|
||||
{
|
||||
TCPUDPService *match_service = NULL;
|
||||
TCPUDPService *match_service = nullptr;
|
||||
if (tu_tsrv->getSrcRangeStart() == 0)
|
||||
{
|
||||
// no source port tranlsation
|
||||
@ -475,7 +475,7 @@ bool NATCompiler_ipt::splitSDNATRule::processNext()
|
||||
|
||||
bool NATCompiler_ipt::VerifyRules::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
RuleElementOSrc *osrc=rule->getOSrc(); assert(osrc);
|
||||
RuleElementODst *odst=rule->getODst(); assert(odst);
|
||||
@ -517,7 +517,7 @@ bool NATCompiler_ipt::VerifyRules::processNext()
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( Group::cast( compiler->getFirstTSrv(rule) )!=NULL)
|
||||
if ( Group::cast( compiler->getFirstTSrv(rule) )!=nullptr)
|
||||
{
|
||||
compiler->abort(
|
||||
rule,
|
||||
@ -539,7 +539,7 @@ bool NATCompiler_ipt::VerifyRules::processNext()
|
||||
if (rule->getRuleType()==NATRule::NATBranch)
|
||||
{
|
||||
RuleSet *branch = rule->getBranch();
|
||||
if (branch == NULL)
|
||||
if (branch == nullptr)
|
||||
{
|
||||
compiler->abort(
|
||||
rule,
|
||||
@ -562,7 +562,7 @@ bool NATCompiler_ipt::VerifyRules::processNext()
|
||||
if (rule->getRuleType()==NATRule::SNAT )
|
||||
{
|
||||
FWObject *o1 = FWReference::getObject(tsrc->front());
|
||||
if ( ! tsrc->isAny() && Network::cast(o1)!=NULL)
|
||||
if ( ! tsrc->isAny() && Network::cast(o1)!=nullptr)
|
||||
{
|
||||
compiler->abort(
|
||||
rule,
|
||||
@ -584,7 +584,7 @@ bool NATCompiler_ipt::VerifyRules::processNext()
|
||||
{
|
||||
Network *a1=Network::cast(compiler->getFirstOSrc(rule));
|
||||
Network *a2=Network::cast(compiler->getFirstTSrc(rule));
|
||||
if ( a1==NULL || a2==NULL ||
|
||||
if ( a1==nullptr || a2==nullptr ||
|
||||
a1->getNetmaskPtr()->getLength() != a2->getNetmaskPtr()->getLength() )
|
||||
{
|
||||
compiler->abort(
|
||||
@ -599,7 +599,7 @@ bool NATCompiler_ipt::VerifyRules::processNext()
|
||||
{
|
||||
Network *a1=Network::cast(compiler->getFirstODst(rule));
|
||||
Network *a2=Network::cast(compiler->getFirstTDst(rule));
|
||||
if ( a1==NULL || a2==NULL ||
|
||||
if ( a1==nullptr || a2==nullptr ||
|
||||
a1->getNetmaskPtr()->getLength() != a2->getNetmaskPtr()->getLength() )
|
||||
{
|
||||
compiler->abort(
|
||||
@ -622,7 +622,7 @@ bool NATCompiler_ipt::VerifyRules::processNext()
|
||||
*/
|
||||
bool NATCompiler_ipt::VerifyRules2::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
if (rule->getRuleType()!= NATRule::Return)
|
||||
{
|
||||
@ -660,12 +660,12 @@ bool NATCompiler_ipt::VerifyRules2::processNext()
|
||||
*/
|
||||
bool NATCompiler_ipt::VerifyRules3::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
RuleElement *itf_i_re = rule->getItfInb();
|
||||
assert(itf_i_re!=NULL);
|
||||
assert(itf_i_re!=nullptr);
|
||||
RuleElement *itf_o_re = rule->getItfOutb();
|
||||
assert(itf_o_re!=NULL);
|
||||
assert(itf_o_re!=nullptr);
|
||||
|
||||
if (rule->getRuleType()==NATRule::SNAT && ! itf_i_re->isAny())
|
||||
{
|
||||
@ -709,7 +709,7 @@ bool NATCompiler_ipt::VerifyRules3::processNext()
|
||||
|
||||
bool NATCompiler_ipt::convertToAtomicportForOSrv::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
if (rule->getOSrv()->size()>1 && ! rule->getTSrv()->isAny())
|
||||
{
|
||||
@ -738,7 +738,7 @@ bool NATCompiler_ipt::convertToAtomicportForOSrv::processNext()
|
||||
|
||||
bool NATCompiler_ipt::portTranslationRules::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
Address *odst=compiler->getFirstODst(rule);
|
||||
// Service *osrv=compiler->getFirstOSrv(rule);
|
||||
@ -760,7 +760,7 @@ bool NATCompiler_ipt::portTranslationRules::processNext()
|
||||
|
||||
bool NATCompiler_ipt::specialCaseWithRedirect::processNext()
|
||||
{
|
||||
NATRule *rule = getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule = getNext(); if (rule==nullptr) return false;
|
||||
|
||||
Address *tdst = compiler->getFirstTDst(rule);
|
||||
|
||||
@ -770,7 +770,7 @@ bool NATCompiler_ipt::specialCaseWithRedirect::processNext()
|
||||
int fw_id = compiler->fw->getId();
|
||||
int cluster_id = -1;
|
||||
bool cluster_member = compiler->fw->getOptionsObject()->getBool("cluster_member");
|
||||
Cluster *cluster = NULL;
|
||||
Cluster *cluster = nullptr;
|
||||
if (cluster_member)
|
||||
{
|
||||
cluster = Cluster::cast(
|
||||
@ -789,7 +789,7 @@ bool NATCompiler_ipt::specialCaseWithRedirect::processNext()
|
||||
|
||||
bool NATCompiler_ipt::splitOnODst::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
RuleElementODst *odst=rule->getODst(); assert(odst);
|
||||
if (rule->getRuleType()==NATRule::DNAT && odst->size()!=1)
|
||||
@ -797,7 +797,7 @@ bool NATCompiler_ipt::splitOnODst::processNext()
|
||||
for(list<FWObject*>::iterator i=odst->begin(); i!=odst->end(); ++i)
|
||||
{
|
||||
FWObject *o= *i;
|
||||
if (FWReference::cast(o)!=NULL) o=FWReference::cast(o)->getPointer();
|
||||
if (FWReference::cast(o)!=nullptr) o=FWReference::cast(o)->getPointer();
|
||||
Address *a=Address::cast( o );
|
||||
assert(a);
|
||||
|
||||
@ -820,7 +820,7 @@ bool NATCompiler_ipt::splitOnODst::processNext()
|
||||
|
||||
bool NATCompiler_ipt::splitOnOSrv::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
RuleElementOSrv *osrv=rule->getOSrv(); assert(osrv);
|
||||
if (osrv->size()!=1)
|
||||
@ -828,7 +828,7 @@ bool NATCompiler_ipt::splitOnOSrv::processNext()
|
||||
for(list<FWObject*>::iterator i=osrv->begin(); i!=osrv->end(); ++i)
|
||||
{
|
||||
FWObject *o= *i;
|
||||
if (FWReference::cast(o)!=NULL) o=FWReference::cast(o)->getPointer();
|
||||
if (FWReference::cast(o)!=nullptr) o=FWReference::cast(o)->getPointer();
|
||||
Service *s=Service::cast( o );
|
||||
assert(s);
|
||||
|
||||
@ -850,7 +850,7 @@ bool NATCompiler_ipt::splitOnOSrv::processNext()
|
||||
|
||||
bool NATCompiler_ipt::fillTranslatedSrv::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
@ -866,17 +866,17 @@ bool NATCompiler_ipt::fillTranslatedSrv::processNext()
|
||||
|
||||
bool NATCompiler_ipt::addVirtualAddress::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
bool cluster_member = compiler->fw->getOptionsObject()->getBool("cluster_member");
|
||||
Cluster *cluster = NULL;
|
||||
Cluster *cluster = nullptr;
|
||||
if (cluster_member)
|
||||
cluster = Cluster::cast(
|
||||
compiler->dbcopy->findInIndex(compiler->fw->getInt("parent_cluster_id")));
|
||||
|
||||
Address *a = NULL;
|
||||
Address *a = nullptr;
|
||||
|
||||
if (rule->getRuleType()==NATRule::SNAT || rule->getRuleType()==NATRule::DNAT)
|
||||
{
|
||||
@ -892,7 +892,7 @@ bool NATCompiler_ipt::addVirtualAddress::processNext()
|
||||
! compiler->complexMatch(a, compiler->fw) &&
|
||||
! compiler->complexMatch(a, cluster))
|
||||
{
|
||||
if (AddressRange::cast(a)!=NULL)
|
||||
if (AddressRange::cast(a)!=nullptr)
|
||||
{
|
||||
compiler->warning(
|
||||
rule,
|
||||
@ -924,7 +924,7 @@ bool NATCompiler_ipt::addVirtualAddress::processNext()
|
||||
|
||||
bool NATCompiler_ipt::splitRuleIfRuleElementIsDynamicInterface::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
RuleElement *re =RuleElement::cast(rule->getFirstByType(re_type));
|
||||
int nre = re->size();
|
||||
@ -934,10 +934,10 @@ bool NATCompiler_ipt::splitRuleIfRuleElementIsDynamicInterface::processNext()
|
||||
for(list<FWObject*>::iterator i=re->begin(); nre>1 && i!=re->end(); ++i)
|
||||
{
|
||||
FWObject *o= *i;
|
||||
FWObject *obj = NULL;
|
||||
if (FWReference::cast(o)!=NULL) obj=FWReference::cast(o)->getPointer();
|
||||
FWObject *obj = nullptr;
|
||||
if (FWReference::cast(o)!=nullptr) obj=FWReference::cast(o)->getPointer();
|
||||
Interface *iface=Interface::cast(obj);
|
||||
if (iface!=NULL && !iface->isRegular())
|
||||
if (iface!=nullptr && !iface->isRegular())
|
||||
{
|
||||
cl.push_back(o); // can not remove right now because remove invalidates iterator
|
||||
nre--;
|
||||
@ -974,10 +974,10 @@ bool NATCompiler_ipt::specialCaseWithUnnumberedInterface::dropUnnumberedInterfac
|
||||
{
|
||||
FWObject *o = *i1;
|
||||
FWObject *obj = o;
|
||||
if (FWReference::cast(o)!=NULL) obj=FWReference::cast(o)->getPointer();
|
||||
if (FWReference::cast(o)!=nullptr) obj=FWReference::cast(o)->getPointer();
|
||||
Interface *ifs =Interface::cast( obj );
|
||||
|
||||
if (ifs!=NULL &&
|
||||
if (ifs!=nullptr &&
|
||||
(ifs->isUnnumbered() || ifs->isBridgePort())
|
||||
) cl.push_back(obj);
|
||||
}
|
||||
@ -991,7 +991,7 @@ bool NATCompiler_ipt::specialCaseWithUnnumberedInterface::dropUnnumberedInterfac
|
||||
|
||||
bool NATCompiler_ipt::specialCaseWithUnnumberedInterface::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
bool keep_rule=true;
|
||||
switch (rule->getRuleType()) {
|
||||
case NATRule::Masq:
|
||||
@ -1014,10 +1014,10 @@ bool NATCompiler_ipt::specialCaseWithUnnumberedInterface::processNext()
|
||||
*/
|
||||
bool NATCompiler_ipt::ReplaceFirewallObjectsODst::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
bool cluster_member = compiler->fw->getOptionsObject()->getBool("cluster_member");
|
||||
Cluster *cluster = NULL;
|
||||
Cluster *cluster = nullptr;
|
||||
if (cluster_member)
|
||||
cluster = Cluster::cast(
|
||||
compiler->dbcopy->findInIndex(compiler->fw->getInt("parent_cluster_id")));
|
||||
@ -1026,7 +1026,7 @@ bool NATCompiler_ipt::ReplaceFirewallObjectsODst::processNext()
|
||||
|
||||
list<FWObject*> cl;
|
||||
RuleElementODst *rel;
|
||||
Address *obj=NULL;
|
||||
Address *obj=nullptr;
|
||||
|
||||
switch (rule->getRuleType()) {
|
||||
|
||||
@ -1035,7 +1035,7 @@ bool NATCompiler_ipt::ReplaceFirewallObjectsODst::processNext()
|
||||
return true;
|
||||
default:
|
||||
rel=rule->getODst(); assert(rel);
|
||||
obj=compiler->getFirstODst(rule); assert(obj!=NULL);
|
||||
obj=compiler->getFirstODst(rule); assert(obj!=nullptr);
|
||||
|
||||
if (obj->getId()==compiler->fw->getId() ||
|
||||
(cluster && obj->getId()==cluster->getId()))
|
||||
@ -1084,10 +1084,10 @@ bool NATCompiler_ipt::ReplaceFirewallObjectsODst::processNext()
|
||||
*/
|
||||
bool NATCompiler_ipt::ReplaceFirewallObjectsTSrc::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
bool cluster_member = compiler->fw->getOptionsObject()->getBool("cluster_member");
|
||||
Cluster *cluster = NULL;
|
||||
Cluster *cluster = nullptr;
|
||||
if (cluster_member)
|
||||
cluster = Cluster::cast(
|
||||
compiler->dbcopy->findInIndex(compiler->fw->getInt("parent_cluster_id")));
|
||||
@ -1096,7 +1096,7 @@ bool NATCompiler_ipt::ReplaceFirewallObjectsTSrc::processNext()
|
||||
|
||||
list<FWObject*> cl;
|
||||
RuleElementTSrc *rel;
|
||||
Address *obj=NULL;
|
||||
Address *obj=nullptr;
|
||||
|
||||
switch (rule->getRuleType()) {
|
||||
|
||||
@ -1105,7 +1105,7 @@ bool NATCompiler_ipt::ReplaceFirewallObjectsTSrc::processNext()
|
||||
|
||||
default:
|
||||
rel=rule->getTSrc(); assert(rel);
|
||||
obj=compiler->getFirstTSrc(rule); assert(obj!=NULL);
|
||||
obj=compiler->getFirstTSrc(rule); assert(obj!=nullptr);
|
||||
|
||||
if (obj->getId()==compiler->fw->getId() ||
|
||||
(cluster && obj->getId()==cluster->getId()))
|
||||
@ -1116,20 +1116,20 @@ bool NATCompiler_ipt::ReplaceFirewallObjectsTSrc::processNext()
|
||||
|
||||
rel->clearChildren();
|
||||
|
||||
Interface *odst_iface = NULL;
|
||||
Interface *odst_iface = nullptr;
|
||||
if (cluster)
|
||||
odst_iface = compiler->findInterfaceFor(odst, cluster);
|
||||
else
|
||||
odst_iface = compiler->findInterfaceFor(odst, compiler->fw);
|
||||
|
||||
Interface *osrc_iface = NULL;
|
||||
Interface *osrc_iface = nullptr;
|
||||
if (cluster)
|
||||
osrc_iface = compiler->findInterfaceFor(osrc, compiler->fw);
|
||||
else
|
||||
osrc_iface = compiler->findInterfaceFor(osrc, compiler->fw);
|
||||
|
||||
|
||||
if (!odst->isAny() && odst_iface!=NULL &&
|
||||
if (!odst->isAny() && odst_iface!=nullptr &&
|
||||
!odstrel->getBool("single_object_negation"))
|
||||
{
|
||||
rel->addRef(odst_iface);
|
||||
@ -1187,7 +1187,7 @@ bool NATCompiler_ipt::ReplaceFirewallObjectsTSrc::processNext()
|
||||
|
||||
bool NATCompiler_ipt::splitMultiSrcAndDst::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
RuleElementOSrv *osrv=rule->getOSrv();
|
||||
RuleElementOSrc *osrc=rule->getOSrc();
|
||||
@ -1267,7 +1267,7 @@ bool NATCompiler_ipt::splitMultiSrcAndDst::processNext()
|
||||
|
||||
bool NATCompiler_ipt::dynamicInterfaceInODst::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
@ -1276,7 +1276,7 @@ bool NATCompiler_ipt::dynamicInterfaceInODst::processNext()
|
||||
if ( ! odstrel->isAny() )
|
||||
{
|
||||
Interface *iface = Interface::cast(odst);
|
||||
if (iface!=NULL && iface->isDyn() && iface->isFailoverInterface())
|
||||
if (iface!=nullptr && iface->isDyn() && iface->isFailoverInterface())
|
||||
{
|
||||
Address *new_odst = compiler->correctForCluster(odst);
|
||||
RuleElementODst *odst_re = rule->getODst(); assert(odst_re);
|
||||
@ -1289,7 +1289,7 @@ bool NATCompiler_ipt::dynamicInterfaceInODst::processNext()
|
||||
|
||||
bool NATCompiler_ipt::dynamicInterfaceInTSrc::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
FWOptions *ruleopt =rule->getOptionsObject();
|
||||
bool use_snat = ruleopt->getBool("ipt_use_snat_instead_of_masq");
|
||||
|
||||
@ -1298,7 +1298,7 @@ bool NATCompiler_ipt::dynamicInterfaceInTSrc::processNext()
|
||||
Address *tsrc = compiler->getFirstTSrc(rule);
|
||||
|
||||
if (rule->getRuleType()==NATRule::SNAT &&
|
||||
Interface::cast(tsrc)!=NULL && !Interface::cast(tsrc)->isRegular())
|
||||
Interface::cast(tsrc)!=nullptr && !Interface::cast(tsrc)->isRegular())
|
||||
{
|
||||
Interface *iface = Interface::cast(tsrc);
|
||||
if (iface->isFailoverInterface())
|
||||
@ -1325,7 +1325,7 @@ bool NATCompiler_ipt::dynamicInterfaceInTSrc::processNext()
|
||||
|
||||
bool NATCompiler_ipt::alwaysUseMasquerading::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
FWOptions *ruleopt =rule->getOptionsObject();
|
||||
bool use_masq = ruleopt->getBool("ipt_use_masq");
|
||||
|
||||
@ -1347,7 +1347,7 @@ bool NATCompiler_ipt::alwaysUseMasquerading::processNext()
|
||||
*/
|
||||
bool NATCompiler_ipt::ExpandAddressRanges::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
@ -1368,7 +1368,7 @@ void NATCompiler_ipt::checkForDynamicInterfacesOfOtherObjects::findDynamicInterf
|
||||
if (re->isAny()) return;
|
||||
|
||||
bool cluster_member = compiler->fw->getOptionsObject()->getBool("cluster_member");
|
||||
FWObject *cluster = NULL;
|
||||
FWObject *cluster = nullptr;
|
||||
if (cluster_member)
|
||||
cluster = compiler->dbcopy->findInIndex(compiler->fw->getInt("parent_cluster_id"));
|
||||
|
||||
@ -1377,10 +1377,10 @@ void NATCompiler_ipt::checkForDynamicInterfacesOfOtherObjects::findDynamicInterf
|
||||
{
|
||||
FWObject *o = *i1;
|
||||
FWObject *obj = o;
|
||||
if (FWReference::cast(o)!=NULL) obj=FWReference::cast(o)->getPointer();
|
||||
if (FWReference::cast(o)!=nullptr) obj=FWReference::cast(o)->getPointer();
|
||||
Interface *ifs =Interface::cast( obj );
|
||||
|
||||
if (ifs!=NULL && ifs->isDyn() &&
|
||||
if (ifs!=nullptr && ifs->isDyn() &&
|
||||
! ifs->isChildOf(compiler->fw) &&
|
||||
! ifs->isChildOf(cluster))
|
||||
{
|
||||
@ -1398,7 +1398,7 @@ void NATCompiler_ipt::checkForDynamicInterfacesOfOtherObjects::findDynamicInterf
|
||||
|
||||
bool NATCompiler_ipt::checkForDynamicInterfacesOfOtherObjects::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
findDynamicInterfaces( rule->getOSrc() , rule );
|
||||
findDynamicInterfaces( rule->getODst() , rule );
|
||||
@ -1411,7 +1411,7 @@ bool NATCompiler_ipt::checkForDynamicInterfacesOfOtherObjects::processNext()
|
||||
|
||||
bool NATCompiler_ipt::prepareForMultiport::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
RuleElementOSrv *rel= rule->getOSrv();
|
||||
Service *srv= compiler->getFirstOSrv(rule);
|
||||
@ -1433,11 +1433,11 @@ bool NATCompiler_ipt::prepareForMultiport::processNext()
|
||||
{
|
||||
int n=0;
|
||||
NATRule *r;
|
||||
RuleElementOSrv *nsrv=NULL;
|
||||
RuleElementOSrv *nsrv=nullptr;
|
||||
for (FWObject::iterator i=rel->begin(); i!=rel->end(); i++)
|
||||
{
|
||||
FWObject *o= *i;
|
||||
if (FWReference::cast(o)!=NULL) o=FWReference::cast(o)->getPointer();
|
||||
if (FWReference::cast(o)!=nullptr) o=FWReference::cast(o)->getPointer();
|
||||
|
||||
Service *s=Service::cast( o );
|
||||
assert(s);
|
||||
@ -1451,7 +1451,7 @@ bool NATCompiler_ipt::prepareForMultiport::processNext()
|
||||
nsrv->clearChildren();
|
||||
tmp_queue.push_back(r);
|
||||
}
|
||||
assert(nsrv!=NULL);
|
||||
assert(nsrv!=nullptr);
|
||||
nsrv->addRef( s );
|
||||
if (++n>=15) n=0;
|
||||
}
|
||||
@ -1467,7 +1467,7 @@ bool NATCompiler_ipt::prepareForMultiport::processNext()
|
||||
|
||||
bool NATCompiler_ipt::splitMultipleICMP::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
RuleElementOSrv *rel= rule->getOSrv();
|
||||
Service *srv= compiler->getFirstOSrv(rule);
|
||||
@ -1484,7 +1484,7 @@ bool NATCompiler_ipt::splitMultipleICMP::processNext()
|
||||
for (FWObject::iterator i=rel->begin(); i!=rel->end(); i++)
|
||||
{
|
||||
FWObject *o= *i;
|
||||
if (FWReference::cast(o)!=NULL) o=FWReference::cast(o)->getPointer();
|
||||
if (FWReference::cast(o)!=nullptr) o=FWReference::cast(o)->getPointer();
|
||||
|
||||
Service *s=Service::cast( o );
|
||||
assert(s);
|
||||
@ -1504,7 +1504,7 @@ bool NATCompiler_ipt::splitMultipleICMP::processNext()
|
||||
|
||||
bool NATCompiler_ipt::doOSrcNegation::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
RuleElementOSrc *osrcrel=rule->getOSrc();
|
||||
|
||||
@ -1586,7 +1586,7 @@ bool NATCompiler_ipt::doOSrcNegation::processNext()
|
||||
|
||||
bool NATCompiler_ipt::doODstNegation::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
RuleElementODst *odstrel=rule->getODst();
|
||||
|
||||
@ -1668,7 +1668,7 @@ bool NATCompiler_ipt::doODstNegation::processNext()
|
||||
|
||||
bool NATCompiler_ipt::doOSrvNegation::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
RuleElementOSrv *osrvrel=rule->getOSrv();
|
||||
|
||||
@ -1748,7 +1748,7 @@ bool NATCompiler_ipt::doOSrvNegation::processNext()
|
||||
|
||||
bool NATCompiler_ipt::splitNONATRule::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
if ( rule->getStr("ipt_chain").empty() && rule->getRuleType()==NATRule::NONAT)
|
||||
{
|
||||
@ -1805,7 +1805,7 @@ bool NATCompiler_ipt::splitNONATRule::processNext()
|
||||
bool NATCompiler_ipt::splitNATBranchRule::processNext()
|
||||
{
|
||||
NATCompiler_ipt *ipt_comp = dynamic_cast<NATCompiler_ipt*>(compiler);
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
if ( rule->getRuleType()==NATRule::NATBranch)
|
||||
{
|
||||
@ -1899,7 +1899,7 @@ bool NATCompiler_ipt::splitNATBranchRule::processNext()
|
||||
|
||||
bool NATCompiler_ipt::localNATRule::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
// if ( rule->getStr("ipt_chain").empty())
|
||||
// {
|
||||
@ -1941,13 +1941,13 @@ bool NATCompiler_ipt::localNATRule::processNext()
|
||||
|
||||
bool NATCompiler_ipt::splitIfOSrcAny::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
/* do not split if user nailed inbound interface */
|
||||
RuleElement *itf_re = rule->getItfInb();
|
||||
assert(itf_re!=NULL);
|
||||
assert(itf_re!=nullptr);
|
||||
if (! itf_re->isAny()) return true;
|
||||
|
||||
/* do not split rules added to handle negation, these rules have "any"
|
||||
@ -1984,7 +1984,7 @@ bool NATCompiler_ipt::splitIfOSrcAny::processNext()
|
||||
*/
|
||||
bool NATCompiler_ipt::DNATforFW::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
@ -2009,7 +2009,7 @@ bool NATCompiler_ipt::DNATforFW::processNext()
|
||||
bool NATCompiler_ipt::decideOnChain::processNext()
|
||||
{
|
||||
NATCompiler_ipt *ipt_comp = dynamic_cast<NATCompiler_ipt*>(compiler);
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
@ -2053,7 +2053,7 @@ bool NATCompiler_ipt::decideOnChain::processNext()
|
||||
|
||||
bool NATCompiler_ipt::decideOnTarget::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
tmp_queue.push_back(rule);
|
||||
|
||||
@ -2124,12 +2124,12 @@ bool NATCompiler_ipt::decideOnTarget::processNext()
|
||||
bool NATCompiler_ipt::AssignInterface::processNext()
|
||||
{
|
||||
NATCompiler_ipt *ipt_comp = dynamic_cast<NATCompiler_ipt*>(compiler);
|
||||
NATRule *rule = getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule = getNext(); if (rule==nullptr) return false;
|
||||
|
||||
RuleElement *itf_re;
|
||||
|
||||
itf_re = rule->getItfInb();
|
||||
assert(itf_re!=NULL);
|
||||
assert(itf_re!=nullptr);
|
||||
|
||||
if ( ! itf_re->isAny())
|
||||
{
|
||||
@ -2138,7 +2138,7 @@ bool NATCompiler_ipt::AssignInterface::processNext()
|
||||
}
|
||||
|
||||
itf_re = rule->getItfOutb();
|
||||
assert(itf_re!=NULL);
|
||||
assert(itf_re!=nullptr);
|
||||
|
||||
if ( ! itf_re->isAny())
|
||||
{
|
||||
@ -2181,7 +2181,7 @@ bool NATCompiler_ipt::AssignInterface::processNext()
|
||||
// cluster interface or its address.
|
||||
iface = fw_iface;
|
||||
RuleElementItfOutb *itf_re = rule->getItfOutb();
|
||||
assert(itf_re!=NULL);
|
||||
assert(itf_re!=nullptr);
|
||||
if ( ! itf_re->hasRef(iface)) itf_re->addRef(iface);
|
||||
tmp_queue.push_back(rule);
|
||||
return true;
|
||||
@ -2191,7 +2191,7 @@ bool NATCompiler_ipt::AssignInterface::processNext()
|
||||
// parent is the cluster but there is no failover
|
||||
// group. This must be a copy of the member interface.
|
||||
RuleElementItfOutb *itf_re = rule->getItfOutb();
|
||||
assert(itf_re!=NULL);
|
||||
assert(itf_re!=nullptr);
|
||||
if ( ! itf_re->hasRef(iface)) itf_re->addRef(iface);
|
||||
tmp_queue.push_back(rule);
|
||||
return true;
|
||||
@ -2202,7 +2202,7 @@ bool NATCompiler_ipt::AssignInterface::processNext()
|
||||
if (iface->isChildOf(compiler->fw))
|
||||
{
|
||||
RuleElementItfOutb *itf_re = rule->getItfOutb();
|
||||
assert(itf_re!=NULL);
|
||||
assert(itf_re!=nullptr);
|
||||
if ( ! itf_re->hasRef(iface)) itf_re->addRef(iface);
|
||||
tmp_queue.push_back(rule);
|
||||
return true;
|
||||
@ -2235,7 +2235,7 @@ bool NATCompiler_ipt::AssignInterface::processNext()
|
||||
r->duplicate(rule);
|
||||
compiler->temp_ruleset->add(r);
|
||||
RuleElementItfOutb *itf_re = r->getItfOutb();
|
||||
assert(itf_re!=NULL);
|
||||
assert(itf_re!=nullptr);
|
||||
if ( ! itf_re->hasRef(itf_group)) itf_re->addRef(itf_group);
|
||||
//r->setInterfaceStr(intf_name.toStdString());
|
||||
tmp_queue.push_back(r);
|
||||
@ -2254,7 +2254,7 @@ bool NATCompiler_ipt::AssignInterface::processNext()
|
||||
|
||||
bool NATCompiler_ipt::verifyRuleWithMAC::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
RuleElementOSrc *rel = rule->getOSrc();
|
||||
if (rel->isAny())
|
||||
@ -2272,12 +2272,12 @@ bool NATCompiler_ipt::verifyRuleWithMAC::processNext()
|
||||
* Issue warning and remove physAddress from the list.
|
||||
*/
|
||||
list<FWObject*> cl;
|
||||
FWObject *pa=NULL;
|
||||
FWObject *pa=nullptr;
|
||||
for (FWObject::iterator i=rel->begin(); i!=rel->end(); i++)
|
||||
{
|
||||
FWObject *o= *i;
|
||||
FWObject *o1= o;
|
||||
if (FWReference::cast(o)!=NULL) o1=FWReference::cast(o)->getPointer();
|
||||
if (FWReference::cast(o)!=nullptr) o1=FWReference::cast(o)->getPointer();
|
||||
|
||||
if (physAddress::isA(o1))
|
||||
{
|
||||
@ -2285,7 +2285,7 @@ bool NATCompiler_ipt::verifyRuleWithMAC::processNext()
|
||||
cl.push_back(o1);
|
||||
}
|
||||
combinedAddress *ca=combinedAddress::cast(o1);
|
||||
if (ca!=NULL && ca->getPhysAddress()!="" )
|
||||
if (ca!=nullptr && ca->getPhysAddress()!="" )
|
||||
{
|
||||
/* there are two possibilities:
|
||||
* 1 - combinedAddress consists of the IPv4 component and MAC address component
|
||||
@ -2303,7 +2303,7 @@ bool NATCompiler_ipt::verifyRuleWithMAC::processNext()
|
||||
rel->removeRef( (*i1) );
|
||||
}
|
||||
|
||||
if (pa!=NULL)
|
||||
if (pa!=nullptr)
|
||||
{
|
||||
if (rel->isAny())
|
||||
{
|
||||
@ -2331,7 +2331,7 @@ bool NATCompiler_ipt::verifyRuleWithMAC::processNext()
|
||||
|
||||
bool NATCompiler_ipt::processMultiAddressObjectsInRE::processNext()
|
||||
{
|
||||
NATRule *rule=getNext(); if (rule==NULL) return false;
|
||||
NATRule *rule=getNext(); if (rule==nullptr) return false;
|
||||
|
||||
OSConfigurator_linux24 *osconf =
|
||||
dynamic_cast<OSConfigurator_linux24*>(compiler->osconfigurator);
|
||||
@ -2341,10 +2341,10 @@ bool NATCompiler_ipt::processMultiAddressObjectsInRE::processNext()
|
||||
if (re->size()==1)
|
||||
{
|
||||
FWObject *o = re->front();
|
||||
if (FWReference::cast(o)!=NULL) o = FWReference::cast(o)->getPointer();
|
||||
if (FWReference::cast(o)!=nullptr) o = FWReference::cast(o)->getPointer();
|
||||
|
||||
MultiAddressRunTime *atrt = MultiAddressRunTime::cast(o);
|
||||
if (atrt!=NULL)
|
||||
if (atrt!=nullptr)
|
||||
{
|
||||
// we have just one object in RE and this object is MutiAddressRunTime
|
||||
if (atrt->getSubstitutionTypeName()==AddressTable::TYPENAME)
|
||||
@ -2372,9 +2372,9 @@ bool NATCompiler_ipt::processMultiAddressObjectsInRE::processNext()
|
||||
for (FWObject::iterator i=re->begin(); i!=re->end(); i++)
|
||||
{
|
||||
FWObject *o= *i;
|
||||
if (FWReference::cast(o)!=NULL) o=FWReference::cast(o)->getPointer();
|
||||
if (FWReference::cast(o)!=nullptr) o=FWReference::cast(o)->getPointer();
|
||||
MultiAddressRunTime *atrt = MultiAddressRunTime::cast(o);
|
||||
if (atrt!=NULL && atrt->getSubstitutionTypeName()==AddressTable::TYPENAME)
|
||||
if (atrt!=nullptr && atrt->getSubstitutionTypeName()==AddressTable::TYPENAME)
|
||||
cl.push_back(atrt);
|
||||
}
|
||||
|
||||
@ -2671,7 +2671,7 @@ string NATCompiler_ipt::commit()
|
||||
{
|
||||
string res="";
|
||||
|
||||
if(printRule!=NULL)
|
||||
if(printRule!=nullptr)
|
||||
{
|
||||
res += printRule->_commit();
|
||||
}
|
||||
|
||||
@ -575,9 +575,9 @@ namespace fwcompiler
|
||||
NATCompiler(_db, fw, ipv6_policy, _oscnf)
|
||||
{
|
||||
have_dynamic_interfaces=false;
|
||||
printRule=NULL;
|
||||
printRule=nullptr;
|
||||
minus_n_commands = m_n_commands_map;
|
||||
branch_ruleset_to_chain_mapping = NULL;
|
||||
branch_ruleset_to_chain_mapping = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -210,7 +210,7 @@ void OSConfigurator_linux24::addVirtualAddressForNAT(const Network *nw)
|
||||
*(nw->getAddressPtr())) == virtual_addresses.end())
|
||||
{
|
||||
Interface *iface = findInterfaceFor( nw, fw );
|
||||
if (iface!=NULL)
|
||||
if (iface!=nullptr)
|
||||
{
|
||||
const InetAddr *addr = nw->getAddressPtr();
|
||||
InetAddr first, last;
|
||||
@ -253,10 +253,10 @@ void OSConfigurator_linux24::addVirtualAddressForNAT(const Address *addr)
|
||||
virtual_addresses.end(), *addr_addr) == virtual_addresses.end())
|
||||
{
|
||||
FWObject *vaddr = findAddressFor(addr, fw );
|
||||
if (vaddr!=NULL)
|
||||
if (vaddr!=nullptr)
|
||||
{
|
||||
Interface *iface = Interface::cast(vaddr->getParent());
|
||||
assert(iface!=NULL);
|
||||
assert(iface!=nullptr);
|
||||
|
||||
QStringList addresses;
|
||||
const InetAddr *vaddr_netm =
|
||||
|
||||
@ -93,9 +93,9 @@ OSConfigurator_secuwall::OSConfigurator_secuwall(FWObjectDatabase *_db,
|
||||
for (list<FWObject *>::iterator it = fw_ifaces.begin(); it != fw_ifaces.end(); it++)
|
||||
{
|
||||
Interface *iface = Interface::cast(*it);
|
||||
assert(NULL != iface);
|
||||