=== modified file 'mandos' --- mandos 2009-01-18 10:56:33 +0000 +++ mandos 2009-01-19 13:13:47 +0000 @@ -226,13 +226,7 @@ if config is None: config = {} logger.debug(u"Creating client %r", self.name) - self.use_dbus = use_dbus - if self.use_dbus: - self.dbus_object_path = (dbus.ObjectPath - ("/Mandos/clients/" - + self.name.replace(".", "_"))) - dbus.service.Object.__init__(self, bus, - self.dbus_object_path) + self.use_dbus = False # During __init__ # Uppercase and remove spaces from fingerprint for later # comparison purposes with return value from the fingerprint() # function @@ -262,6 +256,16 @@ self.disable_initiator_tag = None self.checker_callback_tag = None self.checker_command = config["checker"] + self.last_connect = None + # Only now, when this client is initialized, can it show up on + # the D-Bus + self.use_dbus = use_dbus + if self.use_dbus: + self.dbus_object_path = (dbus.ObjectPath + ("/clients/" + + self.name.replace(".", "_"))) + dbus.service.Object.__init__(self, bus, + self.dbus_object_path) def enable(self): """Start this client's checker and timeout hooks""" @@ -449,7 +453,7 @@ return now < (self.last_checked_ok + self.timeout) ## D-Bus methods & signals - _interface = u"org.mandos_system.Mandos.Client" + _interface = u"se.bsnet.fukt.Mandos.Client" # BumpTimeout - method BumpTimeout = dbus.service.method(_interface)(bump_timeout) @@ -1035,8 +1039,7 @@ avahi.DBUS_INTERFACE_SERVER) # End of Avahi example code if use_dbus: - bus_name = dbus.service.BusName(u"org.mandos-system.Mandos", - bus) + bus_name = dbus.service.BusName(u"se.bsnet.fukt.Mandos", bus) clients.update(Set(Client(name = section, config @@ -1096,9 +1099,8 @@ class MandosServer(dbus.service.Object): """A D-Bus proxy object""" def __init__(self): - dbus.service.Object.__init__(self, bus, - "/Mandos") - _interface = u"org.mandos_system.Mandos" + dbus.service.Object.__init__(self, bus, "/") + _interface = u"se.bsnet.fukt.Mandos" @dbus.service.signal(_interface, signature="oa{sv}") def ClientAdded(self, objpath, properties): @@ -1134,23 +1136,6 @@ return raise KeyError - @dbus.service.method(_interface, in_signature="s") - def RemoveClientByName(self, name): - for c in clients: - if c.name == name: - clients.remove(c) - # Don't signal anything except ClientRemoved - c.use_dbus = False - c.disable() - # Emit D-Bus signal - self.ClientRemoved(c.dbus_object_path, name) - return - raise KeyError - - @dbus.service.method(_interface) - def Quit(self): - main_loop.quit() - del _interface mandos_server = MandosServer()