summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2003-06-28 07:40:23 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2003-06-28 07:40:23 (GMT)
commitafec8e3bde02048524bd1b19d7b2c7c3cc175057 (patch)
tree4b8c547afed4ccfcf5e4e7e2001f1abd0b6b8432 /Modules
parent2dd1ed69b425d2f2ac8152548c7581aa1f01216d (diff)
downloadcpython-afec8e3bde02048524bd1b19d7b2c7c3cc175057.zip
cpython-afec8e3bde02048524bd1b19d7b2c7c3cc175057.tar.gz
cpython-afec8e3bde02048524bd1b19d7b2c7c3cc175057.tar.bz2
Patch #751916: Check for signals, fix some refcounting errors.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_ssl.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 8fe0428..16edadd 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -245,14 +245,17 @@ newPySSLObject(PySocketSockObject *Sock, char *key_file, char *cert_file)
ret = SSL_connect(self->ssl);
err = SSL_get_error(self->ssl, ret);
Py_END_ALLOW_THREADS
+ if(PyErr_CheckSignals()) {
+ goto fail;
+ }
if (err == SSL_ERROR_WANT_READ) {
timedout = wait_for_timeout(Sock, 0);
} else if (err == SSL_ERROR_WANT_WRITE) {
timedout = wait_for_timeout(Sock, 1);
}
if (timedout) {
- PyErr_SetString(PySSLErrorObject, "The connect operation timed out");
- return NULL;
+ errstr = "The connect operation timed out";
+ goto fail;
}
} while (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE);
if (ret <= 0) {
@@ -387,6 +390,9 @@ static PyObject *PySSL_SSLwrite(PySSLObject *self, PyObject *args)
len = SSL_write(self->ssl, data, len);
err = SSL_get_error(self->ssl, len);
Py_END_ALLOW_THREADS
+ if(PyErr_CheckSignals()) {
+ return NULL;
+ }
if (err == SSL_ERROR_WANT_READ) {
timedout = wait_for_timeout(self->Socket, 0);
} else if (err == SSL_ERROR_WANT_WRITE) {
@@ -434,6 +440,10 @@ static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args)
count = SSL_read(self->ssl, PyString_AsString(buf), len);
err = SSL_get_error(self->ssl, count);
Py_END_ALLOW_THREADS
+ if(PyErr_CheckSignals()) {
+ Py_DECREF(buf);
+ return NULL;
+ }
if (err == SSL_ERROR_WANT_READ) {
timedout = wait_for_timeout(self->Socket, 0);
} else if (err == SSL_ERROR_WANT_WRITE) {
@@ -441,6 +451,7 @@ static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args)
}
if (timedout) {
PyErr_SetString(PySSLErrorObject, "The read operation timed out");
+ Py_DECREF(buf);
return NULL;
}
} while (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE);