Mercurial > dovecot > core-2.2
changeset 22835:a21208a433c1
doveadm-server: Fix potential hangs with SSL connections
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Fri, 22 Dec 2017 11:25:06 +0200 |
parents | d2dc1b6e46ab |
children | 78673e865a93 |
files | src/doveadm/client-connection.c |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/doveadm/client-connection.c Tue Feb 06 09:48:11 2018 +0200 +++ b/src/doveadm/client-connection.c Fri Dec 22 11:25:06 2017 +0200 @@ -404,9 +404,13 @@ client_connection_set_proctitle(conn, cmd_name); o_stream_cork(conn->output); + /* Disable IO while running a command. This is required for commands + that do IO themselves (e.g. dsync-server). */ + io_remove(&conn->io); if (doveadm_cmd_handle(conn, cmd_name, argc-2, (const char**)(args+2), &cctx) < 0) o_stream_nsend(conn->output, "\n-\n", 3); o_stream_uncork(conn->output); + conn->io = io_add_istream(conn->input, client_connection_input, conn); client_connection_set_proctitle(conn, ""); /* flush the output and possibly run next command */ @@ -660,7 +664,6 @@ conn->name = conn->remote_ip.family == 0 ? "<local>" : p_strdup(pool, net_ip2addr(&conn->remote_ip)); - conn->io = io_add(fd, IO_READ, client_connection_input, conn); conn->input = i_stream_create_fd(fd, MAX_INBUF_SIZE, FALSE); conn->output = o_stream_create_fd(fd, (size_t)-1, FALSE); i_stream_set_name(conn->input, conn->name); @@ -673,6 +676,8 @@ return NULL; } } + /* add IO after SSL istream is created */ + conn->io = io_add_istream(conn->input, client_connection_input, conn); conn->preauthenticated = client_connection_is_preauthenticated(listen_fd);