dovecot-2.2: Moved ssl_client_ca_dir and ssl_crypto_device to ma...
dovecot at dovecot.org
dovecot at dovecot.org
Tue Mar 19 11:43:04 EET 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/cf9f36e8ada0
changeset: 16039:cf9f36e8ada0
user: Timo Sirainen <tss at iki.fi>
date: Tue Mar 19 11:42:51 2013 +0200
description:
Moved ssl_client_ca_dir and ssl_crypto_device to mail_storage_settings.
Probably could also be moved to master_service_settings, but that makes
accessing them a bit more tricky with the current code.
diffstat:
src/doveadm/doveadm-settings.c | 6 -----
src/doveadm/doveadm-settings.h | 3 --
src/doveadm/dsync/doveadm-dsync.c | 31 ++++++++++++++++++---------
src/lib-storage/index/imapc/imapc-settings.c | 17 +--------------
src/lib-storage/index/imapc/imapc-settings.h | 3 --
src/lib-storage/index/imapc/imapc-storage.c | 4 +-
src/lib-storage/index/pop3c/pop3c-settings.c | 15 +------------
src/lib-storage/index/pop3c/pop3c-settings.h | 2 -
src/lib-storage/index/pop3c/pop3c-storage.c | 16 +++++++-------
src/lib-storage/mail-storage-settings.c | 17 ++++++++++++++-
src/lib-storage/mail-storage-settings.h | 3 ++
11 files changed, 51 insertions(+), 66 deletions(-)
diffs (truncated from 362 to 300 lines):
diff -r aa255de644d0 -r cf9f36e8ada0 src/doveadm/doveadm-settings.c
--- a/src/doveadm/doveadm-settings.c Tue Mar 19 11:39:07 2013 +0200
+++ b/src/doveadm/doveadm-settings.c Tue Mar 19 11:42:51 2013 +0200
@@ -65,9 +65,6 @@
DEF(SET_STR, dsync_alt_char),
DEF(SET_STR, dsync_remote_cmd),
- DEF(SET_STR, ssl_client_ca_dir),
- DEF(SET_STR, ssl_crypto_device),
-
{ SET_STRLIST, "plugin", offsetof(struct doveadm_settings, plugin_envs), NULL },
SETTING_DEFINE_LIST_END
@@ -86,9 +83,6 @@
.dsync_alt_char = "_",
.dsync_remote_cmd = "ssh -l%{login} %{host} doveadm dsync-server -u%u",
- .ssl_client_ca_dir = "",
- .ssl_crypto_device = "",
-
.plugin_envs = ARRAY_INIT
};
diff -r aa255de644d0 -r cf9f36e8ada0 src/doveadm/doveadm-settings.h
--- a/src/doveadm/doveadm-settings.h Tue Mar 19 11:39:07 2013 +0200
+++ b/src/doveadm/doveadm-settings.h Tue Mar 19 11:42:51 2013 +0200
@@ -14,9 +14,6 @@
const char *dsync_alt_char;
const char *dsync_remote_cmd;
- const char *ssl_client_ca_dir;
- const char *ssl_crypto_device;
-
ARRAY(const char *) plugin_envs;
};
diff -r aa255de644d0 -r cf9f36e8ada0 src/doveadm/dsync/doveadm-dsync.c
--- a/src/doveadm/dsync/doveadm-dsync.c Tue Mar 19 11:39:07 2013 +0200
+++ b/src/doveadm/dsync/doveadm-dsync.c Tue Mar 19 11:42:51 2013 +0200
@@ -551,7 +551,8 @@
io_loop_stop(current_ioloop);
}
-static int dsync_init_ssl_ctx(struct dsync_cmd_context *ctx)
+static int dsync_init_ssl_ctx(struct dsync_cmd_context *ctx,
+ const struct mail_storage_settings *mail_set)
{
struct ssl_iostream_settings ssl_set;
@@ -559,16 +560,18 @@
return 0;
memset(&ssl_set, 0, sizeof(ssl_set));
- ssl_set.ca_dir = doveadm_settings->ssl_client_ca_dir;
+ ssl_set.ca_dir = mail_set->ssl_client_ca_dir;
ssl_set.verify_remote_cert = TRUE;
- ssl_set.crypto_device = doveadm_settings->ssl_crypto_device;
+ ssl_set.crypto_device = mail_set->ssl_crypto_device;
return ssl_iostream_context_init_client("doveadm", &ssl_set,
&ctx->ssl_ctx);
}
-static int dsync_connect_tcp(struct dsync_cmd_context *ctx, const char *target,
- bool ssl, const char **error_r)
+static int
+dsync_connect_tcp(struct dsync_cmd_context *ctx,
+ const struct mail_storage_settings *mail_set,
+ const char *target, bool ssl, const char **error_r)
{
struct doveadm_server *server;
struct server_connection *conn;
@@ -578,7 +581,7 @@
server = p_new(ctx->ctx.pool, struct doveadm_server, 1);
server->name = p_strdup(ctx->ctx.pool, target);
if (ssl) {
- if (dsync_init_ssl_ctx(ctx) < 0) {
+ if (dsync_init_ssl_ctx(ctx, mail_set) < 0) {
*error_r = "Couldn't initialize SSL context";
return -1;
}
@@ -624,18 +627,22 @@
}
static int
-parse_location(struct dsync_cmd_context *ctx, const char *location,
+parse_location(struct dsync_cmd_context *ctx,
+ const struct mail_storage_settings *mail_set,
+ const char *location,
const char *const **remote_cmd_args_r, const char **error_r)
{
if (strncmp(location, "tcp:", 4) == 0) {
/* TCP connection to remote dsync */
ctx->remote_name = location+4;
- return dsync_connect_tcp(ctx, ctx->remote_name, FALSE, error_r);
+ return dsync_connect_tcp(ctx, mail_set, ctx->remote_name,
+ FALSE, error_r);
}
if (strncmp(location, "tcps:", 5) == 0) {
/* TCP+SSL connection to remote dsync */
ctx->remote_name = location+5;
- return dsync_connect_tcp(ctx, ctx->remote_name, TRUE, error_r);
+ return dsync_connect_tcp(ctx, mail_set, ctx->remote_name,
+ TRUE, error_r);
}
if (strncmp(location, "remote:", 7) == 0) {
@@ -663,9 +670,11 @@
struct dsync_cmd_context *ctx = (struct dsync_cmd_context *)_ctx;
const char *const *remote_cmd_args = NULL;
const struct mail_user_settings *user_set;
+ const struct mail_storage_settings *mail_set;
const char *username = "";
user_set = mail_storage_service_user_get_set(service_user)[0];
+ mail_set = mail_storage_service_user_get_mail_set(service_user);
ctx->fd_in = -1;
ctx->fd_out = -1;
@@ -697,8 +706,8 @@
}
if (remote_cmd_args == NULL && ctx->local_location != NULL) {
- if (parse_location(ctx, ctx->local_location, &remote_cmd_args,
- error_r) < 0)
+ if (parse_location(ctx, mail_set, ctx->local_location,
+ &remote_cmd_args, error_r) < 0)
return -1;
}
diff -r aa255de644d0 -r cf9f36e8ada0 src/lib-storage/index/imapc/imapc-settings.c
--- a/src/lib-storage/index/imapc/imapc-settings.c Tue Mar 19 11:39:07 2013 +0200
+++ b/src/lib-storage/index/imapc/imapc-settings.c Tue Mar 19 11:42:51 2013 +0200
@@ -29,9 +29,6 @@
DEF(SET_STR, imapc_list_prefix),
DEF(SET_TIME, imapc_max_idle_time),
- DEF(SET_STR, ssl_client_ca_dir),
- DEF(SET_STR, ssl_crypto_device),
-
SETTING_DEFINE_LIST_END
};
@@ -49,10 +46,7 @@
.imapc_features = "",
.imapc_rawlog_dir = "",
.imapc_list_prefix = "",
- .imapc_max_idle_time = 60*29,
-
- .ssl_client_ca_dir = "",
- .ssl_crypto_device = ""
+ .imapc_max_idle_time = 60*29
};
static const struct setting_parser_info imapc_setting_parser_info = {
@@ -122,15 +116,6 @@
*error_r = "invalid imapc_port";
return FALSE;
}
-#ifndef CONFIG_BINARY
- if (*set->ssl_client_ca_dir != '\0' &&
- access(set->ssl_client_ca_dir, X_OK) < 0) {
- *error_r = t_strdup_printf(
- "ssl_client_ca_dir: access(%s) failed: %m",
- set->ssl_client_ca_dir);
- return FALSE;
- }
-#endif
if (set->imapc_max_idle_time == 0) {
*error_r = "imapc_max_idle_time must not be 0";
return FALSE;
diff -r aa255de644d0 -r cf9f36e8ada0 src/lib-storage/index/imapc/imapc-settings.h
--- a/src/lib-storage/index/imapc/imapc-settings.h Tue Mar 19 11:39:07 2013 +0200
+++ b/src/lib-storage/index/imapc/imapc-settings.h Tue Mar 19 11:42:51 2013 +0200
@@ -24,9 +24,6 @@
const char *imapc_list_prefix;
unsigned int imapc_max_idle_time;
- const char *ssl_client_ca_dir;
- const char *ssl_crypto_device;
-
enum imapc_features parsed_features;
};
diff -r aa255de644d0 -r cf9f36e8ada0 src/lib-storage/index/imapc/imapc-storage.c
--- a/src/lib-storage/index/imapc/imapc-storage.c Tue Mar 19 11:39:07 2013 +0200
+++ b/src/lib-storage/index/imapc/imapc-storage.c Tue Mar 19 11:42:51 2013 +0200
@@ -243,7 +243,7 @@
mail_user_set_get_temp_prefix(str, _storage->user->set);
set.temp_path_prefix = str_c(str);
- set.ssl_ca_dir = storage->set->ssl_client_ca_dir;
+ set.ssl_ca_dir = _storage->set->ssl_client_ca_dir;
set.ssl_verify = storage->set->imapc_ssl_verify;
if (strcmp(storage->set->imapc_ssl, "imaps") == 0)
set.ssl_mode = IMAPC_CLIENT_SSL_MODE_IMMEDIATE;
@@ -251,7 +251,7 @@
set.ssl_mode = IMAPC_CLIENT_SSL_MODE_STARTTLS;
else
set.ssl_mode = IMAPC_CLIENT_SSL_MODE_NONE;
- set.ssl_crypto_device = storage->set->ssl_crypto_device;
+ set.ssl_crypto_device = _storage->set->ssl_crypto_device;
storage->list = (struct imapc_mailbox_list *)ns->list;
storage->list->storage = storage;
diff -r aa255de644d0 -r cf9f36e8ada0 src/lib-storage/index/pop3c/pop3c-settings.c
--- a/src/lib-storage/index/pop3c/pop3c-settings.c Tue Mar 19 11:39:07 2013 +0200
+++ b/src/lib-storage/index/pop3c/pop3c-settings.c Tue Mar 19 11:42:51 2013 +0200
@@ -25,8 +25,6 @@
DEF(SET_BOOL, pop3c_ssl_verify),
DEF(SET_STR, pop3c_rawlog_dir),
- DEF(SET_STR, ssl_client_ca_dir),
- DEF(SET_STR, ssl_crypto_device),
SETTING_DEFINE_LIST_END
};
@@ -42,9 +40,7 @@
.pop3c_ssl = "no:pop3s:starttls",
.pop3c_ssl_verify = TRUE,
- .pop3c_rawlog_dir = "",
- .ssl_client_ca_dir = "",
- .ssl_crypto_device = ""
+ .pop3c_rawlog_dir = ""
};
static const struct setting_parser_info pop3c_setting_parser_info = {
@@ -76,14 +72,5 @@
*error_r = "invalid pop3c_port";
return FALSE;
}
-#ifndef CONFIG_BINARY
- if (*set->ssl_client_ca_dir != '\0' &&
- access(set->ssl_client_ca_dir, X_OK) < 0) {
- *error_r = t_strdup_printf(
- "ssl_client_ca_dir: access(%s) failed: %m",
- set->ssl_client_ca_dir);
- return FALSE;
- }
-#endif
return TRUE;
}
diff -r aa255de644d0 -r cf9f36e8ada0 src/lib-storage/index/pop3c/pop3c-settings.h
--- a/src/lib-storage/index/pop3c/pop3c-settings.h Tue Mar 19 11:39:07 2013 +0200
+++ b/src/lib-storage/index/pop3c/pop3c-settings.h Tue Mar 19 11:42:51 2013 +0200
@@ -13,8 +13,6 @@
bool pop3c_ssl_verify;
const char *pop3c_rawlog_dir;
- const char *ssl_client_ca_dir;
- const char *ssl_crypto_device;
};
const struct setting_parser_info *pop3c_get_setting_parser_info(void);
diff -r aa255de644d0 -r cf9f36e8ada0 src/lib-storage/index/pop3c/pop3c-storage.c
--- a/src/lib-storage/index/pop3c/pop3c-storage.c Tue Mar 19 11:39:07 2013 +0200
+++ b/src/lib-storage/index/pop3c/pop3c-storage.c Tue Mar 19 11:42:51 2013 +0200
@@ -50,7 +50,7 @@
}
static struct pop3c_client *
-pop3c_client_create_from_set(struct mail_user *user,
+pop3c_client_create_from_set(struct mail_storage *storage,
const struct pop3c_settings *set)
{
struct pop3c_client_settings client_set;
@@ -63,17 +63,17 @@
client_set.master_user = set->pop3c_master_user;
client_set.password = set->pop3c_password;
client_set.dns_client_socket_path =
- t_strconcat(user->set->base_dir, "/",
+ t_strconcat(storage->user->set->base_dir, "/",
DNS_CLIENT_SOCKET_NAME, NULL);
str = t_str_new(128);
- mail_user_set_get_temp_prefix(str, user->set);
+ mail_user_set_get_temp_prefix(str, storage->user->set);
client_set.temp_path_prefix = str_c(str);
- client_set.debug = user->mail_debug;
+ client_set.debug = storage->user->mail_debug;
client_set.rawlog_dir =
- mail_user_home_expand(user, set->pop3c_rawlog_dir);
+ mail_user_home_expand(storage->user, set->pop3c_rawlog_dir);
- client_set.ssl_ca_dir = set->ssl_client_ca_dir;
+ client_set.ssl_ca_dir = storage->set->ssl_client_ca_dir;
client_set.ssl_verify = set->pop3c_ssl_verify;
if (strcmp(set->pop3c_ssl, "pop3s") == 0)
client_set.ssl_mode = POP3C_CLIENT_SSL_MODE_IMMEDIATE;
@@ -81,7 +81,7 @@
client_set.ssl_mode = POP3C_CLIENT_SSL_MODE_STARTTLS;
else
client_set.ssl_mode = POP3C_CLIENT_SSL_MODE_NONE;
- client_set.ssl_crypto_device = set->ssl_crypto_device;
+ client_set.ssl_crypto_device = storage->set->ssl_crypto_device;
return pop3c_client_init(&client_set);
}
@@ -171,7 +171,7 @@
More information about the dovecot-cvs
mailing list