From: Timo Sirainen Date: Wed, 8 Nov 2017 12:06:00 +0000 (+0200) Subject: doveadm-server: Fix protocol handshake order X-Git-Tag: 2.3.0.rc1~489 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=40b50a2747b9eaea2344f7fbbd5f4a8a0b66bee5;p=thirdparty%2Fdovecot%2Fcore.git 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 --- 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;