From e4cf4d6447fb12bdb696e3f3f9daad9cf5f859d5 Mon Sep 17 00:00:00 2001 From: Vadim Kurland Date: Thu, 9 Jun 2011 12:15:59 -0700 Subject: [PATCH] see #2494 crash happened because class ObjectSignature did not have virtual function to build signature from UserService object --- src/import/objectMaker.cpp | 96 ++++++++++++++++++++++---------------- src/import/objectMaker.h | 5 ++ 2 files changed, 61 insertions(+), 40 deletions(-) diff --git a/src/import/objectMaker.cpp b/src/import/objectMaker.cpp index 1f3704d44..440a61c70 100644 --- a/src/import/objectMaker.cpp +++ b/src/import/objectMaker.cpp @@ -49,6 +49,7 @@ #include "fwbuilder/TCPService.h" #include "fwbuilder/TagService.h" #include "fwbuilder/UDPService.h" +#include "fwbuilder/UserService.h" #include "fwbuilder/physAddress.h" #include "QStringListOperators.h" @@ -108,46 +109,6 @@ ObjectSignature::ObjectSignature(ObjectMakerErrorTracker *et) dst_port_range_end = 0; established = false; -} - -ObjectSignature::ObjectSignature(const ObjectSignature &other) -{ - error_tracker = other.error_tracker; - - type_name = other.type_name; - object_name = other.object_name; - address = other.address; - netmask = other.netmask; - address_range_start = other.address_range_start; - address_range_end = other.address_range_end; - dns_name = other.dns_name; - address_table_name = other.address_table_name; - parent_interface_name = other.parent_interface_name; - protocol = other.protocol; - fragments = other.fragments; - short_fragments = other.short_fragments; - any_opt = other.any_opt; - dscp = other.dscp; - tos = other.tos; - lsrr = other.lsrr; - ssrr = other.ssrr; - rr = other.rr; - ts = other.ts; - rtralt = other.rtralt; - rtralt_value = other.rtralt_value; - icmp_type = other.icmp_type; - icmp_code = other.icmp_code; - src_port_range_start = other.src_port_range_start; - src_port_range_end = other.src_port_range_end; - dst_port_range_start = other.dst_port_range_start; - dst_port_range_end = other.dst_port_range_end; - established = other.established; - flags_mask = other.flags_mask; - flags_comp = other.flags_comp; - platform = other.platform; - protocol_name = other.protocol_name; - code = other.code; - tag = other.tag; if (icmp_names.size() == 0) { @@ -352,6 +313,48 @@ ObjectSignature::ObjectSignature(const ObjectSignature &other) icmp_code_names["auth-fail"] = 2; icmp_code_names["decrypt-fail"] = 3; } + +} + +ObjectSignature::ObjectSignature(const ObjectSignature &other) +{ + error_tracker = other.error_tracker; + + type_name = other.type_name; + object_name = other.object_name; + address = other.address; + netmask = other.netmask; + address_range_start = other.address_range_start; + address_range_end = other.address_range_end; + dns_name = other.dns_name; + address_table_name = other.address_table_name; + parent_interface_name = other.parent_interface_name; + protocol = other.protocol; + fragments = other.fragments; + short_fragments = other.short_fragments; + any_opt = other.any_opt; + dscp = other.dscp; + tos = other.tos; + lsrr = other.lsrr; + ssrr = other.ssrr; + rr = other.rr; + ts = other.ts; + rtralt = other.rtralt; + rtralt_value = other.rtralt_value; + icmp_type = other.icmp_type; + icmp_code = other.icmp_code; + src_port_range_start = other.src_port_range_start; + src_port_range_end = other.src_port_range_end; + dst_port_range_start = other.dst_port_range_start; + dst_port_range_end = other.dst_port_range_end; + established = other.established; + flags_mask = other.flags_mask; + flags_comp = other.flags_comp; + platform = other.platform; + protocol_name = other.protocol_name; + code = other.code; + tag = other.tag; + user_id = other.user_id; } void ObjectSignature::setAddress(const QString &s) @@ -794,6 +797,9 @@ QString ObjectSignature::toString() const type_name == ObjectGroup::TYPENAME) sig << group_children_ids; + if (type_name == UserService::TYPENAME) + sig << protocol_name << user_id; + return sig.join("||"); } @@ -969,6 +975,16 @@ void* ObjectSignature::dispatch(DNSName *obj, void*) return this; } +void* ObjectSignature::dispatch(UserService *obj, void*) +{ + object_name = QString::fromUtf8(obj->getName().c_str()); + type_name = obj->getTypeName().c_str(); + protocol_name = obj->getProtocolName().c_str(); + user_id = obj->getUserId().c_str(); + return this; +} + + void* ObjectSignature::dispatch(AttachedNetworks *obj, void*) { object_name = QString::fromUtf8(obj->getName().c_str()); diff --git a/src/import/objectMaker.h b/src/import/objectMaker.h index 6ad6d37e2..51023ed8a 100644 --- a/src/import/objectMaker.h +++ b/src/import/objectMaker.h @@ -56,6 +56,7 @@ namespace libfwbuilder class TagService; class UDPService; class physAddress; + class UserService; }; @@ -151,6 +152,9 @@ public: QList group_children_ids; + // UserService + QString user_id; + // convenience methods that populate various attributes from // strings taken from imported configs void setAddress(const QString &s); @@ -216,6 +220,7 @@ public: virtual void* dispatch(libfwbuilder::ObjectGroup*, void*); virtual void* dispatch(libfwbuilder::ServiceGroup*, void*); virtual void* dispatch(libfwbuilder::AttachedNetworks*, void*); + virtual void* dispatch(libfwbuilder::UserService*, void*); };