Blame SOURCES/0016-fix-dbus-new-dict-based-APIs-for-services.patch

8a3219
From 08101a69d8b06f176c6f5e975ddfc1a562864bd2 Mon Sep 17 00:00:00 2001
8a3219
From: Eric Garver <eric@garver.life>
8a3219
Date: Wed, 19 Jun 2019 17:52:55 -0400
8a3219
Subject: [PATCH 16/20] fix: dbus: new dict based APIs for services
8a3219
8a3219
Since we can't change the dbus APIs, we need new ones that are more
8a3219
flexible. This adds a few for manipulating services using a dictionary
8a3219
of key,value pairs. All new code should use these new APIs. The old APIs
8a3219
have been marked deprecated.
8a3219
8a3219
Fixes: 1fc208bf9317 ("feat: service includes")
8a3219
(cherry picked from commit bbadd3943dabcc11e864223503a46144b0c03007)
8a3219
---
8a3219
 doc/xml/firewalld.dbus.xml            | 92 +++++++++++++++++++--------
8a3219
 src/firewall/core/io/service.py       | 19 +++---
8a3219
 src/firewall/server/config.py         | 18 +++++-
8a3219
 src/firewall/server/config_service.py | 24 ++++++-
8a3219
 src/firewall/server/firewalld.py      | 13 +++-
8a3219
 5 files changed, 123 insertions(+), 43 deletions(-)
8a3219
8a3219
diff --git a/doc/xml/firewalld.dbus.xml b/doc/xml/firewalld.dbus.xml
8a3219
index cb4e1eac0fb9..4a81e8e61858 100644
8a3219
--- a/doc/xml/firewalld.dbus.xml
8a3219
+++ b/doc/xml/firewalld.dbus.xml
8a3219
@@ -241,13 +241,22 @@
8a3219
               </para>
8a3219
             </listitem>
8a3219
           </varlistentry>
8a3219
-	  <varlistentry id="FirewallD1.Methods.getServiceSettings">
8a3219
+          <varlistentry id="FirewallD1.Methods.getServiceSettings">
8a3219
+            <annotation name="org.freedesktop.DBus.Deprecated" />
8a3219
             <term><methodname>getServiceSettings</methodname>(s: <parameter>service</parameter>) → (sssa(ss)asa{ss}asa(ss))</term>
8a3219
+            <listitem>
8a3219
+              <para>
8a3219
+                This function is deprecated, use <link linkend="FirewallD1.Methods.getServiceSettings2">org.fedoraproject.FirewallD1.Methods.getServiceSettings2</link> instead.
8a3219
+              </para>
8a3219
+            </listitem>
8a3219
+          </varlistentry>
8a3219
+          <varlistentry id="FirewallD1.Methods.getServiceSettings2">
8a3219
+            <term><methodname>getServiceSettings2</methodname>(s: <parameter>service</parameter>) → s{sv}</term>
8a3219
             <listitem>
8a3219
               <para>
8a3219
                 Return runtime settings of given <replaceable>service</replaceable>.
8a3219
-                For getting permanent settings see <link linkend="FirewallD1.config.service.Methods.getSettings">org.fedoraproject.FirewallD1.config.service.Methods.getSettings</link>.
8a3219
-                Settings are in format: <parameter>version</parameter>, <parameter>name</parameter>, <parameter>description</parameter>, array of <parameter>ports</parameter> (port, protocol), array of <parameter>module names</parameter>, dictionary of <parameter>destinations</parameter>, array of <parameter>protocols</parameter>, array of <parameter>source-ports</parameter> (port, protocol).
8a3219
+                For getting permanent settings see <link linkend="FirewallD1.config.service.Methods.getSettings2">org.fedoraproject.FirewallD1.config.service.Methods.getSettings2</link>.
8a3219
+                Settings are a dictionary indexed by keywords. For the type of each value see below. If the value is empty it may be ommitted.
8a3219
               </para>
8a3219
               <para>
8a3219
                 <variablelist>
8a3219
@@ -258,12 +267,13 @@
8a3219
                   <varlistentry><term><parameter>module names (as)</parameter>: array of kernel netfilter helpers, see <literal>module</literal> tag in <citerefentry><refentrytitle>firewalld.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</term></varlistentry>
8a3219
                   <varlistentry><term><parameter>destinations (a{ss})</parameter>: dictionary of {IP family : IP address} where 'IP family' key can be either 'ipv4' or 'ipv6'. See <literal>destination</literal> tag in <citerefentry><refentrytitle>firewalld.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</term></varlistentry>
8a3219
                   <varlistentry><term><parameter>protocols (as)</parameter>: array of protocols, see <literal>protocol</literal> tag in <citerefentry><refentrytitle>firewalld.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</term></varlistentry>
8a3219
-		  <varlistentry><term><parameter>source-ports (a(ss))</parameter>: array of port and protocol pairs. See <literal>source-port</literal> tag in <citerefentry><refentrytitle>firewalld.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</term></varlistentry>
8a3219
+                  <varlistentry><term><parameter>source_ports (a(ss))</parameter>: array of port and protocol pairs. See <literal>source-port</literal> tag in <citerefentry><refentrytitle>firewalld.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</term></varlistentry>
8a3219
+                  <varlistentry><term><parameter>includes (as)</parameter>: array of service includes, see <literal>include</literal> tag in <citerefentry><refentrytitle>firewalld.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</term></varlistentry>
8a3219
                 </variablelist>
8a3219
               </para>
8a3219
-	      <para>
8a3219
-		Possible errors: INVALID_SERVICE
8a3219
-	      </para>
8a3219
+              <para>
8a3219
+                Possible errors: INVALID_SERVICE
8a3219
+              </para>
8a3219
             </listitem>
8a3219
           </varlistentry>
8a3219
           <varlistentry id="FirewallD1.Methods.getZoneSettings">
8a3219
@@ -2293,12 +2303,20 @@
8a3219
             </listitem>
8a3219
           </varlistentry>
8a3219
           <varlistentry id="FirewallD1.config.Methods.addService">
8a3219
+            <annotation name="org.freedesktop.DBus.Deprecated" />
8a3219
             <term><methodname>addService</methodname>(s: service, (sssa(ss)asa{ss}asa(ss)): settings) → o</term>
8a3219
             <listitem>
8a3219
               <para>
8a3219
-		Add <replaceable>service</replaceable> with given <replaceable>settings</replaceable> into permanent configuration.
8a3219
-                Settings are in format: <parameter>version</parameter>, <parameter>name</parameter>, <parameter>description</parameter>, array of <parameter>ports</parameter> (port, protocol), array of <parameter>module names</parameter>, dictionary of <parameter>destinations</parameter>, array of <parameter>protocols</parameter> and array of <parameter>source-ports</parameter> (port, protocol).
8a3219
-		Returns object path of the new icmp type.
8a3219
+                This function is deprecated, use <link linkend="FirewallD1.config.Methods.addService2">org.fedoraproject.FirewallD1.config.Methods.addService2</link> instead.
8a3219
+              </para>
8a3219
+            </listitem>
8a3219
+          </varlistentry>
8a3219
+          <varlistentry id="FirewallD1.config.Methods.addService2">
8a3219
+            <term><methodname>addService2</methodname>s: service, a{sv}: settings) → o</term>
8a3219
+            <listitem>
8a3219
+              <para>
8a3219
+                Add <replaceable>service</replaceable> with given <replaceable>settings</replaceable> into permanent configuration.
8a3219
+                Settings are a dictionary indexed by keywords. For the type of each value see below. To zero a value pass an empty string or list.
8a3219
               </para>
8a3219
               <para>
8a3219
                 <variablelist>
8a3219
@@ -2308,13 +2326,14 @@
8a3219
                   <varlistentry><term><parameter>ports (a(ss))</parameter>: array of port and protocol pairs. See <literal>port</literal> tag in <citerefentry><refentrytitle>firewalld.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</term></varlistentry>
8a3219
                   <varlistentry><term><parameter>module names (as)</parameter>: array of kernel netfilter helpers, see <literal>module</literal> tag in <citerefentry><refentrytitle>firewalld.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</term></varlistentry>
