From: Timo Sirainen Date: Mon, 18 Nov 2013 14:15:38 +0000 (+0200) Subject: lib-storage: Added mail_storage_service_set_auth_conn() X-Git-Tag: 2.2.8~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=50b9773bebe5c66485728e21e4da6e99db388c92;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Added mail_storage_service_set_auth_conn() --- diff --git a/src/lib-storage/mail-storage-service.c b/src/lib-storage/mail-storage-service.c index fc4be24349..36cb8b167e 100644 --- a/src/lib-storage/mail-storage-service.c +++ b/src/lib-storage/mail-storage-service.c @@ -913,6 +913,16 @@ int mail_storage_service_read_settings(struct mail_storage_service_ctx *ctx, return -1; } +void mail_storage_service_set_auth_conn(struct mail_storage_service_ctx *ctx, + struct auth_master_connection *conn) +{ + i_assert(ctx->conn == NULL); + i_assert(mail_user_auth_master_conn == NULL); + + ctx->conn = conn; + mail_user_auth_master_conn = conn; +} + static void mail_storage_service_first_init(struct mail_storage_service_ctx *ctx, const struct setting_parser_info *user_info, @@ -920,17 +930,13 @@ mail_storage_service_first_init(struct mail_storage_service_ctx *ctx, { enum auth_master_flags flags = 0; - i_assert(ctx->conn == NULL); - ctx->debug = mail_user_set_get_mail_debug(user_info, user_set); if (ctx->debug) flags |= AUTH_MASTER_FLAG_DEBUG; if ((ctx->flags & MAIL_STORAGE_SERVICE_FLAG_NO_IDLE_TIMEOUT) != 0) flags |= AUTH_MASTER_FLAG_NO_IDLE_TIMEOUT; - ctx->conn = auth_master_init(user_set->auth_socket_path, flags); - - i_assert(mail_user_auth_master_conn == NULL); - mail_user_auth_master_conn = ctx->conn; + mail_storage_service_set_auth_conn(ctx, + auth_master_init(user_set->auth_socket_path, flags)); } static void diff --git a/src/lib-storage/mail-storage-service.h b/src/lib-storage/mail-storage-service.h index 358652f9d3..69b1a8c20f 100644 --- a/src/lib-storage/mail-storage-service.h +++ b/src/lib-storage/mail-storage-service.h @@ -62,6 +62,9 @@ mail_storage_service_init(struct master_service *service, enum mail_storage_service_flags flags) ATTR_NULL(2); struct auth_master_connection * mail_storage_service_get_auth_conn(struct mail_storage_service_ctx *ctx); +/* Set auth connection (instead of creating a new one automatically). */ +void mail_storage_service_set_auth_conn(struct mail_storage_service_ctx *ctx, + struct auth_master_connection *conn); int mail_storage_service_read_settings(struct mail_storage_service_ctx *ctx, const struct mail_storage_service_input *input, pool_t pool,