mirror of
https://github.com/python/cpython.git
synced 2024-12-20 23:34:40 +08:00
Do simple error checking before doing any SSL calls.
This commit is contained in:
parent
b0b0bd6cc6
commit
22738b9bc1
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user