8a3219
                   <varlistentry><term><parameter>destinations (a{ss})</parameter>: dictionary of {IP family : IP address} where 'IP family' key can be either 'ipv4' or 'ipv6'. See <literal>destination</literal> tag in <citerefentry><refentrytitle>firewalld.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</term></varlistentry>
8a3219
-		  <varlistentry><term><parameter>protocols (as)</parameter>: array of protocols. See <literal>protocol</literal> tag in <citerefentry><refentrytitle>firewalld.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</term></varlistentry>
8a3219
-		  <varlistentry><term><parameter>source-ports (a(ss))</parameter>: array of port and protocol pairs. See <literal>source-port</literal> tag in <citerefentry><refentrytitle>firewalld.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</term></varlistentry>
8a3219
+                  <varlistentry><term><parameter>protocols (as)</parameter>: array of protocols, see <literal>protocol</literal> tag in <citerefentry><refentrytitle>firewalld.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</term></varlistentry>
8a3219
+                  <varlistentry><term><parameter>source_ports (a(ss))</parameter>: array of port and protocol pairs. See <literal>source-port</literal> tag in <citerefentry><refentrytitle>firewalld.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</term></varlistentry>
8a3219
+                  <varlistentry><term><parameter>includes (as)</parameter>: array of service includes, see <literal>include</literal> tag in <citerefentry><refentrytitle>firewalld.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</term></varlistentry>
8a3219
                 </variablelist>
8a3219
               </para>
8a3219
-	      <para>
8a3219
-		Possible errors: NAME_CONFLICT, INVALID_NAME, INVALID_TYPE
8a3219
-	      </para>
8a3219
+              <para>
8a3219
+                Possible errors: NAME_CONFLICT, INVALID_NAME, INVALID_TYPE
8a3219
+              </para>
8a3219
             </listitem>
8a3219
           </varlistentry>
8a3219
           <varlistentry id="FirewallD1.config.Methods.addZone">
8a3219
@@ -4500,12 +4519,21 @@
8a3219
             </listitem>
8a3219
           </varlistentry>
8a3219
           <varlistentry id="FirewallD1.config.service.Methods.getSettings">
8a3219
+            <annotation name="org.freedesktop.DBus.Deprecated" />
8a3219
             <term><methodname>getSettings</methodname>() → (sssa(ss)asa{ss}asa(ss))</term>
8a3219
             <listitem>
8a3219
               <para>
8a3219
-                Return permanent settings of a <replaceable>service</replaceable>.
8a3219
-                For getting runtime settings see <link linkend="FirewallD1.Methods.getServiceSettings">org.fedoraproject.FirewallD1.Methods.getServiceSettings</link>.
8a3219
-                Settings are in format: <parameter>version</parameter>, <parameter>name</parameter>, <parameter>description</parameter>, array of <parameter>ports</parameter> (port, protocol), array of <parameter>module names</parameter>, dictionary of <parameter>destinations</parameter>, array of <parameter>protocols</parameter> and array of <parameter>source-ports</parameter> (port, protocol).
8a3219
+                This function is deprecated, use <link linkend="FirewallD1.config.service.Methods.getSettings2">org.fedoraproject.FirewallD1.config.service.Methods.getSettings2</link> instead.
8a3219
+              </para>
8a3219
+            </listitem>
8a3219
+          </varlistentry>
8a3219
+          <varlistentry id="FirewallD1.config.service.Methods.getSettings2">
8a3219
+            <term><methodname>getSettings2</methodname>(s: <parameter>service</parameter>) → s{sv}</term>
8a3219
+            <listitem>
8a3219
+              <para>
8a3219
+                Return runtime settings of given <replaceable>service</replaceable>.
8a3219
+                For getting runtime settings see <link linkend="FirewallD1.Methods.getServiceSettings2">org.fedoraproject.FirewallD1.Methods.getServiceSettings2</link>.
8a3219
+                Settings are a dictionary indexed by keywords. For the type of each value see below. If the value is empty it may be ommitted.
8a3219
               </para>
8a3219
               <para>
8a3219
                 <variablelist>
