From bc6ba9d59f8070b0e76f127f16ef1cd99da90ffc Mon Sep 17 00:00:00 2001
From: Thomas Woerner <twoerner@redhat.com>
Date: Fri, 19 May 2017 15:35:54 +0200
Subject: [PATCH 5/6] D-Bus interfaces: Fix GetAll for interfaces without
properties (RHBZ#1452017)
Also: Make D-Bus error messages consistent in all interfaces.
(cherry picked from commit fb44764d1275958401e2e69161d997bfb6e02899)
---
src/firewall/server/config.py | 115 +++++++++++++++++++--------------
src/firewall/server/config_helper.py | 15 ++---
src/firewall/server/config_icmptype.py | 15 ++---
src/firewall/server/config_ipset.py | 15 ++---
src/firewall/server/config_service.py | 15 ++---
src/firewall/server/config_zone.py | 15 ++---
src/firewall/server/firewalld.py | 71 ++++++++++++++------
7 files changed, 152 insertions(+), 109 deletions(-)
diff --git a/src/firewall/server/config.py b/src/firewall/server/config.py
index 55bfffbebe76..33f72027d048 100644
--- a/src/firewall/server/config.py
+++ b/src/firewall/server/config.py
@@ -486,8 +486,8 @@ class FirewallDConfig(slip.dbus.service.Object):
"Lockdown", "IPv6_rpfilter", "IndividualCalls",
"LogDenied", "AutomaticHelpers" ]:
raise dbus.exceptions.DBusException(
- "org.freedesktop.DBus.Error.AccessDenied: "
- "Property '%s' isn't exported (or may not exist)" % prop)
+ "org.freedesktop.DBus.Error.InvalidArgs: "
+ "Property '%s' does not exist" % prop)
value = self.config.get_firewalld_conf().get(prop)
@@ -546,8 +546,8 @@ class FirewallDConfig(slip.dbus.service.Object):
return dbus.String(self._get_property(prop))
else:
raise dbus.exceptions.DBusException(
- "org.freedesktop.DBus.Error.AccessDenied: "
- "Property '%s' isn't exported (or may not exist)" % prop)
+ "org.freedesktop.DBus.Error.InvalidArgs: "
+ "Property '%s' does not exist" % prop)
@dbus_service_method(dbus.PROPERTIES_IFACE, in_signature='ss',
out_signature='v')
@@ -558,10 +558,17 @@ class FirewallDConfig(slip.dbus.service.Object):
property_name = dbus_to_python(property_name, str)
log.debug1("config.Get('%s', '%s')", interface_name, property_name)
- if interface_name != config.dbus.DBUS_INTERFACE_CONFIG:
+ if interface_name == config.dbus.DBUS_INTERFACE_CONFIG:
+ return self._get_dbus_property(property_name)
+ elif interface_name in [ config.dbus.DBUS_INTERFACE_CONFIG_DIRECT,
+ config.dbus.DBUS_INTERFACE_CONFIG_POLICIES ]:
+ raise dbus.exceptions.DBusException(
+ "org.freedesktop.DBus.Error.InvalidArgs: "
+ "Property '%s' does not exist" % property_name)
+ else:
raise dbus.exceptions.DBusException(
"org.freedesktop.DBus.Error.UnknownInterface: "
- "FirewallD does not implement %s" % interface_name)
+ "Interface '%s' does not exist" % interface_name)
return self._get_dbus_property(property_name)
@@ -572,16 +579,20 @@ class FirewallDConfig(slip.dbus.service.Object):
interface_name = dbus_to_python(interface_name, str)
log.debug1("config.GetAll('%s')", interface_name)
- if interface_name != config.dbus.DBUS_INTERFACE_CONFIG:
+ ret = { }
+ if interface_name == config.dbus.DBUS_INTERFACE_CONFIG:
+ for x in [ "DefaultZone", "MinimalMark", "CleanupOnExit",
+ "Lockdown", "IPv6_rpfilter", "IndividualCalls",
+ "LogDenied", "AutomaticHelpers" ]:
+ ret[x] = self._get_property(x)
+ elif interface_name in [ config.dbus.DBUS_INTERFACE_CONFIG_DIRECT,
+ config.dbus.DBUS_INTERFACE_CONFIG_POLICIES ]:
+ pass
+ else:
raise dbus.exceptions.DBusException(
"org.freedesktop.DBus.Error.UnknownInterface: "
- "FirewallD does not implement %s" % interface_name)
+ "Interface '%s' does not exist" % interface_name)
- ret = { }
- for x in [ "DefaultZone", "MinimalMark", "CleanupOnExit", "Lockdown",
- "IPv6_rpfilter", "IndividualCalls", "LogDenied",
- "AutomaticHelpers" ]:
- ret[x] = self._get_property(x)
return dbus.Dictionary(ret, signature="sv")
@slip.dbus.polkit.require_auth(config.dbus.PK_ACTION_CONFIG)
@@ -595,49 +606,55 @@ class FirewallDConfig(slip.dbus.service.Object):
property_name, new_value)
self.accessCheck(sender)
- if interface_name != config.dbus.DBUS_INTERFACE_CONFIG:
- raise dbus.exceptions.DBusException(
- "org.freedesktop.DBus.Error.UnknownInterface: "
- "FirewallD does not implement %s" % interface_name)
-
- if property_name in [ "MinimalMark", "CleanupOnExit", "Lockdown",
- "IPv6_rpfilter", "IndividualCalls", "LogDenied",
- "AutomaticHelpers" ]:
- if property_name == "MinimalMark":
+ if interface_name == config.dbus.DBUS_INTERFACE_CONFIG:
+ if property_name in [ "MinimalMark", "CleanupOnExit", "Lockdown",
+ "IPv6_rpfilter", "IndividualCalls",
+ "LogDenied", "AutomaticHelpers" ]:
+ if property_name == "MinimalMark":
+ try:
+ int(new_value)
+ except ValueError:
+ raise FirewallError(errors.INVALID_MARK, new_value)
try:
- int(new_value)
- except ValueError:
- raise FirewallError(errors.INVALID_MARK, new_value)
- try:
- new_value = str(new_value)
- except:
- raise FirewallError(errors.INVALID_VALUE, "'%s' for %s" % \
+ new_value = str(new_value)
+ except:
+ raise FirewallError(errors.INVALID_VALUE,
+ "'%s' for %s" % \
+ (new_value, property_name))
+ if property_name in [ "CleanupOnExit", "Lockdown",
+ "IPv6_rpfilter", "IndividualCalls" ]:
+ if new_value.lower() not in [ "yes", "no",
+ "true", "false" ]:
+ raise FirewallError(errors.INVALID_VALUE,
+ "'%s' for %s" % \
(new_value, property_name))
- if property_name in [ "CleanupOnExit", "Lockdown",
- "IPv6_rpfilter", "IndividualCalls" ]:
- if new_value.lower() not in [ "yes", "no", "true", "false" ]:
- raise FirewallError(errors.INVALID_VALUE, "'%s' for %s" % \
+ if property_name == "LogDenied":
+ if new_value not in config.LOG_DENIED_VALUES:
+ raise FirewallError(errors.INVALID_VALUE,
+ "'%s' for %s" % \
(new_value, property_name))
- if property_name == "LogDenied":
- if new_value not in config.LOG_DENIED_VALUES:
- raise FirewallError(errors.INVALID_VALUE, "'%s' for %s" % \
+ if property_name == "AutomaticHelpers":
+ if new_value not in config.AUTOMATIC_HELPERS_VALUES:
+ raise FirewallError(errors.INVALID_VALUE,
+ "'%s' for %s" % \
(new_value, property_name))
- if property_name == "AutomaticHelpers":
- if new_value not in config.AUTOMATIC_HELPERS_VALUES:
- raise FirewallError(errors.INVALID_VALUE, "'%s' for %s" % \
- (new_value, property_name))
- self.config.get_firewalld_conf().set(property_name, new_value)
- self.config.get_firewalld_conf().write()
- self.PropertiesChanged(interface_name,
- { property_name: new_value }, [ ])
- elif property_name in [ "DefaultZone" ]:
+ self.config.get_firewalld_conf().set(property_name, new_value)
+ self.config.get_firewalld_conf().write()
+ self.PropertiesChanged(interface_name,
+ { property_name: new_value }, [ ])
+ else:
+ raise dbus.exceptions.DBusException(
+ "org.freedesktop.DBus.Error.InvalidArgs: "
+ "Property '%s' does not exist" % property_name)
+ elif interface_name in [ config.dbus.DBUS_INTERFACE_CONFIG_DIRECT,
+ config.dbus.DBUS_INTERFACE_CONFIG_POLICIES ]:
raise dbus.exceptions.DBusException(
- "org.freedesktop.DBus.Error.PropertyReadOnly: "
- "Property '%s' is read-only" % property_name)
+ "org.freedesktop.DBus.Error.InvalidArgs: "
+ "Property '%s' does not exist" % property_name)
else:
raise dbus.exceptions.DBusException(
- "org.freedesktop.DBus.Error.AccessDenied: "
- "Property '%s' does not exist" % property_name)
+ "org.freedesktop.DBus.Error.UnknownInterface: "
+ "Interface '%s' does not exist" % interface_name)
@dbus.service.signal(dbus.PROPERTIES_IFACE, signature='sa{sv}as')
def PropertiesChanged(self, interface_name, changed_properties,
diff --git a/src/firewall/server/config_helper.py b/src/firewall/server/config_helper.py
index e3683e9b7788..23e30e04ba26 100644
--- a/src/firewall/server/config_helper.py
+++ b/src/firewall/server/config_helper.py
@@ -92,9 +92,8 @@ class FirewallDConfigHelper(slip.dbus.service.Object):
return dbus.Boolean(self.obj.builtin)
else:
raise dbus.exceptions.DBusException(
- "org.freedesktop.DBus.Error.AccessDenied: "
- "Property '%s' isn't exported (or may not exist)" % \
- property_name)
+ "org.freedesktop.DBus.Error.InvalidArgs: "
+ "Property '%s' does not exist" % property_name)
@dbus_service_method(dbus.PROPERTIES_IFACE, in_signature='ss',
out_signature='v')
@@ -109,7 +108,7 @@ class FirewallDConfigHelper(slip.dbus.service.Object):
if interface_name != config.dbus.DBUS_INTERFACE_CONFIG_HELPER:
raise dbus.exceptions.DBusException(
"org.freedesktop.DBus.Error.UnknownInterface: "
- "FirewallD does not implement %s" % interface_name)
+ "Interface '%s' does not exist" % interface_name)
return self._get_property(property_name)
@@ -123,7 +122,7 @@ class FirewallDConfigHelper(slip.dbus.service.Object):
if interface_name != config.dbus.DBUS_INTERFACE_CONFIG_HELPER:
raise dbus.exceptions.DBusException(
"org.freedesktop.DBus.Error.UnknownInterface: "
- "FirewallD does not implement %s" % interface_name)
+ "Interface '%s' does not exist" % interface_name)
ret = { }
for x in [ "name", "filename", "path", "default", "builtin" ]:
@@ -144,11 +143,11 @@ class FirewallDConfigHelper(slip.dbus.service.Object):
if interface_name != config.dbus.DBUS_INTERFACE_CONFIG_HELPER:
raise dbus.exceptions.DBusException(
"org.freedesktop.DBus.Error.UnknownInterface: "
- "FirewallD does not implement %s" % interface_name)
+ "Interface '%s' does not exist" % interface_name)
raise dbus.exceptions.DBusException(
- "org.freedesktop.DBus.Error.AccessDenied: "
- "Property '%s' is not settable" % property_name)
+ "org.freedesktop.DBus.Error.PropertyReadOnly: "
+ "Property '%s' is read-only" % property_name)
@dbus.service.signal(dbus.PROPERTIES_IFACE, signature='sa{sv}as')
def PropertiesChanged(self, interface_name, changed_properties,
diff --git a/src/firewall/server/config_icmptype.py b/src/firewall/server/config_icmptype.py
index 9f571ae98128..e1724550d740 100644
--- a/src/firewall/server/config_icmptype.py
+++ b/src/firewall/server/config_icmptype.py
@@ -92,9 +92,8 @@ class FirewallDConfigIcmpType(slip.dbus.service.Object):
return dbus.Boolean(self.obj.builtin)
else:
raise dbus.exceptions.DBusException(
- "org.freedesktop.DBus.Error.AccessDenied: "
- "Property '%s' isn't exported (or may not exist)" % \
- property_name)
+ "org.freedesktop.DBus.Error.InvalidArgs: "
+ "Property '%s' does not exist" % property_name)
@dbus_service_method(dbus.PROPERTIES_IFACE, in_signature='ss',
out_signature='v')
@@ -109,7 +108,7 @@ class FirewallDConfigIcmpType(slip.dbus.service.Object):
if interface_name != config.dbus.DBUS_INTERFACE_CONFIG_ICMPTYPE:
raise dbus.exceptions.DBusException(
"org.freedesktop.DBus.Error.UnknownInterface: "
- "FirewallD does not implement %s" % interface_name)
+ "Interface '%s' does not exist" % interface_name)
return self._get_property(property_name)
@@ -123,7 +122,7 @@ class FirewallDConfigIcmpType(slip.dbus.service.Object):
if interface_name != config.dbus.DBUS_INTERFACE_CONFIG_ICMPTYPE:
raise dbus.exceptions.DBusException(
"org.freedesktop.DBus.Error.UnknownInterface: "
- "FirewallD does not implement %s" % interface_name)
+ "Interface '%s' does not exist" % interface_name)
ret = { }
for x in [ "name", "filename", "path", "default", "builtin" ]:
@@ -144,11 +143,11 @@ class FirewallDConfigIcmpType(slip.dbus.service.Object):
if interface_name != config.dbus.DBUS_INTERFACE_CONFIG_ICMPTYPE:
raise dbus.exceptions.DBusException(
"org.freedesktop.DBus.Error.UnknownInterface: "
- "FirewallD does not implement %s" % interface_name)
+ "Interface '%s' does not exist" % interface_name)
raise dbus.exceptions.DBusException(
- "org.freedesktop.DBus.Error.AccessDenied: "
- "Property '%s' is not settable" % property_name)
+ "org.freedesktop.DBus.Error.PropertyReadOnly: "
+ "Property '%s' is read-only" % property_name)
@dbus.service.signal(dbus.PROPERTIES_IFACE, signature='sa{sv}as')
def PropertiesChanged(self, interface_name, changed_properties,
diff --git a/src/firewall/server/config_ipset.py b/src/firewall/server/config_ipset.py
index a1613c6933ab..8c647bc29ab9 100644
--- a/src/firewall/server/config_ipset.py
+++ b/src/firewall/server/config_ipset.py
@@ -93,9 +93,8 @@ class FirewallDConfigIPSet(slip.dbus.service.Object):
return dbus.Boolean(self.obj.builtin)
else:
raise dbus.exceptions.DBusException(
- "org.freedesktop.DBus.Error.AccessDenied: "
- "Property '%s' isn't exported (or may not exist)" % \
- property_name)
+ "org.freedesktop.DBus.Error.InvalidArgs: "
+ "Property '%s' does not exist" % property_name)
@dbus_service_method(dbus.PROPERTIES_IFACE, in_signature='ss',
out_signature='v')
@@ -110,7 +109,7 @@ class FirewallDConfigIPSet(slip.dbus.service.Object):
if interface_name != config.dbus.DBUS_INTERFACE_CONFIG_IPSET:
raise dbus.exceptions.DBusException(
"org.freedesktop.DBus.Error.UnknownInterface: "
- "FirewallD does not implement %s" % interface_name)
+ "Interface '%s' does not exist" % interface_name)
return self._get_property(property_name)
@@ -124,7 +123,7 @@ class FirewallDConfigIPSet(slip.dbus.service.Object):
if interface_name != config.dbus.DBUS_INTERFACE_CONFIG_IPSET:
raise dbus.exceptions.DBusException(
"org.freedesktop.DBus.Error.UnknownInterface: "
- "FirewallD does not implement %s" % interface_name)
+ "Interface '%s' does not exist" % interface_name)
ret = { }
for x in [ "name", "filename", "path", "default", "builtin" ]:
@@ -145,11 +144,11 @@ class FirewallDConfigIPSet(slip.dbus.service.Object):
if interface_name != config.dbus.DBUS_INTERFACE_CONFIG_IPSET:
raise dbus.exceptions.DBusException(
"org.freedesktop.DBus.Error.UnknownInterface: "
- "FirewallD does not implement %s" % interface_name)
+ "Interface '%s' does not exist" % interface_name)
raise dbus.exceptions.DBusException(
- "org.freedesktop.DBus.Error.AccessDenied: "
- "Property '%s' is not settable" % property_name)
+ "org.freedesktop.DBus.Error.PropertyReadOnly: "
+ "Property '%s' is read-only" % property_name)
@dbus.service.signal(dbus.PROPERTIES_IFACE, signature='sa{sv}as')
def PropertiesChanged(self, interface_name, changed_properties,
diff --git a/src/firewall/server/config_service.py b/src/firewall/server/config_service.py
index 6745e253f88a..47530d319bdb 100644
--- a/src/firewall/server/config_service.py
+++ b/src/firewall/server/config_service.py
@@ -92,9 +92,8 @@ class FirewallDConfigService(slip.dbus.service.Object):
return dbus.Boolean(self.obj.builtin)
else:
raise dbus.exceptions.DBusException(
- "org.freedesktop.DBus.Error.AccessDenied: "
- "Property '%s' isn't exported (or may not exist)" % \
- property_name)
+ "org.freedesktop.DBus.Error.InvalidArgs: "
+ "Property '%s' does not exist" % property_name)
@dbus_service_method(dbus.PROPERTIES_IFACE, in_signature='ss',
out_signature='v')
@@ -109,7 +108,7 @@ class FirewallDConfigService(slip.dbus.service.Object):
if interface_name != config.dbus.DBUS_INTERFACE_CONFIG_SERVICE:
raise dbus.exceptions.DBusException(
"org.freedesktop.DBus.Error.UnknownInterface: "
- "FirewallD does not implement %s" % interface_name)
+ "Interface '%s' does not exist" % interface_name)
return self._get_property(property_name)
@@ -123,7 +122,7 @@ class FirewallDConfigService(slip.dbus.service.Object):
if interface_name != config.dbus.DBUS_INTERFACE_CONFIG_SERVICE:
raise dbus.exceptions.DBusException(
"org.freedesktop.DBus.Error.UnknownInterface: "
- "FirewallD does not implement %s" % interface_name)
+ "Interface '%s' does not exist" % interface_name)
ret = { }
for x in [ "name", "filename", "path", "default", "builtin" ]:
@@ -144,11 +143,11 @@ class FirewallDConfigService(slip.dbus.service.Object):
if interface_name != config.dbus.DBUS_INTERFACE_CONFIG_SERVICE:
raise dbus.exceptions.DBusException(
"org.freedesktop.DBus.Error.UnknownInterface: "
- "FirewallD does not implement %s" % interface_name)
+ "Interface '%s' does not exist" % interface_name)
raise dbus.exceptions.DBusException(
- "org.freedesktop.DBus.Error.AccessDenied: "
- "Property '%s' is not settable" % property_name)
+ "org.freedesktop.DBus.Error.PropertyReadOnly: "
+ "Property '%s' is read-only" % property_name)
@dbus.service.signal(dbus.PROPERTIES_IFACE, signature='sa{sv}as')
def PropertiesChanged(self, interface_name, changed_properties,
diff --git a/src/firewall/server/config_zone.py b/src/firewall/server/config_zone.py
index 42ec963549d8..f98f700bec59 100644
--- a/src/firewall/server/config_zone.py
+++ b/src/firewall/server/config_zone.py
@@ -94,9 +94,8 @@ class FirewallDConfigZone(slip.dbus.service.Object):
return dbus.Boolean(self.obj.builtin)
else:
raise dbus.exceptions.DBusException(
- "org.freedesktop.DBus.Error.AccessDenied: "
- "Property '%s' isn't exported (or may not exist)" % \
- property_name)
+ "org.freedesktop.DBus.Error.InvalidArgs: "
+ "Property '%s' does not exist" % property_name)
@dbus_service_method(dbus.PROPERTIES_IFACE, in_signature='ss',
out_signature='v')
@@ -111,7 +110,7 @@ class FirewallDConfigZone(slip.dbus.service.Object):
if interface_name != config.dbus.DBUS_INTERFACE_CONFIG_ZONE:
raise dbus.exceptions.DBusException(
"org.freedesktop.DBus.Error.UnknownInterface: "
- "FirewallD does not implement %s" % interface_name)
+ "Interface '%s' does not exist" % interface_name)
return self._get_property(property_name)
@@ -125,7 +124,7 @@ class FirewallDConfigZone(slip.dbus.service.Object):
if interface_name != config.dbus.DBUS_INTERFACE_CONFIG_ZONE:
raise dbus.exceptions.DBusException(
"org.freedesktop.DBus.Error.UnknownInterface: "
- "FirewallD does not implement %s" % interface_name)
+ "Interface '%s' does not exist" % interface_name)
ret = { }
for x in [ "name", "filename", "path", "default", "builtin" ]:
@@ -146,11 +145,11 @@ class FirewallDConfigZone(slip.dbus.service.Object):
if interface_name != config.dbus.DBUS_INTERFACE_CONFIG_ZONE:
raise dbus.exceptions.DBusException(
"org.freedesktop.DBus.Error.UnknownInterface: "
- "FirewallD does not implement %s" % interface_name)
+ "Interface '%s' does not exist" % interface_name)
raise dbus.exceptions.DBusException(
- "org.freedesktop.DBus.Error.AccessDenied: "
- "Property '%s' is not settable" % property_name)
+ "org.freedesktop.DBus.Error.PropertyReadOnly: "
+ "Property '%s' is read-only" % property_name)
@dbus.service.signal(dbus.PROPERTIES_IFACE, signature='sa{sv}as')
def PropertiesChanged(self, interface_name, changed_properties,
diff --git a/src/firewall/server/firewalld.py b/src/firewall/server/firewalld.py
index 2f1f8234ab9c..8c4bd4f0c66a 100644
--- a/src/firewall/server/firewalld.py
+++ b/src/firewall/server/firewalld.py
@@ -184,8 +184,8 @@ class FirewallD(slip.dbus.service.Object):
else:
raise dbus.exceptions.DBusException(
- "org.freedesktop.DBus.Error.AccessDenied: "
- "Property '%s' isn't exported (or may not exist)" % prop)
+ "org.freedesktop.DBus.Error.InvalidArgs: "
+ "Property '%s' does not exist" % prop)
@dbus_service_method(dbus.PROPERTIES_IFACE, in_signature='ss',
out_signature='v')
@@ -196,12 +196,19 @@ class FirewallD(slip.dbus.service.Object):
property_name = dbus_to_python(property_name, str)
log.debug1("Get('%s', '%s')", interface_name, property_name)
- if interface_name != config.dbus.DBUS_INTERFACE:
+ if interface_name == config.dbus.DBUS_INTERFACE:
+ return self._get_property(property_name)
+ elif interface_name in [ config.dbus.DBUS_INTERFACE_ZONE,
+ config.dbus.DBUS_INTERFACE_DIRECT,
+ config.dbus.DBUS_INTERFACE_POLICIES,
+ config.dbus.DBUS_INTERFACE_IPSET ]:
+ raise dbus.exceptions.DBusException(
+ "org.freedesktop.DBus.Error.InvalidArgs: "
+ "Property '%s' does not exist" % property_name)
+ else:
raise dbus.exceptions.DBusException(
"org.freedesktop.DBus.Error.UnknownInterface: "
- "FirewallD does not implement %s" % interface_name)
-
- return self._get_property(property_name)
+ "Interface '%s' does not exist" % interface_name)
@dbus_service_method(dbus.PROPERTIES_IFACE, in_signature='s',
out_signature='a{sv}')
@@ -210,17 +217,24 @@ class FirewallD(slip.dbus.service.Object):
interface_name = dbus_to_python(interface_name, str)
log.debug1("GetAll('%s')", interface_name)
- if interface_name != config.dbus.DBUS_INTERFACE:
+ ret = { }
+ if interface_name == config.dbus.DBUS_INTERFACE:
+ for x in [ "version", "interface_version", "state",
+ "IPv4", "IPv6", "IPv6_rpfilter", "BRIDGE",
+ "IPSet", "IPSetTypes", "nf_conntrack_helper_setting",
+ "nf_conntrack_helpers", "IPv4ICMPTypes",
+ "IPv6ICMPTypes" ]:
+ ret[x] = self._get_property(x)
+ elif interface_name in [ config.dbus.DBUS_INTERFACE_ZONE,
+ config.dbus.DBUS_INTERFACE_DIRECT,
+ config.dbus.DBUS_INTERFACE_POLICIES,
+ config.dbus.DBUS_INTERFACE_IPSET ]:
+ pass
+ else:
raise dbus.exceptions.DBusException(
"org.freedesktop.DBus.Error.UnknownInterface: "
- "FirewallD does not implement %s" % interface_name)
+ "Interface '%s' does not exist" % interface_name)
- ret = { }
- for x in [ "version", "interface_version", "state",
- "IPv4", "IPv6", "IPv6_rpfilter", "BRIDGE",
- "IPSet", "IPSetTypes", "nf_conntrack_helper_setting",
- "nf_conntrack_helpers", "IPv4ICMPTypes", "IPv6ICMPTypes" ]:
- ret[x] = self._get_property(x)
return dbus.Dictionary(ret, signature="sv")
@slip.dbus.polkit.require_auth(config.dbus.PK_ACTION_CONFIG)
@@ -234,14 +248,31 @@ class FirewallD(slip.dbus.service.Object):
new_value)
self.accessCheck(sender)
- if interface_name != config.dbus.DBUS_INTERFACE:
+ if interface_name == config.dbus.DBUS_INTERFACE:
+ if property_name in [ "version", "interface_version", "state",
+ "IPv4", "IPv6", "IPv6_rpfilter", "BRIDGE",
+ "IPSet", "IPSetTypes",
+ "nf_conntrack_helper_setting",
+ "nf_conntrack_helpers", "IPv4ICMPTypes",
+ "IPv6ICMPTypes" ]:
+ raise dbus.exceptions.DBusException(
+ "org.freedesktop.DBus.Error.PropertyReadOnly: "
+ "Property '%s' is read-only" % property_name)
+ else:
+ raise dbus.exceptions.DBusException(
+ "org.freedesktop.DBus.Error.InvalidArgs: "
+ "Property '%s' does not exist" % property_name)
+ elif interface_name in [ config.dbus.DBUS_INTERFACE_ZONE,
+ config.dbus.DBUS_INTERFACE_DIRECT,
+ config.dbus.DBUS_INTERFACE_POLICIES,
+ config.dbus.DBUS_INTERFACE_IPSET ]:
+ raise dbus.exceptions.DBusException(
+ "org.freedesktop.DBus.Error.InvalidArgs: "
+ "Property '%s' does not exist" % property_name)
+ else:
raise dbus.exceptions.DBusException(
"org.freedesktop.DBus.Error.UnknownInterface: "
- "FirewallD does not implement %s" % interface_name)
-
- raise dbus.exceptions.DBusException(
- "org.freedesktop.DBus.Error.AccessDenied: "
- "Property '%s' is not settable" % property_name)
+ "Interface '%s' does not exist" % interface_name)
@dbus.service.signal(dbus.PROPERTIES_IFACE, signature='sa{sv}as')
def PropertiesChanged(self, interface_name, changed_properties,
--
2.12.0