/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-01-31 10:33:17 UTC
  • mfrom: (24.1.129 mandos)
  • Revision ID: teddy@fukt.bsnet.se-20090131103317-wzqvyr532sjcjt7u
Merge from Björn:

* mandos-ctl: New option "--remove-client".  Only default to listing
              clients if no clients were given on the command line.
* plugins.d/mandos-client.c: Lower kernel log level while bringing up
                             network interface.  New option "--delay"
                             to control the maximum delay to wait for
                             running interface.
* plugins.d/mandos-client.xml (SYNOPSIS, OPTIONS): New option
                                                   "--delay".

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
             (facility = logging.handlers.SysLogHandler.LOG_DAEMON,
74
74
              address = "/dev/log"))
75
75
syslogger.setFormatter(logging.Formatter
76
 
                       ('Mandos [%(process)d]: %(levelname)s:'
77
 
                        ' %(message)s'))
 
76
                       ('Mandos: %(levelname)s: %(message)s'))
78
77
logger.addHandler(syslogger)
79
78
 
80
79
console = logging.StreamHandler()
81
 
console.setFormatter(logging.Formatter('%(name)s [%(process)d]:'
82
 
                                       ' %(levelname)s: %(message)s'))
 
80
console.setFormatter(logging.Formatter('%(name)s: %(levelname)s:'
 
81
                                       ' %(message)s'))
83
82
logger.addHandler(console)
84
83
 
85
84
class AvahiError(Exception):
412
411
                                             (self.checker.pid,
413
412
                                              self.checker_callback,
414
413
                                              data=command))
415
 
                # The checker may have completed before the gobject
416
 
                # watch was added.  Check for this.
417
 
                pid, status = os.waitpid(self.checker.pid, os.WNOHANG)
418
 
                if pid:
419
 
                    gobject.source_remove(self.checker_callback_tag)
420
 
                    self.checker_callback(pid, status, command)
421
414
            except OSError, error:
422
415
                logger.error(u"Failed to start subprocess: %s",
423
416
                             error)
683
676
        # using OpenPGP certificates.
684
677
        
685
678
        #priority = ':'.join(("NONE", "+VERS-TLS1.1", "+AES-256-CBC",
686
 
        #                     "+SHA1", "+COMP-NULL", "+CTYPE-OPENPGP",
687
 
        #                     "+DHE-DSS"))
 
679
        #                "+SHA1", "+COMP-NULL", "+CTYPE-OPENPGP",
 
680
        #                "+DHE-DSS"))
688
681
        # Use a fallback default, since this MUST be set.
689
682
        priority = self.server.settings.get("priority", "NORMAL")
690
683
        (gnutls.library.functions
771
764
                                 u" bind to interface %s",
772
765
                                 self.settings["interface"])
773
766
                else:
774
 
                    raise
 
767
                    raise error
775
768
        # Only bind(2) the socket if we really need to.
776
769
        if self.server_address[0] or self.server_address[1]:
777
770
            if not self.server_address[0]:
977
970
    # For convenience
978
971
    debug = server_settings["debug"]
979
972
    use_dbus = server_settings["use_dbus"]
 
973
 
 
974
    def sigsegvhandler(signum, frame):
 
975
        raise RuntimeError('Segmentation fault')
980
976
    
981
977
    if not debug:
982
978
        syslogger.setLevel(logging.WARNING)
983
979
        console.setLevel(logging.WARNING)
 
980
    else:
 
981
        signal.signal(signal.SIGSEGV, sigsegvhandler)
984
982
    
985
983
    if server_settings["servicename"] != "Mandos":
986
984
        syslogger.setFormatter(logging.Formatter
1007
1005
    pidfilename = "/var/run/mandos.pid"
1008
1006
    try:
1009
1007
        pidfile = open(pidfilename, "w")
1010
 
    except IOError:
 
1008
    except IOError, error:
1011
1009
        logger.error("Could not open file %r", pidfilename)
1012
1010
    
1013
1011
    try:
1206
1204
        sys.exit(1)
1207
1205
    except KeyboardInterrupt:
1208
1206
        if debug:
1209
 
            print >> sys.stderr
1210
 
        logger.debug("Server received KeyboardInterrupt")
1211
 
    logger.debug("Server exiting")
 
1207
            print
1212
1208
 
1213
1209
if __name__ == '__main__':
1214
1210
    main()