Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
a5d07659
Kaydet (Commit)
a5d07659
authored
Eyl 24, 2016
tarafından
Christian Heimes
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Finish GC code for SSLSession and increase test coverage
üst
22ecc4b3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
4 deletions
+12
-4
test_ssl.py
Lib/test/test_ssl.py
+3
-0
_ssl.c
Modules/_ssl.c
+9
-4
No files found.
Lib/test/test_ssl.py
Dosyayı görüntüle @
a5d07659
...
@@ -1474,6 +1474,7 @@ class SimpleBackgroundTests(unittest.TestCase):
...
@@ -1474,6 +1474,7 @@ class SimpleBackgroundTests(unittest.TestCase):
cert_reqs
=
ssl
.
CERT_NONE
)
as
s
:
cert_reqs
=
ssl
.
CERT_NONE
)
as
s
:
s
.
connect
(
self
.
server_addr
)
s
.
connect
(
self
.
server_addr
)
self
.
assertEqual
({},
s
.
getpeercert
())
self
.
assertEqual
({},
s
.
getpeercert
())
self
.
assertFalse
(
s
.
server_side
)
# this should succeed because we specify the root cert
# this should succeed because we specify the root cert
with
test_wrap_socket
(
socket
.
socket
(
socket
.
AF_INET
),
with
test_wrap_socket
(
socket
.
socket
(
socket
.
AF_INET
),
...
@@ -1481,6 +1482,7 @@ class SimpleBackgroundTests(unittest.TestCase):
...
@@ -1481,6 +1482,7 @@ class SimpleBackgroundTests(unittest.TestCase):
ca_certs
=
SIGNING_CA
)
as
s
:
ca_certs
=
SIGNING_CA
)
as
s
:
s
.
connect
(
self
.
server_addr
)
s
.
connect
(
self
.
server_addr
)
self
.
assertTrue
(
s
.
getpeercert
())
self
.
assertTrue
(
s
.
getpeercert
())
self
.
assertFalse
(
s
.
server_side
)
def
test_connect_fail
(
self
):
def
test_connect_fail
(
self
):
# This should fail because we have no verification certs. Connection
# This should fail because we have no verification certs. Connection
...
@@ -3028,6 +3030,7 @@ if _have_threads:
...
@@ -3028,6 +3030,7 @@ if _have_threads:
host
=
"127.0.0.1"
host
=
"127.0.0.1"
port
=
support
.
bind_port
(
server
)
port
=
support
.
bind_port
(
server
)
server
=
context
.
wrap_socket
(
server
,
server_side
=
True
)
server
=
context
.
wrap_socket
(
server
,
server_side
=
True
)
self
.
assertTrue
(
server
.
server_side
)
evt
=
threading
.
Event
()
evt
=
threading
.
Event
()
remote
=
None
remote
=
None
...
...
Modules/_ssl.c
Dosyayı görüntüle @
a5d07659
...
@@ -149,10 +149,12 @@ static int X509_NAME_ENTRY_set(const X509_NAME_ENTRY *ne)
...
@@ -149,10 +149,12 @@ static int X509_NAME_ENTRY_set(const X509_NAME_ENTRY *ne)
}
}
#ifndef OPENSSL_NO_COMP
#ifndef OPENSSL_NO_COMP
/* LCOV_EXCL_START */
static
int
COMP_get_type
(
const
COMP_METHOD
*
meth
)
static
int
COMP_get_type
(
const
COMP_METHOD
*
meth
)
{
{
return
meth
->
type
;
return
meth
->
type
;
}
}
/* LCOV_EXCL_END */
#endif
#endif
static
pem_password_cb
*
SSL_CTX_get_default_passwd_cb
(
SSL_CTX
*
ctx
)
static
pem_password_cb
*
SSL_CTX_get_default_passwd_cb
(
SSL_CTX
*
ctx
)
...
@@ -2408,8 +2410,7 @@ PySSL_get_session(PySSLSocket *self, void *closure) {
...
@@ -2408,8 +2410,7 @@ PySSL_get_session(PySSLSocket *self, void *closure) {
Py_RETURN_NONE
;
Py_RETURN_NONE
;
}
}
#endif
#endif
pysess
=
PyObject_GC_New
(
PySSLSession
,
&
PySSLSession_Type
);
pysess
=
PyObject_New
(
PySSLSession
,
&
PySSLSession_Type
);
if
(
pysess
==
NULL
)
{
if
(
pysess
==
NULL
)
{
SSL_SESSION_free
(
session
);
SSL_SESSION_free
(
session
);
return
NULL
;
return
NULL
;
...
@@ -2419,6 +2420,7 @@ PySSL_get_session(PySSLSocket *self, void *closure) {
...
@@ -2419,6 +2420,7 @@ PySSL_get_session(PySSLSocket *self, void *closure) {
pysess
->
ctx
=
self
->
ctx
;
pysess
->
ctx
=
self
->
ctx
;
Py_INCREF
(
pysess
->
ctx
);
Py_INCREF
(
pysess
->
ctx
);
pysess
->
session
=
session
;
pysess
->
session
=
session
;
PyObject_GC_Track
(
pysess
);
return
(
PyObject
*
)
pysess
;
return
(
PyObject
*
)
pysess
;
}
}
...
@@ -4289,11 +4291,12 @@ static PyTypeObject PySSLMemoryBIO_Type = {
...
@@ -4289,11 +4291,12 @@ static PyTypeObject PySSLMemoryBIO_Type = {
static
void
static
void
PySSLSession_dealloc
(
PySSLSession
*
self
)
PySSLSession_dealloc
(
PySSLSession
*
self
)
{
{
PyObject_GC_UnTrack
(
self
);
Py_XDECREF
(
self
->
ctx
);
Py_XDECREF
(
self
->
ctx
);
if
(
self
->
session
!=
NULL
)
{
if
(
self
->
session
!=
NULL
)
{
SSL_SESSION_free
(
self
->
session
);
SSL_SESSION_free
(
self
->
session
);
}
}
PyObject_Del
(
self
);
PyObject_
GC_
Del
(
self
);
}
}
static
PyObject
*
static
PyObject
*
...
@@ -4455,7 +4458,7 @@ static PyTypeObject PySSLSession_Type = {
...
@@ -4455,7 +4458,7 @@ static PyTypeObject PySSLSession_Type = {
0
,
/*tp_getattro*/
0
,
/*tp_getattro*/
0
,
/*tp_setattro*/
0
,
/*tp_setattro*/
0
,
/*tp_as_buffer*/
0
,
/*tp_as_buffer*/
Py_TPFLAGS_DEFAULT
,
/*tp_flags*/
Py_TPFLAGS_DEFAULT
|
Py_TPFLAGS_HAVE_GC
,
/*tp_flags*/
0
,
/*tp_doc*/
0
,
/*tp_doc*/
(
traverseproc
)
PySSLSession_traverse
,
/*tp_traverse*/
(
traverseproc
)
PySSLSession_traverse
,
/*tp_traverse*/
(
inquiry
)
PySSLSession_clear
,
/*tp_clear*/
(
inquiry
)
PySSLSession_clear
,
/*tp_clear*/
...
@@ -4590,6 +4593,7 @@ _ssl_RAND_status_impl(PyObject *module)
...
@@ -4590,6 +4593,7 @@ _ssl_RAND_status_impl(PyObject *module)
}
}
#ifndef OPENSSL_NO_EGD
#ifndef OPENSSL_NO_EGD
/* LCOV_EXCL_START */
/*[clinic input]
/*[clinic input]
_ssl.RAND_egd
_ssl.RAND_egd
path: object(converter="PyUnicode_FSConverter")
path: object(converter="PyUnicode_FSConverter")
...
@@ -4615,6 +4619,7 @@ _ssl_RAND_egd_impl(PyObject *module, PyObject *path)
...
@@ -4615,6 +4619,7 @@ _ssl_RAND_egd_impl(PyObject *module, PyObject *path)
}
}
return
PyLong_FromLong
(
bytes
);
return
PyLong_FromLong
(
bytes
);
}
}
/* LCOV_EXCL_STOP */
#endif
/* OPENSSL_NO_EGD */
#endif
/* OPENSSL_NO_EGD */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment