]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm server: Previous non-authentication fix broken authentication.
authorTimo Sirainen <tss@iki.fi>
Thu, 22 Sep 2011 21:46:19 +0000 (00:46 +0300)
committerTimo Sirainen <tss@iki.fi>
Thu, 22 Sep 2011 21:46:19 +0000 (00:46 +0300)
src/doveadm/server-connection.c

index 9060bf460fb2a99e1684025efb393ba5d983f5d5..bb75247ae8c50d9c04808caa5f76697f9d760dc0 100644 (file)
@@ -189,7 +189,6 @@ server_connection_authenticate(struct server_connection *conn)
        str_append_c(cmd, '\n');
 
        o_stream_send(conn->output, cmd->data, cmd->used);
-       server_connection_authenticated(conn);
        return 0;
 }
 
@@ -214,6 +213,7 @@ static void server_connection_input(struct server_connection *conn)
                                server_connection_destroy(&conn);
                                return;
                        }
+                       return;
                } else {
                        i_error("doveadm server sent invalid handshake: %s",
                                line);
@@ -228,6 +228,18 @@ static void server_connection_input(struct server_connection *conn)
                return;
        }
 
+       if (!conn->authenticated) {
+               if ((line = i_stream_next_line(conn->input)) == NULL)
+                       return;
+               if (strcmp(line, "+") == 0)
+                       server_connection_authenticated(conn);
+               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;