]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm: Outgoing dsync TCP connections leaked socket
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 17 Jan 2017 14:23:50 +0000 (16:23 +0200)
committerGitLab <gitlab@git.dovecot.net>
Tue, 17 Jan 2017 17:32:13 +0000 (19:32 +0200)
If doveadm-server was running with service_count>1, each dsync run leaked a
socket.

src/doveadm/doveadm-dsync.c

index 021ec62e0eb388ddcee8129bef77c640c5807418..00aeeeb62dceab7e062234a4df4cfc69316a8753 100644 (file)
@@ -498,6 +498,9 @@ cmd_dsync_icb_stream_init(struct dsync_cmd_context *ctx,
                ctx->input = i_stream_create_fd(ctx->fd_in, (size_t)-1);
                ctx->output = o_stream_create_fd(ctx->fd_out, (size_t)-1);
        } else {
+               i_assert(ctx->fd_in == -1 && ctx->fd_out == -1);
+               ctx->fd_in = i_stream_get_fd(ctx->input);
+               ctx->fd_out = o_stream_get_fd(ctx->output);
                ctx->input_orig_bufsize = i_stream_get_max_buffer_size(ctx->input);
                ctx->output_orig_bufsize = o_stream_get_max_buffer_size(ctx->output);
                i_stream_set_max_buffer_size(ctx->input, (size_t)-1);