Mercurial > dovecot > core-2.2
changeset 13528:1d8009c7b67e
doveadm: Fixed sending commands to doveadm server when it didn't require authentication.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 19 Sep 2011 17:10:11 +0300 |
parents | b97c53c54f72 |
children | cf77e448295c |
files | src/doveadm/server-connection.c |
diffstat | 1 files changed, 11 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/src/doveadm/server-connection.c Wed Sep 21 12:34:02 2011 +0300 +++ b/src/doveadm/server-connection.c Mon Sep 19 17:10:11 2011 +0300 @@ -158,6 +158,15 @@ i_stream_skip(conn->input, size); } +static void server_connection_authenticated(struct server_connection *conn) +{ + conn->authenticated = TRUE; + if (conn->delayed_cmd != NULL) { + o_stream_send_str(conn->output, conn->delayed_cmd); + conn->delayed_cmd = NULL; + } +} + static int server_connection_authenticate(struct server_connection *conn) { @@ -180,10 +189,7 @@ str_append_c(cmd, '\n'); o_stream_send(conn->output, cmd->data, cmd->used); - if (conn->delayed_cmd != NULL) { - o_stream_send_str(conn->output, conn->delayed_cmd); - conn->delayed_cmd = NULL; - } + server_connection_authenticated(conn); return 0; } @@ -202,7 +208,7 @@ conn->handshaked = TRUE; if (strcmp(line, "+") == 0) - conn->authenticated = TRUE; + server_connection_authenticated(conn); else if (strcmp(line, "-") == 0) { if (server_connection_authenticate(conn) < 0) { server_connection_destroy(&conn); @@ -222,18 +228,6 @@ return; } - if (!conn->authenticated) { - if ((line = i_stream_next_line(conn->input)) == NULL) - return; - if (strcmp(line, "+") == 0) - conn->authenticated = TRUE; - else { - i_error("doveadm authentication failed (%s)", line+1); - server_connection_destroy(&conn); - return; - } - } - data = i_stream_get_data(conn->input, &size); if (size == 0) return;