/usr/share/pyshared/M2Crypto/SSL/SSLServer.py is in python-m2crypto 0.21.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | """SSLServer
Copyright (c) 1999-2002 Ng Pheng Siong. All rights reserved."""
__all__ = ['SSLServer', 'ForkingSSLServer', 'ThreadingSSLServer']
# Python
import socket, SocketServer
# M2Crypto
from Connection import Connection
from M2Crypto.SSL import SSLError
from M2Crypto import m2
class SSLServer(SocketServer.TCPServer):
def __init__(self, server_address, RequestHandlerClass, ssl_context, bind_and_activate=True):
"""
Superclass says: Constructor. May be extended, do not override.
This class says: Ho-hum.
"""
SocketServer.BaseServer.__init__(self, server_address, RequestHandlerClass)
self.ssl_ctx=ssl_context
self.socket=Connection(self.ssl_ctx)
if bind_and_activate:
self.server_bind()
self.server_activate()
def handle_request(self):
request = None
client_address = None
try:
request, client_address = self.get_request()
if self.verify_request(request, client_address):
self.process_request(request, client_address)
except SSLError:
self.handle_error(request, client_address)
def handle_error(self, request, client_address):
print '-'*40
import traceback
traceback.print_exc()
print '-'*40
class ForkingSSLServer(SocketServer.ForkingMixIn, SSLServer):
pass
class ThreadingSSLServer(SocketServer.ThreadingMixIn, SSLServer):
pass
|