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
f06628b0
Kaydet (Commit)
f06628b0
authored
Kas 21, 2007
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Make read() and certificate() return bytes instead of bytearray instances.
üst
254348e2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
31 deletions
+23
-31
_ssl.c
Modules/_ssl.c
+23
-31
No files found.
Modules/_ssl.c
Dosyayı görüntüle @
f06628b0
...
...
@@ -504,7 +504,7 @@ _create_tuple_for_attribute (ASN1_OBJECT *name, ASN1_STRING *value) {
name_obj
=
PyUnicode_FromStringAndSize
(
namebuf
,
buflen
);
if
(
name_obj
==
NULL
)
goto
fail
;
buflen
=
ASN1_STRING_to_UTF8
(
&
valuebuf
,
value
);
if
(
buflen
<
0
)
{
_setSSLError
(
NULL
,
0
,
__FILE__
,
__LINE__
);
...
...
@@ -590,7 +590,7 @@ _create_tuple_for_X509_NAME (X509_NAME *xname)
fprintf(stderr, "RDN level %d, attribute %s: %s\n",
entry->set,
PyString_AS_STRING(PyTuple_GET_ITEM(attr, 0)),
PyString_AS_STRING(PyTuple_GET_ITEM(attr, 1)));
PyString_AS_STRING(PyTuple_GET_ITEM(attr, 1)));
*/
if
(
attr
==
NULL
)
goto
fail1
;
...
...
@@ -628,7 +628,7 @@ _create_tuple_for_X509_NAME (X509_NAME *xname)
static
PyObject
*
_get_peer_alt_names
(
X509
*
certificate
)
{
/* this code follows the procedure outlined in
OpenSSL's crypto/x509v3/v3_prn.c:X509v3_EXT_print()
function to extract the STACK_OF(GENERAL_NAME),
...
...
@@ -641,7 +641,7 @@ _get_peer_alt_names (X509 *certificate) {
X509_EXTENSION
*
ext
=
NULL
;
GENERAL_NAMES
*
names
=
NULL
;
GENERAL_NAME
*
name
;
X509V3_EXT_METHOD
*
method
;
X509V3_EXT_METHOD
*
method
;
BIO
*
biobuf
=
NULL
;
char
buf
[
2048
];
char
*
vptr
;
...
...
@@ -663,7 +663,7 @@ _get_peer_alt_names (X509 *certificate) {
if
(
peer_alt_names
==
NULL
)
goto
fail
;
}
/* now decode the altName */
ext
=
X509_get_ext
(
certificate
,
i
);
if
(
!
(
method
=
X509V3_EXT_get
(
ext
)))
{
...
...
@@ -714,7 +714,7 @@ _get_peer_alt_names (X509 *certificate) {
goto
fail
;
}
PyTuple_SET_ITEM
(
t
,
1
,
v
);
}
else
{
/* for everything else, we use the OpenSSL print form */
...
...
@@ -764,7 +764,7 @@ _get_peer_alt_names (X509 *certificate) {
}
else
{
return
peer_alt_names
;
}
fail:
if
(
biobuf
!=
NULL
)
...
...
@@ -817,7 +817,7 @@ _decode_certificate (X509 *certificate, int verbose) {
goto
fail0
;
}
Py_DECREF
(
issuer
);
version
=
PyInt_FromLong
(
X509_get_version
(
certificate
)
+
1
);
if
(
PyDict_SetItemString
(
retval
,
"version"
,
version
)
<
0
)
{
Py_DECREF
(
version
);
...
...
@@ -825,10 +825,10 @@ _decode_certificate (X509 *certificate, int verbose) {
}
Py_DECREF
(
version
);
}
/* get a memory buffer */
biobuf
=
BIO_new
(
BIO_s_mem
());
if
(
verbose
)
{
(
void
)
BIO_reset
(
biobuf
);
...
...
@@ -897,7 +897,7 @@ _decode_certificate (X509 *certificate, int verbose) {
}
Py_DECREF
(
peer_alt_names
);
}
BIO_free
(
biobuf
);
return
retval
;
...
...
@@ -945,7 +945,7 @@ PySSL_test_decode_certificate (PyObject *mod, PyObject *args) {
retval
=
_decode_certificate
(
x
,
verbose
);
fail0:
if
(
cert
!=
NULL
)
BIO_free
(
cert
);
return
retval
;
}
...
...
@@ -977,7 +977,7 @@ PySSL_peercert(PySSLObject *self, PyObject *args)
return
NULL
;
}
/* this is actually an immutable bytes sequence */
retval
=
Py
Bytes
_FromStringAndSize
retval
=
Py
String
_FromStringAndSize
((
const
char
*
)
bytes_buf
,
len
);
OPENSSL_free
(
bytes_buf
);
return
retval
;
...
...
@@ -1044,7 +1044,7 @@ static PyObject *PySSL_cipher (PySSLObject *self) {
goto
fail0
;
PyTuple_SET_ITEM
(
retval
,
2
,
v
);
return
retval
;
fail0:
Py_DECREF
(
retval
);
return
NULL
;
...
...
@@ -1281,13 +1281,8 @@ static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args)
Py_DECREF
(
buf
);
return
NULL
;
}
else
if
(
sockstate
==
SOCKET_HAS_BEEN_CLOSED
)
{
/* should contain a zero-length string */
if
(
!
buf_passed
)
{
PyBytes_Resize
(
buf
,
0
);
return
buf
;
}
else
{
return
PyInt_FromLong
(
0
);
}
count
=
0
;
goto
done
;
}
}
do
{
...
...
@@ -1312,12 +1307,8 @@ static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args)
(
SSL_get_shutdown
(
self
->
ssl
)
==
SSL_RECEIVED_SHUTDOWN
))
{
if
(
!
buf_passed
)
{
PyBytes_Resize
(
buf
,
0
);
return
buf
;
}
else
{
return
PyInt_FromLong
(
0
);
}
count
=
0
;
goto
done
;
}
else
{
sockstate
=
SOCKET_OPERATION_OK
;
}
...
...
@@ -1338,11 +1329,12 @@ static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args)
}
return
PySSL_SetError
(
self
,
count
,
__FILE__
,
__LINE__
);
}
done:
if
(
!
buf_passed
)
{
if
(
count
!=
len
)
{
PyBytes_
Resize
(
buf
,
count
);
}
return
buf
;
PyObject
*
res
=
PyString_FromStringAndSize
(
PyBytes_
AS_STRING
(
buf
)
,
count
);
Py_DECREF
(
buf
);
return
res
;
}
else
{
return
PyInt_FromLong
(
count
);
}
...
...
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