diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-10-10 22:37:48 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-10-10 22:37:48 (GMT) |
commit | 22738b9bc128694493f1eb847d9781e202ad6963 (patch) | |
tree | da21ecd774fe97e7763491c2cb91cc1d0debf395 | |
parent | b0b0bd6cc6c69e909a1f8f384fc63488249a82dc (diff) | |
download | cpython-22738b9bc128694493f1eb847d9781e202ad6963.zip cpython-22738b9bc128694493f1eb847d9781e202ad6963.tar.gz cpython-22738b9bc128694493f1eb847d9781e202ad6963.tar.bz2 |
Do simple error checking before doing any SSL calls.
-rw-r--r-- | Modules/socketmodule.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 276afe2..7d1bb11 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -2512,14 +2512,14 @@ newSSLObject(PySocketSockObject *Sock, char *key_file, char *cert_file) self->ctx = NULL; self->Socket = NULL; - self->ctx = SSL_CTX_new(SSLv23_method()); /* Set up context */ - if (self->ctx == NULL) { - errstr = "SSL_CTX_new error"; + if ((key_file && !cert_file) || (!key_file && cert_file)) { + errstr = "Both the key & certificate files must be specified"; goto fail; } - if ((key_file && !cert_file) || (!key_file && cert_file)) { - errstr = "Both the key & certificate files must be specified"; + self->ctx = SSL_CTX_new(SSLv23_method()); /* Set up context */ + if (self->ctx == NULL) { + errstr = "SSL_CTX_new error"; goto fail; } |