diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libssl/ssl_lib.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c index 73bc05e967..c184f75abe 100644 --- a/src/lib/libssl/ssl_lib.c +++ b/src/lib/libssl/ssl_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_lib.c,v 1.229 2020/09/16 07:25:15 schwarze Exp $ */ | 1 | /* $OpenBSD: ssl_lib.c,v 1.230 2020/09/18 16:18:56 schwarze Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -2726,17 +2726,22 @@ SSL_get_SSL_CTX(const SSL *ssl) | |||
| 2726 | SSL_CTX * | 2726 | SSL_CTX * |
| 2727 | SSL_set_SSL_CTX(SSL *ssl, SSL_CTX* ctx) | 2727 | SSL_set_SSL_CTX(SSL *ssl, SSL_CTX* ctx) |
| 2728 | { | 2728 | { |
| 2729 | if (ssl->ctx == ctx) | 2729 | CERT *new_cert; |
| 2730 | return (ssl->ctx); | 2730 | |
| 2731 | if (ctx == NULL) | 2731 | if (ctx == NULL) |
| 2732 | ctx = ssl->initial_ctx; | 2732 | ctx = ssl->initial_ctx; |
| 2733 | if (ssl->ctx == ctx) | ||
| 2734 | return (ssl->ctx); | ||
| 2733 | 2735 | ||
| 2736 | if ((new_cert = ssl_cert_dup(ctx->internal->cert)) == NULL) | ||
| 2737 | return NULL; | ||
| 2734 | ssl_cert_free(ssl->cert); | 2738 | ssl_cert_free(ssl->cert); |
| 2735 | ssl->cert = ssl_cert_dup(ctx->internal->cert); | 2739 | ssl->cert = new_cert; |
| 2736 | 2740 | ||
| 2737 | CRYPTO_add(&ctx->references, 1, CRYPTO_LOCK_SSL_CTX); | 2741 | SSL_CTX_up_ref(ctx); |
| 2738 | SSL_CTX_free(ssl->ctx); /* decrement reference count */ | 2742 | SSL_CTX_free(ssl->ctx); /* decrement reference count */ |
| 2739 | ssl->ctx = ctx; | 2743 | ssl->ctx = ctx; |
| 2744 | |||
| 2740 | return (ssl->ctx); | 2745 | return (ssl->ctx); |
| 2741 | } | 2746 | } |
| 2742 | 2747 | ||
