Kaydet (Commit) f9faaad8 authored tarafından Victor Stinner's avatar Victor Stinner

Issue #8477: ssl.RAND_egd() supports str with surrogates and bytes for the path

üst 3800e1e9
...@@ -363,8 +363,8 @@ C-API ...@@ -363,8 +363,8 @@ C-API
Library Library
------- -------
- Issue #8477: _ssl._test_decode_cert() supports str with surrogates and bytes - Issue #8477: ssl.RAND_egd() and ssl._test_decode_cert() support str with
for the filename surrogates and bytes for the filename
- Issue #8550: Add first class ``SSLContext`` objects to the ssl module. - Issue #8550: Add first class ``SSLContext`` objects to the ssl module.
......
...@@ -1730,15 +1730,17 @@ It is necessary to seed the PRNG with RAND_add() on some platforms before\n\ ...@@ -1730,15 +1730,17 @@ It is necessary to seed the PRNG with RAND_add() on some platforms before\n\
using the ssl() function."); using the ssl() function.");
static PyObject * static PyObject *
PySSL_RAND_egd(PyObject *self, PyObject *arg) PySSL_RAND_egd(PyObject *self, PyObject *args)
{ {
PyObject *path;
int bytes; int bytes;
if (!PyUnicode_Check(arg)) if (!PyArg_ParseTuple(args, "O&|i:RAND_egd",
return PyErr_Format(PyExc_TypeError, PyUnicode_FSConverter, &path))
"RAND_egd() expected string, found %s", return NULL;
Py_TYPE(arg)->tp_name);
bytes = RAND_egd(_PyUnicode_AsString(arg)); bytes = RAND_egd(PyBytes_AsString(path));
Py_DECREF(path);
if (bytes == -1) { if (bytes == -1) {
PyErr_SetString(PySSLErrorObject, PyErr_SetString(PySSLErrorObject,
"EGD connection failed or EGD did not return " "EGD connection failed or EGD did not return "
...@@ -1767,7 +1769,7 @@ static PyMethodDef PySSL_methods[] = { ...@@ -1767,7 +1769,7 @@ static PyMethodDef PySSL_methods[] = {
#ifdef HAVE_OPENSSL_RAND #ifdef HAVE_OPENSSL_RAND
{"RAND_add", PySSL_RAND_add, METH_VARARGS, {"RAND_add", PySSL_RAND_add, METH_VARARGS,
PySSL_RAND_add_doc}, PySSL_RAND_add_doc},
{"RAND_egd", PySSL_RAND_egd, METH_O, {"RAND_egd", PySSL_RAND_egd, METH_VARARGS,
PySSL_RAND_egd_doc}, PySSL_RAND_egd_doc},
{"RAND_status", (PyCFunction)PySSL_RAND_status, METH_NOARGS, {"RAND_status", (PyCFunction)PySSL_RAND_status, METH_NOARGS,
PySSL_RAND_status_doc}, PySSL_RAND_status_doc},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment