=== modified file 'TODO' --- TODO 2011-10-09 15:21:16 +0000 +++ TODO 2011-10-14 18:00:50 +0000 @@ -66,6 +66,7 @@ ** TODO [#C] python-parsedatetime ** TODO [#C] systemd/launchd http://0pointer.de/blog/projects/systemd.html + http://wiki.debian.org/systemd ** TODO Separate logging logic to own object ** TODO make clients to a dict! ** TODO [#A] Limit approval_delay to max gnutls/tls timeout value @@ -81,6 +82,7 @@ *** Handle "no D-Bus server" and/or "no Mandos server found" better *** [#B] --dump option ** TODO Support RFC 3339 time duration syntax +** TODO Send milliseconds if bare integer is passed as time duration * TODO mandos-dispatch Listens for specified D-Bus signals and spawns shell commands with === modified file 'mandos' --- mandos 2011-10-10 20:29:58 +0000 +++ mandos 2011-10-14 18:35:55 +0000 @@ -464,11 +464,13 @@ if timeout is None: timeout = self.timeout self.last_checked_ok = datetime.datetime.utcnow() - gobject.source_remove(self.disable_initiator_tag) - self.disable_initiator_tag = (gobject.timeout_add - (_timedelta_to_milliseconds - (timeout), self.disable)) - self.expires = datetime.datetime.utcnow() + timeout + if self.disable_initiator_tag is not None: + gobject.source_remove(self.disable_initiator_tag) + if getattr(self, "enabled", False): + self.disable_initiator_tag = (gobject.timeout_add + (_timedelta_to_milliseconds + (timeout), self.disable)) + self.expires = datetime.datetime.utcnow() + timeout def need_approval(self): self.last_approval_request = datetime.datetime.utcnow() @@ -891,8 +893,8 @@ """ Modify a variable so that it's a property which announces its changes to DBus. - transform_fun: Function that takes a value and transforms it - to a D-Bus type. + transform_fun: Function that takes a value and a variant_level + and transforms it to a D-Bus type. dbus_name: D-Bus name of the variable type_func: Function that transform the value before sending it to the D-Bus. Default: no transform @@ -905,7 +907,8 @@ type_func(getattr(self, attrname, None)) != type_func(value)): dbus_value = transform_func(type_func(value), - variant_level) + variant_level + =variant_level) self.PropertyChanged(dbus.String(dbus_name), dbus_value) setattr(self, attrname, value) @@ -1187,12 +1190,11 @@ gobject.source_remove(self.disable_initiator_tag) self.disable_initiator_tag = None self.expires = None - time_to_die = (self. - _timedelta_to_milliseconds((self - .last_checked_ok - + self.timeout) - - datetime.datetime - .utcnow())) + time_to_die = _timedelta_to_milliseconds((self + .last_checked_ok + + self.timeout) + - datetime.datetime + .utcnow()) if time_to_die <= 0: # The timeout has passed self.disable() === modified file 'mandos-ctl' --- mandos-ctl 2011-10-09 17:36:01 +0000 +++ mandos-ctl 2011-10-14 18:21:46 +0000 @@ -301,41 +301,41 @@ dbus_interface= dbus.PROPERTIES_IFACE) else 1) - if options.checker: + if options.checker is not None: client.Set(client_interface, "Checker", options.checker, dbus_interface=dbus.PROPERTIES_IFACE) - if options.host: + if options.host is not None: client.Set(client_interface, "Host", options.host, dbus_interface=dbus.PROPERTIES_IFACE) - if options.interval: + if options.interval is not None: client.Set(client_interface, "Interval", timedelta_to_milliseconds (string_to_delta(options.interval)), dbus_interface=dbus.PROPERTIES_IFACE) - if options.approval_delay: + if options.approval_delay is not None: client.Set(client_interface, "ApprovalDelay", timedelta_to_milliseconds (string_to_delta(options. approval_delay)), dbus_interface=dbus.PROPERTIES_IFACE) - if options.approval_duration: + if options.approval_duration is not None: client.Set(client_interface, "ApprovalDuration", timedelta_to_milliseconds (string_to_delta(options. approval_duration)), dbus_interface=dbus.PROPERTIES_IFACE) - if options.timeout: + if options.timeout is not None: client.Set(client_interface, "Timeout", timedelta_to_milliseconds (string_to_delta(options.timeout)), dbus_interface=dbus.PROPERTIES_IFACE) - if options.extended_timeout: + if options.extended_timeout is not None: client.Set(client_interface, "ExtendedTimeout", timedelta_to_milliseconds (string_to_delta(options.extended_timeout)), dbus_interface=dbus.PROPERTIES_IFACE) - if options.secret: + if options.secret is not None: client.Set(client_interface, "Secret", dbus.ByteArray(open(options.secret, "rb").read()),