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
09c35f78
Kaydet (Commit)
09c35f78
authored
Tem 28, 2002
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Patch #575827: allow threads inside SSL creation.
üst
6c611fae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
4 deletions
+19
-4
_ssl.c
Modules/_ssl.c
+19
-4
No files found.
Modules/_ssl.c
Dosyayı görüntüle @
09c35f78
...
@@ -186,47 +186,62 @@ newPySSLObject(PySocketSockObject *Sock, char *key_file, char *cert_file)
...
@@ -186,47 +186,62 @@ newPySSLObject(PySocketSockObject *Sock, char *key_file, char *cert_file)
goto
fail
;
goto
fail
;
}
}
Py_BEGIN_ALLOW_THREADS
self
->
ctx
=
SSL_CTX_new
(
SSLv23_method
());
/* Set up context */
self
->
ctx
=
SSL_CTX_new
(
SSLv23_method
());
/* Set up context */
Py_END_ALLOW_THREADS
if
(
self
->
ctx
==
NULL
)
{
if
(
self
->
ctx
==
NULL
)
{
errstr
=
"SSL_CTX_new error"
;
errstr
=
"SSL_CTX_new error"
;
goto
fail
;
goto
fail
;
}
}
if
(
key_file
)
{
if
(
key_file
)
{
if
(
SSL_CTX_use_PrivateKey_file
(
self
->
ctx
,
key_file
,
Py_BEGIN_ALLOW_THREADS
SSL_FILETYPE_PEM
)
<
1
)
{
ret
=
SSL_CTX_use_PrivateKey_file
(
self
->
ctx
,
key_file
,
SSL_FILETYPE_PEM
);
Py_END_ALLOW_THREADS
if
(
ret
<
1
)
{
errstr
=
"SSL_CTX_use_PrivateKey_file error"
;
errstr
=
"SSL_CTX_use_PrivateKey_file error"
;
goto
fail
;
goto
fail
;
}
}
if
(
SSL_CTX_use_certificate_chain_file
(
self
->
ctx
,
Py_BEGIN_ALLOW_THREADS
cert_file
)
<
1
)
{
ret
=
SSL_CTX_use_certificate_chain_file
(
self
->
ctx
,
cert_file
);
Py_END_ALLOW_THREADS
if
(
ret
<
1
)
{
errstr
=
"SSL_CTX_use_certificate_chain_file error"
;
errstr
=
"SSL_CTX_use_certificate_chain_file error"
;
goto
fail
;
goto
fail
;
}
}
}
}
Py_BEGIN_ALLOW_THREADS
SSL_CTX_set_verify
(
self
->
ctx
,
SSL_CTX_set_verify
(
self
->
ctx
,
SSL_VERIFY_NONE
,
NULL
);
/* set verify lvl */
SSL_VERIFY_NONE
,
NULL
);
/* set verify lvl */
self
->
ssl
=
SSL_new
(
self
->
ctx
);
/* New ssl struct */
self
->
ssl
=
SSL_new
(
self
->
ctx
);
/* New ssl struct */
Py_END_ALLOW_THREADS
SSL_set_fd
(
self
->
ssl
,
Sock
->
sock_fd
);
/* Set the socket for SSL */
SSL_set_fd
(
self
->
ssl
,
Sock
->
sock_fd
);
/* Set the socket for SSL */
Py_BEGIN_ALLOW_THREADS
SSL_set_connect_state
(
self
->
ssl
);
SSL_set_connect_state
(
self
->
ssl
);
/* Actually negotiate SSL connection */
/* Actually negotiate SSL connection */
/* XXX If SSL_connect() returns 0, it's also a failure. */
/* XXX If SSL_connect() returns 0, it's also a failure. */
ret
=
SSL_connect
(
self
->
ssl
);
ret
=
SSL_connect
(
self
->
ssl
);
Py_END_ALLOW_THREADS
if
(
ret
<=
0
)
{
if
(
ret
<=
0
)
{
PySSL_SetError
(
self
,
ret
);
PySSL_SetError
(
self
,
ret
);
goto
fail
;
goto
fail
;
}
}
self
->
ssl
->
debug
=
1
;
self
->
ssl
->
debug
=
1
;
Py_BEGIN_ALLOW_THREADS
if
((
self
->
server_cert
=
SSL_get_peer_certificate
(
self
->
ssl
)))
{
if
((
self
->
server_cert
=
SSL_get_peer_certificate
(
self
->
ssl
)))
{
X509_NAME_oneline
(
X509_get_subject_name
(
self
->
server_cert
),
X509_NAME_oneline
(
X509_get_subject_name
(
self
->
server_cert
),
self
->
server
,
X509_NAME_MAXLEN
);
self
->
server
,
X509_NAME_MAXLEN
);
X509_NAME_oneline
(
X509_get_issuer_name
(
self
->
server_cert
),
X509_NAME_oneline
(
X509_get_issuer_name
(
self
->
server_cert
),
self
->
issuer
,
X509_NAME_MAXLEN
);
self
->
issuer
,
X509_NAME_MAXLEN
);
}
}
Py_END_ALLOW_THREADS
self
->
Socket
=
Sock
;
self
->
Socket
=
Sock
;
Py_INCREF
(
self
->
Socket
);
Py_INCREF
(
self
->
Socket
);
return
self
;
return
self
;
...
...
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