Mercurial > cpython-lru_cache-weakref
diff Modules/socketmodule.c @ 20367:300b1d8bfa4d legacy-trunk
Do simple error checking before doing any SSL calls.
| author | Jeremy Hylton <jeremy@alum.mit.edu> |
|---|---|
| date | Wed, 10 Oct 2001 22:37:48 +0000 |
| parents | 7bcaca653388 |
| children | 9e72bceb540b |
line wrap: on
line diff
--- a/Modules/socketmodule.c Wed Oct 10 22:33:32 2001 +0000 +++ b/Modules/socketmodule.c Wed Oct 10 22:37:48 2001 +0000 @@ -2512,17 +2512,17 @@ self->ctx = NULL; self->Socket = NULL; + if ((key_file && !cert_file) || (!key_file && cert_file)) { + errstr = "Both the key & certificate files must be specified"; + goto fail; + } + self->ctx = SSL_CTX_new(SSLv23_method()); /* Set up context */ if (self->ctx == NULL) { errstr = "SSL_CTX_new error"; goto fail; } - 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) { if (SSL_CTX_use_PrivateKey_file(self->ctx, key_file, SSL_FILETYPE_PEM) < 1) {
