From: Stephan Bosch Date: Tue, 21 Feb 2023 01:42:50 +0000 (+0100) Subject: imap-urlauth: imap-urlauth-worker - Fully perform client-to-server VERSION handshake... X-Git-Tag: 2.4.0~2861 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8926fc5bf8776824342566a9d25f0e1afc4c9dbd;p=thirdparty%2Fdovecot%2Fcore.git imap-urlauth: imap-urlauth-worker - Fully perform client-to-server VERSION handshake with connection API. --- diff --git a/src/imap-urlauth/imap-urlauth-worker.c b/src/imap-urlauth/imap-urlauth-worker.c index 63b345a41f..a1ba880e66 100644 --- a/src/imap-urlauth/imap-urlauth-worker.c +++ b/src/imap-urlauth/imap-urlauth-worker.c @@ -69,7 +69,6 @@ struct client { bool finished:1; bool waiting_input:1; - bool version_received:1; bool access_received:1; bool access_anonymous:1; }; @@ -758,7 +757,7 @@ static int client_ctrl_read_fds(struct client *client) static int client_ctrl_handshake(struct client *client) { - if (client->version_received) + if (client->conn_ctrl.version_received) return 1; const char *line; @@ -767,16 +766,12 @@ static int client_ctrl_handshake(struct client *client) if (line == NULL) return 0; - if (!version_string_verify(line, "imap-urlauth-worker", - IMAP_URLAUTH_WORKER_PROTOCOL_MAJOR_VERSION)) { - e_error(client->event, - "imap-urlauth-worker client not compatible with this server " - "(mixed old and new binaries?) %s", line); - client_abort(client, "Control session aborted: Version mismatch"); + if (connection_handshake_args_default( + &client->conn_ctrl, t_strsplit_tabescaped(line)) < 0) { + client_abort(client, "Control session aborted: " + "Received bad VERSION line"); return -1; } - - client->version_received = TRUE; return 1; }