8a3219
@@ -4515,8 +4543,9 @@
8a3219
                   <varlistentry><term><parameter>ports (a(ss))</parameter>: array of port and protocol pairs. See <literal>port</literal> tag in <citerefentry><refentrytitle>firewalld.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</term></varlistentry>
8a3219
                   <varlistentry><term><parameter>module names (as)</parameter>: array of kernel netfilter helpers, see <literal>module</literal> tag in <citerefentry><refentrytitle>firewalld.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</term></varlistentry>
8a3219
                   <varlistentry><term><parameter>destinations (a{ss})</parameter>: dictionary of {IP family : IP address} where 'IP family' key can be either 'ipv4' or 'ipv6'. See <literal>destination</literal> tag in <citerefentry><refentrytitle>firewalld.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</term></varlistentry>
8a3219
-		  <varlistentry><term><parameter>protocols (as)</parameter>: array of protocols. See <literal>protocol</literal> tag in <citerefentry><refentrytitle>firewalld.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</term></varlistentry>
8a3219
-		  <varlistentry><term><parameter>source-ports (a(ss))</parameter>: array of port and protocol pairs. See <literal>source-port</literal> tag in <citerefentry><refentrytitle>firewalld.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</term></varlistentry>
8a3219
+                  <varlistentry><term><parameter>protocols (as)</parameter>: array of protocols, see <literal>protocol</literal> tag in <citerefentry><refentrytitle>firewalld.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</term></varlistentry>
8a3219
+                  <varlistentry><term><parameter>source_ports (a(ss))</parameter>: array of port and protocol pairs. See <literal>source-port</literal> tag in <citerefentry><refentrytitle>firewalld.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</term></varlistentry>
8a3219
+                  <varlistentry><term><parameter>includes (as)</parameter>: array of service includes, see <literal>include</literal> tag in <citerefentry><refentrytitle>firewalld.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</term></varlistentry>
8a3219
                 </variablelist>
8a3219
               </para>
8a3219
             </listitem>
8a3219
@@ -4774,11 +4803,20 @@
8a3219
             </listitem>
8a3219
           </varlistentry>
8a3219
           <varlistentry id="FirewallD1.config.service.Methods.update">
8a3219
+            <annotation name="org.freedesktop.DBus.Deprecated" />
8a3219
             <term><methodname>update</methodname>((sssa(ss)asa{ss}asa(ss)): settings) → Nothing</term>
8a3219
             <listitem>
8a3219
               <para>
8a3219
-		Update settings of service to <replaceable>settings</replaceable>.
8a3219
-		Settings are in format: <parameter>version</parameter>, <parameter>name</parameter>, <parameter>description</parameter>, array of <parameter>ports</parameter> (port, protocol), array of <parameter>module names</parameter>, dictionary of <parameter>destinations</parameter>, array of <parameter>protocols</parameter> and array of <parameter>source-ports</parameter> (port, protocol).
8a3219
+                This function is deprecated, use <link linkend="FirewallD1.config.service.Methods.update2">org.fedoraproject.FirewallD1.config.service.Methods.update2</link> instead.
8a3219
+              </para>
8a3219
+            </listitem>
8a3219
+          </varlistentry>
8a3219
+          <varlistentry id="FirewallD1.config.service.Methods.update2">
8a3219
+            <term><methodname>update2</methodname>a{sv}: settings) → Nothing</term>
8a3219
+            <listitem>
8a3219
+              <para>
8a3219
+                Update settings of service to <replaceable>settings</replaceable>.
8a3219
+                Settings are a dictionary indexed by keywords. For the type of each value see below. To zero a value pass an empty string or list.
8a3219
               </para>
8a3219
               <para>
8a3219
                 <variablelist>
8a3219
@@ -4788,12 +4826,14 @@
8a3219
                   <varlistentry><term><parameter>ports (a(ss))</parameter>: array of port and protocol pairs. See <literal>port</literal> tag in <citerefentry><refentrytitle>firewalld.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</term></varlistentry>
8a3219
                   <varlistentry><term><parameter>module names (as)</parameter>: array of kernel netfilter helpers, see <literal>module</literal> tag in <citerefentry><refentrytitle>firewalld.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</term></varlistentry>
8a3219
                   <varlistentry><term><parameter>destinations (a{ss})</parameter>: dictionary of {IP family : IP address} where 'IP family' key can be either 'ipv4' or 'ipv6'. See <literal>destination</literal> tag in <citerefentry><refentrytitle>firewalld.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</term></varlistentry>
8a3219
-		  <varlistentry><term><parameter>protocols (as)</parameter>: array of protocols. See <literal>protocol</literal> tag in <citerefentry><refentrytitle>firewalld.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</term></varlistentry>
8a3219
+                  <varlistentry><term><parameter>protocols (as)</parameter>: array of protocols, see <literal>protocol</literal> tag in <citerefentry><refentrytitle>firewalld.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</term></varlistentry>
8a3219
+                  <varlistentry><term><parameter>source_ports (a(ss))</parameter>: array of port and protocol pairs. See <literal>source-port</literal> tag in <citerefentry><refentrytitle>firewalld.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</term></varlistentry>
8a3219
+                  <varlistentry><term><parameter>includes (as)</parameter>: array of service includes, see <literal>include</literal> tag in <citerefentry><refentrytitle>firewalld.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</term></varlistentry>
8a3219
                 </variablelist>
8a3219
               </para>
8a3219
-	      <para>
8a3219
-		Possible errors: INVALID_TYPE
8a3219
-	      </para>
8a3219
+              <para>
8a3219
+                Possible errors: INVALID_TYPE
8a3219
+              </para>
8a3219
             </listitem>
8a3219
           </varlistentry>
8a3219
 	</variablelist>
8a3219
diff --git a/src/firewall/core/io/service.py b/src/firewall/core/io/service.py
8a3219
index 44dc0ff8a9b0..8236d3078fbe 100644
8a3219
--- a/src/firewall/core/io/service.py
8a3219
+++ b/src/firewall/core/io/service.py
8a3219
@@ -39,17 +39,16 @@ from firewall.errors import FirewallError
8a3219
 
8a3219
 class Service(IO_Object):
8a3219
     IMPORT_EXPORT_STRUCTURE = (
8a3219
-        ( "version",  "" ),                   # s
8a3219
-        ( "short", "" ),                      # s
8a3219
-        ( "description", "" ),                # s
8a3219
-        ( "ports", [ ( "", "" ), ], ),        # a(ss)
8a3219
-        ( "modules", [ "", ], ),              # as
8a3219
-        ( "destination", { "": "", }, ),      # a{ss}
8a3219
-        ( "protocols", [ "", ], ),            # as
8a3219
-        ( "source_ports", [ ( "", "" ), ], ), # a(ss)
8a3219
-        ( "includes", [ "" ], ),              # as
8a3219
+        ( "version",  "" ),
8a3219
+        ( "short", "" ),
8a3219
+        ( "description", "" ),
8a3219
+        ( "ports", [ ( "", "" ), ], ),
8a3219
+        ( "modules", [ "", ], ),
8a3219
+        ( "destination", { "": "", }, ),
8a3219
+        ( "protocols", [ "", ], ),
8a3219
+        ( "source_ports", [ ( "", "" ), ], ),
8a3219
+        ( "includes", [ "" ], ),
8a3219
         )
8a3219
-    DBUS_SIGNATURE = '(sssa(ss)asa{ss}asa(ss))'
8a3219
     ADDITIONAL_ALNUM_CHARS = [ "_", "-" ]
