]> granicus.if.org Git - python/commitdiff
Do simple error checking before doing any SSL calls.
authorJeremy Hylton <jeremy@alum.mit.edu>
Wed, 10 Oct 2001 22:37:48 +0000 (22:37 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Wed, 10 Oct 2001 22:37:48 +0000 (22:37 +0000)
Modules/socketmodule.c

index 276afe205cbbbf8d0779632e015b881834ded413..7d1bb118837f698b2912f0ce6d959eb3456ba558 100644 (file)
@@ -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;
        }