Changeset b0d40f5


Ignore:
Timestamp:
2008-04-30T23:57:49Z (12 years ago)
Author:
Miklos Vajna <vmiklos@…>
Branches:
master
Children:
e3d0b10
Parents:
4c340e9
Message:

add python-gnutls support and make it default if available

  • this change in general should be ok, since openssl has problems when using it from gpl software which is distributed as a binary.
  • anyway, i hope that this will solve that magic "Fatal Python error: PyEval_RestoreThread: NULL tstate" error. at least it worth a try.
Location:
skype
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • skype/README

    r4c340e9 rb0d40f5  
    3535* PyGObject >= 2.8.0. Older versions are part of PyGTK. (And you don't want to
    3636  install GTK for nothing, right?)
     37* pyopenssl or python-gnutls.
    3738
    3839`bitlbee-skype` has been tested under Linux and Mac OS X. Skype and Skype4py is
     
    112113NOTE: Maybe you want to adjust the permissions in the `/usr/local/etc/skyped`
    113114dir. For example make it readable by just your user.
     115
     116- If both pyopenssl and python-gnutls are available, then python-gnutls
     117  will be used. This behaviour can be overwritten by:
     118
     119----
     120$ export SKYPED_NO_GNUTLS=1
     121----
    114122
    115123- Start `skyped` (the tcp server):
  • skype/skyped.py

    r4c340e9 rb0d40f5  
    7474def server(host, port):
    7575        global options
    76 
    77         from OpenSSL import SSL
    78         ctx = SSL.Context(SSL.TLSv1_METHOD)
    79         ctx.use_privatekey_file(options.config.sslkey)
    80         ctx.use_certificate_file(options.config.sslcert)
    81         sock = SSL.Connection(ctx, socket.socket())
    82 
     76        try:
     77                if "SKYPED_NO_GNUTLS" in os.environ.keys():
     78                        dprint("Warning, using OpenSSL instead of gnutls as requested (not recommended).")
     79                        raise ImportError
     80                from gnutls import crypto, connection
     81                cert = crypto.X509Certificate(open(options.config.sslcert).read())
     82                key = crypto.X509PrivateKey(open(options.config.sslkey).read())
     83                cred = connection.X509Credentials(cert, key)
     84                sock = connection.ServerSessionFactory(socket.socket(), cred)
     85        except ImportError:
     86                from OpenSSL import SSL
     87                ctx = SSL.Context(SSL.TLSv1_METHOD)
     88                ctx.use_privatekey_file(options.config.sslkey)
     89                ctx.use_certificate_file(options.config.sslcert)
     90                sock = SSL.Connection(ctx, socket.socket())
    8391        sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    8492        sock.bind((host, port))
     
    8997        global options
    9098        options.conn, addr = sock.accept()
     99        if hasattr(options.conn, 'handshake'):
     100                options.conn.handshake()
    91101        ret = 0
    92102        line = options.conn.recv(1024)
Note: See TracChangeset for help on using the changeset viewer.