/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos

  • Committer: Teddy Hogeborn
  • Date: 2012-01-08 10:12:18 UTC
  • mfrom: (553 trunk)
  • mto: (237.4.29 release)
  • mto: This revision was merged to the branch mainline in revision 554.
  • Revision ID: teddy@recompile.se-20120108101218-h6yp0akairb23436
mergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
85
85
    except ImportError:
86
86
        SO_BINDTODEVICE = None
87
87
 
88
 
version = "1.5.3"
 
88
version = "1.5.1"
89
89
stored_state_file = "clients.pickle"
90
90
 
91
91
logger = logging.getLogger()
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, -2 means no checker completed yet.
 
418
                         checker, or None.
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"] = -2
 
504
            client["last_checker_status"] = None
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):
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."""
 
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
        """
637
635
        if timeout is None:
638
636
            timeout = self.timeout
 
637
        self.last_checked_ok = datetime.datetime.utcnow()
639
638
        if self.disable_initiator_tag is not None:
640
639
            gobject.source_remove(self.disable_initiator_tag)
641
640
        if getattr(self, "enabled", False):
1101
1100
                                       checker is not None)
1102
1101
    last_checked_ok = notifychangeproperty(datetime_to_dbus,
1103
1102
                                           "LastCheckedOK")
1104
 
    last_checker_status = notifychangeproperty(dbus.Int16,
1105
 
                                               "LastCheckerStatus")
1106
1103
    last_approval_request = notifychangeproperty(
1107
1104
        datetime_to_dbus, "LastApprovalRequest")
1108
1105
    approved_by_default = notifychangeproperty(dbus.Boolean,
1342
1339
            return
1343
1340
        return datetime_to_dbus(self.last_checked_ok)
1344
1341
    
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
 
    
1351
1342
    # Expires - property
1352
1343
    @dbus_service_property(_interface, signature="s", access="read")
1353
1344
    def Expires_dbus_property(self):
1614
1605
                
1615
1606
                logger.info("Sending secret to %s", client.name)
1616
1607
                # bump the timeout using extended_timeout
1617
 
                client.bump_timeout(client.extended_timeout)
 
1608
                client.checked_ok(client.extended_timeout)
1618
1609
                if self.server.use_dbus:
1619
1610
                    # Emit D-Bus signal
1620
1611
                    client.GotSecret()