summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-05-12 14:08:45 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-05-12 14:08:45 (GMT)
commita29b1816936bdfc0f2e80620b334d8756a278ce6 (patch)
treebc6a1db6e9746fa24c7d01118e79f2d09858c241 /Modules
parent96f212b3777c113a326bfbbba93c453fbd5e0693 (diff)
downloadcpython-a29b1816936bdfc0f2e80620b334d8756a278ce6.zip
cpython-a29b1816936bdfc0f2e80620b334d8756a278ce6.tar.gz
cpython-a29b1816936bdfc0f2e80620b334d8756a278ce6.tar.bz2
Merged revisions 81116 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r81116 | antoine.pitrou | 2010-05-12 16:05:24 +0200 (mer., 12 mai 2010) | 9 lines Merged revisions 81115 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r81115 | antoine.pitrou | 2010-05-12 16:02:34 +0200 (mer., 12 mai 2010) | 3 lines Improve _ssl.c formatting ........ ................
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_ssl.c59
1 files changed, 26 insertions, 33 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 7f6f566..9ce73cf 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -182,8 +182,7 @@ PySSL_SetError(PySSLObject *obj, int ret, char *filename, int lineno)
break;
case SSL_ERROR_WANT_X509_LOOKUP:
p = PY_SSL_ERROR_WANT_X509_LOOKUP;
- errstr =
- "The operation did not complete (X509 lookup)";
+ errstr = "The operation did not complete (X509 lookup)";
break;
case SSL_ERROR_WANT_CONNECT:
p = PY_SSL_ERROR_WANT_CONNECT;
@@ -196,15 +195,14 @@ PySSL_SetError(PySSLObject *obj, int ret, char *filename, int lineno)
PySocketSockObject *s
= (PySocketSockObject *) PyWeakref_GetObject(obj->Socket);
if (ret == 0 || (((PyObject *)s) == Py_None)) {
- p = PY_SSL_ERROR_EOF;
- errstr =
- "EOF occurred in violation of protocol";
+ p = PY_SSL_ERROR_EOF;
+ errstr = "EOF occurred in violation of protocol";
} else if (ret == -1) {
- /* underlying BIO reported an I/O error */
- return s->errorhandler();
+ /* underlying BIO reported an I/O error */
+ return s->errorhandler();
} else { /* possible? */
- p = PY_SSL_ERROR_SYSCALL;
- errstr = "Some I/O error occurred";
+ p = PY_SSL_ERROR_SYSCALL;
+ errstr = "Some I/O error occurred";
}
} else {
p = PY_SSL_ERROR_SYSCALL;
@@ -221,8 +219,7 @@ PySSL_SetError(PySSLObject *obj, int ret, char *filename, int lineno)
/* XXX Protected by global interpreter lock */
errstr = ERR_error_string(e, NULL);
else { /* possible? */
- errstr =
- "A failure in the SSL library occurred";
+ errstr = "A failure in the SSL library occurred";
}
break;
}
@@ -317,7 +314,7 @@ newPySSLObject(PySocketSockObject *Sock, char *key_file, char *cert_file,
if (certreq != PY_SSL_CERT_NONE) {
if (cacerts_file == NULL) {
errstr = ERRSTR("No root certificates specified for "
- "verification of other-side certificates.");
+ "verification of other-side certificates.");
goto fail;
} else {
PySSL_BEGIN_ALLOW_THREADS
@@ -480,15 +477,15 @@ static PyObject *PySSL_SSLdo_handshake(PySSLObject *self)
}
if (sockstate == SOCKET_HAS_TIMED_OUT) {
PyErr_SetString(PySSLErrorObject,
- ERRSTR("The handshake operation timed out"));
+ ERRSTR("The handshake operation timed out"));
return NULL;
} else if (sockstate == SOCKET_HAS_BEEN_CLOSED) {
PyErr_SetString(PySSLErrorObject,
- ERRSTR("Underlying socket has been closed."));
+ ERRSTR("Underlying socket has been closed."));
return NULL;
} else if (sockstate == SOCKET_TOO_LARGE_FOR_SELECT) {
PyErr_SetString(PySSLErrorObject,
- ERRSTR("Underlying socket too large for select()."));
+ ERRSTR("Underlying socket too large for select()."));
return NULL;
} else if (sockstate == SOCKET_IS_NONBLOCKING) {
break;
@@ -534,7 +531,7 @@ _create_tuple_for_attribute (ASN1_OBJECT *name, ASN1_STRING *value) {
goto fail;
}
value_obj = PyUnicode_DecodeUTF8((char *) valuebuf,
- buflen, "strict");
+ buflen, "strict");
OPENSSL_free(valuebuf);
if (value_obj == NULL) {
Py_DECREF(name_obj);
@@ -1208,11 +1205,9 @@ static PyObject *PySSL_SSLwrite(PySSLObject *self, PyObject *args)
return NULL;
}
if (err == SSL_ERROR_WANT_READ) {
- sockstate =
- check_socket_and_wait_for_timeout(sock, 0);
+ sockstate = check_socket_and_wait_for_timeout(sock, 0);
} else if (err == SSL_ERROR_WANT_WRITE) {
- sockstate =
- check_socket_and_wait_for_timeout(sock, 1);
+ sockstate = check_socket_and_wait_for_timeout(sock, 1);
} else {
sockstate = SOCKET_OPERATION_OK;
}
@@ -1319,7 +1314,7 @@ static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args)
goto error;
} else if (sockstate == SOCKET_TOO_LARGE_FOR_SELECT) {
PyErr_SetString(PySSLErrorObject,
- "Underlying socket too large for select().");
+ "Underlying socket too large for select().");
goto error;
} else if (sockstate == SOCKET_HAS_BEEN_CLOSED) {
count = 0;
@@ -1335,11 +1330,9 @@ static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args)
if (PyErr_CheckSignals())
goto error;
if (err == SSL_ERROR_WANT_READ) {
- sockstate =
- check_socket_and_wait_for_timeout(sock, 0);
+ sockstate = check_socket_and_wait_for_timeout(sock, 0);
} else if (err == SSL_ERROR_WANT_WRITE) {
- sockstate =
- check_socket_and_wait_for_timeout(sock, 1);
+ sockstate = check_socket_and_wait_for_timeout(sock, 1);
} else if ((err == SSL_ERROR_ZERO_RETURN) &&
(SSL_get_shutdown(self->ssl) ==
SSL_RECEIVED_SHUTDOWN))
@@ -1532,7 +1525,7 @@ PySSL_RAND_add(PyObject *self, PyObject *args)
double entropy;
if (!PyArg_ParseTuple(args, "s#d:RAND_add", &buf, &len, &entropy))
- return NULL;
+ return NULL;
RAND_add(buf, len, entropy);
Py_INCREF(Py_None);
return Py_None;
@@ -1563,15 +1556,15 @@ PySSL_RAND_egd(PyObject *self, PyObject *arg)
int bytes;
if (!PyUnicode_Check(arg))
- return PyErr_Format(PyExc_TypeError,
- "RAND_egd() expected string, found %s",
- Py_TYPE(arg)->tp_name);
+ return PyErr_Format(PyExc_TypeError,
+ "RAND_egd() expected string, found %s",
+ Py_TYPE(arg)->tp_name);
bytes = RAND_egd(_PyUnicode_AsString(arg));
if (bytes == -1) {
- PyErr_SetString(PySSLErrorObject,
- "EGD connection failed or EGD did not return "
- "enough data to seed the PRNG");
- return NULL;
+ PyErr_SetString(PySSLErrorObject,
+ "EGD connection failed or EGD did not return "
+ "enough data to seed the PRNG");
+ return NULL;
}
return PyLong_FromLong(bytes);
}