From 1d4594e2463e00def64dd10a71101a4a45e63553 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 30 Apr 2007 11:35:54 +0100 Subject: [PATCH] dbus/connection.py: Import constants from _dbus_bindings; check for reserved local interface as well as path --- dbus/connection.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/dbus/connection.py b/dbus/connection.py index ef6f984..36a9a7b 100644 --- a/dbus/connection.py +++ b/dbus/connection.py @@ -24,12 +24,7 @@ import logging from _dbus_bindings import Connection, ErrorMessage, \ MethodCallMessage, MethodReturnMessage, \ - DBusException - - -# This is special in libdbus - the bus daemon will kick us off if we try to -# send any message to it :-/ -LOCAL_PATH = '/org/freedesktop/DBus/Local' + DBusException, LOCAL_PATH, LOCAL_IFACE _logger = logging.getLogger('dbus.methods') @@ -56,6 +51,9 @@ class _MethodCallMixin(object): if object_path == LOCAL_PATH: raise DBusException('Methods may not be called on the reserved ' 'path %s' % LOCAL_PATH) + if dbus_interface == LOCAL_IFACE: + raise DBusException('Methods may not be called on the reserved ' + 'interface %s' % LOCAL_IFACE) # no need to validate other args - MethodCallMessage ctor will do get_args_opts = {'utf8_strings': utf8_strings, @@ -109,6 +107,9 @@ class _MethodCallMixin(object): if object_path == LOCAL_PATH: raise DBusException('Methods may not be called on the reserved ' 'path %s' % LOCAL_PATH) + if dbus_interface == LOCAL_IFACE: + raise DBusException('Methods may not be called on the reserved ' + 'interface %s' % LOCAL_IFACE) # no need to validate other args - MethodCallMessage ctor will do get_args_opts = {'utf8_strings': utf8_strings, -- 2.11.4.GIT