Mercurial > dovecot > core-2.2
changeset 15923:8e54e73bdade
doveadm: If doveadm-server sends broken input, disconnect.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 24 Feb 2013 19:38:27 +0200 |
parents | b2bc9dd5f8d9 |
children | 08edb5716823 |
files | src/doveadm/server-connection.c |
diffstat | 1 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/doveadm/server-connection.c Sun Feb 24 19:37:45 2013 +0200 +++ b/src/doveadm/server-connection.c Sun Feb 24 19:38:27 2013 +0200 @@ -139,8 +139,11 @@ str = t_str_new(128); for (i = start = 0; i < size; i++) { if (data[i] == '\n') { - if (i != start) - i_error("doveadm server sent broken input"); + if (i != start) { + i_error("doveadm server sent broken print input"); + server_connection_destroy(&conn); + return; + } conn->state = SERVER_REPLY_STATE_RET; i_stream_skip(conn->input, i + 1); @@ -267,8 +270,12 @@ SERVER_CMD_REPLY_UNKNOWN_USER : SERVER_CMD_REPLY_FAIL; server_connection_callback(conn, reply); - } else - i_error("doveadm server sent broken input"); + } else { + i_error("doveadm server sent broken input " + "(expected cmd reply): %s", line); + server_connection_destroy(&conn); + break; + } if (conn->callback == NULL) { /* we're finished, close the connection */ server_connection_destroy(&conn);