/mandos/release

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/release

« back to all changes in this revision

Viewing changes to mandos

  • Committer: Teddy Hogeborn
  • Date: 2015-08-10 09:00:23 UTC
  • mto: (237.7.594 trunk)
  • mto: This revision was merged to the branch mainline in revision 325.
  • Revision ID: teddy@recompile.se-20150810090023-fz6vjqr7zf33e2tf
Support the standard org.freedesktop.DBus.ObjectManager interface.

Now that the D-Bus standard has an interface to keep track of new and
removed objects, use that instead of our own methods.  This deprecates
our D-Bus methods "GetAllClients" and "GetAllClientsWithProperties"
and the signals "ClientAdded" and "ClientRemoved", all on the server
interface "se.recompile.Mandos".

* DBUS-API: Removed references to deprecated methods and signals;
  insert reference to the org.freedesktop.DBus.ObjectManager
  interface.
* mandos (DBusObjectWithProperties._get_all_interface_names): New.
  (dbus.OBJECT_MANAGER_IFACE): If not present, monkey patch.
  (DBusObjectWithObjectManager): New.
  (main/MandosDBusService): Inherit from DBusObjectWithObjectManager.
  (main/MandosDBusService.ClientRemoved): Annotate as deprecated.
  (main/MandosDBusService.GetAllClients): - '' -
  (main/MandosDBusService.GetAllClientsWithProperties): Annotate as
                                                        deprecated.
                                                        Also only
                                                        return
                                                        properties on
                                                        client
                                                        interface.
  (main/MandosDBusService.RemoveClient): Call client_removed_signal
                                         instead of ClientRemoved.
  (main/MandosDBusService.GetManagedObjects): New.
  (main/MandosDBusService.client_added_signal): New.
  (main/MandosDBusService.client_removed_signal): - '' -
  (main/cleanup): Call "client_removed_signal" instead of sending
                  "ClientRemoved" signal directly.
  (main): Call "client_added_signal" instead of sending "ClientAdded"
          signal directly.
* mandos-ctl: Use GetManagedObjects instead of
              GetAllClientsWithProperties.  Also, show better error
              message in case of failure to connect to the D-Bus

* mandos-monitor (MandosClientPropertyCache.properties_changed):
  Bug fix; only update properties on client interface.
  (UserInterface.find_and_remove_client): Change to accept arguments
                                          from InterfacesRemoved
                                          signal.  Also, bug fix:
                                          working error message when
                                          removing unknown client.
  (UserInterface.add_new_client): Change to accept arguments from
                                  InterfacesRemoved signal.  Pass
                                  properties to MandosClientWidget
                                  constructor.
  (UserInterface.run): Connect find_and_remove_client method to
                       InterfacesRemoved signal and the add_new_client
                       method to the InterfacesAdded signal.

Show diffs side-by-side

added added

removed removed

Lines of Context:
104
104
if sys.version_info.major == 2:
105
105
    str = unicode
106
106
 
107
 
version = "1.7.1"
 
107
version = "1.6.9"
108
108
stored_state_file = "clients.pickle"
109
109
 
110
110
logger = logging.getLogger()
1154
1154
    def InterfacesAdded(self, object_path, interfaces_and_properties):
1155
1155
        pass
1156
1156
    
1157
 
    @dbus.service.signal(dbus.OBJECT_MANAGER_IFACE, signature = "oas")
 
1157
    @dbus.service.signal(dbus.OBJECT_MANAGER_IFACE,
 
1158
                         signature = "oas")
1158
1159
    def InterfacesRemoved(self, object_path, interfaces):
1159
1160
        pass
1160
1161
    
1168
1169
        Override return argument name of GetManagedObjects to be
1169
1170
        "objpath_interfaces_and_properties"
1170
1171
        """
1171
 
        xmlstring = DBusObjectWithAnnotations.Introspect(self,
1172
 
                                                         object_path,
1173
 
                                                         connection)
 
1172
        xmlstring = DBusObjectWithAnnotations(self, object_path,
 
1173
                                              connection)
1174
1174
        try:
1175
1175
            document = xml.dom.minidom.parseString(xmlstring)
1176
1176
            
1291
1291
                        func1 and func2 to the "call_both" function
1292
1292
                        outside of its arguments"""
1293
1293
                        
1294
 
                        @functools.wraps(func2)
1295
1294
                        def call_both(*args, **kwargs):
1296
1295
                            """This function will emit two D-Bus
1297
1296
                            signals by calling func1 and func2"""
1298
1297
                            func1(*args, **kwargs)
1299
1298
                            func2(*args, **kwargs)
1300
 
                        # Make wrapper function look like a D-Bus signal
1301
 
                        for name, attr in inspect.getmembers(func2):
1302
 
                            if name.startswith("_dbus_"):
1303
 
                                setattr(call_both, name, attr)
1304
1299
                        
1305
1300
                        return call_both
1306
1301
                    # Create the "call_both" function and add it to