=== modified file 'DBUS-API' --- DBUS-API 2012-01-08 07:52:26 +0000 +++ DBUS-API 2012-01-15 20:27:28 +0000 @@ -93,10 +93,11 @@ | Interval (a) | t | Read/Write | interval | | LastApprovalRequest (g) | s | Read | N/A | | LastCheckedOK (h) | s | Read/Write | N/A | - | LastEnabled (i) | s | Read | N/A | + | LastCheckerStatus (i) | n | Read | N/A | + | LastEnabled (j) | s | Read | N/A | | Name | s | Read | (Section name) | | ObjectPath | o | Read | N/A | - | Secret (j) | ay | Write | secret (or secfile) | + | Secret (k) | ay | Write | secret (or secfile) | | Timeout (a) | t | Read/Write | timeout | a) Represented as milliseconds. @@ -124,10 +125,13 @@ always use an empty string when setting this property, to allow for possible future expansion. - i) The date and time this client was last enabled, as an RFC 3339 + i) The exit status of the last checker, -1 if it did not exit + cleanly, -2 if a checker has not yet returned. + + j) The date and time this client was last enabled, as an RFC 3339 string, or an empty string if this has not happened. - j) A raw byte array, not hexadecimal digits. + k) A raw byte array, not hexadecimal digits. ** Signals *** CheckerCompleted(n: Exitcode, x: Waitstatus, s: Command) === modified file 'TODO' --- TODO 2012-01-01 04:02:00 +0000 +++ TODO 2012-01-15 20:27:28 +0000 @@ -77,6 +77,7 @@ Deprecate methods GetAllClients(), GetAllClientsWithProperties() and signals ClientAdded and ClientRemoved. ** TODO Save state periodically to recover better from hard shutdowns +** TODO CheckerCompleted method, deprecate CheckedOK * mandos.xml ** Add mandos contact info in manual pages === modified file 'mandos' --- mandos 2012-01-08 10:19:33 +0000 +++ mandos 2012-01-15 20:27:28 +0000 @@ -415,7 +415,7 @@ last_checked_ok: datetime.datetime(); (UTC) or None last_checker_status: integer between 0 and 255 reflecting exit status of last checker. -1 reflects crashed - checker, or None. + checker, -2 means no checker completed yet. last_enabled: datetime.datetime(); (UTC) or None name: string; from the config file, used in log messages and D-Bus identifiers @@ -501,7 +501,7 @@ client["checker_command"] = section["checker"] client["last_approval_request"] = None client["last_checked_ok"] = None - client["last_checker_status"] = None + client["last_checker_status"] = -2 return settings @@ -626,15 +626,16 @@ logger.warning("Checker for %(name)s crashed?", vars(self)) - def checked_ok(self, timeout=None): - """Bump up the timeout for this client. - - This should only be called when the client has been seen, - alive and well. - """ + def checked_ok(self): + """Assert that the client has been seen, alive and well.""" + self.last_checked_ok = datetime.datetime.utcnow() + self.last_checker_status = 0 + self.bump_timeout() + + def bump_timeout(self, timeout=None): + """Bump up the timeout for this client.""" if timeout is None: timeout = self.timeout - self.last_checked_ok = datetime.datetime.utcnow() if self.disable_initiator_tag is not None: gobject.source_remove(self.disable_initiator_tag) if getattr(self, "enabled", False): @@ -1100,6 +1101,8 @@ checker is not None) last_checked_ok = notifychangeproperty(datetime_to_dbus, "LastCheckedOK") + last_checker_status = notifychangeproperty(dbus.Int16, + "LastCheckerStatus") last_approval_request = notifychangeproperty( datetime_to_dbus, "LastApprovalRequest") approved_by_default = notifychangeproperty(dbus.Boolean, @@ -1339,6 +1342,12 @@ return return datetime_to_dbus(self.last_checked_ok) + # LastCheckerStatus - property + @dbus_service_property(_interface, signature="n", + access="read") + def LastCheckerStatus_dbus_property(self): + return dbus.Int16(self.last_checker_status) + # Expires - property @dbus_service_property(_interface, signature="s", access="read") def Expires_dbus_property(self): @@ -1605,7 +1614,7 @@ logger.info("Sending secret to %s", client.name) # bump the timeout using extended_timeout - client.checked_ok(client.extended_timeout) + client.bump_timeout(client.extended_timeout) if self.server.use_dbus: # Emit D-Bus signal client.GotSecret()