From: Timo Sirainen Date: Mon, 3 Feb 2025 08:03:42 +0000 (+0200) Subject: auth: Add "auth-legacy" listener type X-Git-Tag: 2.4.1~244 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=baf790336ba10479371a0ebdbb1d26bc3ba2334f;p=thirdparty%2Fdovecot%2Fcore.git auth: Add "auth-legacy" listener type This is needed at least by Exim authentication until it gets updated. --- diff --git a/src/auth/auth-client-connection.c b/src/auth/auth-client-connection.c index b890ba3537..99f00d4ed1 100644 --- a/src/auth/auth-client-connection.c +++ b/src/auth/auth-client-connection.c @@ -188,6 +188,9 @@ static void auth_client_finish_handshake(struct auth_client_connection *conn) const char *mechanisms, *mechanisms_cbind = ""; string_t *str; + if (conn->handshake_finished) + return; + if (conn->token_auth) { mechanisms = t_strconcat("MECH\t", mech_dovecot_token.mech_name, "\tprivate\n", NULL); @@ -206,6 +209,7 @@ static void auth_client_finish_handshake(struct auth_client_connection *conn) str_append(str, "\nDONE\n"); o_stream_nsend(conn->conn.output, str_data(str), str_len(str)); + conn->handshake_finished = TRUE; } static int auth_client_handshake_args(struct connection *conn, const char *const *args) @@ -352,6 +356,9 @@ void auth_client_connection_create(struct auth *auth, int fd, const char *name, conn->conn.list->set.major_version, conn->conn.list->set.minor_version); o_stream_nsend(conn->conn.output, str_data(str), str_len(str)); + + if ((flags & AUTH_CLIENT_CONNECTION_FLAG_LEGACY) != 0) + auth_client_finish_handshake(conn); } static void auth_client_connection_unref(struct auth_client_connection **_conn) diff --git a/src/auth/auth-client-connection.h b/src/auth/auth-client-connection.h index 463eb36fef..136c39f09d 100644 --- a/src/auth/auth-client-connection.h +++ b/src/auth/auth-client-connection.h @@ -8,6 +8,7 @@ enum auth_client_connection_flags { AUTH_CLIENT_CONNECTION_FLAG_LOGIN_REQUESTS = BIT(0), AUTH_CLIENT_CONNECTION_FLAG_TOKEN_AUTH = BIT(1), + AUTH_CLIENT_CONNECTION_FLAG_LEGACY = BIT(2), }; struct auth_client_connection { @@ -24,6 +25,7 @@ struct auth_client_connection { bool login_requests:1; bool version_received:1; bool token_auth:1; + bool handshake_finished:1; }; void auth_client_connection_create(struct auth *auth, int fd, const char *name, enum auth_client_connection_flags flags); diff --git a/src/auth/main.c b/src/auth/main.c index 5338ff6b49..9810c96cf2 100644 --- a/src/auth/main.c +++ b/src/auth/main.c @@ -40,6 +40,7 @@ enum auth_socket_type { AUTH_SOCKET_AUTH, + AUTH_SOCKET_AUTH_LEGACY, AUTH_SOCKET_LOGIN, AUTH_SOCKET_MASTER, AUTH_SOCKET_USERDB, @@ -56,6 +57,7 @@ struct auth_socket_listener { static const char *const auth_socket_type_names[] = { "auth", + "auth-legacy", "login", "master", "userdb", @@ -331,6 +333,10 @@ static void client_connected(struct master_service_connection *conn) case AUTH_SOCKET_AUTH: auth_client_connection_create(auth, conn->fd, conn->name, 0); break; + case AUTH_SOCKET_AUTH_LEGACY: + auth_client_connection_create(auth, conn->fd, conn->name, + AUTH_CLIENT_CONNECTION_FLAG_LEGACY); + break; case AUTH_SOCKET_TOKEN_LOGIN: auth_client_connection_create(auth, conn->fd, conn->name, AUTH_CLIENT_CONNECTION_FLAG_LOGIN_REQUESTS |