]> granicus.if.org Git - python/commitdiff
use SSL_get_session
authorBenjamin Peterson <benjamin@python.org>
Wed, 7 Jan 2015 17:32:00 +0000 (11:32 -0600)
committerBenjamin Peterson <benjamin@python.org>
Wed, 7 Jan 2015 17:32:00 +0000 (11:32 -0600)
Modules/_ssl.c

index 55f04ed38a703b5ac111da75418f47cda7f7fe3f..596966323e38c2b959348c60e7415f9606357278 100644 (file)
@@ -1404,13 +1404,14 @@ cipher_to_tuple(const SSL_CIPHER *cipher)
 
 static PyObject *PySSL_shared_ciphers(PySSLSocket *self)
 {
+    SSL_SESSION *sess = SSL_get_session(self->ssl);
     STACK_OF(SSL_CIPHER) *ciphers;
     int i;
     PyObject *res;
 
-    if (!self->ssl->session || !self->ssl->session->ciphers)
+    if (!sess || !sess->ciphers)
         Py_RETURN_NONE;
-    ciphers = self->ssl->session->ciphers;
+    ciphers = sess->ciphers;
     res = PyList_New(sk_SSL_CIPHER_num(ciphers));
     if (!res)
         return NULL;