=== modified file 'TODO' --- TODO 2010-08-22 13:34:42 +0000 +++ TODO 2010-09-02 18:53:38 +0000 @@ -85,6 +85,7 @@ http://0pointer.de/blog/projects/systemd.html ** TODO Separate logging logic to own object ** TODO make clients to a dict! +** TODO PropertyChanged should be a python generic property for client variables * mandos.xml ** [[file:mandos.xml::XXX][Document D-Bus interface]] === modified file 'mandos' --- mandos 2010-09-01 18:03:03 +0000 +++ mandos 2010-09-02 18:53:38 +0000 @@ -840,6 +840,7 @@ pass # GotSecret - signal + # Is sent after succesfull transfer of secret from mandos-server to mandos-client @dbus.service.signal(_interface) def GotSecret(self): "D-Bus signal" === modified file 'mandos-monitor' --- mandos-monitor 2009-12-25 23:13:47 +0000 +++ mandos-monitor 2010-09-02 18:53:38 +0000 @@ -23,11 +23,14 @@ locale.setlocale(locale.LC_ALL, u'') +import logging +logging.getLogger('dbus.proxies').setLevel(logging.CRITICAL) + # Some useful constants domain = 'se.bsnet.fukt' server_interface = domain + '.Mandos' client_interface = domain + '.Mandos.Client' -version = "1.0.14" +version = "1.0.15" # Always run in monochrome mode urwid.curses_display.curses.has_colors = lambda : False @@ -50,12 +53,12 @@ self.property_changed, client_interface, byte_arrays=True) - + self.properties.update( self.proxy.GetAll(client_interface, dbus_interface = dbus.PROPERTIES_IFACE)) super(MandosClientPropertyCache, self).__init__( - proxy_object=proxy_object, *args, **kwargs) + *args, **kwargs) def property_changed(self, property=None, value=None): """This is called whenever we get a PropertyChanged signal @@ -101,6 +104,10 @@ self.got_secret, client_interface, byte_arrays=True) + self.proxy.connect_to_signal(u"NeedApproval", + self.need_approval, + client_interface, + byte_arrays=True) self.proxy.connect_to_signal(u"Rejected", self.rejected, client_interface, @@ -108,9 +115,9 @@ def checker_completed(self, exitstatus, condition, command): if exitstatus == 0: - self.logger(u'Checker for client %s (command "%s")' - u' was successful' - % (self.properties[u"name"], command)) + #self.logger(u'Checker for client %s (command "%s")' + # u' was successful' + # % (self.properties[u"name"], command)) return if os.WIFEXITED(condition): self.logger(u'Checker for client %s (command "%s")' @@ -131,16 +138,25 @@ self.logger(u'Checker for client %s completed mysteriously') def checker_started(self, command): - self.logger(u'Client %s started checker "%s"' - % (self.properties[u"name"], unicode(command))) + #self.logger(u'Client %s started checker "%s"' + # % (self.properties[u"name"], unicode(command))) + pass def got_secret(self): self.logger(u'Client %s received its secret' % self.properties[u"name"]) - def rejected(self): - self.logger(u'Client %s was rejected' - % self.properties[u"name"]) + def need_approval(self, timeout, default): + if not default: + message = u'Client %s needs approval within %s seconds' + else: + message = u'Client %s will get its secret in %s seconds' + self.logger(message + % (self.properties[u"name"], timeout/1000)) + + def rejected(self, reason): + self.logger(u'Client %s was rejected; reason: %s' + % (self.properties[u"name"], reason)) def selectable(self): """Make this a "selectable" widget. @@ -225,6 +241,10 @@ # self.proxy.unpause() # elif key == u"RET": # self.open() + elif key == u"+": + self.proxy.Approve(True) + elif key == u"-": + self.proxy.Approve(False) else: return key