mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-03-21 10:47:16 +01:00
merged latest changes from development
This commit is contained in:
commit
6b41cb4489
@ -1,3 +1,29 @@
|
||||
2011-04-30 vadim <vadim@netcitadel.com>
|
||||
|
||||
* RuleSetModel.cpp (objectChanged): see #2373 "GUI becomes
|
||||
unresponsive for a long time when an object that is used in a
|
||||
large number of rules is modified". The program spent too much
|
||||
time resizing rule set view columns.
|
||||
|
||||
2011-04-29 vadim <vadim@netcitadel.com>
|
||||
|
||||
* UsageResolver.cpp (findFirewallsForObject): see #2373 "GUI
|
||||
becomes unresponsive for a long time when an object that is used
|
||||
in a large number of rules is modified". This bug only affected
|
||||
configurations with very large rule sets (1500 rules) where lots
|
||||
of rules used the same object. The change in UsageResolver
|
||||
eliminates unnecessary scanning of all rule sets to check if the
|
||||
affected rule set might be used as a branch. The program used to
|
||||
scan the same objects many times.
|
||||
|
||||
* iosaclAdvancedDialog.cpp (accept): fixes #2368 and SF bug
|
||||
3294457 "External install script". External install script name
|
||||
and arguments weren't saved for IOS firewall objects.
|
||||
|
||||
* snmpNetworkDiscoveryWizard/ND_ProgressPage.h: fixes #2370, #2371
|
||||
"broken signals in network discovery wizard". Network discovery
|
||||
wizard was not correctly initializased and did not work.
|
||||
|
||||
2011-04-25 Vadim Kurland <vadim@netcitadel.com>
|
||||
|
||||
* instDialog_ui_ops.cpp (readInstallerOptionsFromDialog):
|
||||
|
||||
@ -43,20 +43,8 @@
|
||||
#include "fwbuilder/AddressTable.h"
|
||||
#include "fwbuilder/Cluster.h"
|
||||
|
||||
#include <iostream>
|
||||
#if __GNUC__ > 3 || \
|
||||
(__GNUC__ == 3 && (__GNUC_MINOR__ > 2 || (__GNUC_MINOR__ == 2 ) ) ) || \
|
||||
_MSC_VER
|
||||
# include <streambuf>
|
||||
#else
|
||||
# include <streambuf.h>
|
||||
#endif
|
||||
#include <iomanip>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <assert.h>
|
||||
#include <cctype>
|
||||
|
||||
using namespace libfwbuilder;
|
||||
using namespace fwcompiler;
|
||||
|
||||
@ -43,18 +43,6 @@
|
||||
#include "fwbuilder/TCPService.h"
|
||||
#include "fwbuilder/UDPService.h"
|
||||
|
||||
#include <iostream>
|
||||
#if __GNUC__ > 3 || \
|
||||
(__GNUC__ == 3 && (__GNUC_MINOR__ > 2 || (__GNUC_MINOR__ == 2 ) ) ) || \
|
||||
_MSC_VER
|
||||
# include <streambuf>
|
||||
#else
|
||||
# include <streambuf.h>
|
||||
#endif
|
||||
#include <iomanip>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
using namespace libfwbuilder;
|
||||
|
||||
@ -46,23 +46,8 @@
|
||||
#include "fwbuilder/Resources.h"
|
||||
#include "fwbuilder/AddressTable.h"
|
||||
|
||||
#include <iostream>
|
||||
#if __GNUC__ > 3 || \
|
||||
(__GNUC__ == 3 && (__GNUC_MINOR__ > 2 || (__GNUC_MINOR__ == 2 ) ) ) || \
|
||||
_MSC_VER
|
||||
# include <streambuf>
|
||||
#else
|
||||
# include <streambuf.h>
|
||||
#endif
|
||||
#include <iomanip>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <QString>
|
||||
|
||||
|
||||
using namespace libfwbuilder;
|
||||
using namespace fwcompiler;
|
||||
using namespace std;
|
||||
|
||||
@ -26,21 +26,7 @@
|
||||
#include "fwbuilder/Firewall.h"
|
||||
#include "fwbuilder/Network.h"
|
||||
|
||||
#include <stack>
|
||||
|
||||
#include <iostream>
|
||||
#if __GNUC__ > 3 || \
|
||||
(__GNUC__ == 3 && (__GNUC_MINOR__ > 2 || (__GNUC_MINOR__ == 2 ) ) ) || \
|
||||
_MSC_VER
|
||||
# include <streambuf>
|
||||
#else
|
||||
# include <streambuf.h>
|
||||
#endif
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
using namespace libfwbuilder;
|
||||
|
||||
@ -29,19 +29,6 @@
|
||||
#include "fwbuilder/Firewall.h"
|
||||
#include "fwbuilder/FWOptions.h"
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#if __GNUC__ > 3 || \
|
||||
(__GNUC__ == 3 && (__GNUC_MINOR__ > 2 || (__GNUC_MINOR__ == 2 ) ) ) || \
|
||||
_MSC_VER
|
||||
# include <streambuf>
|
||||
#else
|
||||
# include <streambuf.h>
|
||||
#endif
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
using namespace libfwbuilder;
|
||||
|
||||
@ -35,21 +35,7 @@
|
||||
#include "fwbuilder/Firewall.h"
|
||||
#include "fwbuilder/Network.h"
|
||||
|
||||
#include <stack>
|
||||
|
||||
#include <iostream>
|
||||
#if __GNUC__ > 3 || \
|
||||
(__GNUC__ == 3 && (__GNUC_MINOR__ > 2 || (__GNUC_MINOR__ == 2 ) ) ) || \
|
||||
_MSC_VER
|
||||
# include <streambuf>
|
||||
#else
|
||||
# include <streambuf.h>
|
||||
#endif
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
using namespace libfwbuilder;
|
||||
|
||||
@ -38,19 +38,6 @@
|
||||
#include "fwbuilder/Firewall.h"
|
||||
#include "fwbuilder/FWOptions.h"
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#if __GNUC__ > 3 || \
|
||||
(__GNUC__ == 3 && (__GNUC_MINOR__ > 2 || (__GNUC_MINOR__ == 2 ) ) ) || \
|
||||
_MSC_VER
|
||||
# include <streambuf>
|
||||
#else
|
||||
# include <streambuf.h>
|
||||
#endif
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
using namespace libfwbuilder;
|
||||
|
||||
@ -24,21 +24,6 @@
|
||||
#include "fwbuilder/Firewall.h"
|
||||
#include "fwbuilder/Network.h"
|
||||
|
||||
#include <stack>
|
||||
|
||||
#include <iostream>
|
||||
#if __GNUC__ > 3 || \
|
||||
(__GNUC__ == 3 && (__GNUC_MINOR__ > 2 || (__GNUC_MINOR__ == 2 ) ) ) || \
|
||||
_MSC_VER
|
||||
# include <streambuf>
|
||||
#else
|
||||
# include <streambuf.h>
|
||||
#endif
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
using namespace libfwbuilder;
|
||||
|
||||
@ -28,19 +28,6 @@
|
||||
#include "fwbuilder/Firewall.h"
|
||||
#include "fwbuilder/FWOptions.h"
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#if __GNUC__ > 3 || \
|
||||
(__GNUC__ == 3 && (__GNUC_MINOR__ > 2 || (__GNUC_MINOR__ == 2 ) ) ) || \
|
||||
_MSC_VER
|
||||
# include <streambuf>
|
||||
#else
|
||||
# include <streambuf.h>
|
||||
#endif
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
using namespace libfwbuilder;
|
||||
|
||||
@ -462,9 +462,8 @@ void CompilerDriver::commonChecks2(Cluster *cluster, Firewall *fw)
|
||||
|
||||
if (!iface->isDyn())
|
||||
{
|
||||
char errstr[256];
|
||||
sprintf(errstr,
|
||||
_("Wildcard interface '%s' must be dynamic."),
|
||||
QString errstr;
|
||||
errstr.sprintf(_("Wildcard interface '%s' must be dynamic."),
|
||||
iface->getName().c_str() );
|
||||
throw FWException(errstr);
|
||||
}
|
||||
|
||||
@ -46,18 +46,6 @@
|
||||
|
||||
#include "combinedAddress.h"
|
||||
|
||||
#include <iostream>
|
||||
#if __GNUC__ > 3 || \
|
||||
(__GNUC__ == 3 && (__GNUC_MINOR__ > 2 || (__GNUC_MINOR__ == 2 ) ) ) || \
|
||||
_MSC_VER
|
||||
# include <streambuf>
|
||||
#else
|
||||
# include <streambuf.h>
|
||||
#endif
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <QString>
|
||||
|
||||
@ -29,18 +29,6 @@
|
||||
#include "fwbuilder/Rule.h"
|
||||
#include "fwbuilder/Resources.h"
|
||||
|
||||
#include <iostream>
|
||||
#if __GNUC__ > 3 || \
|
||||
(__GNUC__ == 3 && (__GNUC_MINOR__ > 2 || (__GNUC_MINOR__ == 2 ) ) ) || \
|
||||
_MSC_VER
|
||||
# include <streambuf>
|
||||
#else
|
||||
# include <streambuf.h>
|
||||
#endif
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
@ -29,18 +29,6 @@
|
||||
#include "fwbuilder/Rule.h"
|
||||
#include "fwbuilder/Resources.h"
|
||||
|
||||
#include <iostream>
|
||||
#if __GNUC__ > 3 || \
|
||||
(__GNUC__ == 3 && (__GNUC_MINOR__ > 2 || (__GNUC_MINOR__ == 2 ) ) ) || \
|
||||
_MSC_VER
|
||||
# include <streambuf>
|
||||
#else
|
||||
# include <streambuf.h>
|
||||
#endif
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
using namespace libfwbuilder;
|
||||
|
||||
@ -59,13 +59,6 @@
|
||||
#include <QRegExp>
|
||||
|
||||
#include <iostream>
|
||||
#if __GNUC__ > 3 || \
|
||||
(__GNUC__ == 3 && (__GNUC_MINOR__ > 2 || (__GNUC_MINOR__ == 2 ) ) ) || \
|
||||
_MSC_VER
|
||||
# include <streambuf>
|
||||
#else
|
||||
# include <streambuf.h>
|
||||
#endif
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
@ -30,13 +30,6 @@
|
||||
#include "fwbuilder/Resources.h"
|
||||
|
||||
#include <iostream>
|
||||
#if __GNUC__ > 3 || \
|
||||
(__GNUC__ == 3 && (__GNUC_MINOR__ > 2 || (__GNUC_MINOR__ == 2 ) ) ) || \
|
||||
_MSC_VER
|
||||
# include <streambuf>
|
||||
#else
|
||||
# include <streambuf.h>
|
||||
#endif
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
@ -30,13 +30,6 @@
|
||||
#include "fwbuilder/Resources.h"
|
||||
|
||||
#include <iostream>
|
||||
#if __GNUC__ > 3 || \
|
||||
(__GNUC__ == 3 && (__GNUC_MINOR__ > 2 || (__GNUC_MINOR__ == 2 ) ) ) || \
|
||||
_MSC_VER
|
||||
# include <streambuf>
|
||||
#else
|
||||
# include <streambuf.h>
|
||||
#endif
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
@ -39,21 +39,6 @@
|
||||
#include "fwbuilder/Firewall.h"
|
||||
#include "fwbuilder/Network.h"
|
||||
|
||||
#include <stack>
|
||||
|
||||
#include <iostream>
|
||||
#if __GNUC__ > 3 || \
|
||||
(__GNUC__ == 3 && (__GNUC_MINOR__ > 2 || (__GNUC_MINOR__ == 2 ) ) ) || \
|
||||
_MSC_VER
|
||||
# include <streambuf>
|
||||
#else
|
||||
# include <streambuf.h>
|
||||
#endif
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
using namespace libfwbuilder;
|
||||
|
||||
@ -99,6 +99,7 @@ using namespace libfwbuilder;
|
||||
int id_seed = 1000;
|
||||
#ifdef _WIN32
|
||||
static int cached_pid = _getpid();
|
||||
#define snprintf sprintf_s
|
||||
#else
|
||||
static int cached_pid = getpid();
|
||||
#endif
|
||||
@ -211,7 +212,7 @@ string FWObjectDatabase::getStringId(int i_id)
|
||||
|
||||
// TODO: Use proper GUID algorithm here
|
||||
char id_buf[64];
|
||||
sprintf(id_buf, "id%dX%d", i_id, cached_pid);
|
||||
snprintf(id_buf, sizeof(id_buf), "id%dX%d", i_id, cached_pid);
|
||||
id_dict[i_id] = string(id_buf);
|
||||
id_dict_reverse[string(id_buf)] = i_id;
|
||||
return id_dict[i_id];
|
||||
|
||||
@ -48,6 +48,9 @@
|
||||
using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
|
||||
#ifdef _WIN32
|
||||
#define snprintf sprintf_s
|
||||
#endif
|
||||
|
||||
class FWObjectTreeScanner {
|
||||
|
||||
@ -492,7 +495,7 @@ FWObject* FWObjectDatabase::recursivelyCopySubtree(FWObject *target,
|
||||
std::map<int,int> &id_map)
|
||||
{
|
||||
char s[64];
|
||||
sprintf(s, ".copy_of_%p", source->getRoot());
|
||||
snprintf(s, sizeof(s), ".copy_of_%p", source->getRoot());
|
||||
string dedup_attribute = s;
|
||||
|
||||
FWObject *nobj = _recursively_copy_subtree(target, source, id_map,
|
||||
@ -599,7 +602,7 @@ FWObject* FWObjectDatabase::_recursively_copy_subtree(
|
||||
|
||||
// Check if we have already copied the same object before
|
||||
char s[64];
|
||||
sprintf(s, "%d", old_ptr_obj->getId());
|
||||
snprintf(s, sizeof(s), "%d", old_ptr_obj->getId());
|
||||
n_ptr_obj = findObjectByAttribute(dedup_attribute, s);
|
||||
if (n_ptr_obj)
|
||||
{
|
||||
|
||||
@ -33,6 +33,10 @@
|
||||
using namespace libfwbuilder;
|
||||
using namespace std;
|
||||
|
||||
#ifdef _WIN32
|
||||
#define snprintf sprintf_s
|
||||
#endif
|
||||
|
||||
const char *TCPUDPService::TYPENAME={"TCPUDPService"};
|
||||
|
||||
TCPUDPService::TCPUDPService()
|
||||
@ -93,14 +97,14 @@ xmlNodePtr TCPUDPService::toXML(xmlNodePtr xml_parent_node) throw(FWException)
|
||||
|
||||
char str[128];
|
||||
|
||||
sprintf(str,"%d",src_range_start);
|
||||
snprintf(str, sizeof(str), "%d", src_range_start);
|
||||
xmlNewProp(me, TOXMLCAST("src_range_start"), TOXMLCAST(str));
|
||||
sprintf(str,"%d",src_range_end);
|
||||
snprintf(str, sizeof(str), "%d", src_range_end);
|
||||
xmlNewProp(me, TOXMLCAST("src_range_end"), TOXMLCAST(str));
|
||||
|
||||
sprintf(str,"%d",dst_range_start);
|
||||
snprintf(str, sizeof(str), "%d", dst_range_start);
|
||||
xmlNewProp(me, TOXMLCAST("dst_range_start"), TOXMLCAST(str));
|
||||
sprintf(str,"%d",dst_range_end);
|
||||
snprintf(str, sizeof(str), "%d", dst_range_end);
|
||||
xmlNewProp(me, TOXMLCAST("dst_range_end"), TOXMLCAST(str));
|
||||
|
||||
return me;
|
||||
|
||||
@ -60,6 +60,10 @@
|
||||
#include <sstream>
|
||||
#include <iterator>
|
||||
|
||||
#ifdef _WIN32
|
||||
#define snprintf sprintf_s
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Define this if you need extra debug output.
|
||||
*/
|
||||
@ -69,18 +73,19 @@ using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
|
||||
/* Compiled OIDs */
|
||||
const char *SNMPQuery::SNMP_INTERFACE_ASTATUS= ".1.3.6.1.2.1.2.2.1.7";
|
||||
const char *SNMPQuery::SNMP_INTERFACE_OSTATUS= ".1.3.6.1.2.1.2.2.1.8";
|
||||
const char *SNMPQuery::SNMP_INTERFACE_INDEX = ".1.3.6.1.2.1.2.2.1.1";
|
||||
const char *SNMPQuery::SNMP_INTERFACES_DESCR = ".1.3.6.1.2.1.2.2.1.2";
|
||||
const char *SNMPQuery::SNMP_INTERFACES_PHYSA = ".1.3.6.1.2.1.2.2.1.6";
|
||||
const char *SNMPQuery::SNMP_INTERFACES_TYPE = ".1.3.6.1.2.1.2.2.1.3";
|
||||
const char *SNMPQuery::SNMP_ADDR_INDEX_TABLE = ".1.3.6.1.2.1.4.20.1.2";
|
||||
const char *SNMPQuery::SNMP_NMASK_TABLE = ".1.3.6.1.2.1.4.20.1.3";
|
||||
const char *SNMPQuery::SNMP_ADDR_TABLE = ".1.3.6.1.2.1.4.20.1.1";
|
||||
const char *SNMPQuery::SNMP_BCAST_TABLE = ".1.3.6.1.2.1.4.20.1.4";
|
||||
const char *SNMPQuery::SNMP_AT_TABLE_NET = ".1.3.6.1.2.1.3.1.1.3";
|
||||
const char *SNMPQuery::SNMP_AT_TABLE_PHYS = ".1.3.6.1.2.1.3.1.1.2";
|
||||
/* We use #define so the compiler can do string concatenation for snprintf */
|
||||
#define SNMP_INTERFACE_ASTATUS ".1.3.6.1.2.1.2.2.1.7"
|
||||
#define SNMP_INTERFACE_OSTATUS ".1.3.6.1.2.1.2.2.1.8"
|
||||
#define SNMP_INTERFACE_INDEX ".1.3.6.1.2.1.2.2.1.1"
|
||||
#define SNMP_INTERFACES_DESCR ".1.3.6.1.2.1.2.2.1.2"
|
||||
#define SNMP_INTERFACES_PHYSA ".1.3.6.1.2.1.2.2.1.6"
|
||||
#define SNMP_INTERFACES_TYPE ".1.3.6.1.2.1.2.2.1.3"
|
||||
#define SNMP_ADDR_INDEX_TABLE ".1.3.6.1.2.1.4.20.1.2"
|
||||
#define SNMP_NMASK_TABLE ".1.3.6.1.2.1.4.20.1.3"
|
||||
#define SNMP_ADDR_TABLE ".1.3.6.1.2.1.4.20.1.1"
|
||||
#define SNMP_BCAST_TABLE ".1.3.6.1.2.1.4.20.1.4"
|
||||
#define SNMP_AT_TABLE_NET ".1.3.6.1.2.1.3.1.1.3"
|
||||
#define SNMP_AT_TABLE_PHYS ".1.3.6.1.2.1.3.1.1.2"
|
||||
|
||||
const char *SNMPQuery::SNMP_SYSNAME = ".1.3.6.1.2.1.1.5.0";
|
||||
const char *SNMPQuery::SNMP_SYSDESCR = ".1.3.6.1.2.1.1.1.0";
|
||||
@ -648,7 +653,7 @@ void SNMPQuery::fetchInterfaces(Logger *logger, SyncFlag *stop_program,
|
||||
char oid[1024];
|
||||
|
||||
// Get admin status
|
||||
sprintf(oid, "%s.%ld", SNMP_INTERFACE_ASTATUS , ifindex);
|
||||
snprintf(oid, sizeof(oid), SNMP_INTERFACE_ASTATUS ".%ld", ifindex);
|
||||
v=c->get(oid);
|
||||
if(v.size()!=1)
|
||||
throw FWException(
|
||||
@ -667,7 +672,7 @@ void SNMPQuery::fetchInterfaces(Logger *logger, SyncFlag *stop_program,
|
||||
}
|
||||
|
||||
// Get operational status
|
||||
sprintf(oid, "%s.%ld", SNMP_INTERFACE_OSTATUS , ifindex);
|
||||
snprintf(oid, sizeof(oid), SNMP_INTERFACE_OSTATUS ".%ld", ifindex);
|
||||
v=c->get(oid);
|
||||
if(v.size()!=1)
|
||||
throw FWException(
|
||||
@ -679,7 +684,7 @@ void SNMPQuery::fetchInterfaces(Logger *logger, SyncFlag *stop_program,
|
||||
/* gather all information for interface ifindex and create Interface object */
|
||||
|
||||
// Get desriptions
|
||||
sprintf(oid,"%s.%ld", SNMP_INTERFACES_DESCR , ifindex);
|
||||
snprintf(oid, sizeof(oid), SNMP_INTERFACES_DESCR ".%ld", ifindex);
|
||||
v=c->get(oid);
|
||||
string descr = SNMPVariable::varList2String(v);
|
||||
SNMPVariable::freeVarList(v);
|
||||
@ -687,7 +692,7 @@ void SNMPQuery::fetchInterfaces(Logger *logger, SyncFlag *stop_program,
|
||||
list<string> &addlist = addr[ifindex];
|
||||
|
||||
// Get physical address
|
||||
sprintf(oid, "%s.%ld", SNMP_INTERFACES_PHYSA , ifindex);
|
||||
snprintf(oid, sizeof(oid), SNMP_INTERFACES_PHYSA ".%ld", ifindex);
|
||||
v=c->get(oid);
|
||||
if(v.size()!=1)
|
||||
throw FWException(string("Unexpected response length for OID: ")+oid);
|
||||
@ -697,7 +702,7 @@ void SNMPQuery::fetchInterfaces(Logger *logger, SyncFlag *stop_program,
|
||||
SNMPVariable::freeVarList(v);
|
||||
|
||||
// Get type
|
||||
sprintf(oid,"%s.%ld", SNMP_INTERFACES_TYPE , ifindex);
|
||||
snprintf(oid, sizeof(oid), SNMP_INTERFACES_TYPE ".%ld", ifindex);
|
||||
v=c->get(oid);
|
||||
if(v.size()!=1)
|
||||
throw FWException(string("Unexpected response length for OID: ")+oid);
|
||||
@ -1124,7 +1129,7 @@ SNMPVariable *SNMPVariable::create(struct variable_list *vars) throw(FWException
|
||||
return new SNMPVariable_IPaddr(vars->val.string, vars->val_len);
|
||||
default:
|
||||
char x[32];
|
||||
sprintf(x, "%d", (int)vars->type);
|
||||
snprintf(x, sizeof(x), "%d", (int)vars->type);
|
||||
throw FWException(string("Unknown SNMP variable type: ") + x);
|
||||
}
|
||||
}
|
||||
@ -1132,7 +1137,7 @@ SNMPVariable *SNMPVariable::create(struct variable_list *vars) throw(FWException
|
||||
string SNMPVariable_Int::toString()
|
||||
{
|
||||
char x[32];
|
||||
sprintf(x, "%ld", value);
|
||||
snprintf(x, sizeof(x), "%ld", value);
|
||||
return x;
|
||||
}
|
||||
|
||||
@ -1143,10 +1148,10 @@ string SNMPVariable_Bits::toString()
|
||||
{
|
||||
res += ".";
|
||||
|
||||
char x[8];
|
||||
char x[12];
|
||||
//TODO: now we print it in hex
|
||||
// we should print it in binary.
|
||||
sprintf(x, "%d", (uint32_t)value[i]);
|
||||
snprintf(x, sizeof(x), "%d", (uint32_t)value[i]);
|
||||
//i += 4;
|
||||
res += x;
|
||||
}
|
||||
@ -1160,8 +1165,8 @@ string SNMPVariable_IPaddr::toString()
|
||||
{
|
||||
if(i)
|
||||
res+=".";
|
||||
char x[8];
|
||||
sprintf(x,"%d", (unsigned int)value[i]);
|
||||
char x[12];
|
||||
snprintf(x, sizeof(x), "%d", (unsigned int)value[i]);
|
||||
res+=x;
|
||||
}
|
||||
res+="]";
|
||||
@ -1205,7 +1210,7 @@ const string SNMPVariable_String::toHexString()
|
||||
res+=':';
|
||||
u_char c=value[i];
|
||||
char buf[16];
|
||||
sprintf(buf,"%02X",(unsigned int)c);
|
||||
snprintf(buf, sizeof(buf), "%02X", (unsigned int)c);
|
||||
res+=buf;
|
||||
}
|
||||
return res;
|
||||
@ -1214,14 +1219,14 @@ const string SNMPVariable_String::toHexString()
|
||||
string SNMPVariable_Counter64::toString()
|
||||
{
|
||||
char x[70];
|
||||
sprintf(x,"[%ld:%ld]", (long)low, (long)high);
|
||||
snprintf(x, sizeof(x), "[%ld:%ld]", (long)low, (long)high);
|
||||
return x;
|
||||
}
|
||||
|
||||
string SNMPVariable_OID::toString()
|
||||
{
|
||||
char x[32];
|
||||
sprintf(x,"%ld", (long)value);
|
||||
snprintf(x, sizeof(x), "%ld", (long)value);
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
@ -1026,7 +1026,9 @@ void FWWindow::prepareFileMenu()
|
||||
|
||||
void FWWindow::prepareToolsMenu()
|
||||
{
|
||||
#ifndef HAVE_LIBSNMP
|
||||
#ifdef HAVE_LIBSNMP
|
||||
m_mainWindow->SNMPDiscoveryAction->setEnabled(true);
|
||||
#else
|
||||
m_mainWindow->SNMPDiscoveryAction->setEnabled(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1245,7 +1245,7 @@ void ObjectManipulator::showObjectInTree(ObjectTreeViewItem *otvi)
|
||||
m_objectManipulator->widgetStack->setCurrentWidget(otv);
|
||||
|
||||
otvi->getTree()->clearSelection();
|
||||
otvi->getTree()->scrollToItem(otvi, QAbstractItemView::PositionAtCenter);
|
||||
otvi->getTree()->scrollToItem(otvi);
|
||||
otvi->getTree()->setCurrentItem(otvi);
|
||||
otvi->setSelected(true);
|
||||
otvi->getTree()->setFocus(Qt::OtherFocusReason);
|
||||
|
||||
@ -231,13 +231,15 @@ void ObjectManipulator::pasteObj()
|
||||
continue;
|
||||
|
||||
// Check if we have already copied the same object before
|
||||
char s[64];
|
||||
sprintf(s, ".copy_of_%p", co->getRoot());
|
||||
string dedup_attribute = s;
|
||||
QString buff;
|
||||
buff.sprintf(".copy_of_%p", co->getRoot());
|
||||
string dedup_attribute = buff.toAscii().constData();
|
||||
|
||||
sprintf(s, "%d", co->getId());
|
||||
buff.sprintf("%d", co->getId());
|
||||
QByteArray bytes = buff.toAscii();
|
||||
FWObject *n_obj =
|
||||
target_object->getRoot()->findObjectByAttribute(dedup_attribute, s);
|
||||
target_object->getRoot()->findObjectByAttribute(dedup_attribute,
|
||||
bytes.constData());
|
||||
if (n_obj) continue;
|
||||
|
||||
last_object = actuallyPasteTo(target_object, co, map_ids);
|
||||
|
||||
@ -132,7 +132,7 @@ ObjectTreeView::ObjectTreeView(ProjectPanel* project,
|
||||
|
||||
//header()->hide();
|
||||
|
||||
header()->setDefaultAlignment(Qt::AlignHCenter);
|
||||
header()->setDefaultAlignment(Qt::AlignLeft);
|
||||
header()->setResizeMode(QHeaderView::Interactive);
|
||||
|
||||
showOrHideAttributesColumn();
|
||||
|
||||
@ -1246,18 +1246,31 @@ int RuleSetModel::getRulePosition(QModelIndex index)
|
||||
|
||||
void RuleSetModel::objectChanged(FWObject* object)
|
||||
{
|
||||
/*
|
||||
* See #2373
|
||||
*
|
||||
* Signal dataChanged() is connected to the slot
|
||||
* RuleSetView::updateAllColumnsSize() that just calls resizeColumns()
|
||||
* and does not do anything different depending on the model
|
||||
* index. Can just call it once using different signal.
|
||||
|
||||
QModelIndexList relatedIndexes = findObject(object);
|
||||
|
||||
if (fwbdebug)
|
||||
qDebug() << "RuleSetModel::objectChanged"
|
||||
<< "object=" << object->getName().c_str()
|
||||
<< "relatedIndexes.size()=" << relatedIndexes.size();
|
||||
|
||||
foreach(QModelIndex index, relatedIndexes)
|
||||
{
|
||||
emit dataChanged(index, index);
|
||||
}
|
||||
*/
|
||||
emit layoutChanged();
|
||||
}
|
||||
|
||||
QModelIndexList RuleSetModel::findObject (FWObject* object)
|
||||
QModelIndexList RuleSetModel::findObject(FWObject* object)
|
||||
{
|
||||
// qDebug() << "RuleSetModel::findObject (FWObject* object)";
|
||||
// qDebug() << "object:" << ((object)?QString::fromUtf8(object->getName().c_str()):"null");
|
||||
QModelIndexList list;
|
||||
|
||||
RuleSetModelIterator it = begin();
|
||||
@ -1270,13 +1283,11 @@ QModelIndexList RuleSetModel::findObject (FWObject* object)
|
||||
|
||||
if (node->type == RuleNode::Group)
|
||||
{
|
||||
// qDebug() << "Group: " << node->name;
|
||||
++it;
|
||||
continue;
|
||||
}
|
||||
|
||||
Rule* rule = node->rule;
|
||||
// qDebug() << "Rule " << rule->getPosition();
|
||||
|
||||
// iterate through columns
|
||||
int column = 0;
|
||||
@ -1287,7 +1298,8 @@ QModelIndexList RuleSetModel::findObject (FWObject* object)
|
||||
if (colDesc.type == ColDesc::Object || colDesc.type == ColDesc::Time)
|
||||
{
|
||||
// try to find the object
|
||||
RuleElement* re = getRuleElementByRole(rule, colDesc.origin.toStdString());
|
||||
RuleElement* re = getRuleElementByRole(
|
||||
rule, colDesc.origin.toStdString());
|
||||
if (re->isAny()) continue;
|
||||
|
||||
for (FWObject::iterator i=re->begin(); i!=re->end(); i++)
|
||||
@ -1314,14 +1326,12 @@ QModelIndexList RuleSetModel::findObject (FWObject* object)
|
||||
if (pr->getBranch() == object)
|
||||
{
|
||||
list.append(this->index(rule, column));
|
||||
// qDebug() << "Branch column:" << column;
|
||||
}
|
||||
} else if (pr->getTagging())
|
||||
{
|
||||
if (pr->getTagObject() == object)
|
||||
{
|
||||
list.append(this->index(rule, column));
|
||||
// qDebug() << "Tag column:" << column;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -381,7 +381,8 @@ QPixmap RuleSetViewDelegate::getPixmap(QString name, PixmapAttr pmattr) const
|
||||
return pm;
|
||||
}
|
||||
|
||||
QSize RuleSetViewDelegate::sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const
|
||||
QSize RuleSetViewDelegate::sizeHint(const QStyleOptionViewItem & option,
|
||||
const QModelIndex & index) const
|
||||
{
|
||||
QStyleOptionViewItem newOpt = option;
|
||||
QFont font = st->getRulesFont();
|
||||
|
||||
@ -84,9 +84,8 @@ StartTipDialog::StartTipDialog(QWidget *parent): QDialog(parent)
|
||||
int tip_no = 1;
|
||||
while (true)
|
||||
{
|
||||
char buf[64];
|
||||
sprintf(buf, "tip%02d.html", tip_no);
|
||||
QString tip_file = QString(buf);
|
||||
QString tip_file;
|
||||
tip_file.sprintf("tip%02d.html", tip_no);
|
||||
QString contents;
|
||||
if (fwbdebug)
|
||||
qDebug("Trying tip file %s", tip_file.toAscii().constData());
|
||||
|
||||
@ -36,6 +36,8 @@
|
||||
#include "fwbuilder/Interface.h"
|
||||
#include "fwbuilder/FWOptions.h"
|
||||
#include "fwbuilder/Management.h"
|
||||
#include "fwbuilder/RuleSet.h"
|
||||
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@ -124,7 +126,8 @@ void UsageResolver::findWhereUsedRecursively(
|
||||
}
|
||||
}
|
||||
|
||||
list<Firewall*> UsageResolver::findFirewallsForObject(FWObject *o, FWObjectDatabase *db)
|
||||
list<Firewall*> UsageResolver::findFirewallsForObject(FWObject *o,
|
||||
FWObjectDatabase *db)
|
||||
{
|
||||
if (fwbdebug)
|
||||
qDebug("UsageResolver::findFirewallsForObject");
|
||||
@ -156,7 +159,17 @@ list<Firewall*> UsageResolver::findFirewallsForObject(FWObject *o, FWObjectDatab
|
||||
}
|
||||
}
|
||||
|
||||
set<FWObject *>::iterator i = resset.begin();
|
||||
// whenever we find that a rule has been modified by the change in
|
||||
// the object @o, we record rule set it belongs to. We should scan
|
||||
// other rule sets to see if some rule somewhere might be using
|
||||
// one of the rule sets that changed as a branch. However in a
|
||||
// common situation where many rules of the same rule set are
|
||||
// affected, it won't make sense to search for the dependencies on
|
||||
// the same rule set many times.
|
||||
|
||||
set<RuleSet*> modified_rule_sets;
|
||||
|
||||
set<FWObject*>::iterator i = resset.begin();
|
||||
for ( ;i!=resset.end(); ++i)
|
||||
{
|
||||
FWObject *obj = *i;
|
||||
@ -169,9 +182,6 @@ list<Firewall*> UsageResolver::findFirewallsForObject(FWObject *o, FWObjectDatab
|
||||
{
|
||||
obj = ref->getParent();
|
||||
}
|
||||
|
||||
// else
|
||||
// continue;
|
||||
|
||||
Rule *r = Rule::cast(obj);
|
||||
if (r == NULL) r = Rule::cast(obj->getParent());
|
||||
@ -185,27 +195,42 @@ list<Firewall*> UsageResolver::findFirewallsForObject(FWObject *o, FWObjectDatab
|
||||
fws.push_back(Firewall::cast(f));
|
||||
}
|
||||
|
||||
// check if some rule somewhere may use ruleset r belongs to as a branch
|
||||
FWObject *ruleset = r->getParent();
|
||||
list<Firewall*> other_fws =
|
||||
UsageResolver::findFirewallsForObject(ruleset, db);
|
||||
for (list<Firewall*>::iterator fit = other_fws.begin(); fit != other_fws.end(); ++fit)
|
||||
{
|
||||
if (std::find(fws.begin(), fws.end(), *fit) == fws.end())
|
||||
fws.push_back(*fit);
|
||||
}
|
||||
// check if some rule somewhere may use @ruleset as a
|
||||
// branch
|
||||
|
||||
RuleSet *ruleset = RuleSet::cast(r->getParent());
|
||||
assert(ruleset != NULL);
|
||||
modified_rule_sets.insert(ruleset);
|
||||
}
|
||||
}
|
||||
|
||||
set<RuleSet*>::iterator i1 = modified_rule_sets.begin();
|
||||
for ( ;i1!=modified_rule_sets.end(); ++i1)
|
||||
{
|
||||
RuleSet *ruleset = *i1;
|
||||
|
||||
list<Firewall*> other_fws =
|
||||
UsageResolver::findFirewallsForObject(ruleset, db);
|
||||
|
||||
for (list<Firewall*>::iterator fit = other_fws.begin();
|
||||
fit != other_fws.end(); ++fit)
|
||||
{
|
||||
if (std::find(fws.begin(), fws.end(), *fit) == fws.end())
|
||||
fws.push_back(*fit);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (fwbdebug)
|
||||
{
|
||||
qDebug() << QString("Program spent %1 ms searching for firewalls.") .arg(tt.elapsed());
|
||||
qDebug() << QString("Program spent %1 ms searching for firewalls.")
|
||||
.arg(tt.elapsed());
|
||||
qDebug() << "UsageResolver::findFirewallsForObject returns";
|
||||
|
||||
for (list<Firewall*>::iterator i = fws.begin(); i!=fws.end(); ++i)
|
||||
{
|
||||
qDebug() << " " << (*i)->getName().c_str();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return fws;
|
||||
|
||||
@ -327,7 +327,7 @@ void iosaclAdvancedDialog::accept()
|
||||
FWOptions* options = Firewall::cast(new_state)->getOptionsObject();
|
||||
assert(options!=NULL);
|
||||
|
||||
Management *mgmt=(Firewall::cast(obj))->getManagementObject();
|
||||
Management *mgmt = (Firewall::cast(new_state))->getManagementObject();
|
||||
assert(mgmt!=NULL);
|
||||
|
||||
data.saveAll(options);
|
||||
|
||||
@ -26,10 +26,13 @@
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="childrenCollapsible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<widget class="QFrame" name="treeDockWidgetParentFrame">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -116,14 +119,6 @@
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<widget class="QStackedWidget" name="ruleSets">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="WorkflowIcons" name="icons"/>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QWidget" name="toolbar" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
@ -308,6 +303,14 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QStackedWidget" name="ruleSets">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="WorkflowIcons" name="icons"/>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
@ -58,6 +58,10 @@ ND_ProgressPage::ND_ProgressPage(QWidget *parent) : QWizardPage(parent)
|
||||
|
||||
#ifdef HAVE_LIBSNMP
|
||||
crawler = NULL;
|
||||
|
||||
connect(m_dialog->discoveryStopButton, SIGNAL(clicked()), this, SLOT(stop()));
|
||||
connect(m_dialog->logSaveButton, SIGNAL(clicked()), this, SLOT(saveLog()));
|
||||
|
||||
#endif
|
||||
|
||||
QTextCursor cursor(m_dialog->discoveryLog->textCursor());
|
||||
|
||||
@ -24,6 +24,9 @@
|
||||
#ifndef __ND_PROGRESSPAGE_H_
|
||||
#define __ND_PROGRESSPAGE_H_
|
||||
|
||||
// for HAVE_LIBSNMP
|
||||
#include "fwbuilder/libfwbuilder-config.h"
|
||||
|
||||
#include "ui_nd_progresspage_q.h"
|
||||
|
||||
#include <QTextCharFormat>
|
||||
|
||||
@ -70,40 +70,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>discoveryStopButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>ND_ProgressPage_q</receiver>
|
||||
<slot>stop()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>47</x>
|
||||
<y>513</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>304</x>
|
||||
<y>268</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>logSaveButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>ND_ProgressPage_q</receiver>
|
||||
<slot>saveLog()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>160</x>
|
||||
<y>513</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>304</x>
|
||||
<y>268</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<connections/>
|
||||
<slots>
|
||||
<slot>stop()</slot>
|
||||
<slot>saveLog()</slot>
|
||||
|
||||
@ -41,19 +41,6 @@
|
||||
#include "fwbuilder/Firewall.h"
|
||||
#include "fwbuilder/DNSName.h"
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#if __GNUC__ > 3 || \
|
||||
(__GNUC__ == 3 && (__GNUC_MINOR__ > 2 || (__GNUC_MINOR__ == 2 ) ) ) || \
|
||||
_MSC_VER
|
||||
# include <streambuf>
|
||||
#else
|
||||
# include <streambuf.h>
|
||||
#endif
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
using namespace libfwbuilder;
|
||||
|
||||
@ -39,23 +39,9 @@
|
||||
#include "fwbuilder/IPv4.h"
|
||||
#include "fwbuilder/Firewall.h"
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#if __GNUC__ > 3 || \
|
||||
(__GNUC__ == 3 && (__GNUC_MINOR__ > 2 || (__GNUC_MINOR__ == 2 ) ) ) || \
|
||||
_MSC_VER
|
||||
# include <streambuf>
|
||||
#else
|
||||
# include <streambuf.h>
|
||||
#endif
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
using namespace libfwbuilder;
|
||||
using namespace fwcompiler;
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
@ -41,24 +41,9 @@
|
||||
#include "fwbuilder/Firewall.h"
|
||||
#include "fwbuilder/DNSName.h"
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#if __GNUC__ > 3 || \
|
||||
(__GNUC__ == 3 && (__GNUC_MINOR__ > 2 || (__GNUC_MINOR__ == 2 ) ) ) || \
|
||||
_MSC_VER
|
||||
# include <streambuf>
|
||||
#else
|
||||
# include <streambuf.h>
|
||||
#endif
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
|
||||
using namespace libfwbuilder;
|
||||
using namespace fwcompiler;
|
||||
using namespace std;
|
||||
|
||||
@ -38,24 +38,8 @@
|
||||
#include "fwbuilder/Firewall.h"
|
||||
#include "fwbuilder/DNSName.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#if __GNUC__ > 3 || \
|
||||
(__GNUC__ == 3 && (__GNUC_MINOR__ > 2 || (__GNUC_MINOR__ == 2 ) ) ) || \
|
||||
_MSC_VER
|
||||
# include <streambuf>
|
||||
#else
|
||||
# include <streambuf.h>
|
||||
#endif
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
|
||||
using namespace libfwbuilder;
|
||||
using namespace fwcompiler;
|
||||
using namespace std;
|
||||
|
||||
@ -44,32 +44,14 @@
|
||||
#include "fwbuilder/DNSName.h"
|
||||
#include "fwbuilder/FWObjectDatabase.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#if __GNUC__ > 3 || \
|
||||
(__GNUC__ == 3 && (__GNUC_MINOR__ > 2 || (__GNUC_MINOR__ == 2 ) ) ) || \
|
||||
_MSC_VER
|
||||
# include <streambuf>
|
||||
#else
|
||||
# include <streambuf.h>
|
||||
#endif
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
|
||||
using namespace libfwbuilder;
|
||||
using namespace fwcompiler;
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*-----------------------------------------------------------------------
|
||||
* Methods for printing
|
||||
|
||||
2461
src/res/help/en_US/release_notes_4.2.1.html
Normal file
2461
src/res/help/en_US/release_notes_4.2.1.html
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user