Changeset c7000bb


Ignore:
Timestamp:
2010-12-11T15:14:12Z (13 years ago)
Author:
Miklos Vajna <vmiklos@…>
Branches:
master
Children:
0b77a9b
Parents:
35249d6
Message:

Use internal ssl module instead of pyopenssl or python-gnutls

This results in shorter code and is available on Windows as well.

Location:
skype
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • skype/README

    r35249d6 rc7000bb  
    4141* PyGObject >= 2.8.0. Older versions are part of PyGTK. (And you don't want to
    4242  install GTK for nothing, right?)
    43 * pyopenssl or python-gnutls.
    4443
    4544`bitlbee-skype` has been tested under Linux and Mac OS X. Skype and Skype4py is
     
    9089----
    9190
    92 and you have to install `bitlbee-skype`, `skype4py` and `python-gnutls` from
     91and you have to install `bitlbee-skype` and `skype4py` from
    9392source.
    9493
     
    124123$ cd Skype4Py-x.x.x.x
    125124# python setup.py install
    126 ----
    127 
    128 - To install http://pypi.python.org/pypi/python-gnutls[python-gnutls] from source
    129   (unless you want to install the plugin for a public server):
    130 
    131 ----
    132 $ tar -zxvf python-gnutls-x.x.x.tar.gz
    133 $ cd python-gnutls-x.x.x
    134 # python setup.py install
    135 ----
    136 
    137 NOTE: On OS X you will need the following hacks first:
    138 
    139 ----
    140 $ export LD_LIBRARY_PATH=/opt/local/lib
    141 $ export CFLAGS="-I/opt/local/include"
    142 $ export LDFLAGS="-L/opt/local/lib"
    143125----
    144126
     
    191173http://code.google.com/p/gdata-python-client/source/browse/src/gdata/oauth/rsa.py#87[here].
    192174
    193 - If both pyopenssl and python-gnutls are available, then python-gnutls
    194   will be used. This behaviour can be overwritten by:
    195 
    196 ----
    197 $ export SKYPED_NO_GNUTLS=1
    198 ----
    199 
    200175- Start `skyped` (the tcp server):
    201176
  • skype/skyped.py

    r35249d6 rc7000bb  
    3333from ConfigParser import ConfigParser, NoOptionError
    3434from traceback import print_exception
     35import ssl
    3536
    3637__version__ = "0.1.1"
     
    8687def server(host, port):
    8788        global options
    88         try:
    89                 if "SKYPED_NO_GNUTLS" in os.environ.keys():
    90                         dprint("Warning, using OpenSSL instead of gnutls as requested (not recommended).")
    91                         raise ImportError
    92                 from gnutls import crypto, connection
    93                 cert = crypto.X509Certificate(open(options.config.sslcert).read())
    94                 key = crypto.X509PrivateKey(open(options.config.sslkey).read())
    95                 cred = connection.X509Credentials(cert, key)
    96                 sock = connection.ServerSessionFactory(socket.socket(), cred)
    97         except ImportError:
    98                 from OpenSSL import SSL
    99                 ctx = SSL.Context(SSL.TLSv1_METHOD)
    100                 ctx.use_privatekey_file(options.config.sslkey)
    101                 ctx.use_certificate_file(options.config.sslcert)
    102                 sock = SSL.Connection(ctx, socket.socket())
     89        sock = socket.socket()
    10390        sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    10491        sock.bind((host, port))
     
    10895def listener(sock, *args):
    10996        global options
    110         options.conn, addr = sock.accept()
     97        rawsock, addr = sock.accept()
     98        options.conn = ssl.wrap_socket(rawsock,
     99                server_side=True,
     100                certfile=options.config.sslcert,
     101                keyfile=options.config.sslkey,
     102                ssl_version=ssl.PROTOCOL_TLSv1)
    111103        if hasattr(options.conn, 'handshake'):
    112104                try:
Note: See TracChangeset for help on using the changeset viewer.