]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Added mail_storage_service_set_auth_conn()
authorTimo Sirainen <tss@iki.fi>
Mon, 18 Nov 2013 14:15:38 +0000 (16:15 +0200)
committerTimo Sirainen <tss@iki.fi>
Mon, 18 Nov 2013 14:15:38 +0000 (16:15 +0200)
src/lib-storage/mail-storage-service.c
src/lib-storage/mail-storage-service.h

index fc4be24349fffdcae0cec107877609726fc30349..36cb8b167eace7b7dff36061a5a3597d0cd31d6b 100644 (file)
@@ -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
index 358652f9d3052135e64c3a8e49c388e7468997b7..69b1a8c20fbcbe1e4d37a581416454eb00defcbb 100644 (file)
@@ -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,