[PATCH 06/17] dbus/connection.py: Import constants from _dbus_bindings; check for reserved local interface as well as path

John (J5) Palmieri johnp at redhat.com
Mon Apr 30 14:45:34 PDT 2007


Looks good.


On Mon, 2007-04-30 at 11:35 +0100, Simon McVittie wrote:
> 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,
> _______________________________________________
> dbus mailing list
> dbus at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dbus



More information about the dbus mailing list