/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-04-16 06:47:28 UTC
  • Revision ID: teddy@fukt.bsnet.se-20090416064728-c3d36mvgxo5q9aoh
* mandos: Import "SocketServer" as "socketserver" and "ConfigParser"
          as "configparser".  All users changed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
 
34
34
from __future__ import division, with_statement, absolute_import
35
35
 
36
 
import SocketServer
 
36
import SocketServer as socketserver
37
37
import socket
38
38
import optparse
39
39
import datetime
44
44
import gnutls.library.functions
45
45
import gnutls.library.constants
46
46
import gnutls.library.types
47
 
import ConfigParser
 
47
import ConfigParser as configparser
48
48
import sys
49
49
import re
50
50
import os
701
701
    del _interface
702
702
 
703
703
 
704
 
class ClientHandler(SocketServer.BaseRequestHandler, object):
 
704
class ClientHandler(socketserver.BaseRequestHandler, object):
705
705
    """A class to handle client connections.
706
706
    
707
707
    Instantiated once for each connection to handle it.
849
849
        return hex_fpr
850
850
 
851
851
 
852
 
class ForkingMixInWithPipe(SocketServer.ForkingMixIn, object):
853
 
    """Like SocketServer.ForkingMixIn, but also pass a pipe.
 
852
class ForkingMixInWithPipe(socketserver.ForkingMixIn, object):
 
853
    """Like socketserver.ForkingMixIn, but also pass a pipe.
854
854
    
855
855
    Assumes a gobject.MainLoop event loop.
856
856
    """
874
874
 
875
875
 
876
876
class IPv6_TCPServer(ForkingMixInWithPipe,
877
 
                     SocketServer.TCPServer, object):
 
877
                     socketserver.TCPServer, object):
878
878
    """IPv6-capable TCP server.  Accepts 'None' as address and/or port
879
879
    
880
880
    Attributes:
896
896
        self.clients = clients
897
897
        self.use_dbus = use_dbus
898
898
        self.gnutls_priority = gnutls_priority
899
 
        SocketServer.TCPServer.__init__(self, server_address,
 
899
        socketserver.TCPServer.__init__(self, server_address,
900
900
                                        RequestHandlerClass)
901
901
    def server_bind(self):
902
902
        """This overrides the normal server_bind() function
932
932
#                                            0, # flowinfo
933
933
#                                            if_nametoindex
934
934
#                                            (self.interface))
935
 
            return SocketServer.TCPServer.server_bind(self)
 
935
            return socketserver.TCPServer.server_bind(self)
936
936
    def server_activate(self):
937
937
        if self.enabled:
938
 
            return SocketServer.TCPServer.server_activate(self)
 
938
            return socketserver.TCPServer.server_activate(self)
939
939
    def enable(self):
940
940
        self.enabled = True
941
941
    def handle_ipc(self, source, condition, file_objects={}):
1170
1170
                        }
1171
1171
    
1172
1172
    # Parse config file for server-global settings
1173
 
    server_config = ConfigParser.SafeConfigParser(server_defaults)
 
1173
    server_config = configparser.SafeConfigParser(server_defaults)
1174
1174
    del server_defaults
1175
1175
    server_config.read(os.path.join(options.configdir,
1176
1176
                                    u"mandos.conf"))
1223
1223
                        u"checker": u"fping -q -- %%(host)s",
1224
1224
                        u"host": u"",
1225
1225
                        }
1226
 
    client_config = ConfigParser.SafeConfigParser(client_defaults)
 
1226
    client_config = configparser.SafeConfigParser(client_defaults)
1227
1227
    client_config.read(os.path.join(server_settings[u"configdir"],
1228
1228
                                    u"clients.conf"))
1229
1229