From: Jeremy Hylton Date: Wed, 10 Oct 2001 22:37:48 +0000 (+0000) Subject: Do simple error checking before doing any SSL calls. X-Git-Tag: v2.2.1c1~1347 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=22738b9bc128694493f1eb847d9781e202ad6963;p=python Do simple error checking before doing any SSL calls. --- diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 276afe205c..7d1bb11883 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; }