Repository :
http://git.fedorahosted.org/cgit/firewalld-recode.git
On branch : master
---------------------------------------------------------------
commit 40bc6b68c7ea1670c4b4015a3a5fc4a985d3e314
Author: Jiri Popelka <jpopelka(a)redhat.com>
Date: Sat Dec 6 14:51:05 2014 +0100
Fix compiler warnings.
to be able to build with 'all warnings being treated as errors', like:
./autogen.sh; rpm -E %configure | bash
---------------------------------------------------------------
src/Common/Utility.cpp | 2 +-
src/Daemon/Backends/Linux/IPTables.cpp | 10 +++---
src/Daemon/Backends/Linux/IPTables.hpp | 2 +-
src/Daemon/Backends/Linux/KernelModule.cpp | 2 +-
src/Daemon/Backends/Linux/Sysctl.cpp | 2 +-
src/Daemon/Backends/LinuxXTables.cpp | 38 +++++++++++++---------
src/Daemon/DBus.cpp | 2 +-
src/Daemon/DBus.hpp | 10 +++---
src/Daemon/DBus/direct/getChains.cpp | 3 +-
src/Daemon/DBus/zone/getActiveZones.cpp | 4 +-
src/Daemon/Firewall/IPAddress.cpp | 6 ++--
src/Daemon/Firewall/RichLanguageParser/Parser.c | 2 +-
src/Daemon/SignalHandler.cpp | 2 +-
13 files changed, 46 insertions(+), 39 deletions(-)
diff --git a/src/Common/Utility.cpp b/src/Common/Utility.cpp
index d8e8805..9cf263f 100644
--- a/src/Common/Utility.cpp
+++ b/src/Common/Utility.cpp
@@ -135,7 +135,7 @@ namespace firewalld
// +1 ... for nullptr termination of the array
//
char **args_cstr = (char **)(::alloca(sizeof(const char *) * (args.size() + 2)));
- int i;
+ unsigned int i;
args_cstr[0] = const_cast<char *>(path.c_str());
for (i = 0; i < args.size(); ++i) {
diff --git a/src/Daemon/Backends/Linux/IPTables.cpp
b/src/Daemon/Backends/Linux/IPTables.cpp
index b26365a..677441e 100644
--- a/src/Daemon/Backends/Linux/IPTables.cpp
+++ b/src/Daemon/Backends/Linux/IPTables.cpp
@@ -24,12 +24,12 @@
namespace firewalld
{
IPTables::IPTables(const char * const ipXtables_path)
- : _filter("filter"),
- _nat("nat"),
- _mangle("mangle"),
+ : _ipXtables_path(ipXtables_path),
_security("security"),
_raw("raw"),
- _ipXtables_path(ipXtables_path)
+ _mangle("mangle"),
+ _nat("nat"),
+ _filter("filter")
{
cleanup();
@@ -191,7 +191,7 @@ namespace firewalld
#endif
}
- int IPTables::cleanup()
+ void IPTables::cleanup()
{
for (auto table : listTables()) {
execute({"-t", table, "-F"});
diff --git a/src/Daemon/Backends/Linux/IPTables.hpp
b/src/Daemon/Backends/Linux/IPTables.hpp
index eccfd04..abd9593 100644
--- a/src/Daemon/Backends/Linux/IPTables.hpp
+++ b/src/Daemon/Backends/Linux/IPTables.hpp
@@ -43,7 +43,7 @@ namespace firewalld
XTable& getTableRef(const String& table);
int execute(const XTables::Operation& op);
int execute(const StringVector& args);
- int cleanup();
+ void cleanup();
private:
const char * const _ipXtables_path;
diff --git a/src/Daemon/Backends/Linux/KernelModule.cpp
b/src/Daemon/Backends/Linux/KernelModule.cpp
index bc24f3d..3d38df5 100644
--- a/src/Daemon/Backends/Linux/KernelModule.cpp
+++ b/src/Daemon/Backends/Linux/KernelModule.cpp
@@ -32,7 +32,7 @@ namespace firewalld
_name = UString(name);
char regexp_cstr[256];
- if (snprintf(regexp_cstr, sizeof regexp_cstr, "^%s\\s\\+", name) >=
sizeof regexp_cstr) {
+ if (snprintf(regexp_cstr, sizeof regexp_cstr, "^%s\\s\\+", name) >=
static_cast <int> (sizeof regexp_cstr)) {
LOG(FATAL) << "BUG: Buffer too small for constructing the regular
expression";
}
if (regcomp(&_regexp, regexp_cstr, REG_NOSUB) != 0) {
diff --git a/src/Daemon/Backends/Linux/Sysctl.cpp b/src/Daemon/Backends/Linux/Sysctl.cpp
index 7df4db7..16906af 100644
--- a/src/Daemon/Backends/Linux/Sysctl.cpp
+++ b/src/Daemon/Backends/Linux/Sysctl.cpp
@@ -31,7 +31,7 @@ namespace firewalld
static void sysctlNameToProcFSPath(const char *name, char *buffer, size_t buflen)
{
- int i;
+ size_t i;
CHECK_NOTNULL(name);
CHECK_NOTNULL(buffer);
diff --git a/src/Daemon/Backends/LinuxXTables.cpp b/src/Daemon/Backends/LinuxXTables.cpp
index 8580a76..29dfdd5 100644
--- a/src/Daemon/Backends/LinuxXTables.cpp
+++ b/src/Daemon/Backends/LinuxXTables.cpp
@@ -210,6 +210,9 @@ namespace firewalld
case Port::Protocol::UDP:
rule_spec = "-p udp -m udp --dport ";
break;
+ case Port::Protocol::AnyProtocol:
+ // TODO
+ break;
}
rule_spec += port.range().toString(":");
@@ -243,26 +246,26 @@ namespace firewalld
const UString& type = rule.getType();
if (type == "service") {
- const ServiceRule& rule = dynamic_cast<const ServiceRule&>(rule);
- addService(zone, rule.getService());
+ const ServiceRule& srule = dynamic_cast<const ServiceRule&>(rule);
+ addService(zone, srule.getService());
}
else if (type == "port") {
- const PortRule& rule = dynamic_cast<const PortRule&>(rule);
- addPort(zone, rule.getPort());
+ const PortRule& prule = dynamic_cast<const PortRule&>(rule);
+ addPort(zone, prule.getPort());
}
else if (type == "protocol") {
const ProtocolRule& rule = dynamic_cast<const ProtocolRule&>(rule);
}
else if (type == "icmp-block") {
- const ICMPBlockRule& rule = dynamic_cast<const
ICMPBlockRule&>(rule);
- addICMPBlock(zone, rule.getICMPType());
+ const ICMPBlockRule& irule = dynamic_cast<const
ICMPBlockRule&>(rule);
+ addICMPBlock(zone, irule.getICMPType());
}
else if (type == "masquerade") {
const MasqueradeRule& rule = dynamic_cast<const
MasqueradeRule&>(rule);
}
else if (type == "forward-port") {
- const ForwardPortRule& rule = dynamic_cast<const
ForwardPortRule&>(rule);
- addPortForward(zone, rule.getPortForward());
+ const ForwardPortRule& fprule = dynamic_cast<const
ForwardPortRule&>(rule);
+ addPortForward(zone, fprule.getPortForward());
}
else {
throw std::runtime_error("BUG: Unknown Rich Rule type");
@@ -361,6 +364,9 @@ namespace firewalld
case Port::Protocol::UDP:
rule_spec = "-p udp -m udp --dport ";
break;
+ case Port::Protocol::AnyProtocol:
+ // TODO
+ break;
}
rule_spec += port.range().toString(":");
@@ -389,26 +395,26 @@ namespace firewalld
const UString& type = rule.getType();
if (type == "service") {
- const ServiceRule& rule = dynamic_cast<const ServiceRule&>(rule);
- removeService(zone, rule.getService());
+ const ServiceRule& srule = dynamic_cast<const ServiceRule&>(rule);
+ removeService(zone, srule.getService());
}
else if (type == "port") {
- const PortRule& rule = dynamic_cast<const PortRule&>(rule);
- removePort(zone, rule.getPort());
+ const PortRule& prule = dynamic_cast<const PortRule&>(rule);
+ removePort(zone, prule.getPort());
}
else if (type == "protocol") {
const ProtocolRule& rule = dynamic_cast<const ProtocolRule&>(rule);
}
else if (type == "icmp-block") {
- const ICMPBlockRule& rule = dynamic_cast<const
ICMPBlockRule&>(rule);
- removeICMPBlock(zone, rule.getICMPType());
+ const ICMPBlockRule& irule = dynamic_cast<const
ICMPBlockRule&>(rule);
+ removeICMPBlock(zone, irule.getICMPType());
}
else if (type == "masquerade") {
const MasqueradeRule& rule = dynamic_cast<const
MasqueradeRule&>(rule);
}
else if (type == "forward-port") {
- const ForwardPortRule& rule = dynamic_cast<const
ForwardPortRule&>(rule);
- removePortForward(zone, rule.getPortForward());
+ const ForwardPortRule& fprule = dynamic_cast<const
ForwardPortRule&>(rule);
+ removePortForward(zone, fprule.getPortForward());
}
else {
throw std::runtime_error("BUG: Unknown Rich Rule type");
diff --git a/src/Daemon/DBus.cpp b/src/Daemon/DBus.cpp
index 59996a2..4f53787 100644
--- a/src/Daemon/DBus.cpp
+++ b/src/Daemon/DBus.cpp
@@ -112,7 +112,7 @@ namespace firewalld
void DBus::on_bus_acquired(const Glib::RefPtr<Gio::DBus::Connection>&
connection,
const UString& name)
{
- guint id;
+ //guint id;
LOG(TRACE) << "DBus acquired. Registering interfaces.";
connection->set_exit_on_close(false);
diff --git a/src/Daemon/DBus.hpp b/src/Daemon/DBus.hpp
index ae10f6a..d4c349f 100644
--- a/src/Daemon/DBus.hpp
+++ b/src/Daemon/DBus.hpp
@@ -171,8 +171,8 @@ namespace firewalld
* Default constructor of an empty builder
*/
DBusResultBuilder(const char *signature = nullptr)
- : _g_variant_base(_dummy_variant_base),
- _g_variant_container(_dummy_variant_container)
+ : _g_variant_container(_dummy_variant_container),
+ _g_variant_base(_dummy_variant_base)
{
_builder_type = BuilderType::Intermediate;
_value_type = ValueType::Unknown;
@@ -200,8 +200,8 @@ namespace firewalld
* Constructor of a DBus property value response builder.
*/
DBusResultBuilder(Glib::VariantBase& g_variant_base, const char *signature =
nullptr)
- : _g_variant_base(g_variant_base),
- _g_variant_container(_dummy_variant_container)
+ : _g_variant_container(_dummy_variant_container),
+ _g_variant_base(g_variant_base)
{
_builder_type = BuilderType::PropertyValue;
_value_type = ValueType::Unknown;
@@ -303,7 +303,7 @@ namespace firewalld
{
if (_value_type == ValueType::Array || _value_type == ValueType::Unknown) {
/* Allocate more space if necessary */
- if (index >= _array.size()) {
+ if (index >= static_cast <int> (_array.size())) {
_array.resize(index+10, nullptr);
}
DBusResultBuilder*& builder = _array[index];
diff --git a/src/Daemon/DBus/direct/getChains.cpp b/src/Daemon/DBus/direct/getChains.cpp
index 7805797..0745381 100644
--- a/src/Daemon/DBus/direct/getChains.cpp
+++ b/src/Daemon/DBus/direct/getChains.cpp
@@ -48,6 +48,7 @@ namespace firewalld
LOG(DEBUG) << "return: " << chains;
result.setTypeSignature("(as)");
- result = chains;
+ if (fwret)
+ result = chains;
}
} /* namespace firewalld */
diff --git a/src/Daemon/DBus/zone/getActiveZones.cpp
b/src/Daemon/DBus/zone/getActiveZones.cpp
index 2a9f355..00290a2 100644
--- a/src/Daemon/DBus/zone/getActiveZones.cpp
+++ b/src/Daemon/DBus/zone/getActiveZones.cpp
@@ -28,9 +28,9 @@ namespace firewalld
// (a{sa{sas}})
//
// Array Of Dictionaries
- // \
+ //
// --- Array Of Dictionaries
- // \
+ //
// --- Array Of Strings
//
result.setTypeSignature("(a{sa{sas}})");
diff --git a/src/Daemon/Firewall/IPAddress.cpp b/src/Daemon/Firewall/IPAddress.cpp
index 442f210..2f31e5d 100644
--- a/src/Daemon/Firewall/IPAddress.cpp
+++ b/src/Daemon/Firewall/IPAddress.cpp
@@ -30,8 +30,8 @@ namespace firewalld
{
UString ip;
UString net;
- Protocol ip_protocol = Protocol::Unknown;
- Protocol net_protocol = Protocol::Unknown;
+ //Protocol ip_protocol = Protocol::Unknown;
+ //Protocol net_protocol = Protocol::Unknown;
UString::size_type slash_pos = addr_spec.find_first_of('/');
@@ -51,7 +51,7 @@ namespace firewalld
if (::inet_pton(AF_INET, net.c_str(), &sa) != 1) {
}
- net_protocol = Protocol::IPv4;
+ //net_protocol = Protocol::IPv4;
} else if (regex_cidr->match(net)) {
int cidr = stringToNumber<int>(net);
if (cidr < 0 || cidr > 32) {
diff --git a/src/Daemon/Firewall/RichLanguageParser/Parser.c
b/src/Daemon/Firewall/RichLanguageParser/Parser.c
index 8b30b7c..b20f730 100644
--- a/src/Daemon/Firewall/RichLanguageParser/Parser.c
+++ b/src/Daemon/Firewall/RichLanguageParser/Parser.c
@@ -354,7 +354,7 @@ static void yy_destructor(
YYCODETYPE yymajor, /* Type code for object to destroy */
YYMINORTYPE *yypminor /* The object to be destroyed */
){
- RichLanguageParserARG_FETCH;
+ //RichLanguageParserARG_FETCH;
switch( yymajor ){
/* Here is inserted the actions which take place when a
** terminal or non-terminal is destroyed. This can happen
diff --git a/src/Daemon/SignalHandler.cpp b/src/Daemon/SignalHandler.cpp
index 81fbc59..c06558a 100644
--- a/src/Daemon/SignalHandler.cpp
+++ b/src/Daemon/SignalHandler.cpp
@@ -33,7 +33,7 @@ using namespace Glib;
namespace firewalld
{
- static Threads::Thread *G_signal_handler_thread = nullptr;
+ //static Threads::Thread *G_signal_handler_thread = nullptr;
static ::sigset_t G_signal_mask;
SignalHandler::SignalHandler(FirewallD* firewalld_ptr)