[firewalld-recode] master: Add missing copyrights (982508d)
by mildew@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/firewalld-recode.git
On branch : master
>---------------------------------------------------------------
commit 982508dc33d429dbc1d43be9acd9d50af1d190d9
Author: Daniel Kopecek <dkopecek(a)redhat.com>
Date: Wed Nov 26 14:45:47 2014 +0100
Add missing copyrights
>---------------------------------------------------------------
src/Daemon/Backends/LinuxXTables.cpp | 18 ++++++++++++++++++
src/Daemon/Backends/LinuxXTables.hpp | 18 ++++++++++++++++++
src/Daemon/Firewall/BackendOpTable.hpp | 18 ++++++++++++++++++
src/Daemon/Firewall/IPAddress.cpp | 18 ++++++++++++++++++
src/Daemon/Firewall/IPAddress.hpp | 18 ++++++++++++++++++
src/Daemon/Firewall/RichRule.cpp | 18 ++++++++++++++++++
src/Daemon/Firewall/RichRule.hpp | 18 ++++++++++++++++++
src/Daemon/Firewall/RichRuleParser.cpp | 18 ++++++++++++++++++
src/Daemon/Firewall/RichRuleParser.hpp | 18 ++++++++++++++++++
src/Daemon/Firewall/RichRules/ForwardPortRule.cpp | 18 ++++++++++++++++++
src/Daemon/Firewall/RichRules/ForwardPortRule.hpp | 18 ++++++++++++++++++
src/Daemon/Firewall/RichRules/ICMPBlockRule.cpp | 18 ++++++++++++++++++
src/Daemon/Firewall/RichRules/ICMPBlockRule.hpp | 18 ++++++++++++++++++
src/Daemon/Firewall/RichRules/MasqueradeRule.cpp | 18 ++++++++++++++++++
src/Daemon/Firewall/RichRules/MasqueradeRule.hpp | 18 ++++++++++++++++++
src/Daemon/Firewall/RichRules/PortRule.cpp | 18 ++++++++++++++++++
src/Daemon/Firewall/RichRules/PortRule.hpp | 18 ++++++++++++++++++
src/Daemon/Firewall/RichRules/ProtocolRule.cpp | 18 ++++++++++++++++++
src/Daemon/Firewall/RichRules/ProtocolRule.hpp | 18 ++++++++++++++++++
src/Daemon/Firewall/RichRules/ServiceRule.cpp | 18 ++++++++++++++++++
src/Daemon/Firewall/RichRules/ServiceRule.hpp | 18 ++++++++++++++++++
21 files changed, 378 insertions(+), 0 deletions(-)
diff --git a/src/Daemon/Backends/LinuxXTables.cpp b/src/Daemon/Backends/LinuxXTables.cpp
index 8f57893..0238a1a 100644
--- a/src/Daemon/Backends/LinuxXTables.cpp
+++ b/src/Daemon/Backends/LinuxXTables.cpp
@@ -1,3 +1,21 @@
+//
+// Copyright (C) 2014 Red Hat, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
+//
#include "LinuxXTables.hpp"
#include "Common/Types.hpp"
#include "Common/Logging.hpp"
diff --git a/src/Daemon/Backends/LinuxXTables.hpp b/src/Daemon/Backends/LinuxXTables.hpp
index 4abc9ab..423d840 100644
--- a/src/Daemon/Backends/LinuxXTables.hpp
+++ b/src/Daemon/Backends/LinuxXTables.hpp
@@ -1,3 +1,21 @@
+//
+// Copyright (C) 2014 Red Hat, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
+//
#ifndef FIREWALLD_BACKENDS_LINUXXTABLES_HPP
#define FIREWALLD_BACKENDS_LINUXXTABLES_HPP
diff --git a/src/Daemon/Firewall/BackendOpTable.hpp b/src/Daemon/Firewall/BackendOpTable.hpp
index 97bb6a8..0f07976 100644
--- a/src/Daemon/Firewall/BackendOpTable.hpp
+++ b/src/Daemon/Firewall/BackendOpTable.hpp
@@ -1,3 +1,21 @@
+//
+// Copyright (C) 2014 Red Hat, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
+//
#ifndef FIREWALLD_FIREWALL_BACKENDOPTABLE_HPP
#define FIREWALLD_FIREWALL_BACKENDOPTABLE_HPP
diff --git a/src/Daemon/Firewall/IPAddress.cpp b/src/Daemon/Firewall/IPAddress.cpp
index ed64bf6..442f210 100644
--- a/src/Daemon/Firewall/IPAddress.cpp
+++ b/src/Daemon/Firewall/IPAddress.cpp
@@ -1,3 +1,21 @@
+//
+// Copyright (C) 2014 Red Hat, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
+//
#include "Common/Types.hpp"
#include "Common/Utility.hpp"
#include "IPAddress.hpp"
diff --git a/src/Daemon/Firewall/IPAddress.hpp b/src/Daemon/Firewall/IPAddress.hpp
index 7b6e5f2..1c4bb72 100644
--- a/src/Daemon/Firewall/IPAddress.hpp
+++ b/src/Daemon/Firewall/IPAddress.hpp
@@ -1,3 +1,21 @@
+//
+// Copyright (C) 2014 Red Hat, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
+//
#ifndef FIREWALLD_FIREWALL_IPADDRESS_HPP
#define FIREWALLD_FIREWALL_IPADDRESS_HPP
diff --git a/src/Daemon/Firewall/RichRule.cpp b/src/Daemon/Firewall/RichRule.cpp
index 06a947a..3b990e6 100644
--- a/src/Daemon/Firewall/RichRule.cpp
+++ b/src/Daemon/Firewall/RichRule.cpp
@@ -1,3 +1,21 @@
+//
+// Copyright (C) 2014 Red Hat, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
+//
#include "RichRule.hpp"
#include "Common/Logging.hpp"
#include <stdexcept>
diff --git a/src/Daemon/Firewall/RichRule.hpp b/src/Daemon/Firewall/RichRule.hpp
index 11f3c42..1e55ecb 100644
--- a/src/Daemon/Firewall/RichRule.hpp
+++ b/src/Daemon/Firewall/RichRule.hpp
@@ -1,3 +1,21 @@
+//
+// Copyright (C) 2014 Red Hat, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
+//
#ifndef FIREWALLD_FIREWALL_RICHRULE_HPP
#define FIREWALLD_FIREWALL_RICHRULE_HPP
diff --git a/src/Daemon/Firewall/RichRuleParser.cpp b/src/Daemon/Firewall/RichRuleParser.cpp
index 4ecb845..fb5da96 100644
--- a/src/Daemon/Firewall/RichRuleParser.cpp
+++ b/src/Daemon/Firewall/RichRuleParser.cpp
@@ -1,3 +1,21 @@
+//
+// Copyright (C) 2014 Red Hat, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
+//
#include "RichRuleParser.hpp"
#include "RichRule.hpp"
diff --git a/src/Daemon/Firewall/RichRuleParser.hpp b/src/Daemon/Firewall/RichRuleParser.hpp
index ed04d60..29fedd9 100644
--- a/src/Daemon/Firewall/RichRuleParser.hpp
+++ b/src/Daemon/Firewall/RichRuleParser.hpp
@@ -1,3 +1,21 @@
+//
+// Copyright (C) 2014 Red Hat, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
+//
#ifndef FIREWALLD_FIREWALL_RICHRULEPARSER_HPP
#define FIREWALLD_FIREWALL_RICHRULEPARSER_HPP
diff --git a/src/Daemon/Firewall/RichRules/ForwardPortRule.cpp b/src/Daemon/Firewall/RichRules/ForwardPortRule.cpp
index 2b7ff66..7a755ec 100644
--- a/src/Daemon/Firewall/RichRules/ForwardPortRule.cpp
+++ b/src/Daemon/Firewall/RichRules/ForwardPortRule.cpp
@@ -1,3 +1,21 @@
+//
+// Copyright (C) 2014 Red Hat, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
+//
#include "ForwardPortRule.hpp"
namespace firewalld
diff --git a/src/Daemon/Firewall/RichRules/ForwardPortRule.hpp b/src/Daemon/Firewall/RichRules/ForwardPortRule.hpp
index 2f7913e..e1af161 100644
--- a/src/Daemon/Firewall/RichRules/ForwardPortRule.hpp
+++ b/src/Daemon/Firewall/RichRules/ForwardPortRule.hpp
@@ -1,3 +1,21 @@
+//
+// Copyright (C) 2014 Red Hat, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
+//
#ifndef FIREWALLD_FIREWALL_FORWARDPORTRULE_HPP
#define FIREWALLD_FIREWALL_FORWARDPORTRULE_HPP
diff --git a/src/Daemon/Firewall/RichRules/ICMPBlockRule.cpp b/src/Daemon/Firewall/RichRules/ICMPBlockRule.cpp
index 9f5063d..084ace7 100644
--- a/src/Daemon/Firewall/RichRules/ICMPBlockRule.cpp
+++ b/src/Daemon/Firewall/RichRules/ICMPBlockRule.cpp
@@ -1,3 +1,21 @@
+//
+// Copyright (C) 2014 Red Hat, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
+//
#include "ICMPBlockRule.hpp"
#include "Daemon/FirewallD.hpp"
diff --git a/src/Daemon/Firewall/RichRules/ICMPBlockRule.hpp b/src/Daemon/Firewall/RichRules/ICMPBlockRule.hpp
index 8cc6f00..667ecbf 100644
--- a/src/Daemon/Firewall/RichRules/ICMPBlockRule.hpp
+++ b/src/Daemon/Firewall/RichRules/ICMPBlockRule.hpp
@@ -1,3 +1,21 @@
+//
+// Copyright (C) 2014 Red Hat, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
+//
#ifndef FIREWALLD_FIREWALL_ICMPBLOCKRULE_HPP
#define FIREWALLD_FIREWALL_ICMPBLOCKRULE_HPP
diff --git a/src/Daemon/Firewall/RichRules/MasqueradeRule.cpp b/src/Daemon/Firewall/RichRules/MasqueradeRule.cpp
index e8a21c4..5837a2b 100644
--- a/src/Daemon/Firewall/RichRules/MasqueradeRule.cpp
+++ b/src/Daemon/Firewall/RichRules/MasqueradeRule.cpp
@@ -1,3 +1,21 @@
+//
+// Copyright (C) 2014 Red Hat, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
+//
#include "MasqueradeRule.hpp"
namespace firewalld
diff --git a/src/Daemon/Firewall/RichRules/MasqueradeRule.hpp b/src/Daemon/Firewall/RichRules/MasqueradeRule.hpp
index 7cd6348..7c4f005 100644
--- a/src/Daemon/Firewall/RichRules/MasqueradeRule.hpp
+++ b/src/Daemon/Firewall/RichRules/MasqueradeRule.hpp
@@ -1,3 +1,21 @@
+//
+// Copyright (C) 2014 Red Hat, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
+//
#ifndef FIREWALLD_FIREWALL_MASQUERADERULE_HPP
#define FIREWALLD_FIREWALL_MASQUERADERULE_HPP
diff --git a/src/Daemon/Firewall/RichRules/PortRule.cpp b/src/Daemon/Firewall/RichRules/PortRule.cpp
index 8e58d92..9418e2f 100644
--- a/src/Daemon/Firewall/RichRules/PortRule.cpp
+++ b/src/Daemon/Firewall/RichRules/PortRule.cpp
@@ -1,3 +1,21 @@
+//
+// Copyright (C) 2014 Red Hat, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
+//
#include "PortRule.hpp"
namespace firewalld
diff --git a/src/Daemon/Firewall/RichRules/PortRule.hpp b/src/Daemon/Firewall/RichRules/PortRule.hpp
index b819d1b..291c624 100644
--- a/src/Daemon/Firewall/RichRules/PortRule.hpp
+++ b/src/Daemon/Firewall/RichRules/PortRule.hpp
@@ -1,3 +1,21 @@
+//
+// Copyright (C) 2014 Red Hat, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
+//
#ifndef FIREWALLD_FIREWALL_PORTRULE_HPP
#define FIREWALLD_FIREWALL_PORTRULE_HPP
diff --git a/src/Daemon/Firewall/RichRules/ProtocolRule.cpp b/src/Daemon/Firewall/RichRules/ProtocolRule.cpp
index 9e9d067..69ee634 100644
--- a/src/Daemon/Firewall/RichRules/ProtocolRule.cpp
+++ b/src/Daemon/Firewall/RichRules/ProtocolRule.cpp
@@ -1,3 +1,21 @@
+//
+// Copyright (C) 2014 Red Hat, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
+//
#include "ProtocolRule.hpp"
#include "Common/Utility.hpp"
#include <netdb.h>
diff --git a/src/Daemon/Firewall/RichRules/ProtocolRule.hpp b/src/Daemon/Firewall/RichRules/ProtocolRule.hpp
index 124d2f8..73baad3 100644
--- a/src/Daemon/Firewall/RichRules/ProtocolRule.hpp
+++ b/src/Daemon/Firewall/RichRules/ProtocolRule.hpp
@@ -1,3 +1,21 @@
+//
+// Copyright (C) 2014 Red Hat, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
+//
#ifndef FIREWALLD_FIREWALL_PROTOCOLRULE_HPP
#define FIREWALLD_FIREWALL_PROTOCOLRULE_HPP
diff --git a/src/Daemon/Firewall/RichRules/ServiceRule.cpp b/src/Daemon/Firewall/RichRules/ServiceRule.cpp
index e7f93e4..42c1330 100644
--- a/src/Daemon/Firewall/RichRules/ServiceRule.cpp
+++ b/src/Daemon/Firewall/RichRules/ServiceRule.cpp
@@ -1,3 +1,21 @@
+//
+// Copyright (C) 2014 Red Hat, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
+//
#include "ServiceRule.hpp"
#include "Daemon/FirewallD.hpp"
diff --git a/src/Daemon/Firewall/RichRules/ServiceRule.hpp b/src/Daemon/Firewall/RichRules/ServiceRule.hpp
index 0875397..3dc8b5e 100644
--- a/src/Daemon/Firewall/RichRules/ServiceRule.hpp
+++ b/src/Daemon/Firewall/RichRules/ServiceRule.hpp
@@ -1,3 +1,21 @@
+//
+// Copyright (C) 2014 Red Hat, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+// Authors: Daniel Kopecek <dkopecek(a)redhat.com>
+//
#ifndef FIREWALLD_FIREWALL_SERVICERULE_HPP
#define FIREWALLD_FIREWALL_SERVICERULE_HPP
9 years, 5 months
[firewalld-recode] master: Use the subdir-object automake option (df42912)
by mildew@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/firewalld-recode.git
On branch : master
>---------------------------------------------------------------
commit df42912fb4df386fbabd57110f0fba1df302f362
Author: Daniel Kopecek <dkopecek(a)redhat.com>
Date: Wed Nov 26 14:29:41 2014 +0100
Use the subdir-object automake option
We are using non-recursive automake and the subdir-object
prevents filename conflicts.
>---------------------------------------------------------------
configure.ac | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/configure.ac b/configure.ac
index 5ee3398..ae7f3cc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5,7 +5,7 @@ AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([config])
-AM_INIT_AUTOMAKE([foreign tar-pax])
+AM_INIT_AUTOMAKE([subdir-objects foreign tar-pax])
# If automake supports "silent rules", enable them by default
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
9 years, 5 months
[firewalld-recode] master: Remove Port::Protocol::AnyProtocol from other methods too (5305ca3)
by mildew@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/firewalld-recode.git
On branch : master
>---------------------------------------------------------------
commit 5305ca3c280413ae4b2bce5156925fc374ee7412
Author: Daniel Kopecek <dkopecek(a)redhat.com>
Date: Wed Nov 26 14:22:23 2014 +0100
Remove Port::Protocol::AnyProtocol from other methods too
>---------------------------------------------------------------
src/Daemon/Firewall/Zone.cpp | 18 +++++-------------
1 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/src/Daemon/Firewall/Zone.cpp b/src/Daemon/Firewall/Zone.cpp
index a7d3bdf..10a5f84 100644
--- a/src/Daemon/Firewall/Zone.cpp
+++ b/src/Daemon/Firewall/Zone.cpp
@@ -254,10 +254,8 @@ namespace firewalld
case Port::Protocol::UDP:
retval = (_udp_port_map.erase(port->range()) == 1);
break;
- case Port::Protocol::AnyProtocol:
- retval = (_tcp_port_map.erase(port->range()) == 1 &&
- _udp_port_map.erase(port->range()) == 1);
- break;
+ default:
+ throw FirewallError("INVALID_PORT", "Zone::removePort: invalid port protocol");
}
return retval;
@@ -280,14 +278,8 @@ namespace firewalld
retval = (port_it != _udp_port_map.end());
}
break;
- case Port::Protocol::AnyProtocol:
- {
- auto const& tcp_port_it = _tcp_port_map.find(port->range());
- auto const& udp_port_it = _udp_port_map.find(port->range());
- retval = (tcp_port_it != _tcp_port_map.end() &&
- udp_port_it != _udp_port_map.end());
- }
- break;
+ default:
+ throw FirewallError("INVALID_PORT", "Zone::queryPort: invalid port protocol");
}
return retval;
@@ -301,7 +293,7 @@ namespace firewalld
case Port::Protocol::UDP:
return _udp_port_map;
default:
- throw std::runtime_error("Invalid protocol");
+ throw FirewallError("INVALID_PROTOCOL", "Zone::getPorts: invalid protocol");
}
}
9 years, 5 months
[firewalld-recode] master: Don't try to be smart in Zone::addPort, throw an exception for an invalid protocol (cf69521)
by mildew@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/firewalld-recode.git
On branch : master
>---------------------------------------------------------------
commit cf69521b388160f3014a88698da2cce5fdda77cb
Author: Daniel Kopecek <dkopecek(a)redhat.com>
Date: Wed Nov 26 13:58:53 2014 +0100
Don't try to be smart in Zone::addPort, throw an exception for an invalid protocol
>---------------------------------------------------------------
src/Daemon/Firewall/Zone.cpp | 6 +-----
1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/src/Daemon/Firewall/Zone.cpp b/src/Daemon/Firewall/Zone.cpp
index 2b61bb2..a7d3bdf 100644
--- a/src/Daemon/Firewall/Zone.cpp
+++ b/src/Daemon/Firewall/Zone.cpp
@@ -238,12 +238,8 @@ namespace firewalld
case Port::Protocol::UDP:
_udp_port_map[port->range()] = port;
break;
- case Port::Protocol::AnyProtocol:
- _tcp_port_map[port->range()] = port;
- _udp_port_map[port->range()] = port;
- break;
default:
- ; // throw an exception
+ throw FirewallError("INVALID_PORT", "Zone::addPort: invalid port protocol");
}
}
9 years, 5 months
[firewalld-recode] master: Change internal DBus method calling semantics (0127486)
by mildew@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/firewalld-recode.git
On branch : master
>---------------------------------------------------------------
commit 01274862ef7f5d376f526a0b90b077f4f0eea119
Author: Daniel Kopecek <dkopecek(a)redhat.com>
Date: Wed Nov 26 13:33:33 2014 +0100
Change internal DBus method calling semantics
- use the interface version and subinterface when
looking up the method handler
- prepare the Backend class for handling the direct
interface methods
- make the backend instance accessible via the
backend() method to the firewalld instance
- reroute the handling to the backend in dbus_method_handle
- update the DBus method definitions
>---------------------------------------------------------------
src/Daemon/DBus.cpp | 23 +++++-
src/Daemon/DBus.hpp | 3 +-
src/Daemon/DBus/completeReload.cpp | 2 +-
src/Daemon/DBus/direct/addChain.cpp | 2 +-
src/Daemon/DBus/direct/addRule.cpp | 2 +-
src/Daemon/DBus/direct/getAllChains.cpp | 2 +-
src/Daemon/DBus/direct/getAllRules.cpp | 2 +-
src/Daemon/DBus/direct/getChains.cpp | 2 +-
src/Daemon/DBus/direct/getRules.cpp | 2 +-
src/Daemon/DBus/direct/methods.decl | 24 +++---
src/Daemon/DBus/direct/passthrough.cpp | 2 +-
src/Daemon/DBus/direct/queryChain.cpp | 2 +-
src/Daemon/DBus/direct/queryRule.cpp | 2 +-
src/Daemon/DBus/direct/removeChain.cpp | 2 +-
src/Daemon/DBus/direct/removeRule.cpp | 2 +-
src/Daemon/DBus/direct/removeRules.cpp | 2 +-
src/Daemon/DBus/disablePanicMode.cpp | 2 +-
src/Daemon/DBus/enablePanicMode.cpp | 2 +-
src/Daemon/DBus/getDefaultZone.cpp | 2 +-
src/Daemon/DBus/getIcmpTypeSettings.cpp | 2 +-
src/Daemon/DBus/getServiceSettings.cpp | 2 +-
src/Daemon/DBus/getZoneSettings.cpp | 2 +-
src/Daemon/DBus/listIcmpTypes.cpp | 2 +-
src/Daemon/DBus/listServices.cpp | 2 +-
src/Daemon/DBus/methods.decl | 24 +++---
src/Daemon/DBus/queryPanicMode.cpp | 2 +-
src/Daemon/DBus/reload.cpp | 2 +-
src/Daemon/DBus/setDefaultZone.cpp | 2 +-
src/Daemon/DBus/zone/addForwardPort.cpp | 2 +-
src/Daemon/DBus/zone/addIcmpBlock.cpp | 2 +-
src/Daemon/DBus/zone/addInterface.cpp | 2 +-
src/Daemon/DBus/zone/addMasquerade.cpp | 2 +-
src/Daemon/DBus/zone/addPort.cpp | 2 +-
src/Daemon/DBus/zone/addRichRule.cpp | 2 +-
src/Daemon/DBus/zone/addService.cpp | 2 +-
src/Daemon/DBus/zone/addSource.cpp | 2 +-
src/Daemon/DBus/zone/changeZone.cpp | 2 +-
src/Daemon/DBus/zone/changeZoneOfInterface.cpp | 2 +-
src/Daemon/DBus/zone/changeZoneOfSource.cpp | 2 +-
src/Daemon/DBus/zone/getActiveZones.cpp | 2 +-
src/Daemon/DBus/zone/getForwardPorts.cpp | 2 +-
src/Daemon/DBus/zone/getIcmpBlocks.cpp | 2 +-
src/Daemon/DBus/zone/getInterfaces.cpp | 2 +-
src/Daemon/DBus/zone/getPorts.cpp | 2 +-
src/Daemon/DBus/zone/getRichRules.cpp | 2 +-
src/Daemon/DBus/zone/getServices.cpp | 2 +-
src/Daemon/DBus/zone/getSources.cpp | 2 +-
src/Daemon/DBus/zone/getZoneOfInterface.cpp | 2 +-
src/Daemon/DBus/zone/getZoneOfSource.cpp | 2 +-
src/Daemon/DBus/zone/getZones.cpp | 2 +-
src/Daemon/DBus/zone/isImmutable.cpp | 2 +-
src/Daemon/DBus/zone/methods.decl | 98 ++++++++++++------------
src/Daemon/DBus/zone/queryForwardPort.cpp | 2 +-
src/Daemon/DBus/zone/queryIcmpBlock.cpp | 2 +-
src/Daemon/DBus/zone/queryInterface.cpp | 2 +-
src/Daemon/DBus/zone/queryMasquerade.cpp | 2 +-
src/Daemon/DBus/zone/queryPort.cpp | 2 +-
src/Daemon/DBus/zone/queryRichRule.cpp | 2 +-
src/Daemon/DBus/zone/queryService.cpp | 2 +-
src/Daemon/DBus/zone/querySource.cpp | 2 +-
src/Daemon/DBus/zone/removeForwardPort.cpp | 2 +-
src/Daemon/DBus/zone/removeIcmpBlock.cpp | 2 +-
src/Daemon/DBus/zone/removeInterface.cpp | 2 +-
src/Daemon/DBus/zone/removeMasquerade.cpp | 2 +-
src/Daemon/DBus/zone/removePort.cpp | 2 +-
src/Daemon/DBus/zone/removeRichRule.cpp | 2 +-
src/Daemon/DBus/zone/removeService.cpp | 2 +-
src/Daemon/DBus/zone/removeSource.cpp | 2 +-
src/Daemon/Firewall/Backend.cpp | 15 ++++-
src/Daemon/Firewall/Backend.hpp | 8 ++-
src/Daemon/Firewall/Firewall.cpp | 9 ++
src/Daemon/Firewall/Firewall.hpp | 2 +
src/Daemon/Firewall/Zone.cpp | 18 ++++-
src/Daemon/FirewallD.cpp | 74 ++++++++++++------
src/Daemon/FirewallD.hpp | 28 ++++++-
75 files changed, 282 insertions(+), 170 deletions(-)
diff --git a/src/Daemon/DBus.cpp b/src/Daemon/DBus.cpp
index 12ef16c..59996a2 100644
--- a/src/Daemon/DBus.cpp
+++ b/src/Daemon/DBus.cpp
@@ -150,8 +150,24 @@ namespace firewalld
Glib::VariantContainerBase g_dbus_result_container;
DBusResultBuilder dbus_result(g_dbus_result_container);
- // Signal method call
- method_called(method_name, dbus_parameters, dbus_result);
+ if (!Glib::str_has_prefix(interface_name, DBUS_INTERFACE_DOMAIN_COMMON)) {
+ invocation->return_dbus_error(DBUS_ERROR_DOMAIN ".UNKNOWN_INTERFACE",
+ "BUG: the requested interaface \""
+ + interface_name
+ + "\" is unknown to FirewallD");
+ }
+
+ const UString interface_internal = interface_name.substr(strlen(DBUS_INTERFACE_DOMAIN_COMMON));
+ const UString method_name_internal = interface_internal + "." + method_name;
+
+ LOG(DEBUG) << "Calling DBus method handler for " + method_name_internal;
+
+ /*
+ * Signal method call. The method call is signaled using an internal
+ * form of the method name which is of the form:
+ * <version>.[<interface>.]<method_name>
+ */
+ method_called(method_name_internal, dbus_parameters, dbus_result);
if (unlikely(dbus_result.isError())) {
const DBusError& error = dbus_result.getError();
@@ -169,6 +185,9 @@ namespace firewalld
dbus_result.finish();
invocation->return_value(g_dbus_result_container);
} catch(...) {
+ invocation->return_dbus_error(DBUS_ERROR_DOMAIN ".INTERNAL_ERROR",
+ "BUG: an unhandled exception was caught "
+ "when processing DBus result");
}
}
}
diff --git a/src/Daemon/DBus.hpp b/src/Daemon/DBus.hpp
index 5e023ef..ae10f6a 100644
--- a/src/Daemon/DBus.hpp
+++ b/src/Daemon/DBus.hpp
@@ -34,7 +34,8 @@
#define __STRINGIFY_X(x) #x
#define __STRINGIFY(x) __STRINGIFY_X(x)
-#define DBUS_INTERFACE "org.fedoraproject.FirewallD" __STRINGIFY(DBUS_INTERFACE_VERSION)
+#define DBUS_INTERFACE_DOMAIN_COMMON "org.fedoraproject.FirewallD"
+#define DBUS_INTERFACE DBUS_INTERFACE_DOMAIN_COMMON __STRINGIFY(DBUS_INTERFACE_VERSION)
#define DBUS_INTERFACE_ZONE DBUS_INTERFACE ".zone"
#define DBUS_INTERFACE_DIRECT DBUS_INTERFACE ".direct"
#define DBUS_INTERFACE_POLICIES DBUS_INTERFACE ".policies"
diff --git a/src/Daemon/DBus/completeReload.cpp b/src/Daemon/DBus/completeReload.cpp
index 6a719cf..5e92a33 100644
--- a/src/Daemon/DBus/completeReload.cpp
+++ b/src/Daemon/DBus/completeReload.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(completeReload)
+ FIREWALLD_DBUS_METHOD(1,,completeReload)
{
// TODO: Make sure kernel modules are reloaded
// Shutdown DBus and stop the Glib main loop
diff --git a/src/Daemon/DBus/direct/addChain.cpp b/src/Daemon/DBus/direct/addChain.cpp
index b320306..05de14e 100644
--- a/src/Daemon/DBus/direct/addChain.cpp
+++ b/src/Daemon/DBus/direct/addChain.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(addChain)
+ FIREWALLD_DBUS_METHOD(1,direct,addChain)
{
LOG(TRACE) << "addChain";
UString ipv;
diff --git a/src/Daemon/DBus/direct/addRule.cpp b/src/Daemon/DBus/direct/addRule.cpp
index 6255a12..551956d 100644
--- a/src/Daemon/DBus/direct/addRule.cpp
+++ b/src/Daemon/DBus/direct/addRule.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(addRule)
+ FIREWALLD_DBUS_METHOD(1,direct,addRule)
{
LOG(TRACE) << "addRule";
UString ipv;
diff --git a/src/Daemon/DBus/direct/getAllChains.cpp b/src/Daemon/DBus/direct/getAllChains.cpp
index 2e9ff44..927ddf6 100644
--- a/src/Daemon/DBus/direct/getAllChains.cpp
+++ b/src/Daemon/DBus/direct/getAllChains.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(getAllChains)
+ FIREWALLD_DBUS_METHOD(1,direct,getAllChains)
{
StringVector ipv_vector = { "ipv4", "ipv6" };
int i = 0;
diff --git a/src/Daemon/DBus/direct/getAllRules.cpp b/src/Daemon/DBus/direct/getAllRules.cpp
index 554aa58..092b8be 100644
--- a/src/Daemon/DBus/direct/getAllRules.cpp
+++ b/src/Daemon/DBus/direct/getAllRules.cpp
@@ -23,7 +23,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(getAllRules)
+ FIREWALLD_DBUS_METHOD(1,direct,getAllRules)
{
StringVector ipv_vector = { "ipv4", "ipv6" };
int i = 0;
diff --git a/src/Daemon/DBus/direct/getChains.cpp b/src/Daemon/DBus/direct/getChains.cpp
index 4d1c269..7805797 100644
--- a/src/Daemon/DBus/direct/getChains.cpp
+++ b/src/Daemon/DBus/direct/getChains.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(getChains)
+ FIREWALLD_DBUS_METHOD(1,direct,getChains)
{
LOG(TRACE) << "getChains";
UString ipv;
diff --git a/src/Daemon/DBus/direct/getRules.cpp b/src/Daemon/DBus/direct/getRules.cpp
index 7f3d8c2..c1b19b3 100644
--- a/src/Daemon/DBus/direct/getRules.cpp
+++ b/src/Daemon/DBus/direct/getRules.cpp
@@ -23,7 +23,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(getRules)
+ FIREWALLD_DBUS_METHOD(1,direct,getRules)
{
UString ipv;
UString table;
diff --git a/src/Daemon/DBus/direct/methods.decl b/src/Daemon/DBus/direct/methods.decl
index 292938f..4e1013a 100644
--- a/src/Daemon/DBus/direct/methods.decl
+++ b/src/Daemon/DBus/direct/methods.decl
@@ -1,14 +1,14 @@
-FIREWALLD_DBUS_METHOD(passthrough);
+FIREWALLD_DBUS_METHOD(1,direct,passthrough);
-FIREWALLD_DBUS_METHOD(addChain);
-FIREWALLD_DBUS_METHOD(getChains);
-FIREWALLD_DBUS_METHOD(getAllChains);
-FIREWALLD_DBUS_METHOD(queryChain);
-FIREWALLD_DBUS_METHOD(removeChain);
+FIREWALLD_DBUS_METHOD(1,direct,addChain);
+FIREWALLD_DBUS_METHOD(1,direct,getChains);
+FIREWALLD_DBUS_METHOD(1,direct,getAllChains);
+FIREWALLD_DBUS_METHOD(1,direct,queryChain);
+FIREWALLD_DBUS_METHOD(1,direct,removeChain);
-FIREWALLD_DBUS_METHOD(addRule);
-FIREWALLD_DBUS_METHOD(getRules);
-FIREWALLD_DBUS_METHOD(getAllRules);
-FIREWALLD_DBUS_METHOD(queryRule);
-FIREWALLD_DBUS_METHOD(removeRule);
-FIREWALLD_DBUS_METHOD(removeRules);
+FIREWALLD_DBUS_METHOD(1,direct,addRule);
+FIREWALLD_DBUS_METHOD(1,direct,getRules);
+FIREWALLD_DBUS_METHOD(1,direct,getAllRules);
+FIREWALLD_DBUS_METHOD(1,direct,queryRule);
+FIREWALLD_DBUS_METHOD(1,direct,removeRule);
+FIREWALLD_DBUS_METHOD(1,direct,removeRules);
diff --git a/src/Daemon/DBus/direct/passthrough.cpp b/src/Daemon/DBus/direct/passthrough.cpp
index 8582c6d..4f93c57 100644
--- a/src/Daemon/DBus/direct/passthrough.cpp
+++ b/src/Daemon/DBus/direct/passthrough.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(passthrough)
+ FIREWALLD_DBUS_METHOD(1,direct,passthrough)
{
LOG(TRACE) << "passthrough";
UString ipv;
diff --git a/src/Daemon/DBus/direct/queryChain.cpp b/src/Daemon/DBus/direct/queryChain.cpp
index 8d3fbd6..eba4c6d 100644
--- a/src/Daemon/DBus/direct/queryChain.cpp
+++ b/src/Daemon/DBus/direct/queryChain.cpp
@@ -23,7 +23,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(queryChain)
+ FIREWALLD_DBUS_METHOD(1,direct,queryChain)
{
UString ipv;
UString table;
diff --git a/src/Daemon/DBus/direct/queryRule.cpp b/src/Daemon/DBus/direct/queryRule.cpp
index 5b96019..dd4ab43 100644
--- a/src/Daemon/DBus/direct/queryRule.cpp
+++ b/src/Daemon/DBus/direct/queryRule.cpp
@@ -23,7 +23,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(queryRule)
+ FIREWALLD_DBUS_METHOD(1,direct,queryRule)
{
UString ipv;
UString table;
diff --git a/src/Daemon/DBus/direct/removeChain.cpp b/src/Daemon/DBus/direct/removeChain.cpp
index be5d76b..b9a5fa6 100644
--- a/src/Daemon/DBus/direct/removeChain.cpp
+++ b/src/Daemon/DBus/direct/removeChain.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(removeChain)
+ FIREWALLD_DBUS_METHOD(1,direct,removeChain)
{
LOG(TRACE) << "removeChain";
UString ipv;
diff --git a/src/Daemon/DBus/direct/removeRule.cpp b/src/Daemon/DBus/direct/removeRule.cpp
index 3630da7..7933b00 100644
--- a/src/Daemon/DBus/direct/removeRule.cpp
+++ b/src/Daemon/DBus/direct/removeRule.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(removeRule)
+ FIREWALLD_DBUS_METHOD(1,direct,removeRule)
{
LOG(TRACE) << "removeRule";
UString ipv;
diff --git a/src/Daemon/DBus/direct/removeRules.cpp b/src/Daemon/DBus/direct/removeRules.cpp
index 882e0ae..a480e9a 100644
--- a/src/Daemon/DBus/direct/removeRules.cpp
+++ b/src/Daemon/DBus/direct/removeRules.cpp
@@ -44,7 +44,7 @@ namespace firewalld
dbus.broadcastSignal("RuleRemoved", DBUS_INTERFACE_DIRECT, signal_parameters);
}
- FIREWALLD_DBUS_METHOD(removeRules)
+ FIREWALLD_DBUS_METHOD(1,direct,removeRules)
{
UString ipv;
UString table;
diff --git a/src/Daemon/DBus/disablePanicMode.cpp b/src/Daemon/DBus/disablePanicMode.cpp
index fbe90fb..d001ae8 100644
--- a/src/Daemon/DBus/disablePanicMode.cpp
+++ b/src/Daemon/DBus/disablePanicMode.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(disablePanicMode)
+ FIREWALLD_DBUS_METHOD(1,,disablePanicMode)
{
result.setTypeSignature("()");
diff --git a/src/Daemon/DBus/enablePanicMode.cpp b/src/Daemon/DBus/enablePanicMode.cpp
index a7e37df..e8e5a2e 100644
--- a/src/Daemon/DBus/enablePanicMode.cpp
+++ b/src/Daemon/DBus/enablePanicMode.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(enablePanicMode)
+ FIREWALLD_DBUS_METHOD(1,,enablePanicMode)
{
result.setTypeSignature("()");
diff --git a/src/Daemon/DBus/getDefaultZone.cpp b/src/Daemon/DBus/getDefaultZone.cpp
index 3ab2483..d35f9e3 100644
--- a/src/Daemon/DBus/getDefaultZone.cpp
+++ b/src/Daemon/DBus/getDefaultZone.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(getDefaultZone)
+ FIREWALLD_DBUS_METHOD(1,,getDefaultZone)
{
result.setTypeSignature("(s)");
result = _fw.getDefaultZoneName();
diff --git a/src/Daemon/DBus/getIcmpTypeSettings.cpp b/src/Daemon/DBus/getIcmpTypeSettings.cpp
index 492c438..d7d5269 100644
--- a/src/Daemon/DBus/getIcmpTypeSettings.cpp
+++ b/src/Daemon/DBus/getIcmpTypeSettings.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(getIcmpTypeSettings)
+ FIREWALLD_DBUS_METHOD(1,,getIcmpTypeSettings)
{
result.setTypeSignature("((sssas))");
diff --git a/src/Daemon/DBus/getServiceSettings.cpp b/src/Daemon/DBus/getServiceSettings.cpp
index 5e209b5..70df337 100644
--- a/src/Daemon/DBus/getServiceSettings.cpp
+++ b/src/Daemon/DBus/getServiceSettings.cpp
@@ -23,7 +23,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(getServiceSettings)
+ FIREWALLD_DBUS_METHOD(1,,getServiceSettings)
{
result.setTypeSignature("((sssa(ss)asa{ss}))");
diff --git a/src/Daemon/DBus/getZoneSettings.cpp b/src/Daemon/DBus/getZoneSettings.cpp
index f976bb2..fa23b9e 100644
--- a/src/Daemon/DBus/getZoneSettings.cpp
+++ b/src/Daemon/DBus/getZoneSettings.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(getZoneSettings)
+ FIREWALLD_DBUS_METHOD(1,,getZoneSettings)
{
result.setTypeSignature("((sssbsasa(ss)asba(ssss)asasas))");
diff --git a/src/Daemon/DBus/listIcmpTypes.cpp b/src/Daemon/DBus/listIcmpTypes.cpp
index 45a1c07..b505870 100644
--- a/src/Daemon/DBus/listIcmpTypes.cpp
+++ b/src/Daemon/DBus/listIcmpTypes.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(listIcmpTypes)
+ FIREWALLD_DBUS_METHOD(1,,listIcmpTypes)
{
result.setTypeSignature("(as)");
UStringVector icmptypes;
diff --git a/src/Daemon/DBus/listServices.cpp b/src/Daemon/DBus/listServices.cpp
index eeebc41..fb5f14e 100644
--- a/src/Daemon/DBus/listServices.cpp
+++ b/src/Daemon/DBus/listServices.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(listServices)
+ FIREWALLD_DBUS_METHOD(1,,listServices)
{
result.setTypeSignature("(as)");
UStringVector service_names;
diff --git a/src/Daemon/DBus/methods.decl b/src/Daemon/DBus/methods.decl
index 8a82557..aacbb5c 100644
--- a/src/Daemon/DBus/methods.decl
+++ b/src/Daemon/DBus/methods.decl
@@ -1,12 +1,12 @@
-FIREWALLD_DBUS_METHOD(reload);
-FIREWALLD_DBUS_METHOD(completeReload);
-FIREWALLD_DBUS_METHOD(disablePanicMode);
-FIREWALLD_DBUS_METHOD(enablePanicMode);
-FIREWALLD_DBUS_METHOD(getDefaultZone);
-FIREWALLD_DBUS_METHOD(listIcmpTypes);
-FIREWALLD_DBUS_METHOD(listServices);
-FIREWALLD_DBUS_METHOD(queryPanicMode);
-FIREWALLD_DBUS_METHOD(setDefaultZone);
-FIREWALLD_DBUS_METHOD(getIcmpTypeSettings);
-FIREWALLD_DBUS_METHOD(getServiceSettings);
-FIREWALLD_DBUS_METHOD(getZoneSettings);
+FIREWALLD_DBUS_METHOD(1,,reload);
+FIREWALLD_DBUS_METHOD(1,,completeReload);
+FIREWALLD_DBUS_METHOD(1,,disablePanicMode);
+FIREWALLD_DBUS_METHOD(1,,enablePanicMode);
+FIREWALLD_DBUS_METHOD(1,,getDefaultZone);
+FIREWALLD_DBUS_METHOD(1,,listIcmpTypes);
+FIREWALLD_DBUS_METHOD(1,,listServices);
+FIREWALLD_DBUS_METHOD(1,,queryPanicMode);
+FIREWALLD_DBUS_METHOD(1,,setDefaultZone);
+FIREWALLD_DBUS_METHOD(1,,getIcmpTypeSettings);
+FIREWALLD_DBUS_METHOD(1,,getServiceSettings);
+FIREWALLD_DBUS_METHOD(1,,getZoneSettings);
diff --git a/src/Daemon/DBus/queryPanicMode.cpp b/src/Daemon/DBus/queryPanicMode.cpp
index 0e5abdb..a4b632a 100644
--- a/src/Daemon/DBus/queryPanicMode.cpp
+++ b/src/Daemon/DBus/queryPanicMode.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(queryPanicMode)
+ FIREWALLD_DBUS_METHOD(1,,queryPanicMode)
{
result.setTypeSignature("(b)");
result = panicMode();
diff --git a/src/Daemon/DBus/reload.cpp b/src/Daemon/DBus/reload.cpp
index eb2d080..2450335 100644
--- a/src/Daemon/DBus/reload.cpp
+++ b/src/Daemon/DBus/reload.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(reload)
+ FIREWALLD_DBUS_METHOD(1,,reload)
{
// Shutdown DBus and stop the Glib main loop
// This will result in terminating the .run() method
diff --git a/src/Daemon/DBus/setDefaultZone.cpp b/src/Daemon/DBus/setDefaultZone.cpp
index 663f32a..bd885a4 100644
--- a/src/Daemon/DBus/setDefaultZone.cpp
+++ b/src/Daemon/DBus/setDefaultZone.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(setDefaultZone)
+ FIREWALLD_DBUS_METHOD(1,,setDefaultZone)
{
result.setTypeSignature("()");
diff --git a/src/Daemon/DBus/zone/addForwardPort.cpp b/src/Daemon/DBus/zone/addForwardPort.cpp
index 1c89bd2..bd1e185 100644
--- a/src/Daemon/DBus/zone/addForwardPort.cpp
+++ b/src/Daemon/DBus/zone/addForwardPort.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(addForwardPort)
+ FIREWALLD_DBUS_METHOD(1,zone,addForwardPort)
{
result.setTypeSignature("(s)");
diff --git a/src/Daemon/DBus/zone/addIcmpBlock.cpp b/src/Daemon/DBus/zone/addIcmpBlock.cpp
index 60bdb2c..0b68205 100644
--- a/src/Daemon/DBus/zone/addIcmpBlock.cpp
+++ b/src/Daemon/DBus/zone/addIcmpBlock.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(addIcmpBlock)
+ FIREWALLD_DBUS_METHOD(1,zone,addIcmpBlock)
{
result.setTypeSignature("(s)");
diff --git a/src/Daemon/DBus/zone/addInterface.cpp b/src/Daemon/DBus/zone/addInterface.cpp
index 8db80db..577f7fe 100644
--- a/src/Daemon/DBus/zone/addInterface.cpp
+++ b/src/Daemon/DBus/zone/addInterface.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(addInterface)
+ FIREWALLD_DBUS_METHOD(1,zone,addInterface)
{
result.setTypeSignature("(s)");
diff --git a/src/Daemon/DBus/zone/addMasquerade.cpp b/src/Daemon/DBus/zone/addMasquerade.cpp
index 05aa590..316abbf 100644
--- a/src/Daemon/DBus/zone/addMasquerade.cpp
+++ b/src/Daemon/DBus/zone/addMasquerade.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(addMasquerade)
+ FIREWALLD_DBUS_METHOD(1,zone,addMasquerade)
{
result.setTypeSignature("(s)");
diff --git a/src/Daemon/DBus/zone/addPort.cpp b/src/Daemon/DBus/zone/addPort.cpp
index fe89bca..e515a9d 100644
--- a/src/Daemon/DBus/zone/addPort.cpp
+++ b/src/Daemon/DBus/zone/addPort.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(addPort)
+ FIREWALLD_DBUS_METHOD(1,zone,addPort)
{
result.setTypeSignature("(s)");
diff --git a/src/Daemon/DBus/zone/addRichRule.cpp b/src/Daemon/DBus/zone/addRichRule.cpp
index 22f075a..87a5704 100644
--- a/src/Daemon/DBus/zone/addRichRule.cpp
+++ b/src/Daemon/DBus/zone/addRichRule.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(addRichRule)
+ FIREWALLD_DBUS_METHOD(1,zone,addRichRule)
{
result.setTypeSignature("(s)");
diff --git a/src/Daemon/DBus/zone/addService.cpp b/src/Daemon/DBus/zone/addService.cpp
index 3dd3651..034f61d 100644
--- a/src/Daemon/DBus/zone/addService.cpp
+++ b/src/Daemon/DBus/zone/addService.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(addService)
+ FIREWALLD_DBUS_METHOD(1,zone,addService)
{
result.setTypeSignature("(s)");
diff --git a/src/Daemon/DBus/zone/addSource.cpp b/src/Daemon/DBus/zone/addSource.cpp
index b425398..47a7cda 100644
--- a/src/Daemon/DBus/zone/addSource.cpp
+++ b/src/Daemon/DBus/zone/addSource.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(addSource)
+ FIREWALLD_DBUS_METHOD(1,zone,addSource)
{
result.setTypeSignature("(s)");
diff --git a/src/Daemon/DBus/zone/changeZone.cpp b/src/Daemon/DBus/zone/changeZone.cpp
index 8d182ed..f9905a3 100644
--- a/src/Daemon/DBus/zone/changeZone.cpp
+++ b/src/Daemon/DBus/zone/changeZone.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(changeZone)
+ FIREWALLD_DBUS_METHOD(1,zone,changeZone)
{
result.setTypeSignature("(s)");
diff --git a/src/Daemon/DBus/zone/changeZoneOfInterface.cpp b/src/Daemon/DBus/zone/changeZoneOfInterface.cpp
index b02efc1..993ce72 100644
--- a/src/Daemon/DBus/zone/changeZoneOfInterface.cpp
+++ b/src/Daemon/DBus/zone/changeZoneOfInterface.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(changeZoneOfInterface)
+ FIREWALLD_DBUS_METHOD(1,zone,changeZoneOfInterface)
{
result.setTypeSignature("(s)");
diff --git a/src/Daemon/DBus/zone/changeZoneOfSource.cpp b/src/Daemon/DBus/zone/changeZoneOfSource.cpp
index 60cc238..39de0e1 100644
--- a/src/Daemon/DBus/zone/changeZoneOfSource.cpp
+++ b/src/Daemon/DBus/zone/changeZoneOfSource.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(changeZoneOfSource)
+ FIREWALLD_DBUS_METHOD(1,zone,changeZoneOfSource)
{
result.setTypeSignature("(s)");
diff --git a/src/Daemon/DBus/zone/getActiveZones.cpp b/src/Daemon/DBus/zone/getActiveZones.cpp
index 1a06aa6..2a9f355 100644
--- a/src/Daemon/DBus/zone/getActiveZones.cpp
+++ b/src/Daemon/DBus/zone/getActiveZones.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(getActiveZones)
+ FIREWALLD_DBUS_METHOD(1,zone,getActiveZones)
{
//
// (a{sa{sas}})
diff --git a/src/Daemon/DBus/zone/getForwardPorts.cpp b/src/Daemon/DBus/zone/getForwardPorts.cpp
index e6b516e..e9587b9 100644
--- a/src/Daemon/DBus/zone/getForwardPorts.cpp
+++ b/src/Daemon/DBus/zone/getForwardPorts.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(getForwardPorts)
+ FIREWALLD_DBUS_METHOD(1,zone,getForwardPorts)
{
result.setTypeSignature("(aas)");
diff --git a/src/Daemon/DBus/zone/getIcmpBlocks.cpp b/src/Daemon/DBus/zone/getIcmpBlocks.cpp
index 3da5df1..95b49d5 100644
--- a/src/Daemon/DBus/zone/getIcmpBlocks.cpp
+++ b/src/Daemon/DBus/zone/getIcmpBlocks.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(getIcmpBlocks)
+ FIREWALLD_DBUS_METHOD(1,zone,getIcmpBlocks)
{
result.setTypeSignature("(as)");
diff --git a/src/Daemon/DBus/zone/getInterfaces.cpp b/src/Daemon/DBus/zone/getInterfaces.cpp
index 850552e..c8eac2b 100644
--- a/src/Daemon/DBus/zone/getInterfaces.cpp
+++ b/src/Daemon/DBus/zone/getInterfaces.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(getInterfaces)
+ FIREWALLD_DBUS_METHOD(1,zone,getInterfaces)
{
result.setTypeSignature("(as)");
diff --git a/src/Daemon/DBus/zone/getPorts.cpp b/src/Daemon/DBus/zone/getPorts.cpp
index 5a331f8..a9094f7 100644
--- a/src/Daemon/DBus/zone/getPorts.cpp
+++ b/src/Daemon/DBus/zone/getPorts.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(getPorts)
+ FIREWALLD_DBUS_METHOD(1,zone,getPorts)
{
result.setTypeSignature("(aas)");
diff --git a/src/Daemon/DBus/zone/getRichRules.cpp b/src/Daemon/DBus/zone/getRichRules.cpp
index 2e639b3..45cdf36 100644
--- a/src/Daemon/DBus/zone/getRichRules.cpp
+++ b/src/Daemon/DBus/zone/getRichRules.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(getRichRules)
+ FIREWALLD_DBUS_METHOD(1,zone,getRichRules)
{
result.setTypeSignature("(as)");
diff --git a/src/Daemon/DBus/zone/getServices.cpp b/src/Daemon/DBus/zone/getServices.cpp
index 248305a..60fd66d 100644
--- a/src/Daemon/DBus/zone/getServices.cpp
+++ b/src/Daemon/DBus/zone/getServices.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(getServices)
+ FIREWALLD_DBUS_METHOD(1,zone,getServices)
{
result.setTypeSignature("(as)");
diff --git a/src/Daemon/DBus/zone/getSources.cpp b/src/Daemon/DBus/zone/getSources.cpp
index c0596f4..4f206a7 100644
--- a/src/Daemon/DBus/zone/getSources.cpp
+++ b/src/Daemon/DBus/zone/getSources.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(getSources)
+ FIREWALLD_DBUS_METHOD(1,zone,getSources)
{
result.setTypeSignature("(as)");
diff --git a/src/Daemon/DBus/zone/getZoneOfInterface.cpp b/src/Daemon/DBus/zone/getZoneOfInterface.cpp
index 6e0b052..5a4daae 100644
--- a/src/Daemon/DBus/zone/getZoneOfInterface.cpp
+++ b/src/Daemon/DBus/zone/getZoneOfInterface.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(getZoneOfInterface)
+ FIREWALLD_DBUS_METHOD(1,zone,getZoneOfInterface)
{
result.setTypeSignature("(s)");
diff --git a/src/Daemon/DBus/zone/getZoneOfSource.cpp b/src/Daemon/DBus/zone/getZoneOfSource.cpp
index 5245ebf..56a2a7a 100644
--- a/src/Daemon/DBus/zone/getZoneOfSource.cpp
+++ b/src/Daemon/DBus/zone/getZoneOfSource.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(getZoneOfSource)
+ FIREWALLD_DBUS_METHOD(1,zone,getZoneOfSource)
{
result.setTypeSignature("(s)");
diff --git a/src/Daemon/DBus/zone/getZones.cpp b/src/Daemon/DBus/zone/getZones.cpp
index dd23319..b335759 100644
--- a/src/Daemon/DBus/zone/getZones.cpp
+++ b/src/Daemon/DBus/zone/getZones.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(getZones)
+ FIREWALLD_DBUS_METHOD(1,zone,getZones)
{
result.setTypeSignature("(as)");
UStringVector zone_names;
diff --git a/src/Daemon/DBus/zone/isImmutable.cpp b/src/Daemon/DBus/zone/isImmutable.cpp
index ed4f900..9137ba4 100644
--- a/src/Daemon/DBus/zone/isImmutable.cpp
+++ b/src/Daemon/DBus/zone/isImmutable.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(isImmutable)
+ FIREWALLD_DBUS_METHOD(1,zone,isImmutable)
{
result.setTypeSignature("(b)");
diff --git a/src/Daemon/DBus/zone/methods.decl b/src/Daemon/DBus/zone/methods.decl
index 230aa0a..3ab6c7c 100644
--- a/src/Daemon/DBus/zone/methods.decl
+++ b/src/Daemon/DBus/zone/methods.decl
@@ -1,49 +1,49 @@
-FIREWALLD_DBUS_METHOD(getActiveZones);
-FIREWALLD_DBUS_METHOD(getZones);
-
-FIREWALLD_DBUS_METHOD(addSource);
-FIREWALLD_DBUS_METHOD(removeSource);
-FIREWALLD_DBUS_METHOD(querySource);
-FIREWALLD_DBUS_METHOD(getSources);
-FIREWALLD_DBUS_METHOD(changeZoneOfSource);
-FIREWALLD_DBUS_METHOD(getZoneOfSource);
-
-FIREWALLD_DBUS_METHOD(addInterface);
-FIREWALLD_DBUS_METHOD(removeInterface);
-FIREWALLD_DBUS_METHOD(queryInterface);
-
-FIREWALLD_DBUS_METHOD(getInterfaces);
-FIREWALLD_DBUS_METHOD(getZoneOfInterface);
-FIREWALLD_DBUS_METHOD(changeZoneOfInterface);
-
-FIREWALLD_DBUS_METHOD(addService);
-FIREWALLD_DBUS_METHOD(removeService);
-FIREWALLD_DBUS_METHOD(queryService);
-FIREWALLD_DBUS_METHOD(getServices);
-
-FIREWALLD_DBUS_METHOD(addPort);
-FIREWALLD_DBUS_METHOD(removePort);
-FIREWALLD_DBUS_METHOD(queryPort);
-FIREWALLD_DBUS_METHOD(getPorts);
-
-FIREWALLD_DBUS_METHOD(addMasquerade);
-FIREWALLD_DBUS_METHOD(queryMasquerade);
-FIREWALLD_DBUS_METHOD(removeMasquerade);
-
-FIREWALLD_DBUS_METHOD(changeZone);
-FIREWALLD_DBUS_METHOD(isImmutable);
-
-FIREWALLD_DBUS_METHOD(addIcmpBlock);
-FIREWALLD_DBUS_METHOD(queryIcmpBlock);
-FIREWALLD_DBUS_METHOD(removeIcmpBlock);
-FIREWALLD_DBUS_METHOD(getIcmpBlocks);
-
-FIREWALLD_DBUS_METHOD(addForwardPort);
-FIREWALLD_DBUS_METHOD(removeForwardPort);
-FIREWALLD_DBUS_METHOD(queryForwardPort);
-FIREWALLD_DBUS_METHOD(getForwardPorts);
-
-FIREWALLD_DBUS_METHOD(addRichRule);
-FIREWALLD_DBUS_METHOD(removeRichRule);
-FIREWALLD_DBUS_METHOD(queryRichRule);
-FIREWALLD_DBUS_METHOD(getRichRules);
+FIREWALLD_DBUS_METHOD(1,zone,getActiveZones);
+FIREWALLD_DBUS_METHOD(1,zone,getZones);
+
+FIREWALLD_DBUS_METHOD(1,zone,addSource);
+FIREWALLD_DBUS_METHOD(1,zone,removeSource);
+FIREWALLD_DBUS_METHOD(1,zone,querySource);
+FIREWALLD_DBUS_METHOD(1,zone,getSources);
+FIREWALLD_DBUS_METHOD(1,zone,changeZoneOfSource);
+FIREWALLD_DBUS_METHOD(1,zone,getZoneOfSource);
+
+FIREWALLD_DBUS_METHOD(1,zone,addInterface);
+FIREWALLD_DBUS_METHOD(1,zone,removeInterface);
+FIREWALLD_DBUS_METHOD(1,zone,queryInterface);
+
+FIREWALLD_DBUS_METHOD(1,zone,getInterfaces);
+FIREWALLD_DBUS_METHOD(1,zone,getZoneOfInterface);
+FIREWALLD_DBUS_METHOD(1,zone,changeZoneOfInterface);
+
+FIREWALLD_DBUS_METHOD(1,zone,addService);
+FIREWALLD_DBUS_METHOD(1,zone,removeService);
+FIREWALLD_DBUS_METHOD(1,zone,queryService);
+FIREWALLD_DBUS_METHOD(1,zone,getServices);
+
+FIREWALLD_DBUS_METHOD(1,zone,addPort);
+FIREWALLD_DBUS_METHOD(1,zone,removePort);
+FIREWALLD_DBUS_METHOD(1,zone,queryPort);
+FIREWALLD_DBUS_METHOD(1,zone,getPorts);
+
+FIREWALLD_DBUS_METHOD(1,zone,addMasquerade);
+FIREWALLD_DBUS_METHOD(1,zone,queryMasquerade);
+FIREWALLD_DBUS_METHOD(1,zone,removeMasquerade);
+
+FIREWALLD_DBUS_METHOD(1,zone,changeZone);
+FIREWALLD_DBUS_METHOD(1,zone,isImmutable);
+
+FIREWALLD_DBUS_METHOD(1,zone,addIcmpBlock);
+FIREWALLD_DBUS_METHOD(1,zone,queryIcmpBlock);
+FIREWALLD_DBUS_METHOD(1,zone,removeIcmpBlock);
+FIREWALLD_DBUS_METHOD(1,zone,getIcmpBlocks);
+
+FIREWALLD_DBUS_METHOD(1,zone,addForwardPort);
+FIREWALLD_DBUS_METHOD(1,zone,removeForwardPort);
+FIREWALLD_DBUS_METHOD(1,zone,queryForwardPort);
+FIREWALLD_DBUS_METHOD(1,zone,getForwardPorts);
+
+FIREWALLD_DBUS_METHOD(1,zone,addRichRule);
+FIREWALLD_DBUS_METHOD(1,zone,removeRichRule);
+FIREWALLD_DBUS_METHOD(1,zone,queryRichRule);
+FIREWALLD_DBUS_METHOD(1,zone,getRichRules);
diff --git a/src/Daemon/DBus/zone/queryForwardPort.cpp b/src/Daemon/DBus/zone/queryForwardPort.cpp
index 6c777f6..1cb4a9f 100644
--- a/src/Daemon/DBus/zone/queryForwardPort.cpp
+++ b/src/Daemon/DBus/zone/queryForwardPort.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(queryForwardPort)
+ FIREWALLD_DBUS_METHOD(1,zone,queryForwardPort)
{
result.setTypeSignature("(b)");
diff --git a/src/Daemon/DBus/zone/queryIcmpBlock.cpp b/src/Daemon/DBus/zone/queryIcmpBlock.cpp
index 549ad82..2566db5 100644
--- a/src/Daemon/DBus/zone/queryIcmpBlock.cpp
+++ b/src/Daemon/DBus/zone/queryIcmpBlock.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(queryIcmpBlock)
+ FIREWALLD_DBUS_METHOD(1,zone,queryIcmpBlock)
{
result.setTypeSignature("(b)");
diff --git a/src/Daemon/DBus/zone/queryInterface.cpp b/src/Daemon/DBus/zone/queryInterface.cpp
index 9361199..424615e 100644
--- a/src/Daemon/DBus/zone/queryInterface.cpp
+++ b/src/Daemon/DBus/zone/queryInterface.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(queryInterface)
+ FIREWALLD_DBUS_METHOD(1,zone,queryInterface)
{
result.setTypeSignature("(b)");
diff --git a/src/Daemon/DBus/zone/queryMasquerade.cpp b/src/Daemon/DBus/zone/queryMasquerade.cpp
index 8b95f86..95ee40d 100644
--- a/src/Daemon/DBus/zone/queryMasquerade.cpp
+++ b/src/Daemon/DBus/zone/queryMasquerade.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(queryMasquerade)
+ FIREWALLD_DBUS_METHOD(1,zone,queryMasquerade)
{
result.setTypeSignature("(b)");
diff --git a/src/Daemon/DBus/zone/queryPort.cpp b/src/Daemon/DBus/zone/queryPort.cpp
index 982ccf4..61b2d76 100644
--- a/src/Daemon/DBus/zone/queryPort.cpp
+++ b/src/Daemon/DBus/zone/queryPort.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(queryPort)
+ FIREWALLD_DBUS_METHOD(1,zone,queryPort)
{
result.setTypeSignature("(b)");
diff --git a/src/Daemon/DBus/zone/queryRichRule.cpp b/src/Daemon/DBus/zone/queryRichRule.cpp
index 58d3b04..c1798f6 100644
--- a/src/Daemon/DBus/zone/queryRichRule.cpp
+++ b/src/Daemon/DBus/zone/queryRichRule.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(queryRichRule)
+ FIREWALLD_DBUS_METHOD(1,zone,queryRichRule)
{
result.setTypeSignature("(b)");
diff --git a/src/Daemon/DBus/zone/queryService.cpp b/src/Daemon/DBus/zone/queryService.cpp
index d097aae..edc2e40 100644
--- a/src/Daemon/DBus/zone/queryService.cpp
+++ b/src/Daemon/DBus/zone/queryService.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(queryService)
+ FIREWALLD_DBUS_METHOD(1,zone,queryService)
{
result.setTypeSignature("(b)");
diff --git a/src/Daemon/DBus/zone/querySource.cpp b/src/Daemon/DBus/zone/querySource.cpp
index 533e876..17e1782 100644
--- a/src/Daemon/DBus/zone/querySource.cpp
+++ b/src/Daemon/DBus/zone/querySource.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(querySource)
+ FIREWALLD_DBUS_METHOD(1,zone,querySource)
{
result.setTypeSignature("(b)");
diff --git a/src/Daemon/DBus/zone/removeForwardPort.cpp b/src/Daemon/DBus/zone/removeForwardPort.cpp
index a36382a..eb8a684 100644
--- a/src/Daemon/DBus/zone/removeForwardPort.cpp
+++ b/src/Daemon/DBus/zone/removeForwardPort.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(removeForwardPort)
+ FIREWALLD_DBUS_METHOD(1,zone,removeForwardPort)
{
result.setTypeSignature("(s)");
diff --git a/src/Daemon/DBus/zone/removeIcmpBlock.cpp b/src/Daemon/DBus/zone/removeIcmpBlock.cpp
index 64b3833..cdaf380 100644
--- a/src/Daemon/DBus/zone/removeIcmpBlock.cpp
+++ b/src/Daemon/DBus/zone/removeIcmpBlock.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(removeIcmpBlock)
+ FIREWALLD_DBUS_METHOD(1,zone,removeIcmpBlock)
{
result.setTypeSignature("(s)");
diff --git a/src/Daemon/DBus/zone/removeInterface.cpp b/src/Daemon/DBus/zone/removeInterface.cpp
index 062f342..eb7d7a9 100644
--- a/src/Daemon/DBus/zone/removeInterface.cpp
+++ b/src/Daemon/DBus/zone/removeInterface.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(removeInterface)
+ FIREWALLD_DBUS_METHOD(1,zone,removeInterface)
{
result.setTypeSignature("(s)");
diff --git a/src/Daemon/DBus/zone/removeMasquerade.cpp b/src/Daemon/DBus/zone/removeMasquerade.cpp
index 02ce720..f35a515 100644
--- a/src/Daemon/DBus/zone/removeMasquerade.cpp
+++ b/src/Daemon/DBus/zone/removeMasquerade.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(removeMasquerade)
+ FIREWALLD_DBUS_METHOD(1,zone,removeMasquerade)
{
result.setTypeSignature("(s)");
diff --git a/src/Daemon/DBus/zone/removePort.cpp b/src/Daemon/DBus/zone/removePort.cpp
index 5ae9d18..f629ef6 100644
--- a/src/Daemon/DBus/zone/removePort.cpp
+++ b/src/Daemon/DBus/zone/removePort.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(removePort)
+ FIREWALLD_DBUS_METHOD(1,zone,removePort)
{
result.setTypeSignature("(s)");
diff --git a/src/Daemon/DBus/zone/removeRichRule.cpp b/src/Daemon/DBus/zone/removeRichRule.cpp
index cdfc119..161d24e 100644
--- a/src/Daemon/DBus/zone/removeRichRule.cpp
+++ b/src/Daemon/DBus/zone/removeRichRule.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(removeRichRule)
+ FIREWALLD_DBUS_METHOD(1,zone,removeRichRule)
{
result.setTypeSignature("(s)");
diff --git a/src/Daemon/DBus/zone/removeService.cpp b/src/Daemon/DBus/zone/removeService.cpp
index 227c2a7..f2a0d70 100644
--- a/src/Daemon/DBus/zone/removeService.cpp
+++ b/src/Daemon/DBus/zone/removeService.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(removeService)
+ FIREWALLD_DBUS_METHOD(1,zone,removeService)
{
result.setTypeSignature("(s)");
diff --git a/src/Daemon/DBus/zone/removeSource.cpp b/src/Daemon/DBus/zone/removeSource.cpp
index c2abbcf..ce1841e 100644
--- a/src/Daemon/DBus/zone/removeSource.cpp
+++ b/src/Daemon/DBus/zone/removeSource.cpp
@@ -22,7 +22,7 @@
namespace firewalld
{
- FIREWALLD_DBUS_METHOD(removeSource)
+ FIREWALLD_DBUS_METHOD(1,zone,removeSource)
{
result.setTypeSignature("(s)");
diff --git a/src/Daemon/Firewall/Backend.cpp b/src/Daemon/Firewall/Backend.cpp
index 0ece111..3d78dbb 100644
--- a/src/Daemon/Firewall/Backend.cpp
+++ b/src/Daemon/Firewall/Backend.cpp
@@ -25,9 +25,10 @@
namespace firewalld
{
- Backend::Backend(const UString& identifier)
+ Backend::Backend(const UString& identifier, const UString& dbus_interface)
{
_identifier = identifier;
+ _dbus_interface = dbus_interface;
_transaction_counter = 0;
}
@@ -40,6 +41,11 @@ namespace firewalld
return _identifier;
}
+ const UString& Backend::directDBusInterface() const
+ {
+ return _dbus_interface;
+ }
+
Pointer<Transaction> Backend::createTransaction()
{
std::lock_guard<std::mutex> backend_lock(_backend_mutex);
@@ -96,4 +102,11 @@ namespace firewalld
return _transactions.size();
}
+ void Backend::handleDBusMethod(const UString& name,
+ const DBusParameters& parameters,
+ DBusResultBuilder& result)
+ {
+ LOG(FATAL) << "BUG: virtual backend method handleDBusMethod not implemented";
+ }
+
} /* namespace firewalld */
diff --git a/src/Daemon/Firewall/Backend.hpp b/src/Daemon/Firewall/Backend.hpp
index d227733..edd5d59 100644
--- a/src/Daemon/Firewall/Backend.hpp
+++ b/src/Daemon/Firewall/Backend.hpp
@@ -21,6 +21,7 @@
#include "Common/Types.hpp"
#include "Daemon/Firewall/Transaction.hpp"
+#include "Daemon/DBus.hpp"
#include <cstddef>
#include <mutex>
@@ -30,22 +31,27 @@ namespace firewalld
class Backend
{
public:
- Backend(const UString& identifier);
+ Backend(const UString& identifier, const UString& dbus_interface = UString(""));
virtual ~Backend();
const UString& identifier() const;
+ const UString& directDBusInterface() const;
Pointer<Transaction> createTransaction();
void commitTransaction(Pointer<Transaction> transaction);
void removeTransaction(const String& identifier);
size_t countTransactions() const;
+ virtual void handleDBusMethod(const UString& name,
+ const DBusParameters& parameters,
+ DBusResultBuilder& result);
protected:
virtual void processOperation(const UStringVector& op, bool undo = false) = 0;
void removeTransactionUnlocked(const String& identifier);
private:
UString _identifier;
+ UString _dbus_interface;
PointerVector<Transaction> _transactions;
mutable std::mutex _backend_mutex;
uint64_t _transaction_counter;
diff --git a/src/Daemon/Firewall/Firewall.cpp b/src/Daemon/Firewall/Firewall.cpp
index 8083064..e8ff653 100644
--- a/src/Daemon/Firewall/Firewall.cpp
+++ b/src/Daemon/Firewall/Firewall.cpp
@@ -270,6 +270,15 @@ namespace firewalld
return _backend->countTransactions();
}
+ Backend& Firewall::backend()
+ {
+ if (_backend == nullptr) {
+ LOG(FATAL) << "BUG: Firewall backend not set!";
+ }
+
+ return *_backend;
+ }
+
void Firewall::processOperation(const UStringVector& op, bool undo)
{
// TODO
diff --git a/src/Daemon/Firewall/Firewall.hpp b/src/Daemon/Firewall/Firewall.hpp
index cdf6a7a..23c81bf 100644
--- a/src/Daemon/Firewall/Firewall.hpp
+++ b/src/Daemon/Firewall/Firewall.hpp
@@ -99,6 +99,8 @@ namespace firewalld
void removeTransaction(const String& identifier);
size_t countTransactions() const;
+ Backend& backend();
+
protected:
void processOperation(const UStringVector& op, bool undo = false);
diff --git a/src/Daemon/Firewall/Zone.cpp b/src/Daemon/Firewall/Zone.cpp
index c3fb97a..2b61bb2 100644
--- a/src/Daemon/Firewall/Zone.cpp
+++ b/src/Daemon/Firewall/Zone.cpp
@@ -89,12 +89,26 @@ namespace firewalld
UStringVector Zone::getAllInterfaceIdentifiers() const
{
- return UStringVector();
+ UStringVector interface_identifiers;
+
+ for(auto const& map_entry : _interface_map) {
+ Pointer<const Interface> interface = map_entry.second;
+ interface_identifiers.push_back(interface->identifier());
+ }
+
+ return std::move(interface_identifiers);
}
UStringVector Zone::getAllSourceIdentifiers() const
{
- return UStringVector();
+ UStringVector source_identifiers;
+
+ for(auto const& map_entry : _source_map) {
+ Pointer<const Source> source = map_entry.second;
+ source_identifiers.push_back(source->identifier());
+ }
+
+ return std::move(source_identifiers);
}
void Zone::addSource(Pointer<Source> source)
diff --git a/src/Daemon/FirewallD.cpp b/src/Daemon/FirewallD.cpp
index 25c600f..90afe66 100644
--- a/src/Daemon/FirewallD.cpp
+++ b/src/Daemon/FirewallD.cpp
@@ -71,7 +71,15 @@ namespace firewalld
// a statement that inserts an entry into the DBus method table.
//
#undef FIREWALLD_DBUS_METHOD
-#define FIREWALLD_DBUS_METHOD(name) _dbus_method_table[#name] = &FirewallD::dbus_##name
+#define FIREWALLD_DBUS_METHOD_REGISTER0(key,sym) \
+ _dbus_method_table[key] = &FirewallD::dbus_##sym
+
+#define FIREWALLD_DBUS_METHOD_REGISTER(key,sym) \
+ FIREWALLD_DBUS_METHOD_REGISTER0(key,sym)
+
+#define FIREWALLD_DBUS_METHOD(v, i, n) \
+ FIREWALLD_DBUS_METHOD_REGISTER(FirewallD::dbusMethodKey(v,#i"",#n),FIREWALLD_DBUS_METHOD_SYM(v,i,n))
+
#include "DBus/methods.decl"
#include "DBus/direct/methods.decl"
#include "DBus/policies/methods.decl"
@@ -305,33 +313,40 @@ namespace firewalld
LOG(TRACE) << "DBus method call: method=" << name;
try {
- //
- // Lookup the method implementation in the DBus method table
- // and call it.
- //
- // Method implementations are registered in the constructor.
- //
- // XXX: So far all methods from all interfaces are stored together.
- // This could be a problem in case there are methods with the
- // same name but in different interfaces.
- // To fix this we have to either create separate tables and do
- // another lookup or use a composite key interface+name.
- //
- const DBusMethodPointer method = _dbus_method_table.at(name);
-
- // Make sure no other DBus method will be executed during execution
- // of this one.
- std::lock_guard<std::mutex> dbus_method_lock(_dbus_method_mutex);
-
- //
- // This will call the method implementation on our instance of the
- // FirewallD class
- //
- (*this.*method)(parameters, result);
- } catch(const std::out_of_range& ex) {
+ /*
+ * First check whether the method call should be handled by
+ * the firewall backend. The directDBusInterface() method
+ * returns the interface name owned by the backend. The `name'
+ * argument contains the name of the called method including
+ * the interface name, i.e.: "foo.bar.interface.method_name".
+ */
+ if (Glib::str_has_prefix(name, _fw.backend().directDBusInterface() + ".")) {
+ _fw.backend().handleDBusMethod(name, parameters, result);
+ } else {
+ /*
+ * Lookup the method implementation in the DBus method table
+ * and call it.
+ *
+ * Method implementations are registered in the constructor.
+ */
+ const DBusMethodPointer method = _dbus_method_table.at(name);
+ /*
+ * Make sure no other DBus method will be executed during execution
+ * of this one.
+ */
+ std::lock_guard<std::mutex> dbus_method_lock(_dbus_method_mutex);
+ /*
+ * This will call the method implementation on our instance of the
+ * FirewallD class
+ */
+ (*this.*method)(parameters, result);
+ }
+ }
+ catch(const std::out_of_range& ex) {
LOG(WARNING) << "Requested DBus method not found in the method table: " << name;
result = DBusError("NotImplemented", "The " + name + " method is currently not implented");
}
+
return;
}
@@ -348,4 +363,13 @@ namespace firewalld
return false;
}
+ const UString FirewallD::dbusMethodKey(int version, const UString& interface, const UString& name)
+ {
+ if (interface != "") {
+ return numberToString(version) + "." + interface + "." + name;
+ } else {
+ return numberToString(version) + "." + name;
+ }
+ }
+
} /* namespace firewalld */
diff --git a/src/Daemon/FirewallD.hpp b/src/Daemon/FirewallD.hpp
index e4d0e16..fbec33a 100644
--- a/src/Daemon/FirewallD.hpp
+++ b/src/Daemon/FirewallD.hpp
@@ -173,13 +173,30 @@ namespace firewalld
DBusResultBuilder& result);
bool dbus_property_set(const UString& name,
const DBusParameters& value);
+ /**
+ * Construct a method table key of a method given a
+ * triple (version, inteface, name). This function is used
+ * when initializing the method table in the constructor.
+ * The resulting keys should resemble the last part of the
+ * interface + name string. The method handling code will
+ * remove the common part
+ */
+ static const UString dbusMethodKey(int version, const UString& interface, const UString& name);
//
// Create a decralation for each DBus method defined
// in the methods.decl files. See a longer comment in
// firewalld.cpp in FirewallD::FirewallD() implementation.
//
-#define FIREWALLD_DBUS_METHOD(name) void dbus_##name(const DBusParameters&, DBusResultBuilder&)
+#define FIREWALLD_DBUS_METHOD_SYM(v, i, n) i##_##n##v
+
+#define __FIREWALLD_DBUS_METHOD_DECL0(n) \
+ void dbus_##n(const DBusParameters&, DBusResultBuilder&)
+#define __FIREWALLD_DBUS_METHOD_DECL(n) \
+ __FIREWALLD_DBUS_METHOD_DECL0(n)
+#define FIREWALLD_DBUS_METHOD(v,i,n) \
+ __FIREWALLD_DBUS_METHOD_DECL(FIREWALLD_DBUS_METHOD_SYM(v,i,n))
+
#include "DBus/methods.decl"
#include "DBus/direct/methods.decl"
#include "DBus/policies/methods.decl"
@@ -214,6 +231,13 @@ namespace firewalld
* in the actual sources of the DBus methods implementations in
* the firewalld_dbus/ subdirectory (see the various *.cpp files)
*/
-#define FIREWALLD_DBUS_METHOD(name) void FirewallD::dbus_##name(const DBusParameters& parameters, DBusResultBuilder& result)
+#define FIREWALLD_DBUS_METHOD_DEFINE0(n) \
+ void FirewallD::dbus_##n(const DBusParameters& parameters, DBusResultBuilder& result)
+
+#define FIREWALLD_DBUS_METHOD_DEFINE(n) \
+ FIREWALLD_DBUS_METHOD_DEFINE0(n)
+
+#define FIREWALLD_DBUS_METHOD(v, i, n) \
+ FIREWALLD_DBUS_METHOD_DEFINE(FIREWALLD_DBUS_METHOD_SYM(v,i,n))
#endif /* _FIREWALLD_H_ */
9 years, 5 months
[firewalld-recode] master: Fix compilation when debug build is disabled (724cef3)
by mildew@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/firewalld-recode.git
On branch : master
>---------------------------------------------------------------
commit 724cef37f6ab5ca09ecf279ac11d90a15c9c1f97
Author: Daniel Kopecek <dkopecek(a)redhat.com>
Date: Wed Nov 26 13:31:14 2014 +0100
Fix compilation when debug build is disabled
>---------------------------------------------------------------
src/Daemon/Firewall/RichRuleParser.cpp | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/Daemon/Firewall/RichRuleParser.cpp b/src/Daemon/Firewall/RichRuleParser.cpp
index 1d5adfa..4ecb845 100644
--- a/src/Daemon/Firewall/RichRuleParser.cpp
+++ b/src/Daemon/Firewall/RichRuleParser.cpp
@@ -9,7 +9,6 @@
#include "RichRules/ForwardPortRule.hpp"
#include "RichLanguageParser/Lexer.hpp"
-#include "RichLanguageParser/Parser.c"
#include "Common/Types.hpp"
#include "Common/Logging.hpp"
@@ -17,9 +16,12 @@
#include <stdexcept>
#include <cstdlib>
#include <sstream>
+#include <cassert>
namespace firewalld
{
+#include "RichLanguageParser/Parser.c"
+
static void RichLanguageParserDeleter(void *p)
{
RichLanguageParserFree(p, &free);
9 years, 5 months
[firewalld-recode] master: Add --enable-debug-build option to the ./configure script (015b8ce)
by mildew@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/firewalld-recode.git
On branch : master
>---------------------------------------------------------------
commit 015b8ce131c157962332cc856c21fed39860f72b
Author: Daniel Kopecek <dkopecek(a)redhat.com>
Date: Wed Nov 26 13:29:38 2014 +0100
Add --enable-debug-build option to the ./configure script
>---------------------------------------------------------------
configure.ac | 34 +++++++++++++++++++++++++++++++++-
1 files changed, 33 insertions(+), 1 deletions(-)
diff --git a/configure.ac b/configure.ac
index 2b8746e..5ee3398 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10,8 +10,24 @@ AM_INIT_AUTOMAKE([foreign tar-pax])
# If automake supports "silent rules", enable them by default
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+#
# Compiler flags
-CXXFLAGS="$CXXFLAGS -std=c++11 -Werror -Wformat=2"
+#
+CXXFLAGS="-std=c++11 -Werror -Wformat=2 $CXXFLAGS"
+
+#
+# Additional CXXFLAGS used when --enable-debug-build is used
+#
+CXXFLAGS_DEBUG_ENABLE="-g -O0"
+
+#
+# Additional CXXFLAGS used when --disable-debug-build is used
+# and when --enable-debug-build is
+#
+# Don't add -DNDEBUG here. It's added to the generated config.h
+# header file.
+#
+CXXFLAGS_DEBUG_DISABLE=""
# Checks for programs.
AC_PROG_CXX
@@ -88,5 +104,21 @@ AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([dup2 gettimeofday localtime_r memset mkdir regcomp setlocale strerror strstr])
+# ./configure script options
+AC_ARG_ENABLE([debug-build],
+ [AC_HELP_STRING([--enable-debug-build], [enable debugging flags (default=no)])],
+ [case "${enableval}" in
+ yes) debug=yes ;;
+ no) debug=no ;;
+ *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug-build]) ;;
+ esac], [debug=no])
+
+if test "$debug" = "yes"; then
+ CXXFLAGS="$CXXFLAGS $CXXFLAGS_DEBUG_ENABLED"
+else
+ CXXFLAGS="$CXXFLAGS $CXXFLAGS_DEBUG_DISABLED"
+ AC_DEFINE([NDEBUG], [1], [Debug build disabled])
+fi
+
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
9 years, 5 months
[firewalld-recode] master: Disable broken code in DBusResultBuilder (ea74f13)
by mildew@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/firewalld-recode.git
On branch : master
>---------------------------------------------------------------
commit ea74f13e454807cc877af497900a4d30685482a9
Author: Daniel Kopecek <dkopecek(a)redhat.com>
Date: Mon Nov 24 15:36:28 2014 +0100
Disable broken code in DBusResultBuilder
>---------------------------------------------------------------
src/Daemon/DBus.hpp | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/Daemon/DBus.hpp b/src/Daemon/DBus.hpp
index 9592e47..5e023ef 100644
--- a/src/Daemon/DBus.hpp
+++ b/src/Daemon/DBus.hpp
@@ -459,6 +459,7 @@ namespace firewalld
break;
case ValueType::Unknown:
LOG(DEBUG) << "Unknown";
+#if 0 /* XXX: this is causing exceptions with empty results */
if (!_value_signature.empty()) {
GVariant *g_array = g_variant_new(_value_signature.c_str(), nullptr);
LOG(DEBUG) << "Add empty variant of type " << _value_signature;
@@ -468,6 +469,8 @@ namespace firewalld
} else {
return false;
}
+#endif
+ return false;
break;
case ValueType::Error:
default:
9 years, 5 months
[firewalld-recode] master: Fix compilation using the CMake based build system (b737352)
by mildew@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/firewalld-recode.git
On branch : master
>---------------------------------------------------------------
commit b7373526b1128d96bea57350b1f3e202da6ca9c5
Author: Daniel Kopecek <dkopecek(a)redhat.com>
Date: Mon Nov 24 15:33:06 2014 +0100
Fix compilation using the CMake based build system
- anything that uses daemonize() now requires Logging.cpp
to compile because of the added Logger reinit in daemonize()
>---------------------------------------------------------------
CMakeLists.txt | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c246d45..461512c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -66,12 +66,14 @@ add_executable(test_sysctl
# Compile test: runcommand
add_executable(test_runcommand
tests/utility/test_runcommand.cpp
+ src/Common/Logging.cpp
src/Common/Utility.cpp)
# Compile test: kernelmodule
add_executable(test_kernelmodule
tests/kernelmodule/test_kernelmodule.cpp
src/Daemon/Backends/Linux/KernelModule.cpp
+ src/Common/Logging.cpp
src/Common/Utility.cpp)
target_link_libraries(test_kernelmodule ${GLIBMM_LIBRARIES})
@@ -81,6 +83,7 @@ add_executable(test_iptables
tests/iptables/test_iptables.cpp
src/Daemon/Backends/Linux/IPTables.cpp
src/Daemon/Backends/Linux/XTables.cpp
+ src/Common/Logging.cpp
src/Common/Utility.cpp)
target_link_libraries(test_iptables ${GLIBMM_LIBRARIES})
@@ -92,6 +95,7 @@ add_executable(test_service_xml
src/Daemon/Firewall/Port.cpp
src/Daemon/Backends/Linux/KernelModule.cpp
src/Common/XMLStorage.cpp
+ src/Common/Logging.cpp
src/Common/Utility.cpp)
target_link_libraries(test_service_xml ${GLIBMM_LIBRARIES} ${EXPAT_LIBRARIES})
9 years, 5 months
[firewalld-recode] master: Implement internal zone definition to zone state transfers (013e91b)
by mildew@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/firewalld-recode.git
On branch : master
>---------------------------------------------------------------
commit 013e91bf6dfb021e6ff35e5d251f1fc5227409e0
Author: Daniel Kopecek <dkopecek(a)redhat.com>
Date: Mon Nov 24 15:28:04 2014 +0100
Implement internal zone definition to zone state transfers
- refactored the Firewall class API to provide
two methods for getting a Zone object pointer:
1) getZone: returns a const pointer for read-only
requests
2) getWritableZone: returns a writable Zone pointer
to an internal firewall state copy of a Zone
definition object which tracks runtime changes to
a Zone
- adapted all DBus methods that used the old getZone
method
>---------------------------------------------------------------
src/Daemon/DBus/zone/addForwardPort.cpp | 3 +-
src/Daemon/DBus/zone/addIcmpBlock.cpp | 3 +-
src/Daemon/DBus/zone/addInterface.cpp | 3 +-
src/Daemon/DBus/zone/addMasquerade.cpp | 3 +-
src/Daemon/DBus/zone/addPort.cpp | 3 +-
src/Daemon/DBus/zone/addRichRule.cpp | 3 +-
src/Daemon/DBus/zone/addService.cpp | 3 +-
src/Daemon/DBus/zone/addSource.cpp | 3 +-
src/Daemon/DBus/zone/changeZone.cpp | 3 +-
src/Daemon/DBus/zone/changeZoneOfInterface.cpp | 3 +-
src/Daemon/DBus/zone/changeZoneOfSource.cpp | 2 +-
src/Daemon/DBus/zone/getForwardPorts.cpp | 2 +-
src/Daemon/DBus/zone/getIcmpBlocks.cpp | 2 +-
src/Daemon/DBus/zone/getInterfaces.cpp | 2 +-
src/Daemon/DBus/zone/getPorts.cpp | 2 +-
src/Daemon/DBus/zone/getRichRules.cpp | 2 +-
src/Daemon/DBus/zone/getServices.cpp | 2 +-
src/Daemon/DBus/zone/getSources.cpp | 2 +-
src/Daemon/DBus/zone/isImmutable.cpp | 2 +-
src/Daemon/DBus/zone/queryForwardPort.cpp | 2 +-
src/Daemon/DBus/zone/queryIcmpBlock.cpp | 2 +-
src/Daemon/DBus/zone/queryInterface.cpp | 2 +-
src/Daemon/DBus/zone/queryMasquerade.cpp | 2 +-
src/Daemon/DBus/zone/queryPort.cpp | 2 +-
src/Daemon/DBus/zone/queryRichRule.cpp | 2 +-
src/Daemon/DBus/zone/queryService.cpp | 2 +-
src/Daemon/DBus/zone/querySource.cpp | 2 +-
src/Daemon/DBus/zone/removeForwardPort.cpp | 3 +-
src/Daemon/DBus/zone/removeIcmpBlock.cpp | 3 +-
src/Daemon/DBus/zone/removeInterface.cpp | 3 +-
src/Daemon/DBus/zone/removeMasquerade.cpp | 3 +-
src/Daemon/DBus/zone/removePort.cpp | 3 +-
src/Daemon/DBus/zone/removeRichRule.cpp | 3 +-
src/Daemon/DBus/zone/removeService.cpp | 3 +-
src/Daemon/DBus/zone/removeSource.cpp | 2 +-
src/Daemon/Firewall/Firewall.cpp | 53 +++++++++++++++++++++---
src/Daemon/Firewall/Firewall.hpp | 18 ++++++++-
src/Daemon/Firewall/Zone.cpp | 16 +++++++-
src/Daemon/Firewall/Zone.hpp | 2 +-
39 files changed, 132 insertions(+), 44 deletions(-)
diff --git a/src/Daemon/DBus/zone/addForwardPort.cpp b/src/Daemon/DBus/zone/addForwardPort.cpp
index 98dc58a..1c89bd2 100644
--- a/src/Daemon/DBus/zone/addForwardPort.cpp
+++ b/src/Daemon/DBus/zone/addForwardPort.cpp
@@ -41,7 +41,8 @@ namespace firewalld
parameters.get(5, timeout);
try {
- Pointer<Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
+ Pointer<Zone> zone = _fw.getWritableZone(zone_name.empty() ?
+ _fw.getDefaultZoneName() : zone_name);
Pointer<Port> src_port = makePointer<Port>(src_port_range, protocol);
Pointer<Port> dst_port = makePointer<Port>(dst_port_range, protocol);
Pointer<PortForward> port_forward = makePointer<PortForward>(src_port, dst_port, dst_address);
diff --git a/src/Daemon/DBus/zone/addIcmpBlock.cpp b/src/Daemon/DBus/zone/addIcmpBlock.cpp
index af509fe..60bdb2c 100644
--- a/src/Daemon/DBus/zone/addIcmpBlock.cpp
+++ b/src/Daemon/DBus/zone/addIcmpBlock.cpp
@@ -35,7 +35,8 @@ namespace firewalld
parameters.get(2, timeout);
try {
- Pointer<Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
+ Pointer<Zone> zone = _fw.getWritableZone(zone_name.empty() ?
+ _fw.getDefaultZoneName() : zone_name);
Pointer<ICMPType> icmptype = lookupICMPType(icmptype_identifier);
if (icmptype == nullptr) {
diff --git a/src/Daemon/DBus/zone/addInterface.cpp b/src/Daemon/DBus/zone/addInterface.cpp
index 8b94cd0..8db80db 100644
--- a/src/Daemon/DBus/zone/addInterface.cpp
+++ b/src/Daemon/DBus/zone/addInterface.cpp
@@ -34,7 +34,8 @@ namespace firewalld
try {
Pointer<Interface> interface = makePointer<Interface>(interface_identifier);
- Pointer<Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
+ Pointer<Zone> zone = _fw.getWritableZone(zone_name.empty() ?
+ _fw.getDefaultZoneName() : zone_name);
zone->addInterface(interface);
_dbus.broadcastSignal("InterfaceAdded", DBUS_INTERFACE_ZONE, parameters);
diff --git a/src/Daemon/DBus/zone/addMasquerade.cpp b/src/Daemon/DBus/zone/addMasquerade.cpp
index 4bd3e89..05aa590 100644
--- a/src/Daemon/DBus/zone/addMasquerade.cpp
+++ b/src/Daemon/DBus/zone/addMasquerade.cpp
@@ -33,7 +33,8 @@ namespace firewalld
parameters.get(1, timeout);
try {
- Pointer<Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
+ Pointer<Zone> zone = _fw.getWritableZone(zone_name.empty() ?
+ _fw.getDefaultZoneName() : zone_name);
zone->setMasquerade(true);
result = zone->name();
}
diff --git a/src/Daemon/DBus/zone/addPort.cpp b/src/Daemon/DBus/zone/addPort.cpp
index 5ed7602..fe89bca 100644
--- a/src/Daemon/DBus/zone/addPort.cpp
+++ b/src/Daemon/DBus/zone/addPort.cpp
@@ -37,7 +37,8 @@ namespace firewalld
parameters.get(3, timeout);
try {
- Pointer<Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
+ Pointer<Zone> zone = _fw.getWritableZone(zone_name.empty() ?
+ _fw.getDefaultZoneName() : zone_name);
Pointer<Port> port = makePointer<Port>(range_spec, protocol);
port->setZone(zone);
zone->addPort(port);
diff --git a/src/Daemon/DBus/zone/addRichRule.cpp b/src/Daemon/DBus/zone/addRichRule.cpp
index d01629f..22f075a 100644
--- a/src/Daemon/DBus/zone/addRichRule.cpp
+++ b/src/Daemon/DBus/zone/addRichRule.cpp
@@ -33,7 +33,8 @@ namespace firewalld
parameters.get(1, rich_rule_spec);
try {
- Pointer<Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
+ Pointer<Zone> zone = _fw.getWritableZone(zone_name.empty() ?
+ _fw.getDefaultZoneName() : zone_name);
Pointer<RichRule> rich_rule = RichRuleParser::parse(rich_rule_spec);
zone->addRichRule(rich_rule);
_dbus.broadcastSignal("RichRuleAdded", DBUS_INTERFACE_ZONE, parameters);
diff --git a/src/Daemon/DBus/zone/addService.cpp b/src/Daemon/DBus/zone/addService.cpp
index 7e409b4..3dd3651 100644
--- a/src/Daemon/DBus/zone/addService.cpp
+++ b/src/Daemon/DBus/zone/addService.cpp
@@ -33,7 +33,8 @@ namespace firewalld
parameters.get(1, service_identifier);
try {
- Pointer<Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
+ Pointer<Zone> zone = _fw.getWritableZone(zone_name.empty() ?
+ _fw.getDefaultZoneName() : zone_name);
Pointer<Service> service = makePointer<Service>(service_identifier);
zone->addService(service);
_dbus.broadcastSignal("ServiceAdded", DBUS_INTERFACE_ZONE, parameters);
diff --git a/src/Daemon/DBus/zone/addSource.cpp b/src/Daemon/DBus/zone/addSource.cpp
index 9bc8e15..b425398 100644
--- a/src/Daemon/DBus/zone/addSource.cpp
+++ b/src/Daemon/DBus/zone/addSource.cpp
@@ -34,7 +34,8 @@ namespace firewalld
try {
Pointer<Source> source = makePointer<Source>(source_spec);
- Pointer<Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
+ Pointer<Zone> zone = _fw.getWritableZone(zone_name.empty() ?
+ _fw.getDefaultZoneName() : zone_name);
zone->addSource(source);
_dbus.broadcastSignal("SourceAdded", DBUS_INTERFACE_ZONE, parameters);
result = zone->name();
diff --git a/src/Daemon/DBus/zone/changeZone.cpp b/src/Daemon/DBus/zone/changeZone.cpp
index ebcf65f..8d182ed 100644
--- a/src/Daemon/DBus/zone/changeZone.cpp
+++ b/src/Daemon/DBus/zone/changeZone.cpp
@@ -33,7 +33,8 @@ namespace firewalld
parameters.get(1, interface_identifier);
try {
- Pointer<Zone> zone_new = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
+ Pointer<Zone> zone_new = _fw.getWritableZone(zone_name.empty() ?
+ _fw.getDefaultZoneName() : zone_name);
Pointer<Interface> interface = _fw.getInterface(interface_identifier);
Pointer<Zone> zone_cur = interface->getZone();
diff --git a/src/Daemon/DBus/zone/changeZoneOfInterface.cpp b/src/Daemon/DBus/zone/changeZoneOfInterface.cpp
index 1c42ff8..b02efc1 100644
--- a/src/Daemon/DBus/zone/changeZoneOfInterface.cpp
+++ b/src/Daemon/DBus/zone/changeZoneOfInterface.cpp
@@ -33,7 +33,8 @@ namespace firewalld
parameters.get(1, interface_identifier);
try {
- Pointer<Zone> zone_new = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
+ Pointer<Zone> zone_new = _fw.getWritableZone(zone_name.empty() ?
+ _fw.getDefaultZoneName() : zone_name);
Pointer<Interface> interface = _fw.getInterface(interface_identifier);
Pointer<Zone> zone_cur = interface->getZone();
diff --git a/src/Daemon/DBus/zone/changeZoneOfSource.cpp b/src/Daemon/DBus/zone/changeZoneOfSource.cpp
index 461a40e..60cc238 100644
--- a/src/Daemon/DBus/zone/changeZoneOfSource.cpp
+++ b/src/Daemon/DBus/zone/changeZoneOfSource.cpp
@@ -33,7 +33,7 @@ namespace firewalld
parameters.get(1, source_spec);
try {
- Pointer<Zone> zone_new = _fw.getZone(zone_name);
+ Pointer<Zone> zone_new = _fw.getWritableZone(zone_name);
Pointer<Source> source = _fw.getSource(source_spec);
Pointer<Zone> zone_cur = source->getZone();
diff --git a/src/Daemon/DBus/zone/getForwardPorts.cpp b/src/Daemon/DBus/zone/getForwardPorts.cpp
index 6d27229..e6b516e 100644
--- a/src/Daemon/DBus/zone/getForwardPorts.cpp
+++ b/src/Daemon/DBus/zone/getForwardPorts.cpp
@@ -31,7 +31,7 @@ namespace firewalld
parameters.get(0, zone_name);
try {
- Pointer<Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
+ Pointer<const Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
auto port_forwards = zone->getForwardPorts();
size_t i = 0;
diff --git a/src/Daemon/DBus/zone/getIcmpBlocks.cpp b/src/Daemon/DBus/zone/getIcmpBlocks.cpp
index 9dc5355..3da5df1 100644
--- a/src/Daemon/DBus/zone/getIcmpBlocks.cpp
+++ b/src/Daemon/DBus/zone/getIcmpBlocks.cpp
@@ -31,7 +31,7 @@ namespace firewalld
parameters.get(0, zone_name);
try {
- Pointer<Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
+ Pointer<const Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
UStringVector icmp_types;
for (auto const& map_entry : zone->getICMPBlocks()) {
icmp_types.push_back(map_entry.first);
diff --git a/src/Daemon/DBus/zone/getInterfaces.cpp b/src/Daemon/DBus/zone/getInterfaces.cpp
index a3f1362..850552e 100644
--- a/src/Daemon/DBus/zone/getInterfaces.cpp
+++ b/src/Daemon/DBus/zone/getInterfaces.cpp
@@ -31,7 +31,7 @@ namespace firewalld
parameters.get(0, zone_name);
try {
- Pointer<Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
+ Pointer<const Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
auto interface_map = zone->getInterfaces();
UStringVector interface_identifier_vector;
diff --git a/src/Daemon/DBus/zone/getPorts.cpp b/src/Daemon/DBus/zone/getPorts.cpp
index 0b08aaa..5a331f8 100644
--- a/src/Daemon/DBus/zone/getPorts.cpp
+++ b/src/Daemon/DBus/zone/getPorts.cpp
@@ -31,7 +31,7 @@ namespace firewalld
parameters.get(0, zone_name);
try {
- Pointer<Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
+ Pointer<const Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
auto tcp_ports = zone->getPorts(Port::Protocol::TCP);
auto udp_ports = zone->getPorts(Port::Protocol::UDP);
size_t i = 0;
diff --git a/src/Daemon/DBus/zone/getRichRules.cpp b/src/Daemon/DBus/zone/getRichRules.cpp
index f05663c..2e639b3 100644
--- a/src/Daemon/DBus/zone/getRichRules.cpp
+++ b/src/Daemon/DBus/zone/getRichRules.cpp
@@ -31,7 +31,7 @@ namespace firewalld
parameters.get(0, zone_name);
try {
- Pointer<Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
+ Pointer<const Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
auto rich_rules = zone->getRichRules();
UStringVector rich_rule_vector;
diff --git a/src/Daemon/DBus/zone/getServices.cpp b/src/Daemon/DBus/zone/getServices.cpp
index 4190e89..248305a 100644
--- a/src/Daemon/DBus/zone/getServices.cpp
+++ b/src/Daemon/DBus/zone/getServices.cpp
@@ -31,7 +31,7 @@ namespace firewalld
parameters.get(0, zone_name);
try {
- Pointer<Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
+ Pointer<const Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
auto services = zone->getServices();
UStringVector service_identifier_vector;
diff --git a/src/Daemon/DBus/zone/getSources.cpp b/src/Daemon/DBus/zone/getSources.cpp
index d1e4f4a..c0596f4 100644
--- a/src/Daemon/DBus/zone/getSources.cpp
+++ b/src/Daemon/DBus/zone/getSources.cpp
@@ -31,7 +31,7 @@ namespace firewalld
parameters.get(0, zone_name);
try {
- Pointer<Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
+ Pointer<const Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
auto source_map = zone->getSources();
UStringVector source_spec_vector;
diff --git a/src/Daemon/DBus/zone/isImmutable.cpp b/src/Daemon/DBus/zone/isImmutable.cpp
index f224891..ed4f900 100644
--- a/src/Daemon/DBus/zone/isImmutable.cpp
+++ b/src/Daemon/DBus/zone/isImmutable.cpp
@@ -31,7 +31,7 @@ namespace firewalld
parameters.get(0, zone_name);
try {
- Pointer<Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
+ Pointer<const Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
result = zone->isImmutable();
}
catch(const FirewallError& ex) {
diff --git a/src/Daemon/DBus/zone/queryForwardPort.cpp b/src/Daemon/DBus/zone/queryForwardPort.cpp
index ef6f5a1..6c777f6 100644
--- a/src/Daemon/DBus/zone/queryForwardPort.cpp
+++ b/src/Daemon/DBus/zone/queryForwardPort.cpp
@@ -39,7 +39,7 @@ namespace firewalld
parameters.get(4, dst_address);
try {
- Pointer<Zone> zone = _fw.getZone(zone_name);
+ Pointer<const Zone> zone = _fw.getZone(zone_name);
Pointer<Port> src_port = makePointer<Port>(src_port_range, protocol);
Pointer<Port> dst_port = makePointer<Port>(dst_port_range, protocol);
Pointer<PortForward> port_forward = makePointer<PortForward>(src_port, dst_port, dst_address);
diff --git a/src/Daemon/DBus/zone/queryIcmpBlock.cpp b/src/Daemon/DBus/zone/queryIcmpBlock.cpp
index f4cbad6..549ad82 100644
--- a/src/Daemon/DBus/zone/queryIcmpBlock.cpp
+++ b/src/Daemon/DBus/zone/queryIcmpBlock.cpp
@@ -33,7 +33,7 @@ namespace firewalld
parameters.get(1, icmp_type);
try {
- Pointer<Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
+ Pointer<const Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
result = zone->queryICMPBlock(icmp_type);
}
catch(const FirewallError& ex) {
diff --git a/src/Daemon/DBus/zone/queryInterface.cpp b/src/Daemon/DBus/zone/queryInterface.cpp
index 305d461..9361199 100644
--- a/src/Daemon/DBus/zone/queryInterface.cpp
+++ b/src/Daemon/DBus/zone/queryInterface.cpp
@@ -34,7 +34,7 @@ namespace firewalld
try {
Pointer<Interface> interface = makePointer<Interface>(interface_identifier);
- Pointer<Zone> zone = _fw.getZone(zone_name);
+ Pointer<const Zone> zone = _fw.getZone(zone_name);
result = zone->queryInterface(interface);
}
catch(const FirewallError& ex) {
diff --git a/src/Daemon/DBus/zone/queryMasquerade.cpp b/src/Daemon/DBus/zone/queryMasquerade.cpp
index cdb194e..8b95f86 100644
--- a/src/Daemon/DBus/zone/queryMasquerade.cpp
+++ b/src/Daemon/DBus/zone/queryMasquerade.cpp
@@ -31,7 +31,7 @@ namespace firewalld
parameters.get(0, zone_name);
try {
- Pointer<Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
+ Pointer<const Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
result = zone->queryMasquerade();
}
catch(const FirewallError& ex) {
diff --git a/src/Daemon/DBus/zone/queryPort.cpp b/src/Daemon/DBus/zone/queryPort.cpp
index 619ff6a..982ccf4 100644
--- a/src/Daemon/DBus/zone/queryPort.cpp
+++ b/src/Daemon/DBus/zone/queryPort.cpp
@@ -35,7 +35,7 @@ namespace firewalld
parameters.get(2, protocol);
try {
- Pointer<Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
+ Pointer<const Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
Pointer<Port> port = makePointer<Port>(range_spec, protocol);
result = zone->queryPort(port);
}
diff --git a/src/Daemon/DBus/zone/queryRichRule.cpp b/src/Daemon/DBus/zone/queryRichRule.cpp
index 007a1ce..58d3b04 100644
--- a/src/Daemon/DBus/zone/queryRichRule.cpp
+++ b/src/Daemon/DBus/zone/queryRichRule.cpp
@@ -33,7 +33,7 @@ namespace firewalld
parameters.get(1, rich_rule_spec);
try {
- Pointer<Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
+ Pointer<const Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
Pointer<RichRule> rich_rule = RichRuleParser::parse(rich_rule_spec);
result = zone->queryRichRule(rich_rule);
}
diff --git a/src/Daemon/DBus/zone/queryService.cpp b/src/Daemon/DBus/zone/queryService.cpp
index 423aa4d..d097aae 100644
--- a/src/Daemon/DBus/zone/queryService.cpp
+++ b/src/Daemon/DBus/zone/queryService.cpp
@@ -33,7 +33,7 @@ namespace firewalld
parameters.get(1, service_identifier);
try {
- Pointer<Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
+ Pointer<const Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
Pointer<Service> service = makePointer<Service>(service_identifier);
result = zone->queryService(service);
}
diff --git a/src/Daemon/DBus/zone/querySource.cpp b/src/Daemon/DBus/zone/querySource.cpp
index 4e09b48..533e876 100644
--- a/src/Daemon/DBus/zone/querySource.cpp
+++ b/src/Daemon/DBus/zone/querySource.cpp
@@ -34,7 +34,7 @@ namespace firewalld
try {
Pointer<Source> source = makePointer<Source>(source_spec);
- Pointer<Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
+ Pointer<const Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
result = zone->querySource(source);
}
catch(const FirewallError& ex) {
diff --git a/src/Daemon/DBus/zone/removeForwardPort.cpp b/src/Daemon/DBus/zone/removeForwardPort.cpp
index 3a06639..a36382a 100644
--- a/src/Daemon/DBus/zone/removeForwardPort.cpp
+++ b/src/Daemon/DBus/zone/removeForwardPort.cpp
@@ -39,7 +39,8 @@ namespace firewalld
parameters.get(4, dst_address);
try {
- Pointer<Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
+ Pointer<Zone> zone = _fw.getWritableZone(zone_name.empty() ?
+ _fw.getDefaultZoneName() : zone_name);
Pointer<Port> src_port = makePointer<Port>(src_port_range, protocol);
Pointer<Port> dst_port = makePointer<Port>(dst_port_range, protocol);
Pointer<PortForward> port_forward = makePointer<PortForward>(src_port, dst_port, dst_address);
diff --git a/src/Daemon/DBus/zone/removeIcmpBlock.cpp b/src/Daemon/DBus/zone/removeIcmpBlock.cpp
index 65230f6..64b3833 100644
--- a/src/Daemon/DBus/zone/removeIcmpBlock.cpp
+++ b/src/Daemon/DBus/zone/removeIcmpBlock.cpp
@@ -33,7 +33,8 @@ namespace firewalld
parameters.get(1, icmp_type);
try {
- Pointer<Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
+ Pointer<Zone> zone = _fw.getWritableZone(zone_name.empty() ?
+ _fw.getDefaultZoneName() : zone_name);
zone->removeICMPBlock(icmp_type);
result = zone->name();
}
diff --git a/src/Daemon/DBus/zone/removeInterface.cpp b/src/Daemon/DBus/zone/removeInterface.cpp
index d000455..062f342 100644
--- a/src/Daemon/DBus/zone/removeInterface.cpp
+++ b/src/Daemon/DBus/zone/removeInterface.cpp
@@ -34,7 +34,8 @@ namespace firewalld
try {
Pointer<Interface> interface = makePointer<Interface>(interface_identifier);
- Pointer<Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
+ Pointer<Zone> zone = _fw.getWritableZone(zone_name.empty() ?
+ _fw.getDefaultZoneName() : zone_name);
if (zone->removeInterface(interface)) {
_dbus.broadcastSignal("InterfaceRemoved", DBUS_INTERFACE_ZONE, parameters);
diff --git a/src/Daemon/DBus/zone/removeMasquerade.cpp b/src/Daemon/DBus/zone/removeMasquerade.cpp
index 6bd5d6c..02ce720 100644
--- a/src/Daemon/DBus/zone/removeMasquerade.cpp
+++ b/src/Daemon/DBus/zone/removeMasquerade.cpp
@@ -31,7 +31,8 @@ namespace firewalld
parameters.get(0, zone_name);
try {
- Pointer<Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
+ Pointer<Zone> zone = _fw.getWritableZone(zone_name.empty() ?
+ _fw.getDefaultZoneName() : zone_name);
zone->setMasquerade(false);
result = zone->name();
}
diff --git a/src/Daemon/DBus/zone/removePort.cpp b/src/Daemon/DBus/zone/removePort.cpp
index 4c6b6c0..5ae9d18 100644
--- a/src/Daemon/DBus/zone/removePort.cpp
+++ b/src/Daemon/DBus/zone/removePort.cpp
@@ -35,7 +35,8 @@ namespace firewalld
parameters.get(2, protocol);
try {
- Pointer<Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
+ Pointer<Zone> zone = _fw.getWritableZone(zone_name.empty() ?
+ _fw.getDefaultZoneName() : zone_name);
Pointer<Port> port = makePointer<Port>(range_spec, protocol);
if (zone->removePort(port)) {
diff --git a/src/Daemon/DBus/zone/removeRichRule.cpp b/src/Daemon/DBus/zone/removeRichRule.cpp
index 876e83e..cdfc119 100644
--- a/src/Daemon/DBus/zone/removeRichRule.cpp
+++ b/src/Daemon/DBus/zone/removeRichRule.cpp
@@ -33,7 +33,8 @@ namespace firewalld
parameters.get(1, rich_rule_spec);
try {
- Pointer<Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
+ Pointer<Zone> zone = _fw.getWritableZone(zone_name.empty() ?
+ _fw.getDefaultZoneName() : zone_name);
Pointer<RichRule> rich_rule = RichRuleParser::parse(rich_rule_spec);
if (zone->removeRichRule(rich_rule)) {
diff --git a/src/Daemon/DBus/zone/removeService.cpp b/src/Daemon/DBus/zone/removeService.cpp
index 3cc5483..227c2a7 100644
--- a/src/Daemon/DBus/zone/removeService.cpp
+++ b/src/Daemon/DBus/zone/removeService.cpp
@@ -33,7 +33,8 @@ namespace firewalld
parameters.get(1, service_identifier);
try {
- Pointer<Zone> zone = _fw.getZone(zone_name.empty() ? _fw.getDefaultZoneName() : zone_name);
+ Pointer<Zone> zone = _fw.getWritableZone(zone_name.empty() ?
+ _fw.getDefaultZoneName() : zone_name);
Pointer<Service> service = makePointer<Service>(service_identifier);
if (zone->removeService(service)) {
diff --git a/src/Daemon/DBus/zone/removeSource.cpp b/src/Daemon/DBus/zone/removeSource.cpp
index 5578688..c2abbcf 100644
--- a/src/Daemon/DBus/zone/removeSource.cpp
+++ b/src/Daemon/DBus/zone/removeSource.cpp
@@ -34,7 +34,7 @@ namespace firewalld
try {
Pointer<Source> source = makePointer<Source>(source_spec);
- Pointer<Zone> zone = _fw.getZone(zone_name);
+ Pointer<Zone> zone = _fw.getWritableZone(zone_name);
if (zone->removeSource(source)) {
// Send the signal only if we actualy removed
diff --git a/src/Daemon/Firewall/Firewall.cpp b/src/Daemon/Firewall/Firewall.cpp
index f2d09d1..8083064 100644
--- a/src/Daemon/Firewall/Firewall.cpp
+++ b/src/Daemon/Firewall/Firewall.cpp
@@ -132,18 +132,59 @@ namespace firewalld
}
bool Firewall::zoneExists(const UString &name) const
- {
+ {
return (_zone_map.find(name) != _zone_map.end());
}
- Pointer<Zone> Firewall::getZone(const UString& name) const
+ Pointer<const Zone> Firewall::getZone(const UString& name) const
+ {
+ /*
+ * First look into the internal firewall state map.
+ */
+ Pointer<const Zone> zone = PointerMapOp::findOne(_zone_map, name);
+
+ if (zone != nullptr) {
+ return zone;
+ }
+
+ /*
+ * The requested zone doesn't have any runtime data to track, try
+ * to search for it among the zone definitions loaded from disk.
+ */
+ zone = FirewallD::instance()->lookupZone(name);
+
+ if (zone == nullptr) {
+ throw FirewallError("INVALID_ZONE", "Zone \"" + name + "\" not defined");
+ }
+
+ return zone;
+ }
+
+ Pointer<Zone> Firewall::getWritableZone(const UString& name)
{
- auto zone_ptr = PointerMapOp::findOne(_zone_map, name);
- if (zone_ptr == nullptr) {
+ Pointer<Zone> zone = PointerMapOp::findOne(_zone_map, name);
+
+ if (zone != nullptr) {
+ return zone;
+ }
+
+ Pointer<const Zone> zone_definition = FirewallD::instance()->lookupZone(name);
+
+ if (zone_definition == nullptr) {
throw FirewallError("INVALID_ZONE", "Zone \"" + name + "\" not defined");
- } else {
- return zone_ptr;
}
+
+ /*
+ * Create a deep copy of the zone definition object and
+ * add it to the internal firewall state. All runtime data
+ * will be tracked in this instance.
+ */
+ zone = makePointer<Zone>(*zone_definition);
+ _zone_map[name] = zone;
+
+ LOG(DEBUG) << "Zone \"" << name << "\" copied to the internal firewall state";
+
+ return zone;
}
Pointer<Source> Firewall::getSource(const UString& source_spec) const
diff --git a/src/Daemon/Firewall/Firewall.hpp b/src/Daemon/Firewall/Firewall.hpp
index f873ce8..cdf6a7a 100644
--- a/src/Daemon/Firewall/Firewall.hpp
+++ b/src/Daemon/Firewall/Firewall.hpp
@@ -67,7 +67,23 @@ namespace firewalld
bool directIPv6QueryRule(const String& table, const String& chain, const String& rule_specification, int rule_num);
bool zoneExists(const UString& name) const;
- Pointer<Zone> getZone(const UString& name) const;
+ /**
+ * Get a pointer to a readonly Zone object.
+ * A readonly Zone object may be used only for querying
+ * data. If a Zone object was changed at runtime, then
+ * the return value points to this modified version.
+ * Otherwise, a pointer to the Zone definition as it was
+ * read from the disk is returned.
+ */
+ Pointer<const Zone> getZone(const UString& name) const;
+ /**
+ * Get a pointer to a writable Zone object.
+ * If a zone is requested for the first time via this
+ * functions, it's definition is first copied to the
+ * internal Firewall state as a new Zone object and a
+ * pointer to the newly created object is returned.
+ */
+ Pointer<Zone> getWritableZone(const UString& name);
Pointer<Source> getSource(const UString& source_spec) const;
Pointer<Interface> getInterface(const UString& interface_identifier) const;
diff --git a/src/Daemon/Firewall/Zone.cpp b/src/Daemon/Firewall/Zone.cpp
index c27f468..c3fb97a 100644
--- a/src/Daemon/Firewall/Zone.cpp
+++ b/src/Daemon/Firewall/Zone.cpp
@@ -27,8 +27,22 @@ namespace firewalld
{
}
- Zone::~Zone()
- {
+ Zone::Zone(const Zone& zone)
+ {
+ _identifier = zone._identifier;
+ _name = zone._name;
+ _description = zone._description;
+ _version = zone._version;
+ _target = zone._target;
+ _flags = zone._flags;
+ _interface_map = zone._interface_map;
+ _service_map = zone._service_map;
+ _source_map = zone._source_map;
+ _tcp_port_map = zone._tcp_port_map;
+ _udp_port_map = zone._udp_port_map;
+ _port_forward_map = zone._port_forward_map;
+ _icmp_block_map = zone._icmp_block_map;
+ _rich_rule_map = zone._rich_rule_map;
}
Zone::Zone(const UString& identifier, const UString& target)
diff --git a/src/Daemon/Firewall/Zone.hpp b/src/Daemon/Firewall/Zone.hpp
index e023f14..9a7ea6c 100644
--- a/src/Daemon/Firewall/Zone.hpp
+++ b/src/Daemon/Firewall/Zone.hpp
@@ -48,8 +48,8 @@ namespace firewalld
};
Zone();
+ Zone(const Zone& zone);
Zone(const UString& identifier, const UString& target = UString());
- ~Zone();
const UString& name() const;
const UString& identifier() const;
9 years, 5 months