8a3219
     PARSER_REQUIRED_ELEMENT_ATTRS = {
8a3219
         "short": None,
8a3219
diff --git a/src/firewall/server/config.py b/src/firewall/server/config.py
8a3219
index 971dc7d4a14a..e03c4984e058 100644
8a3219
--- a/src/firewall/server/config.py
8a3219
+++ b/src/firewall/server/config.py
8a3219
@@ -41,7 +41,6 @@ from firewall.server.config_zone import FirewallDConfigZone
8a3219
 from firewall.server.config_ipset import FirewallDConfigIPSet
8a3219
 from firewall.server.config_helper import FirewallDConfigHelper
8a3219
 from firewall.core.io.zone import Zone
8a3219
-from firewall.core.io.service import Service
8a3219
 from firewall.core.io.icmptype import IcmpType
8a3219
 from firewall.core.io.ipset import IPSet
8a3219
 from firewall.core.io.helper import Helper
8a3219
@@ -1065,7 +1064,7 @@ class FirewallDConfig(slip.dbus.service.Object):
8a3219
         raise FirewallError(errors.INVALID_SERVICE, service)
8a3219
 
8a3219
     @dbus_service_method(config.dbus.DBUS_INTERFACE_CONFIG,
8a3219
-                         in_signature='s'+Service.DBUS_SIGNATURE,
8a3219
+                         in_signature='s(sssa(ss)asa{ss}asa(ss))',
8a3219
                          out_signature='o')
8a3219
     @dbus_handle_exceptions
8a3219
     def addService(self, service, settings, sender=None):
8a3219
@@ -1079,6 +1078,21 @@ class FirewallDConfig(slip.dbus.service.Object):
8a3219
         config_service = self._addService(obj)
8a3219
         return config_service
8a3219
 
8a3219
+    @dbus_service_method(config.dbus.DBUS_INTERFACE_CONFIG,
8a3219
+                         in_signature='sa{sv}',
8a3219
+                         out_signature='o')
8a3219
+    @dbus_handle_exceptions
8a3219
+    def addService2(self, service, settings, sender=None):
8a3219
+        """add service with given name and settings
8a3219
+        """
8a3219
+        service = dbus_to_python(service, str)
8a3219
+        settings = dbus_to_python(settings)
8a3219
+        log.debug1("config.addService2('%s')", service)
8a3219
+        self.accessCheck(sender)
8a3219
+        obj = self.config.new_service_dict(service, settings)
8a3219
+        config_service = self._addService(obj)
8a3219
+        return config_service
8a3219
+
8a3219
     @dbus.service.signal(config.dbus.DBUS_INTERFACE_CONFIG, signature='s')
8a3219
     @dbus_handle_exceptions
8a3219
     def ServiceAdded(self, service):
8a3219
diff --git a/src/firewall/server/config_service.py b/src/firewall/server/config_service.py
8a3219
index 05ded1c78da7..3236b3aee135 100644
8a3219
--- a/src/firewall/server/config_service.py
8a3219
+++ b/src/firewall/server/config_service.py
8a3219
@@ -32,7 +32,6 @@ from firewall import config
8a3219
 from firewall.dbus_utils import dbus_to_python, \
8a3219
     dbus_introspection_prepare_properties, \
8a3219
     dbus_introspection_add_properties
8a3219
-from firewall.core.io.service import Service
8a3219
 from firewall.core.logger import log
8a3219
 from firewall.server.decorators import handle_exceptions, \
8a3219
     dbus_handle_exceptions, dbus_service_method
8a3219
@@ -173,7 +172,7 @@ class FirewallDConfigService(slip.dbus.service.Object):
8a3219
     # S E T T I N G S
8a3219
 
8a3219
     @dbus_service_method(config.dbus.DBUS_INTERFACE_CONFIG_SERVICE,
8a3219
-                         out_signature=Service.DBUS_SIGNATURE)
8a3219
+                         out_signature='(sssa(ss)asa{ss}asa(ss))')
8a3219
     @dbus_handle_exceptions
8a3219
     def getSettings(self, sender=None): # pylint: disable=W0613
8a3219
         """get settings for service
8a3219
@@ -182,7 +181,16 @@ class FirewallDConfigService(slip.dbus.service.Object):
8a3219
         return self.config.get_service_config(self.obj)
8a3219
 
8a3219
     @dbus_service_method(config.dbus.DBUS_INTERFACE_CONFIG_SERVICE,
8a3219
-                         in_signature=Service.DBUS_SIGNATURE)
8a3219
+                         out_signature='a{sv}')
8a3219
+    @dbus_handle_exceptions
8a3219
+    def getSettings2(self, sender=None):
8a3219
+        """get settings for service
8a3219
+        """
8a3219
+        log.debug1("%s.getSettings2()", self._log_prefix)
8a3219
+        return self.config.get_service_config_dict(self.obj)
8a3219
+
8a3219
+    @dbus_service_method(config.dbus.DBUS_INTERFACE_CONFIG_SERVICE,
8a3219
+                         in_signature='(sssa(ss)asa{ss}asa(ss))')
8a3219
     @dbus_handle_exceptions
8a3219
     def update(self, settings, sender=None):
8a3219
         """update settings for service
