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
78ace81c
Kaydet (Commit)
78ace81c
authored
Ock 09, 2014
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #20207: Always disable SSLv2 except when PROTOCOL_SSLv2 is explicitly asked for.
üst
5940b929
2f7c3167
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
10 deletions
+12
-10
test_ssl.py
Lib/test/test_ssl.py
+4
-6
NEWS
Misc/NEWS
+3
-0
_ssl.c
Modules/_ssl.c
+5
-4
No files found.
Lib/test/test_ssl.py
Dosyayı görüntüle @
78ace81c
...
...
@@ -670,9 +670,7 @@ class ContextTests(unittest.TestCase):
@skip_if_broken_ubuntu_ssl
def
test_options
(
self
):
ctx
=
ssl
.
SSLContext
(
ssl
.
PROTOCOL_TLSv1
)
# OP_ALL is the default value
self
.
assertEqual
(
ssl
.
OP_ALL
,
ctx
.
options
)
ctx
.
options
|=
ssl
.
OP_NO_SSLv2
# OP_ALL | OP_NO_SSLv2 is the default value
self
.
assertEqual
(
ssl
.
OP_ALL
|
ssl
.
OP_NO_SSLv2
,
ctx
.
options
)
ctx
.
options
|=
ssl
.
OP_NO_SSLv3
...
...
@@ -2095,7 +2093,7 @@ else:
try_protocol_combo
(
ssl
.
PROTOCOL_SSLv2
,
ssl
.
PROTOCOL_SSLv2
,
True
)
try_protocol_combo
(
ssl
.
PROTOCOL_SSLv2
,
ssl
.
PROTOCOL_SSLv2
,
True
,
ssl
.
CERT_OPTIONAL
)
try_protocol_combo
(
ssl
.
PROTOCOL_SSLv2
,
ssl
.
PROTOCOL_SSLv2
,
True
,
ssl
.
CERT_REQUIRED
)
try_protocol_combo
(
ssl
.
PROTOCOL_SSLv2
,
ssl
.
PROTOCOL_SSLv23
,
Tru
e
)
try_protocol_combo
(
ssl
.
PROTOCOL_SSLv2
,
ssl
.
PROTOCOL_SSLv23
,
Fals
e
)
try_protocol_combo
(
ssl
.
PROTOCOL_SSLv2
,
ssl
.
PROTOCOL_SSLv3
,
False
)
try_protocol_combo
(
ssl
.
PROTOCOL_SSLv2
,
ssl
.
PROTOCOL_TLSv1
,
False
)
# SSLv23 client with specific SSL options
...
...
@@ -2103,9 +2101,9 @@ else:
# No SSLv2 => client will use an SSLv3 hello on recent OpenSSLs
try_protocol_combo
(
ssl
.
PROTOCOL_SSLv2
,
ssl
.
PROTOCOL_SSLv23
,
False
,
client_options
=
ssl
.
OP_NO_SSLv2
)
try_protocol_combo
(
ssl
.
PROTOCOL_SSLv2
,
ssl
.
PROTOCOL_SSLv23
,
Tru
e
,
try_protocol_combo
(
ssl
.
PROTOCOL_SSLv2
,
ssl
.
PROTOCOL_SSLv23
,
Fals
e
,
client_options
=
ssl
.
OP_NO_SSLv3
)
try_protocol_combo
(
ssl
.
PROTOCOL_SSLv2
,
ssl
.
PROTOCOL_SSLv23
,
Tru
e
,
try_protocol_combo
(
ssl
.
PROTOCOL_SSLv2
,
ssl
.
PROTOCOL_SSLv23
,
Fals
e
,
client_options
=
ssl
.
OP_NO_TLSv1
)
@skip_if_broken_ubuntu_ssl
...
...
Misc/NEWS
Dosyayı görüntüle @
78ace81c
...
...
@@ -25,6 +25,9 @@ Core and Builtins
Library
-------
- Issue #20207: Always disable SSLv2 except when PROTOCOL_SSLv2 is explicitly
asked for.
- Issue #18960: The tokenize module now ignore the source encoding declaration
on the second line if the first line contains anything except a comment.
...
...
Modules/_ssl.c
Dosyayı görüntüle @
78ace81c
...
...
@@ -134,9 +134,7 @@ enum py_ssl_cert_requirements {
};
enum
py_ssl_version
{
#ifndef OPENSSL_NO_SSL2
PY_SSL_VERSION_SSL2
,
#endif
PY_SSL_VERSION_SSL3
=
1
,
PY_SSL_VERSION_SSL23
,
#if HAVE_TLSv1_2
...
...
@@ -1999,6 +1997,7 @@ context_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
char
*
kwlist
[]
=
{
"protocol"
,
NULL
};
PySSLContext
*
self
;
int
proto_version
=
PY_SSL_VERSION_SSL23
;
long
options
;
SSL_CTX
*
ctx
=
NULL
;
if
(
!
PyArg_ParseTupleAndKeywords
(
...
...
@@ -2055,8 +2054,10 @@ context_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
self
->
check_hostname
=
0
;
/* Defaults */
SSL_CTX_set_verify
(
self
->
ctx
,
SSL_VERIFY_NONE
,
NULL
);
SSL_CTX_set_options
(
self
->
ctx
,
SSL_OP_ALL
&
~
SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS
);
options
=
SSL_OP_ALL
&
~
SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS
;
if
(
proto_version
!=
PY_SSL_VERSION_SSL2
)
options
|=
SSL_OP_NO_SSLv2
;
SSL_CTX_set_options
(
self
->
ctx
,
options
);
#define SID_CTX "Python"
SSL_CTX_set_session_id_context
(
self
->
ctx
,
(
const
unsigned
char
*
)
SID_CTX
,
...
...
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