From 40b50a2747b9eaea2344f7fbbd5f4a8a0b66bee5 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Wed, 8 Nov 2017 14:06:00 +0200 Subject: [PATCH] doveadm-server: Fix protocol handshake order 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-tcp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/doveadm/client-connection-tcp.c b/src/doveadm/client-connection-tcp.c index eb34085937..f1ed1dcffe 100644 --- a/src/doveadm/client-connection-tcp.c +++ b/src/doveadm/client-connection-tcp.c @@ -43,6 +43,8 @@ struct client_connection_tcp { static void client_connection_tcp_input(struct client_connection_tcp *conn); static void +client_connection_tcp_send_auth_handshake(struct client_connection_tcp *conn); +static void client_connection_tcp_destroy(struct client_connection_tcp **_conn); static failure_callback_t *orig_error_callback, *orig_fatal_callback; @@ -502,6 +504,7 @@ client_connection_tcp_input(struct client_connection_tcp *conn) DOVEADM_CLIENT_PROTOCOL_VERSION_LINE"\n"); conn->use_multiplex = TRUE; } + client_connection_tcp_send_auth_handshake(conn); conn->handshaked = TRUE; } if (!conn->authenticated) { @@ -650,7 +653,6 @@ client_connection_tcp_create(int fd, int listen_fd, bool ssl) } conn->preauthenticated = client_connection_is_preauthenticated(listen_fd); - client_connection_tcp_send_auth_handshake(conn); client_connection_set_proctitle(&conn->conn, ""); return &conn->conn; -- 2.47.3