]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm-server: Fix protocol handshake order
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 8 Nov 2017 12:06:00 +0000 (14:06 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Thu, 18 Jan 2018 07:11:04 +0000 (09:11 +0200)
With version 1.1 protocol, server sent the authentication "+" or "-" line
before the VERSION. doveadm client accepts the VERSION reply either before
or after, so this change doesn't break it. It makes the protocol cleaner
though.

Based on patch by Manuel Mausz

src/doveadm/client-connection.c

index 5c1d89831687fe0a05285e4e0700f308885e7668..7125436ba889582afac8a0a45d37d694bfe488ac 100644 (file)
@@ -28,6 +28,8 @@
 #define MAX_INBUF_SIZE (1024*1024)
 
 static void client_connection_input(struct client_connection *conn);
+static void
+client_connection_send_auth_handshake(struct client_connection *conn);
 
 static failure_callback_t *orig_error_callback, *orig_fatal_callback;
 static failure_callback_t *orig_info_callback, *orig_debug_callback = NULL;
@@ -505,6 +507,7 @@ static void client_connection_input(struct client_connection *conn)
                                           DOVEADM_CLIENT_PROTOCOL_VERSION_LINE"\n");
                        conn->use_multiplex = TRUE;
                }
+               client_connection_send_auth_handshake(conn);
                conn->handshaked = TRUE;
        }
        if (!conn->authenticated) {
@@ -672,7 +675,6 @@ client_connection_create(int fd, int listen_fd, bool ssl)
        }
        conn->preauthenticated =
                client_connection_is_preauthenticated(listen_fd);
-       client_connection_send_auth_handshake(conn);
 
        client_connection_set_proctitle(conn, "");