/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: 2012-01-15 21:02:37 UTC
  • mfrom: (237.7.106 trunk)
  • Revision ID: teddy@recompile.se-20120115210237-6mcl2zuoxyn5smr5
MergeĀ fromĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
415
415
    last_checked_ok: datetime.datetime(); (UTC) or None
416
416
    last_checker_status: integer between 0 and 255 reflecting exit
417
417
                         status of last checker. -1 reflects crashed
418
 
                         checker, or None.
 
418
                         checker, -2 means no checker completed yet.
419
419
    last_enabled: datetime.datetime(); (UTC) or None
420
420
    name:       string; from the config file, used in log messages and
421
421
                        D-Bus identifiers
501
501
            client["checker_command"] = section["checker"]
502
502
            client["last_approval_request"] = None
503
503
            client["last_checked_ok"] = None
504
 
            client["last_checker_status"] = None
 
504
            client["last_checker_status"] = -2
505
505
        
506
506
        return settings
507
507
        
626
626
            logger.warning("Checker for %(name)s crashed?",
627
627
                           vars(self))
628
628
    
629
 
    def checked_ok(self, timeout=None):
630
 
        """Bump up the timeout for this client.
631
 
        
632
 
        This should only be called when the client has been seen,
633
 
        alive and well.
634
 
        """
 
629
    def checked_ok(self):
 
630
        """Assert that the client has been seen, alive and well."""
 
631
        self.last_checked_ok = datetime.datetime.utcnow()
 
632
        self.last_checker_status = 0
 
633
        self.bump_timeout()
 
634
    
 
635
    def bump_timeout(self, timeout=None):
 
636
        """Bump up the timeout for this client."""
635
637
        if timeout is None:
636
638
            timeout = self.timeout
637
 
        self.last_checked_ok = datetime.datetime.utcnow()
638
639
        if self.disable_initiator_tag is not None:
639
640
            gobject.source_remove(self.disable_initiator_tag)
640
641
        if getattr(self, "enabled", False):
1100
1101
                                       checker is not None)
1101
1102
    last_checked_ok = notifychangeproperty(datetime_to_dbus,
1102
1103
                                           "LastCheckedOK")
 
1104
    last_checker_status = notifychangeproperty(dbus.Int16,
 
1105
                                               "LastCheckerStatus")
1103
1106
    last_approval_request = notifychangeproperty(
1104
1107
        datetime_to_dbus, "LastApprovalRequest")
1105
1108
    approved_by_default = notifychangeproperty(dbus.Boolean,
1339
1342
            return
1340
1343
        return datetime_to_dbus(self.last_checked_ok)
1341
1344
    
 
1345
    # LastCheckerStatus - property
 
1346
    @dbus_service_property(_interface, signature="n",
 
1347
                           access="read")
 
1348
    def LastCheckerStatus_dbus_property(self):
 
1349
        return dbus.Int16(self.last_checker_status)
 
1350
    
1342
1351
    # Expires - property
1343
1352
    @dbus_service_property(_interface, signature="s", access="read")
1344
1353
    def Expires_dbus_property(self):
1605
1614
                
1606
1615
                logger.info("Sending secret to %s", client.name)
1607
1616
                # bump the timeout using extended_timeout
1608
 
                client.checked_ok(client.extended_timeout)
 
1617
                client.bump_timeout(client.extended_timeout)
1609
1618
                if self.server.use_dbus:
1610
1619
                    # Emit D-Bus signal
1611
1620
                    client.GotSecret()