8a3219
@@ -193,6 +201,16 @@ class FirewallDConfigService(slip.dbus.service.Object):
8a3219
         self.obj = self.config.set_service_config(self.obj, settings)
8a3219
         self.Updated(self.obj.name)
8a3219
 
8a3219
+    @dbus_service_method(config.dbus.DBUS_INTERFACE_CONFIG_SERVICE,
8a3219
+                         in_signature='a{sv}')
8a3219
+    @dbus_handle_exceptions
8a3219
+    def update2(self, settings, sender=None):
8a3219
+        settings = dbus_to_python(settings)
8a3219
+        log.debug1("%s.update2('...')", self._log_prefix)
8a3219
+        self.parent.accessCheck(sender)
8a3219
+        self.obj = self.config.set_service_config_dict(self.obj, settings)
8a3219
+        self.Updated(self.obj.name)
8a3219
+
8a3219
     @dbus_service_method(config.dbus.DBUS_INTERFACE_CONFIG_SERVICE)
8a3219
     @dbus_handle_exceptions
8a3219
     def loadDefaults(self, sender=None):
8a3219
diff --git a/src/firewall/server/firewalld.py b/src/firewall/server/firewalld.py
8a3219
index 233160b64b18..06c2834c602e 100644
8a3219
--- a/src/firewall/server/firewalld.py
8a3219
+++ b/src/firewall/server/firewalld.py
8a3219
@@ -49,7 +49,6 @@ from firewall.dbus_utils import dbus_to_python, \
8a3219
 from firewall.core.io.functions import check_config
8a3219
 from firewall.core.io.zone import Zone
8a3219
 from firewall.core.io.ipset import IPSet
8a3219
-from firewall.core.io.service import Service
8a3219
 from firewall.core.io.icmptype import IcmpType
8a3219
 from firewall.core.io.helper import Helper
8a3219
 from firewall.core.fw_nm import nm_get_bus_name, nm_get_connection_of_interface, \
8a3219
@@ -916,7 +915,7 @@ class FirewallD(slip.dbus.service.Object):
8a3219
 
8a3219
     @slip.dbus.polkit.require_auth(config.dbus.PK_ACTION_CONFIG_INFO)
8a3219
     @dbus_service_method(config.dbus.DBUS_INTERFACE, in_signature='s',
8a3219
-                         out_signature=Service.DBUS_SIGNATURE)
8a3219
+                         out_signature='(sssa(ss)asa{ss}asa(ss))')
8a3219
     @dbus_handle_exceptions
8a3219
     def getServiceSettings(self, service, sender=None): # pylint: disable=W0613
8a3219
         # returns service settings for service
8a3219
@@ -934,6 +933,16 @@ class FirewallD(slip.dbus.service.Object):
8a3219
                 conf_list.append(conf_dict[obj.IMPORT_EXPORT_STRUCTURE[i][0]])
8a3219
         return tuple(conf_list)
8a3219
 
8a3219
+    @slip.dbus.polkit.require_auth(config.dbus.PK_ACTION_CONFIG_INFO)
8a3219
+    @dbus_service_method(config.dbus.DBUS_INTERFACE, in_signature='s',
8a3219
+                         out_signature='a{sv}')
8a3219
+    @dbus_handle_exceptions
8a3219
+    def getServiceSettings2(self, service, sender=None): # pylint: disable=W0613
8a3219
+        service = dbus_to_python(service, str)
8a3219
+        log.debug1("getServiceSettings2(%s)", service)
8a3219
+        obj = self.fw.service.get_service(service)
8a3219
+        return obj.export_config()
8a3219
+
8a3219
     @slip.dbus.polkit.require_auth(config.dbus.PK_ACTION_INFO)
8a3219
     @dbus_service_method(config.dbus.DBUS_INTERFACE, in_signature='',
8a3219
                          out_signature='as')
8a3219
-- 
8a3219
2.20.1
8a3219