/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: 2009-02-13 07:01:10 UTC
  • Revision ID: teddy@fukt.bsnet.se-20090213070110-lngze7thjhpq1peo
* mandos (Client.current_checker_command): New attribute.
  (Client.start_checker): Make sure the running checker process is not
                          a zombie, just in case.

Show diffs side-by-side

added added

removed removed

Lines of Context:
205
205
                     client lives.  %() expansions are done at
206
206
                     runtime with vars(self) as dict, so that for
207
207
                     instance %(name)s can be used in the command.
 
208
    current_checker_command: string; current running checker_command
208
209
    use_dbus: bool(); Whether to provide D-Bus interface and signals
209
210
    dbus_object_path: dbus.ObjectPath ; only set if self.use_dbus
210
211
    """
259
260
        self.disable_initiator_tag = None
260
261
        self.checker_callback_tag = None
261
262
        self.checker_command = config["checker"]
 
263
        self.current_checker_command = None
262
264
        self.last_connect = None
263
265
        # Only now, when this client is initialized, can it show up on
264
266
        # the D-Bus
379
381
        # checkers alone, the checker would have to take more time
380
382
        # than 'timeout' for the client to be declared invalid, which
381
383
        # is as it should be.
 
384
        
 
385
        # If a checker exists, make sure it is not a zombie
 
386
        if self.checker is not None:
 
387
            pid, status = os.waitpid(self.checker.pid, os.WNOHANG)
 
388
            if pid:
 
389
                logger.warning("Checker was a zombie")
 
390
                gobject.source_remove(self.checker_callback_tag)
 
391
                self.checker_callback(pid, status,
 
392
                                      self.current_checker_command)
 
393
        # Start a new checker if needed
382
394
        if self.checker is None:
383
395
            try:
384
396
                # In case checker_command has exactly one % operator
394
406
                    logger.error(u'Could not format string "%s":'
395
407
                                 u' %s', self.checker_command, error)
396
408
                    return True # Try again later
 
409
                self.current_checker_command = command
397
410
            try:
398
411
                logger.info(u"Starting checker %r for %s",
399
412
                            command, self.name)