]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-ssl-iostream: Change ssl_iostream_context.set to not be a pointer
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 30 Oct 2017 14:55:43 +0000 (16:55 +0200)
committerTimo Sirainen <tss@dovecot.fi>
Mon, 6 Nov 2017 23:09:00 +0000 (01:09 +0200)
It's just unnecessary memory usage.

src/lib-ssl-iostream/iostream-openssl-context.c
src/lib-ssl-iostream/iostream-openssl.c
src/lib-ssl-iostream/iostream-openssl.h

index 17a995ab44b90984184467c041f134e02236ba49..4fe8b420f9e82af1395e0b762bc2ed835085f509 100644 (file)
@@ -279,7 +279,7 @@ ssl_iostream_ctx_verify_remote_cert(struct ssl_iostream_context *ctx,
                                    STACK_OF(X509_NAME) *ca_names)
 {
 #if OPENSSL_VERSION_NUMBER >= 0x00907000L
-       if (!ctx->set->skip_crl_check) {
+       if (!ctx->set.skip_crl_check) {
                X509_STORE *store;
 
                store = SSL_CTX_get_cert_store(ctx->ssl_ctx);
@@ -358,7 +358,7 @@ ssl_iostream_context_set(struct ssl_iostream_context *ctx,
                         const struct ssl_iostream_settings *set,
                         const char **error_r)
 {
-       ctx->set = ssl_iostream_settings_dup(ctx->pool, set);
+       ssl_iostream_settings_init_from(ctx->pool, &ctx->set, set);
        if (set->cipher_list != NULL &&
            SSL_CTX_set_cipher_list(ctx->ssl_ctx, set->cipher_list) == 0) {
                *error_r = t_strdup_printf("Can't set cipher list to '%s': %s",
@@ -377,9 +377,9 @@ ssl_iostream_context_set(struct ssl_iostream_context *ctx,
                SSL_CTX_set_options(ctx->ssl_ctx,
                                    SSL_OP_CIPHER_SERVER_PREFERENCE);
        }
-       if (ctx->set->protocols != NULL) {
+       if (ctx->set.protocols != NULL) {
                SSL_CTX_set_options(ctx->ssl_ctx,
-                           openssl_get_protocol_options(ctx->set->protocols));
+                           openssl_get_protocol_options(ctx->set.protocols));
        }
 
        if (set->cert.cert != NULL &&
index cb2e9c5644e8760e61dbcb53590e90fd2c873b03..73f22d16ee9868056bafa6e65a488dbf88cac97d 100644 (file)
@@ -146,7 +146,7 @@ openssl_iostream_set(struct ssl_iostream *ssl_io,
                     const struct ssl_iostream_settings *set,
                     const char **error_r)
 {
-       const struct ssl_iostream_settings *ctx_set = ssl_io->ctx->set;
+       const struct ssl_iostream_settings *ctx_set = &ssl_io->ctx->set;
        int verify_flags;
 
        if (set->verbose)
index 34b59ec3e40c441f77d66cc483cf4962e5edc597..5849b48c50540f19f3edb80c21b36d224973f68a 100644 (file)
@@ -19,7 +19,7 @@ struct ssl_iostream_context {
        SSL_CTX *ssl_ctx;
 
        pool_t pool;
-       const struct ssl_iostream_settings *set;
+       struct ssl_iostream_settings set;
 
        DH *dh_512, *dh_default;
        int username_nid;