/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: 2014-01-21 20:43:52 UTC
  • mfrom: (237.7.200 trunk)
  • Revision ID: teddy@recompile.se-20140121204352-s0sd0d4mp86ivvog
Merge from trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
# "AvahiService" class, and some lines in "main".
12
12
13
13
# Everything else is
14
 
# Copyright © 2008-2013 Teddy Hogeborn
15
 
# Copyright © 2008-2013 Björn Påhlsson
 
14
# Copyright © 2008-2014 Teddy Hogeborn
 
15
# Copyright © 2008-2014 Björn Påhlsson
16
16
17
17
# This program is free software: you can redistribute it and/or modify
18
18
# it under the terms of the GNU General Public License as published by
690
690
        # If a checker exists, make sure it is not a zombie
691
691
        try:
692
692
            pid, status = os.waitpid(self.checker.pid, os.WNOHANG)
693
 
        except (AttributeError, OSError) as error:
694
 
            if (isinstance(error, OSError)
695
 
                and error.errno != errno.ECHILD):
696
 
                raise error
 
693
        except AttributeError:
 
694
            pass
 
695
        except OSError as error:
 
696
            if error.errno != errno.ECHILD:
 
697
                raise
697
698
        else:
698
699
            if pid:
699
700
                logger.warning("Checker was a zombie")
933
934
            # The byte_arrays option is not supported yet on
934
935
            # signatures other than "ay".
935
936
            if prop._dbus_signature != "ay":
936
 
                raise ValueError
 
937
                raise ValueError("Byte arrays not supported for non-"
 
938
                                 "'ay' signature {0!r}"
 
939
                                 .format(prop._dbus_signature))
937
940
            value = dbus.ByteArray(b''.join(chr(byte)
938
941
                                            for byte in value))
939
942
        prop(value)
1702
1705
            logger.debug("Protocol version: %r", line)
1703
1706
            try:
1704
1707
                if int(line.strip().split()[0]) > 1:
1705
 
                    raise RuntimeError
 
1708
                    raise RuntimeError(line)
1706
1709
            except (ValueError, IndexError, RuntimeError) as error:
1707
1710
                logger.error("Unknown protocol version: %s", error)
1708
1711
                return
1915
1918
    
1916
1919
    def add_pipe(self, parent_pipe, proc):
1917
1920
        """Dummy function; override as necessary"""
1918
 
        raise NotImplementedError
 
1921
        raise NotImplementedError()
1919
1922
 
1920
1923
 
1921
1924
class IPv6_TCPServer(MultiprocessingMixInWithPipe,
2258
2261
            else:
2259
2262
                raise ValueError("Unknown suffix {0!r}"
2260
2263
                                 .format(suffix))
2261
 
        except (ValueError, IndexError) as e:
 
2264
        except IndexError as e:
2262
2265
            raise ValueError(*(e.args))
2263
2266
        timevalue += delta
2264
2267
    return timevalue
2457
2460
                                        or None))
2458
2461
    if not foreground:
2459
2462
        pidfilename = "/run/mandos.pid"
 
2463
        if not os.path.isdir("/run/."):
 
2464
            pidfilename = "/var/run/mandos.pid"
2460
2465
        pidfile = None
2461
2466
        try:
2462
2467
            pidfile = open(pidfilename, "w")
2479
2484
        os.setuid(uid)
2480
2485
    except OSError as error:
2481
2486
        if error.errno != errno.EPERM:
2482
 
            raise error
 
2487
            raise
2483
2488
    
2484
2489
    if debug:
2485
2490
        # Enable all possible GnuTLS debugging
2790
2795
            else:
2791
2796
                logger.warning("Could not save persistent state:",
2792
2797
                               exc_info=e)
2793
 
                raise e
 
2798
                raise
2794
2799
        
2795
2800
        # Delete all clients, and settings from config
2796
2801
        while tcp_server.clients: