Kaydet (Commit) 22738b9b authored tarafından Jeremy Hylton's avatar Jeremy Hylton

Do simple error checking before doing any SSL calls.

üst b0b0bd6c
...@@ -2512,14 +2512,14 @@ newSSLObject(PySocketSockObject *Sock, char *key_file, char *cert_file) ...@@ -2512,14 +2512,14 @@ newSSLObject(PySocketSockObject *Sock, char *key_file, char *cert_file)
self->ctx = NULL; self->ctx = NULL;
self->Socket = NULL; self->Socket = NULL;
self->ctx = SSL_CTX_new(SSLv23_method()); /* Set up context */ if ((key_file && !cert_file) || (!key_file && cert_file)) {
if (self->ctx == NULL) { errstr = "Both the key & certificate files must be specified";
errstr = "SSL_CTX_new error";
goto fail; goto fail;
} }
if ((key_file && !cert_file) || (!key_file && cert_file)) { self->ctx = SSL_CTX_new(SSLv23_method()); /* Set up context */
errstr = "Both the key & certificate files must be specified"; if (self->ctx == NULL) {
errstr = "SSL_CTX_new error";
goto fail; goto fail;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment