]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-ssl-iostream: move ssl_iostream_settings_dup to iostream-ssl.c
authorMartti Rannanjärvi <martti.rannanjarvi@dovecot.fi>
Tue, 26 Apr 2016 07:32:16 +0000 (10:32 +0300)
committerGitLab <gitlab@git.dovecot.net>
Sat, 7 May 2016 16:13:04 +0000 (19:13 +0300)
src/lib-ssl-iostream/iostream-openssl-context.c
src/lib-ssl-iostream/iostream-ssl.c
src/lib-ssl-iostream/iostream-ssl.h

index b976a0c03cdfa08070028729dfe16f2987dbf535..f0ea1e403c2a9345a713da94e7c7c559425b0cb0 100644 (file)
@@ -225,23 +225,6 @@ ssl_iostream_ctx_verify_remote_cert(struct ssl_iostream_context *ctx,
        SSL_CTX_set_client_CA_list(ctx->ssl_ctx, ca_names);
 }
 
-static struct ssl_iostream_settings *
-ssl_iostream_settings_dup(pool_t pool,
-                         const struct ssl_iostream_settings *old_set)
-{
-       struct ssl_iostream_settings *new_set;
-
-       new_set = p_new(pool, struct ssl_iostream_settings, 1);
-       new_set->protocols = p_strdup(pool, old_set->protocols);
-       new_set->cipher_list = p_strdup(pool, old_set->cipher_list);
-       new_set->cert = p_strdup(pool, old_set->cert);
-       new_set->key = p_strdup(pool, old_set->key);
-       new_set->key_password = p_strdup(pool, old_set->key_password);
-
-       new_set->verbose = old_set->verbose;
-       return new_set;
-}
-
 #ifdef HAVE_SSL_GET_SERVERNAME
 static int ssl_servername_callback(SSL *ssl, int *al ATTR_UNUSED,
                                   void *context ATTR_UNUSED)
index a0659ab2c4f972c66dea8516399b45f25f5c7284..7ff03df30089bc993775762347fddae61cf2bdba 100644 (file)
@@ -216,3 +216,26 @@ const char *ssl_iostream_get_last_error(struct ssl_iostream *ssl_io)
 {
        return ssl_vfuncs->get_last_error(ssl_io);
 }
+
+struct ssl_iostream_settings *
+ssl_iostream_settings_dup(pool_t pool,
+                         const struct ssl_iostream_settings *old_set)
+{
+       struct ssl_iostream_settings *new_set;
+
+       new_set = p_new(pool, struct ssl_iostream_settings, 1);
+       memcpy(new_set, old_set, sizeof(*new_set));
+
+       new_set->protocols = p_strdup(pool, old_set->protocols);
+       new_set->cipher_list = p_strdup(pool, old_set->cipher_list);
+       new_set->ca = p_strdup(pool, old_set->ca);
+       new_set->ca_file = p_strdup(pool, old_set->ca_file);
+       new_set->ca_dir = p_strdup(pool, old_set->ca_dir);
+       new_set->cert = p_strdup(pool, old_set->cert);
+       new_set->key = p_strdup(pool, old_set->key);
+       new_set->key_password = p_strdup(pool, old_set->key_password);
+       new_set->cert_username_field = p_strdup(pool, old_set->cert_username_field);
+       new_set->crypto_device = p_strdup(pool, old_set->crypto_device);
+
+       return new_set;
+}
index 3969f74df5dae8e2043ab9d69e683f93bd79b57d..930d099e7199cfddd5f2dbfd6a189cfaa34aba51 100644 (file)
@@ -77,5 +77,7 @@ int ssl_iostream_context_init_server(const struct ssl_iostream_settings *set,
                                     struct ssl_iostream_context **ctx_r,
                                     const char **error_r);
 void ssl_iostream_context_deinit(struct ssl_iostream_context **ctx);
+struct ssl_iostream_settings *ssl_iostream_settings_dup(pool_t pool,
+                       const struct ssl_iostream_settings *old_set);
 
 #endif