[Python-bugs-list] [ python-Bugs-461353 ] SSL write doesn't check return codes (original) (raw)
noreply@sourceforge.net noreply@sourceforge.net
Tue, 09 Oct 2001 19:42:39 -0700
- Previous message: [Python-bugs-list] [ python-Bugs-461358 ] SSL constructor/destructor bugs
- Next message: [Python-bugs-list] [ python-Bugs-461350 ] SSL support crashes python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Bugs item #461353, was opened at 2001-09-13 14:01 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=105470&aid=461353&group_id=5470
Category: Python Library Group: Python 2.1.1 Status: Open Resolution: None Priority: 5 Submitted By: Nobody/Anonymous (nobody)
Assigned to: Jeremy Hylton (jhylton) Summary: SSL write doesn't check return codes
Initial Comment: routine SSL_SSLwrite() in socketmodule.c does not check the SSL_write() return codes. As a consequence, SSL write errors do not throw exceptions. Something like the following needs to be added:
len = SSL_write(self->ssl, data, len);
res = SSL_get_error(self->ssl, len);
switch (res) {
case SSL_ERROR_NONE:
assert(len > 0);
break;
case SSL_ERROR_ZERO_RETURN: /* connection closed */ assert(len == 0); #ifdef MS_WINDOWS ec = WSAENOTCONN; #elif defined(PYOS_OS2) ec = -1; #else ec = ENOTCONN; #endif v = Py_BuildValue("(is)", ec, "Connection closed"); if (v != NULL) { PyErr_SetObject (PySocket_Error, v); Py_DECREF(v); } return NULL; break; case SSL_ERROR_SYSCALL: if (ERR_get_error() == 0 && len == 0) { v = Py_BuildValue("(is)", - 1, "Protocol violation: unexpected EOF"); if (v != NULL) { PyErr_SetObject (PySocket_Error, v); Py_DECREF(v); } return NULL; } else { return PySocket_Err(); } break; default: return PySocket_Err(); }
You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=105470&aid=461353&group_id=5470
- Previous message: [Python-bugs-list] [ python-Bugs-461358 ] SSL constructor/destructor bugs
- Next message: [Python-bugs-list] [ python-Bugs-461350 ] SSL support crashes python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]